package com.rf.real.categ;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;

public class DescribeTreesCateg {
//method to take the txt fle as input and pass those values to random forests
  BufferedReader BR = null;
	String path;
	public DescribeTreesCateg(String path){
		this.path=path;
	}
	public ArrayList<ArrayList<String>> CreateInputCateg(String path){

		ArrayList<ArrayList<String>> DataInput = new ArrayList<ArrayList<String>>();
		
		try {
		 
		String sCurrentLine;
		BR = new BufferedReader(new FileReader(path));
		
		while ((sCurrentLine = BR.readLine()) != null) {
			ArrayList<Integer> Sp=new ArrayList<Integer>();int i;
			if(sCurrentLine!=null){
				if(sCurrentLine.indexOf(",")>=0){
					//has comma
					System.out.print("has comma");
					sCurrentLine=","+sCurrentLine+",";
					char[] c =sCurrentLine.toCharArray();
					for(i=0;i<sCurrentLine.length();i++){
						if(c[i]==',')
							Sp.add(i);
					}ArrayList<String> DataPoint=new ArrayList<String>();
					for(i=0;i<Sp.size()-1;i++){
						DataPoint.add(sCurrentLine.substring(Sp.get(i)+1, Sp.get(i+1)));
					}DataInput.add(DataPoint);System.out.println(DataPoint);
				}
				else if(sCurrentLine.indexOf(" ")>=0){
					//has spaces
					sCurrentLine=" "+sCurrentLine+" ";
					for(i=0;i<sCurrentLine.length();i++){
						if(Character.isWhitespace(sCurrentLine.charAt(i)))
							Sp.add(i);
					}ArrayList<String> DataPoint=new ArrayList<String>();
					for(i=0;i<Sp.size()-1;i++){
						DataPoint.add(sCurrentLine.substring(Sp.get(i), Sp.get(i+1)).trim());
					}DataInput.add(DataPoint);System.out.println(DataPoint);
				}
			}
		}System.out.println("Input generated");

	} catch (IOException e) {
		e.printStackTrace();
	} finally {
		try {
			if (BR != null)BR.close();
		} catch (IOException ex) {
			ex.printStackTrace();
		}
	}
	return DataInput;
}
}

@@ -252,10 +252,9 @@
 sts%0A
-  
+%09
 Buff
@@ -788,38 +788,8 @@
 %09%09%09%09
-System.out.print(%22has comma%22);
 %0A%09%09%09
@@ -1109,16 +1109,23 @@
 et(i+1))
+.trim()
 );%0A%09%09%09%09%09
@@ -1142,32 +1142,34 @@
 .add(DataPoint);
+//
 System.out.print
@@ -1568,32 +1568,32 @@
 (i+1)).trim());%0A
-
 %09%09%09%09%09%7DDataInput.
@@ -1607,16 +1607,18 @@
 aPoint);
+//
 System.o

Update DescribeTreesCateg.java