Click to See Complete Forum and Search --> : locating row and col from a vector, Emergent


February 24th, 2000, 12:26 PM
Hi, I have a vector of data like this:
Vector(Vector(supports), Vector([db, alg, Vector(vector(time),vector(no_passes))]))
Vector(supports) is vector of strings
db is a String
alg is a String
vector(time) is a vector of strings
vector(passes) is a vector of strings
Those three vectors (support, time, passes) have the same size.
I am looking to fill up data[][] and columns, I need to locate col and row to use them when filling up data[row][col];
this is what I did :

/*
* This is where data got changed every time we press Next or
* Previous Buttons( increment or decrement supp).
*/

public int Change_support(int supp) {
System.out.println("inside Change_support fct...");
V_size = V.size();
supp_array = (Vector)V.elementAt(0);
int tt = supp_array.size();
Vector vv = new Vector();
for(int i = 1; i < V_size; i++)
vv = (Vector)V.elementAt(i);
DB_hash.put((String)vv.elementAt(0),"db");
for(int i = 1; i < V_size; i++)
ALG_hash.put((String)vv.elementAt(1),"alg");
int k = 0;
for(Enumeration e = ALG_hash.keys() ; e.hasMoreElements() ;k++){
String s = (String)e.nextElement();
ALG_hash.put(s, new Integer(k));
data[k][0]=s;
}

int t = 0;
for (Enumeration e = DB_hash.keys() ; e.hasMoreElements() ;)
{
if (t == 0)
headers[t] = "ALG Name";
else {
headers[t] =(String)e.nextElement();
DB_hash.put(headers[t], new Integer(t));
}
t++;
}

//if( supp + 2 > tt) return 1;
for(int i = 1; i < V_size ; i++){
Vector v = (Vector)V.elementAt(i);
System.out.println("Show this"); // when running it shows this output
int col = ((Integer)DB_hash.get((String)v.elementAt(0))).intValue();
int row = ((Integer)ALG_hash.get((String)v.elementAt(1))).intValue();
System.out.println("Does not show this"); // But not this output
Vector vt = (Vector)v.elementAt(2);
Vector vp = (Vector)v.elementAt(3);
data[row][col] = (String)vt.elementAt(supp) + "/" + (String)vp.elementAt(supp) ;
System.out.println(data[row][col]);
}
return 0;
}




Please help.
Your help will be appreciate.