package BlueTurtle.warnings;

/**
 * This class is used to represent a PMD warning.
 * 
 * @author BlueTurtle.
 *
 */
public class PMDWarning extends Warning {

	private int line;
	/**
	 * Constructor.
	 * 
	 * @param filePath
	 *            the path to the file where the warning is located.
	 * @param filename
	 *            the name of the file where the warning is located.
	 * @param line
	 *            the line number where the warning is located.
	 * @param packageName
	 *            the package of the warning.
	 * @param ruleName
	 *            the rule name of the warning.
	 * @param ruleSet
	 *            the ruleSet of the warning.
	 * @param method
	 *            the method of the warning.
	 * @param Classification
	 *            of the violated rule of the warning.
	 */
	public PMDWarning(String filePath, String filename, int line, String packageName, String ruleSet, String method,  String ruleName, String classification) {
		super(filePath, filename, "PMD", ruleName, classification);
		setLine(line);
		setPackageName(packageName);
		setRuleSet(ruleSet);
		setMethod(method);
	}
	
	private String ruleSet;
	private String method;
	private String packageName;

	/**
	 * Check whether two PMD warnings are the same.
	 * 
	 * @param other
	 *            the other warning.
	 * @return a boolean
	 */
	@Override
	public boolean equals(Object other) {

		if (!(other instanceof PMDWarning)) {
			return false;
		}

		PMDWarning that = (PMDWarning) other;
		if (filePath.equals(that.filePath) && fileName.equals(that.fileName) && line == that.line
				&& classification.equals(that.classification) && packageName.equals(that.packageName) && type.equals(that.type) 
				&& ruleSet.equals(that.ruleSet) && method.equals(that.method) && ruleName.equals(that.ruleName)) {
			return true;
		} else {
			return false;
		}

	}

	/*************************************/
	/*** Getters and setters ************/
	/***********************************/

	/**
	 * Get the line number where the warning is located.
	 * 
	 * @return the line number where the warning is located.
	 */
	public int getLine() {
		return line;
	}

	/**
	 * Set line number where the warning is located.
	 * 
	 * @param line
	 *            the line number where the warning is located.
	 */
	public void setLine(int line) {
		this.line = line;
	}

	/**
	 * Set the package for the PMD warning.
	 * 
	 * @param packageName
	 *            the package of the warning
	 */
	public void setPackageName(String packageName) {
		this.packageName = packageName;
	}

	/**
	 * Get the package from the PMD warning.
	 * 
	 * @return the package from the PMD warning.
	 */
	public String getPackageName() {
		return packageName;
	}

	/**
	 * Get the ruleSet from the PMD warning.
	 * 
	 * @return the ruleSet from the PMD warning.
	 */
	public String getRuleSet() {
		return ruleSet;
	}
	
	/**
	 * Set the ruleSet for the PMD warning.
	 * 
	 * @param ruleSet
	 *            the ruleSet of the warning.
	 */
	public void setRuleSet(String ruleSet) {
		this.ruleSet = ruleSet;
	}	

	/**
	 * Get the method of the PMD warning.
	 * 
	 * @return the method of the PMD warning.
	 */
	public String getMethod() {
		return method;
	}
	
	/**
	 * Set the method for the PMD warning.
	 * 
	 * @param method
	 *            the method of the warning.
	 */
	public void setMethod(String method) {
		this.method = method;
	}	
	
}

@@ -173,16 +173,96 @@
 t line;%0A
+%09private String ruleSet;%0A%09private String method;%0A%09private String packageName;%0A%09%0A
 %09/**%0A%09 *
@@ -1182,88 +1182,8 @@
 ;%0A%09%7D
-%0A%09%0A%09private String ruleSet;%0A%09private String method;%0A%09private String packageName;
 %0A%0A%09/

move the attributes of the PMDWarning to the top of the constructor