Forums Register Login

criteriaFind()

+Pie Number of slices to send: Send
hi, everyone
i am stuck in the criteriaFind().
could you give me some hints?
//some codes from my criteraFind()
outer:for (int r = 1; r <= recordCount; r++){
values = readRecord();
middle:for(int a=1;a<V.size();a+=2){
found= false;

for( int i=0;i<description.length;i++){
if (values[i].equals(V.get(a))){
found=true;
System.out.print("ok");//line 2
break;
}
}
continue middle;
}

if(found){
recordContainer.add(new DataInfo(r, description, values));
}
continue outer;}
//******
V is a vector which holds the object that originate from tokenizing "criteria".
RecorderContainer is an Arraylist which holds records matching criteria.
could you let me know why it can't never reach line2? Am i on the right track?
Thanks in advance....
Note: for the moment i just compare the values.
+Pie Number of slices to send: Send
 

if (values[i].equals(V.get(a))){


you are using the equals method, which I believe returns true when they are the same Object, that is returns the same "Hashcode"
so you have a values array comparing against a "Object" that returns from a Vector. Hmm. sounds like it will never be equal to me. But I could be wrong.
Mark
+Pie Number of slices to send: Send
In criteria string you may not have all the field names.So Don't you think before checking for equality of values you need to check the fieldnames.
+Pie Number of slices to send: Send
hi, Mark and Mathew
Thanks for your reply, and i really appreciate it.
It is ok that an objcet from Vecton compare with a string.
Also now i am just tryint to make comparing values work and then i will compare the fieldname as well.
Any hint?
She said she got a brazillian. I think owning people is wrong. That is how I learned ... tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 988 times.
Similar Threads
Moderators: following topic is no longer available
criteriaFind review please...
about criteriaFind
method criteriaFind
FBN: criteriaFind(String criteria) method; is this ok ?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 02:45:41.