// Path: src/main/java/BlueTurtle/warnings/CheckStyleWarning.java
// public class CheckStyleWarning extends Warning {
// 
// 
// 	/**
// 	 * 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 message
// 	 *            the message of the warning.
// 	 * 
// 	 * @param ruleName
// 	 *            the rule name of the warning.
// 	 * @param classification
// 	 *            of the violated rule of the warning.
// 	 */
// 	public CheckStyleWarning(String filePath, String filename, int line, String message, String ruleName, String classification) {
// 		super(filePath, filename, line, "CheckStyle", ruleName, message, classification);
// 		setMessage(message.replaceAll("'", ""));
// 	}
// 
// 	/**
// 	 * Check whether two CheckStyle warnings are the same.
// 	 * 
// 	 * @param other
// 	 *            the other warning.
// 	 * @return a boolean
// 	 */
// 	@Override
// 	public boolean equals(Object other) {
// 
// 		if (!(other instanceof CheckStyleWarning)) {
// 			return false;
// 		}
// 
// 		CheckStyleWarning that = (CheckStyleWarning) other;
// 
// 		// fixed SimplifyBooleanReturn, Conditional logic can be removed.
// 		return (ruleName.equals(that.ruleName) && filePath.equals(that.filePath) && fileName.equals(that.fileName) && line == that.line
// 				&& message.equals(that.message) && classification.equals(that.classification) && type.equals(that.type));
// 
// 	}
// 
// 	/**
// 	 * HashCode for the CheckStyle Warning.
// 	 */
// 	@Override
// 	public int hashCode() {
// 		return java.util.Objects.hash(filePath, fileName, type, line, message, ruleName, classification);
// 	}
// 	
// 	/**
// 	 * toString method for CheckStylWarning.
// 	 */
// 	@Override
// 	public String toString() {
// 		return "CheckStyleWarning [line=" + line + ", message=" + message + ", classification=" + classification
// 				+ ", fileName=" + fileName + ", type=" + type + ", filePath=" + filePath + ", ruleName=" + ruleName
// 				+ "]";
// 	}
// 	
// }


import org.w3c.dom.NodeList;
import BlueTurtle.finders.ProjectInfoFinder;
import BlueTurtle.warnings.CheckStyleWarning;
import BlueTurtle.warnings.Warning;
import org.w3c.dom.Node;
import org.w3c.dom.Element;
import java.io.File;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.regex.Matcher;

			// Convert the node to an element.
			Element warningElement = (Element) warning;

			// The message contained by the warning.
			String message = warningElement.getAttribute("message");

			// line number where the warning is located.
			int line = Integer.parseInt(warningElement.getAttribute("line"));

			// Get the category of the warning.
			String ruleName = getRuleName(warningElement.getAttribute("source"));

			String classification = classify(ruleName);

			// replace the backward slash in the file name with file separator.
			String fileNWithSep = fileName.replaceAll("\\\\", Matcher.quoteReplacement(File.separator));

			try {
				// for-loop in stream, find correct filePath.

				String filePath = ProjectInfoFinder.getClassPaths().stream().filter(p -> p.endsWith(fileNWithSep))
						.findFirst().get();

				// Get the name of the file where the warning is from.
				String finalFileName = fileNWithSep.substring(fileNWithSep.lastIndexOf(File.separatorChar) + 1,
						fileNWithSep.length());

				// Add warning to the list of warnings.
				checkStyleWarnings
// Path: src/main/java/BlueTurtle/warnings/CheckStyleWarning.java
// public class CheckStyleWarning extends Warning {
// 
// 
// 	/**
// 	 * 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 message
// 	 *            the message of the warning.
// 	 * 
// 	 * @param ruleName
// 	 *            the rule name of the warning.
// 	 * @param classification
// 	 *            of the violated rule of the warning.
// 	 */
// 	public CheckStyleWarning(String filePath, String filename, int line, String message, String ruleName, String classification) {
// 		super(filePath, filename, line, "CheckStyle", ruleName, message, classification);
// 		setMessage(message.replaceAll("'", ""));
// 	}
// 
// 	/**
// 	 * Check whether two CheckStyle warnings are the same.
// 	 * 
// 	 * @param other
// 	 *            the other warning.
// 	 * @return a boolean
// 	 */
// 	@Override
// 	public boolean equals(Object other) {
// 
// 		if (!(other instanceof CheckStyleWarning)) {
// 			return false;
// 		}
// 
// 		CheckStyleWarning that = (CheckStyleWarning) other;
// 
// 		// fixed SimplifyBooleanReturn, Conditional logic can be removed.
// 		return (ruleName.equals(that.ruleName) && filePath.equals(that.filePath) && fileName.equals(that.fileName) && line == that.line
// 				&& message.equals(that.message) && classification.equals(that.classification) && type.equals(that.type));
// 
// 	}
// 
// 	/**
// 	 * HashCode for the CheckStyle Warning.
// 	 */
// 	@Override
// 	public int hashCode() {
// 		return java.util.Objects.hash(filePath, fileName, type, line, message, ruleName, classification);
// 	}
// 	
// 	/**
// 	 * toString method for CheckStylWarning.
// 	 */
// 	@Override
// 	public String toString() {
// 		return "CheckStyleWarning [line=" + line + ", message=" + message + ", classification=" + classification
// 				+ ", fileName=" + fileName + ", type=" + type + ", filePath=" + filePath + ", ruleName=" + ruleName
// 				+ "]";
// 	}
// 	
// }


// Path: src/main/java/BlueTurtle/parsers/CheckStyleXMLParser.java
import org.w3c.dom.NodeList;
import BlueTurtle.finders.ProjectInfoFinder;
import BlueTurtle.warnings.CheckStyleWarning;
import BlueTurtle.warnings.Warning;
import org.w3c.dom.Node;
import org.w3c.dom.Element;
import java.io.File;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.regex.Matcher;


			// Convert the node to an element.
			Element warningElement = (Element) warning;

			// The message contained by the warning.
			String message = warningElement.getAttribute("message");

			// line number where the warning is located.
			int line = Integer.parseInt(warningElement.getAttribute("line"));

			// Get the category of the warning.
			String ruleName = getRuleName(warningElement.getAttribute("source"));

			String classification = classify(ruleName);

			// replace the backward slash in the file name with file separator.
			String fileNWithSep = fileName.replaceAll("\\\\", Matcher.quoteReplacement(File.separator));

			try {
				// for-loop in stream, find correct filePath.

				String filePath = ProjectInfoFinder.getClassPaths().stream().filter(p -> p.endsWith(fileNWithSep))
						.findFirst().get();

				// Get the name of the file where the warning is from.
				String finalFileName = fileNWithSep.substring(fileNWithSep.lastIndexOf(File.separatorChar) + 1,
						fileNWithSep.length());

				// Add warning to the list of warnings.
				checkStyleWarnings
						.add(new CheckStyleWarning(filePath, finalFileName, line, message, ruleName, classification));