package IAMdatabase;

import java.io.BufferedReader;
import java.io.FileReader;
import java.util.ArrayList;
/* potrebujeme ziskat info o autoroch jednotlivych obrazkov, tj vytvorime si polia kde ulozime 
 * IDcka 
 */

public class IAM {

	private static ArrayList formId = new ArrayList();
	private static ArrayList writerId = new ArrayList();
	private static ArrayList numberSentences = new ArrayList();
	private static ArrayList numberWords = new ArrayList(); 
	
	public IAM() {
	
	}
	
	public static ArrayList getFormId(){
		return formId;
	}	
	
	public static ArrayList getWriterId(){
		return writerId;
	}	
	
	public static void run(){
		
		try{
			//iam.txt je subor so vsetkymi obrazkami a informaciami o nich
			FileReader fr = new FileReader("IAMdatabase\\iam.txt");
			BufferedReader br = new BufferedReader(fr);
			String line = "";
			while ( (line = br.readLine()) != null ) {
				String l = line.substring(0, line.indexOf(' '));
				formId.add(l);
			//	System.out.println("formI "+formId.get(formId.size()-1));
								
				line = line.substring(line.indexOf(' ') + 1, line.length());
				l = line.substring(0, line.indexOf(' '));
				writerId.add(l);
				//System.out.println("writerId "+writerId.get(writerId.size()-1));
				
				line = line.substring(line.indexOf(' ') + 1, line.length());
				l = line.substring(0, line.indexOf(' '));
				numberSentences.add(l);
				//System.out.println("numberSentences "+numberSentences.get(numberSentences.size()-1));
				
				line = line.substring(line.indexOf(' ') + 1, line.length());
				line = line.substring(line.indexOf(' ') + 1, line.length());
				line = line.substring(line.indexOf(' ') + 1, line.length());
				
				line = line.substring(line.indexOf(' ') + 1, line.length());
				l = line.substring(0, line.indexOf(' '));
				numberWords.add(l);
				//System.out.println("numberWords "+numberWords.get(numberWords.size()-1));
			}
			
			
		} catch (Exception e) {
			System.err.println("subor sa nenasiel!");
		}		
		
	}
}

