Softwareprojektmanagement/src/main/java/de/hsel/spm/baudas/analysis/Analysis.java

46 lines
1.0 KiB
Java

package de.hsel.spm.baudas.analysis;
import de.hsel.spm.baudas.BauDas;
import org.jetbrains.annotations.Nullable;
import weka.core.Instances;
import weka.core.converters.CSVLoader;
import java.io.File;
import java.io.IOException;
/**
* base interface for analysis.
*
* @author Johannes Theiner
* @version 0.1
* @since 1.0
* @param <T> Type the chosen analysis returns as a result
*/
public interface Analysis<T> {
/**
* loads data from csv file.
*
* @param file File to analyze
* @return loaded data in weka format
*/
@Nullable
default Instances load(File file) {
CSVLoader loader = new CSVLoader();
try {
loader.setSource(file);
return loader.getDataSet();
} catch (IOException e) {
BauDas.getLogger().throwing(this.getClass().getName(), this.getClass().getEnclosingMethod().getName(), e);
}
return null;
}
/**
* result of the analysis.
*
* @return result as T
*/
T getResult();
}