package csv;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.List;

import org.apache.commons.csv.CSVFormat;
import org.apache.commons.csv.CSVParser;
import org.apache.commons.csv.CSVRecord;

import csv.operations.OutlierDetectionOperation;
import util.Operation;

public class CSVOperationManager {

	private Operation operation;
	
	
	public CSVOperationManager() {
		
	
	}
		
	public String executeCSVOperation(File csv) throws IOException {
		if (csv != null && csv.exists()) {
			operation.setFile(csv);
			return operation.execute();
		}
		throw new FileNotFoundException("The csv file does not exist!");
		
	}
	
	public void setOperation(Operation op) {
		operation = op;
	}
	
	public static void main(String[] args) throws IOException {
		CSVOperationManager opm = new CSVOperationManager();		
		opm.setOperation(new OutlierDetectionOperation(2,"http://ua.be/drivetrain/description/artifacts/artifacts#", "drivetrain-sensor-data"));
		System.out.println(opm.executeCSVOperation(new File("src/main/resources/csv/rotation.csv")));
	}
	
	
	
}
