Index: trunk/CrossPare/src/de/ugoe/cs/cpdp/loader/ARFFFolderLoader.java
===================================================================
--- trunk/CrossPare/src/de/ugoe/cs/cpdp/loader/ARFFFolderLoader.java	(revision 4)
+++ trunk/CrossPare/src/de/ugoe/cs/cpdp/loader/ARFFFolderLoader.java	(revision 4)
@@ -0,0 +1,20 @@
+package de.ugoe.cs.cpdp.loader;
+
+/**
+ * Implements the {@link AbstractFolderLoader} for standard ARFF files.
+ * 
+ * @author Steffen Herbold
+ * 
+ */
+public class ARFFFolderLoader extends AbstractFolderLoader {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see de.ugoe.cs.cpdp.loader.AbstractFolderLoader#getSingleLoader()
+	 */
+	@Override
+	protected SingleVersionLoader getSingleLoader() {
+		return new ARFFLoader();
+	}
+}
Index: trunk/CrossPare/src/de/ugoe/cs/cpdp/loader/ARFFLoader.java
===================================================================
--- trunk/CrossPare/src/de/ugoe/cs/cpdp/loader/ARFFLoader.java	(revision 4)
+++ trunk/CrossPare/src/de/ugoe/cs/cpdp/loader/ARFFLoader.java	(revision 4)
@@ -0,0 +1,53 @@
+package de.ugoe.cs.cpdp.loader;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+
+import weka.core.Instances;
+
+/**
+ * Loads ARFF files and chooses the last attribute as class attribute.
+ * 
+ * @author Steffen Herbold
+ */
+public class ARFFLoader implements SingleVersionLoader {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see de.ugoe.cs.cpdp.loader.SingleVersionLoader#load(java.io.File)
+	 */
+	@Override
+	public Instances load(File file) {
+		BufferedReader reader;
+		Instances data;
+		try {
+			reader = new BufferedReader(new FileReader(file));
+			data = new Instances(reader);
+			reader.close();
+		} catch (IOException e) {
+			// TODO Auto-generated catch block
+			throw new RuntimeException(e);
+		}
+
+		// setting class attribute
+		data.setClassIndex(data.numAttributes() - 1);
+
+		return data;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * de.ugoe.cs.cpdp.loader.SingleVersionLoader#filenameFilter(java.lang.String
+	 * )
+	 */
+	@Override
+	public boolean filenameFilter(String filename) {
+		return filename.endsWith(".arff");
+	}
+
+}
Index: trunk/CrossPare/src/de/ugoe/cs/cpdp/loader/AbstractFolderLoader.java
===================================================================
--- trunk/CrossPare/src/de/ugoe/cs/cpdp/loader/AbstractFolderLoader.java	(revision 3)
+++ trunk/CrossPare/src/de/ugoe/cs/cpdp/loader/AbstractFolderLoader.java	(revision 4)
@@ -9,12 +9,12 @@
 import de.ugoe.cs.cpdp.versions.SoftwareVersion;
 
-
+/**
+ * Abstract class for loading data from a folder. The subfolders of a defined
+ * folder define the projects, the file contained in the subfolder are the
+ * versions of a project.
+ * 
+ * @author Steffen Herbold
+ */
 public abstract class AbstractFolderLoader implements IVersionLoader {
-	
-	// TODO
-	interface SingleVersionLoader {
-		Instances load(File file);
-		boolean filenameFilter(String filename);
-	}
 
 	/**
@@ -22,5 +22,5 @@
 	 */
 	private String path = "";
-	
+
 	/**
 	 * @see de.ugoe.cs.cpdp.loader.IVersionLoader#setLocation(java.lang.String)
@@ -28,7 +28,7 @@
 	@Override
 	public void setLocation(String location) {
-		path=location;
+		path = location;
 	}
-	
+
 	/**
 	 * @see de.ugoe.cs.cpdp.loader.IVersionLoader#load()
@@ -37,16 +37,19 @@
 	public List<SoftwareVersion> load() {
 		final List<SoftwareVersion> versions = new LinkedList<SoftwareVersion>();
-		
+
 		final File dataDir = new File(path);
 		final SingleVersionLoader instancesLoader = getSingleLoader();
-		
-		for( File projectDir : dataDir.listFiles() ) {
-			if( projectDir.isDirectory() ) {
+
+		for (File projectDir : dataDir.listFiles()) {
+			if (projectDir.isDirectory()) {
 				String projectName = projectDir.getName();
-				for( File versionFile : projectDir.listFiles() ) {
-					if( versionFile.isFile() && instancesLoader.filenameFilter(versionFile.getName()) ) {
+				for (File versionFile : projectDir.listFiles()) {
+					if (versionFile.isFile()
+							&& instancesLoader.filenameFilter(versionFile
+									.getName())) {
 						String versionName = versionFile.getName();
 						Instances data = instancesLoader.load(versionFile);
-						versions.add(new SoftwareVersion(projectName, versionName, data));
+						versions.add(new SoftwareVersion(projectName,
+								versionName, data));
 					}
 				}
@@ -55,5 +58,11 @@
 		return versions;
 	}
-	
+
+	/**
+	 * Returns the concrete {@link SingleVersionLoader} to be used with this
+	 * folder loader.
+	 * 
+	 * @return
+	 */
 	abstract protected SingleVersionLoader getSingleLoader();
 }
Index: trunk/CrossPare/src/de/ugoe/cs/cpdp/loader/CSVDataLoader.java
===================================================================
--- trunk/CrossPare/src/de/ugoe/cs/cpdp/loader/CSVDataLoader.java	(revision 3)
+++ trunk/CrossPare/src/de/ugoe/cs/cpdp/loader/CSVDataLoader.java	(revision 4)
@@ -8,18 +8,20 @@
 import weka.core.DenseInstance;
 import weka.core.Instances;
-import de.ugoe.cs.cpdp.loader.AbstractFolderLoader.SingleVersionLoader;
 import de.ugoe.cs.util.FileTools;
 
 /**
- * Loads the instances for a software version from a CSV file of the // TODO dataset citation
- * data set. 
+ * Loads the instances for a software version from a CSV file of the PROMISE
+ * data set mined by Jurezko and Madeyski.
+ * 
  * @author Steffen Herbold
  */
 class CSVDataLoader implements SingleVersionLoader {
-	
-	/**
-	 * Loads the instances.
-	 * @param file handle to the file of the instances
-	 * @return the instances
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * de.ugoe.cs.cpdp.loader.AbstractFolderLoader.SingleVersionLoader#load(
+	 * java.io.File)
 	 */
 	@Override
@@ -31,11 +33,11 @@
 			throw new RuntimeException(e);
 		}
-		
+
 		// configure Instances
 		final ArrayList<Attribute> atts = new ArrayList<Attribute>();
-		
-		String[] lineSplit = lines[0].split(",");		
-		for( int j=0 ; j<lineSplit.length-4 ; j++ ) {
-			atts.add(new Attribute(lineSplit[j+3]));
+
+		String[] lineSplit = lines[0].split(",");
+		for (int j = 0; j < lineSplit.length - 4; j++) {
+			atts.add(new Attribute(lineSplit[j + 3]));
 		}
 		final ArrayList<String> classAttVals = new ArrayList<String>();
@@ -44,22 +46,29 @@
 		final Attribute classAtt = new Attribute("bug", classAttVals);
 		atts.add(classAtt);
-		
+
 		final Instances data = new Instances(file.getName(), atts, 0);
 		data.setClass(classAtt);
-		
+
 		// fetch data
-		for( int i=1 ; i<lines.length ; i++ ) {
+		for (int i = 1; i < lines.length; i++) {
 			lineSplit = lines[i].split(",");
-			double[] values = new double[lineSplit.length-3];
-			for( int j=0 ; j<values.length-1 ; j++ ) {
-				values[j] = Double.parseDouble(lineSplit[j+3].trim());
+			double[] values = new double[lineSplit.length - 3];
+			for (int j = 0; j < values.length - 1; j++) {
+				values[j] = Double.parseDouble(lineSplit[j + 3].trim());
 			}
-			values[values.length-1] = lineSplit[lineSplit.length-1].trim().equals("0") ? 0 : 1;
+			values[values.length - 1] = lineSplit[lineSplit.length - 1].trim()
+					.equals("0") ? 0 : 1;
 			data.add(new DenseInstance(1.0, values));
 		}
-		
+
 		return data;
 	}
-	
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see de.ugoe.cs.cpdp.loader.AbstractFolderLoader.SingleVersionLoader#
+	 * filenameFilter(java.lang.String)
+	 */
 	@Override
 	public boolean filenameFilter(String filename) {
Index: trunk/CrossPare/src/de/ugoe/cs/cpdp/loader/CSVFolderLoader.java
===================================================================
--- trunk/CrossPare/src/de/ugoe/cs/cpdp/loader/CSVFolderLoader.java	(revision 3)
+++ trunk/CrossPare/src/de/ugoe/cs/cpdp/loader/CSVFolderLoader.java	(revision 4)
@@ -2,11 +2,16 @@
 
 /**
- * Implements a {@link IVersionLoader} for data from // TODO data reference
- * Each folder contained in the defined location ({@link #setLocation(String)}) represents a project, the data files
- * within the versions.  
+ * Implements the {@link AbstractFolderLoader} for data from the PROMISE
+ * repository mined by Jurezko and Madeyski.
+ * 
  * @author Steffen Herbold
  */
 public class CSVFolderLoader extends AbstractFolderLoader {
 
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see de.ugoe.cs.cpdp.loader.AbstractFolderLoader#getSingleLoader()
+	 */
 	@Override
 	protected SingleVersionLoader getSingleLoader() {
@@ -14,4 +19,3 @@
 	}
 
-	
 }
Index: trunk/CrossPare/src/de/ugoe/cs/cpdp/loader/IVersionLoader.java
===================================================================
--- trunk/CrossPare/src/de/ugoe/cs/cpdp/loader/IVersionLoader.java	(revision 3)
+++ trunk/CrossPare/src/de/ugoe/cs/cpdp/loader/IVersionLoader.java	(revision 4)
@@ -7,16 +7,20 @@
 /**
  * Implements the interface for loading software versions from a data source.
+ * 
  * @author Steffen Herbold
  */
 public interface IVersionLoader {
-	
+
 	/**
-	 * Sets the location of the data. 
-	 * @param location location of the data
+	 * Sets the location of the data.
+	 * 
+	 * @param location
+	 *            location of the data
 	 */
 	public void setLocation(String location);
-	
+
 	/**
 	 * Loads the data.
+	 * 
 	 * @return the data
 	 */
Index: trunk/CrossPare/src/de/ugoe/cs/cpdp/loader/NasaARFFFolderLoader.java
===================================================================
--- trunk/CrossPare/src/de/ugoe/cs/cpdp/loader/NasaARFFFolderLoader.java	(revision 3)
+++ trunk/CrossPare/src/de/ugoe/cs/cpdp/loader/NasaARFFFolderLoader.java	(revision 4)
@@ -1,6 +1,17 @@
 package de.ugoe.cs.cpdp.loader;
 
+/**
+ * Implements the {@link AbstractFolderLoader} for the NASA/SOFTLAB/MDP data
+ * set.
+ * 
+ * @author Steffen Herbold
+ */
 public class NasaARFFFolderLoader extends AbstractFolderLoader {
 
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see de.ugoe.cs.cpdp.loader.AbstractFolderLoader#getSingleLoader()
+	 */
 	@Override
 	protected SingleVersionLoader getSingleLoader() {
Index: trunk/CrossPare/src/de/ugoe/cs/cpdp/loader/NasaARFFLoader.java
===================================================================
--- trunk/CrossPare/src/de/ugoe/cs/cpdp/loader/NasaARFFLoader.java	(revision 3)
+++ trunk/CrossPare/src/de/ugoe/cs/cpdp/loader/NasaARFFLoader.java	(revision 4)
@@ -10,5 +10,4 @@
 import java.util.Map;
 
-import de.ugoe.cs.cpdp.loader.AbstractFolderLoader.SingleVersionLoader;
 import weka.core.Instances;
 import weka.filters.Filter;
@@ -16,12 +15,29 @@
 import weka.filters.unsupervised.attribute.Reorder;
 
+/**
+ * Loads the instances for a software version from an ARFF file of the
+ * NASA/SOFTLAB/MDP data.
+ * 
+ * @author Steffen Herbold
+ */
 public class NasaARFFLoader implements SingleVersionLoader {
 
+	/**
+	 * used to map attributes the same attribute with different names to each
+	 * other
+	 */
 	Map<String, String> attributeNameMap;
+
+	/**
+	 * used to ensure that the attribute order is the same after loading
+	 */
 	List<String> attributeOrder;
-	
+
+	/**
+	 * Constructor. Creates a new NasaARFFLoader.
+	 */
 	public NasaARFFLoader() {
 		attributeNameMap = new HashMap<>();
-		
+
 		// Map entries for ar project
 		attributeNameMap.put("total_loc", "LOC_TOTAL");
@@ -32,6 +48,6 @@
 		attributeNameMap.put("unique_operators", "NUM_UNIQUE_OPERATORS");
 		attributeNameMap.put("total_operands", "NUM_OPERANDS");
-		attributeNameMap.put("total_operators",  "NUM_OPERATORS");
-		attributeNameMap.put("halstead_length",  "HALSTEAD_LENGTH");
+		attributeNameMap.put("total_operators", "NUM_OPERATORS");
+		attributeNameMap.put("halstead_length", "HALSTEAD_LENGTH");
 		attributeNameMap.put("halstead_volume", "HALSTEAD_VOLUME");
 		attributeNameMap.put("halstead_difficulty", "HALSTEAD_DIFFICULTY");
@@ -41,9 +57,9 @@
 		attributeNameMap.put("branch_count", "BRANCH_COUNT");
 		attributeNameMap.put("cyclomatic_complexity", "CYCLOMATIC_COMPLEXITY");
-		attributeNameMap.put("design_complexity",  "DESIGN_COMPLEXITY");
-		
+		attributeNameMap.put("design_complexity", "DESIGN_COMPLEXITY");
+
 		// Map entries for KC2
-		attributeNameMap.put("loc", "LOC_TOTAL"); // TODO these first two LOCs are guesses
-		attributeNameMap.put("lOCode", "LOC_EXECUTABLE"); // TODO
+		attributeNameMap.put("loc", "LOC_TOTAL");
+		attributeNameMap.put("lOCode", "LOC_EXECUTABLE");
 		attributeNameMap.put("lOComment", "LOC_COMMENTS");
 		attributeNameMap.put("lOCodeAndComment", "LOC_CODE_AND_COMMENT");
@@ -56,18 +72,18 @@
 		attributeNameMap.put("d", "HALSTEAD_DIFFICULTY");
 		attributeNameMap.put("e", "HALSTEAD_EFFORT");
-		attributeNameMap.put("b",  "HALSTEAD_ERROR_EST"); // TODO not sure about this one
+		attributeNameMap.put("b", "HALSTEAD_ERROR_EST");
 		attributeNameMap.put("t", "HALSTEAD_PROG_TIME");
 		attributeNameMap.put("branchCount", "BRANCH_COUNT");
-		attributeNameMap.put("v(g)",  "CYCLOMATIC_COMPLEXITY");
+		attributeNameMap.put("v(g)", "CYCLOMATIC_COMPLEXITY");
 		attributeNameMap.put("iv(g)", "DESIGN_COMPLEXITY");
-				
-		attributeNameMap.put("defects",  "bug");
+
+		attributeNameMap.put("defects", "bug");
 		attributeNameMap.put("Defective", "bug");
 		attributeNameMap.put("problems", "bug");
 		attributeNameMap.put("label", "bug");
-		
+
 		// build list with normalized attribute order
 		attributeOrder = new LinkedList<>();
-		
+
 		attributeOrder.add("LOC_TOTAL");
 		attributeOrder.add("LOC_EXECUTABLE");
@@ -89,10 +105,11 @@
 		attributeOrder.add("bug");
 	}
-	
-	/**
-	 * Loads the instances.
-	 * @param file handle to the file of the instances
-	 * @return the instances
-	 */
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see de.ugoe.cs.cpdp.loader.SingleVersionLoader#load(java.io.File)
+	 */
+	@Override
 	public Instances load(File file) {
 		BufferedReader reader;
@@ -103,30 +120,30 @@
 			reader.close();
 		} catch (IOException e) {
-			// TODO Auto-generated catch block
-			throw new RuntimeException(e);
-		}
-		
-		//setting class attribute
+			throw new RuntimeException("Error reading data", e);
+		}
+
+		// setting class attribute
 		data.setClassIndex(data.numAttributes() - 1);
-		
+
 		// normalize attribute names
-		for( int i=0; i<data.numAttributes(); i++) {
+		for (int i = 0; i < data.numAttributes(); i++) {
 			String mapValue = attributeNameMap.get(data.attribute(i).name());
-			if( mapValue!= null ) {
+			if (mapValue != null) {
 				data.renameAttribute(i, mapValue);
 			}
 		}
-		
-		// determine new attribute order (unwanted attributes are implicitly removed
+
+		// determine new attribute order (unwanted attributes are implicitly
+		// removed
 		String orderString = "";
-		for( String attName : attributeOrder ) {
-			for( int i=0; i<data.numAttributes(); i++) {
-				if(attName.equals(data.attribute(i).name())) {
-					orderString += (i+1) + ",";
+		for (String attName : attributeOrder) {
+			for (int i = 0; i < data.numAttributes(); i++) {
+				if (attName.equals(data.attribute(i).name())) {
+					orderString += (i + 1) + ",";
 				}
 			}
 		}
-		orderString = orderString.substring(0, orderString.length()-1);
-		
+		orderString = orderString.substring(0, orderString.length() - 1);
+
 		String relationName = data.relationName();
 		String[] options = new String[2];
@@ -139,53 +156,61 @@
 			data = Filter.useFilter(data, reorder);
 		} catch (Exception e) {
-			// TODO Auto-generated catch block
-			throw new RuntimeException();
-		}
-		if( data.numAttributes()!=attributeOrder.size() ) {
-			throw new RuntimeException("Invalid number of attributes; filename: " + file.getName());
-		}
-		
+			throw new RuntimeException("Error while reordering the data", e);
+		}
+		if (data.numAttributes() != attributeOrder.size()) {
+			throw new RuntimeException(
+					"Invalid number of attributes; filename: " + file.getName());
+		}
+
 		// normalize bug nominal values
 		Add add = new Add();
 		add.setAttributeIndex("last");
-        add.setNominalLabels("0,1");
-        add.setAttributeName("bug-new");
-        try {
+		add.setNominalLabels("0,1");
+		add.setAttributeName("bug-new");
+		try {
 			add.setInputFormat(data);
 			data = Filter.useFilter(data, add);
 		} catch (Exception e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}
-        data.setRelationName(relationName);
-		
-        double classValue;
-        
-        String firstValue = data.classAttribute().enumerateValues().nextElement().toString();
-        if( firstValue.equals("Y") || firstValue.equals("yes") || firstValue.equals("true") ) {
-        	classValue = 0.0;
-        } else {
-        	classValue = 1.0;
-        }
-        
-		for( int i=0 ; i<data.numInstances() ; i++ ) {
-			if( data.instance(i).classValue() == classValue ) {
-				data.instance(i).setValue(data.classIndex()+1, 1.0);
+			throw new RuntimeException(
+					"Error while normalizing the bug nonminal values", e);
+		}
+		data.setRelationName(relationName);
+
+		double classValue;
+
+		String firstValue = data.classAttribute().enumerateValues()
+				.nextElement().toString();
+		if (firstValue.equals("Y") || firstValue.equals("yes")
+				|| firstValue.equals("true")) {
+			classValue = 0.0;
+		} else {
+			classValue = 1.0;
+		}
+
+		for (int i = 0; i < data.numInstances(); i++) {
+			if (data.instance(i).classValue() == classValue) {
+				data.instance(i).setValue(data.classIndex() + 1, 1.0);
 			} else {
-				data.instance(i).setValue(data.classIndex()+1, 0.0);
+				data.instance(i).setValue(data.classIndex() + 1, 0.0);
 			}
 		}
-		
+
 		int oldClassIndex = data.classIndex();
-		data.setClassIndex(oldClassIndex+1);
+		data.setClassIndex(oldClassIndex + 1);
 		data.deleteAttributeAt(oldClassIndex);
-		
+
 		return data;
 	}
-	
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see de.ugoe.cs.cpdp.loader.AbstractFolderLoader.SingleVersionLoader#
+	 * filenameFilter(java.lang.String)
+	 */
 	@Override
 	public boolean filenameFilter(String filename) {
 		return filename.endsWith(".arff");
 	}
-	
+
 }
Index: trunk/CrossPare/src/de/ugoe/cs/cpdp/loader/SingleVersionLoader.java
===================================================================
--- trunk/CrossPare/src/de/ugoe/cs/cpdp/loader/SingleVersionLoader.java	(revision 4)
+++ trunk/CrossPare/src/de/ugoe/cs/cpdp/loader/SingleVersionLoader.java	(revision 4)
@@ -0,0 +1,33 @@
+package de.ugoe.cs.cpdp.loader;
+
+import java.io.File;
+
+import weka.core.Instances;
+
+/**
+ * Interface for version loaders, i.e., loading of a set of instances from a
+ * file
+ * 
+ * @author Steffen Herbold
+ */
+public interface SingleVersionLoader {
+
+	/**
+	 * Loads the instances.
+	 * 
+	 * @param file
+	 *            handle to the file of the instances
+	 * @return the instances
+	 */
+	Instances load(File file);
+
+	/**
+	 * Defines a filter for the files to be loaded; only strings that end with
+	 * the filter are considered.
+	 * 
+	 * @param filename
+	 *            string defining the filename filter
+	 * @return true if a filename shall be considered
+	 */
+	boolean filenameFilter(String endsWith);
+}
