package comparison;

import java.io.BufferedWriter;
import java.io.FileWriter;
import GUI.Result;
import java.util.*;

import javax.swing.JOptionPane;

public class SaveHabitualData {
	
	Result result;
	int numberResult;
	
	public SaveHabitualData(int numberResult) {
		this.numberResult = numberResult;
	}
	
	public void run(){
		
		
		///////////////////////////////////////////////////////////////////
		//for (int i = 0; i < 12; i++) {
			//System.out.println("Slant "+result.getSlant());
		//}
		//create file
		try{
			FileWriter fw = new FileWriter("pics\\graphemes\\"+numberResult+"\\habitData.txt");
			BufferedWriter bw = new BufferedWriter(fw);
			
			bw.write("RatioLines/Height ");
			bw.write(result.getRatioLinesHeightPerc()+" ");
			bw.write(result.getRatioLinesHeight()+"");
			
			bw.write("\n");
			
			bw.write("Density ");
			bw.write(result.getDensityHandwrPerc()+" ");
			bw.write(result.getDensityHandwr()+"");
			
			bw.write("\n");
			
			bw.write("Proportion1 ");
			bw.write(result.getRatioThreeElementsChar1Perc()+" ");
			bw.write(result.getRatioThreeElementsChar1()+"");
			
			bw.write("\n");
			bw.write("Proportion2 ");
			bw.write(result.getRatioThreeElementsChar2Perc()+" ");
			bw.write(result.getRatioThreeElementsChar2()+"");
			
			bw.write("\n");
			bw.write("Proportion3 ");
			bw.write(result.getRatioThreeElementsChar3Perc()+" ");
			bw.write(result.getRatioThreeElementsChar3()+"");			
			
			bw.write("\n");
			bw.write("Slant ");
			bw.write(result.getSlantPerc()+" ");
			bw.write(result.getSlant()+"");			

			//palickovost
			bw.write("\n");
			bw.write("Block ");
			bw.write(result.getRatioWordsSegmentsPerc()+" ");
			bw.write(result.getrRatioWordsSegments()+"");						

			bw.write("\n");
			bw.write("RatioLinesWords ");
			bw.write(result.getRatioLinesWordPerc()+" ");
			bw.write(result.getRatioLinesWord()+"");									
			
			bw.close();
			fw.close();
		} catch (Exception e) {
			System.out.println("nieco zlyhalo so suborom");
		}
	}

}
