package ws.gazebo.util.ontTool.shp;

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

import ws.gazebo.util.region.state.StateInfo;
import au.com.bytecode.opencsv.CSVReader;

public class OntToolCensusStates {


	public static void main(String[] args) {

		// to do: use the iterator approach for OpenCSV
		// cf. http://opencsv.sourceforge.net/#how-to-read
		// essentially producing Ontology instance data and properties from the
		// input value
		
		
	}

	public static final Collection<StateInfo> readStateInfo(String pathname)
			throws IOException {
		String[] buffer;
		StateInfo info;
		Collection<StateInfo> table = new ArrayList<StateInfo>(57);
		
		CSVReader reader = new CSVReader(new FileReader(pathname));
		while((buffer = reader.readNext()) != null) {
			info = new StateInfo(buffer);
			table.add(info);
		}
		return table;
	}

}

@@ -88,65 +88,8 @@
 ion;
-%0Aimport java.util.ArrayList;%0Aimport java.util.Collection;
 %0A%0Aim
@@ -130,16 +130,21 @@
 tateInfo
+Table
 ;%0Aimport
@@ -216,17 +216,16 @@
 ates %7B%0A%0A
-%0A
 %09public 
@@ -453,21 +453,16 @@
 t value%0A
-%09%09%0A%09%09
 %0A%09%7D%0A%0A%09pu
@@ -479,27 +479,16 @@
 c final 
-Collection%3C
 StateInf
@@ -488,17 +488,21 @@
 tateInfo
-%3E
+Table
  readSta
@@ -583,38 +583,13 @@
 Info
- info;%0A%09%09Collection%3CStateInfo%3E
+Table
  tab
@@ -601,18 +601,8 @@
 new 
-ArrayList%3C
 Stat
@@ -610,17 +610,17 @@
 Info
-%3E(57
+Table(
 );%0A
-%09%09
 %0A%09%09C
@@ -636,16 +636,42 @@
 reader =
+ null;%0A%09%09try %7B%0A%09%09%09reader =
  new CSV
@@ -710,13 +710,15 @@
 ;%0A%09%09
+%09
 while
+ 
 ((bu
@@ -761,19 +761,18 @@
 %0A%09%09%09
-info = new 
+%09table.add
 Stat
@@ -793,29 +793,79 @@
 %0A%09%09%09
-table.add(info
+%7D%0A%09%09%7D finally %7B%0A%09%09%09if (reader != null) %7B%0A%09%09%09%09reader.close(
 );%0A
+%09
 %09%09%7D%0A
+%09%09%7D%0A%0A
 %09%09re

use StateInfoTable; cleanup class element imports