import java.util.Vector;

/// Class implementing a data container for CSV data header
public class CSVDataHeader
{
	//the header variable contains the blue print for the data types 
	//that this object is to hold. For example if (String)Name,(int)Age,(double)Number
	//are the raw data of a CSV file then the blue print should go as follows
	//header[0] = "String"; header[1] = "int"; header[2] = "double";
	private String[] header;
	//this vector is to contain other vectors to form a 2-d Array pattern. 
	private Vector data;
	//this is the descriptor that differenciates this header of data from other header patterns. 
	//from the example above this String should be "Name,Age,Number"
	private String name;

	public CSVDataHeader(String[] header, String name)
	{
		this.header = header;
		this.name = name;
		data = new Vector();
		for(int i=0;i<header.length;i++)
		{
			data.add(i,new Vector());
		}
		
	}

	//add data to the specified index
	public void add(Object data,int index)
	{
		((Vector)this.data.elementAt(index)).add(data);
	}

	//if no index was given then guess where the data is supposed to go 
	//by getting the data class type and matching it with a header blue print
	public void add(Object data,String type)
	{
		int index = 0;
		for(int i=0;i<header.length;i++)
		{
			if(type.equals(header[i])){ add(data,i); break;}
		}	  
	}

	public void add(int value){	add(new Integer(value),"int");}	
	public void add(long value){add(new Long(value),"long");} 
	public void add(boolean value){add(new Boolean(value),"boolean");}
	public void add(float value){add(new Float(value),"float");} 
	public void add(double value){add(new Double(value),"double");}
	public void addString(String value){add(value,"String");}

	//convert a raw string to an object that contains its value and
	//insert it into the header
	public void addRaw(String rawData, String headerName)
	{
		try{
			if(headerName.equals("String"))
				addString(new String(rawData));
			else if(headerName.equals("int"))
				add((Integer.parseInt(rawData)));
			else if(headerName.equals("double"))
				add((Double.parseDouble(rawData)));
			else if(headerName.equals("long"))
				add((Long.parseLong(rawData)));
			else if(headerName.equals("float"))
				add((Float.parseFloat(rawData)));
			else if(headerName.equals("bool"))
				add((Boolean.parseBoolean(rawData)));
			else
				return;
		}
		catch(Exception e){System.out.println(e.getMessage());}
	}

	public Vector getData(){return data;}
	public String[] getHeader(){return header;}
	public String getName(){return name;}
	
}


@@ -25,31 +25,8 @@
 %0A%0A//
-/ Class implementing a 
 data
@@ -56,16 +56,16 @@
  header%0A
+
 public c
@@ -720,17 +720,16 @@
  header,
- 
 String n
@@ -1318,25 +1318,24 @@
 %7D%0A%09%09%7D%09  %0A%09%7D%0A
-%0A
 %09public void
@@ -1861,17 +1861,16 @@
 %09try%7B%0A%09%09
-%09
 if(heade
@@ -1889,25 +1889,24 @@
 (%22String%22))%0A
-%09
 %09%09%09addString
@@ -1926,25 +1926,24 @@
 awData));%0A%09%09
-%09
 else if(head
@@ -1960,25 +1960,24 @@
 als(%22int%22))%0A
-%09
 %09%09%09add((Inte
@@ -1995,33 +1995,32 @@
 t(rawData)));%0A%09%09
-%09
 else if(headerNa
@@ -2039,25 +2039,24 @@
 ouble%22))%0A%09%09%09
-%09
 add((Double.
@@ -2071,33 +2071,32 @@
 ble(rawData)));%0A
-%09
 %09%09else if(header
@@ -2115,25 +2115,24 @@
 %22long%22))%0A%09%09%09
-%09
 add((Long.pa
@@ -2143,33 +2143,32 @@
 ong(rawData)));%0A
-%09
 %09%09else if(header
@@ -2188,25 +2188,24 @@
 float%22))%0A%09%09%09
-%09
 add((Float.p
@@ -2222,25 +2222,24 @@
 rawData)));%0A
-%09
 %09%09else if(he
@@ -2266,17 +2266,16 @@
 l%22))%0A%09%09%09
-%09
 add((Boo
@@ -2310,15 +2310,13 @@
 ;%0A%09%09
-%09
 else%0A
-%09
 %09%09%09r

Reset CSVDataHeader to before my modifications.