Ok but there is something else, here my interface method from sun:
so if the record has the fields:
name, location, size, smoking, rate, date, owner
the user can only type name and/or locaton (two JTextField), so my criteria array looks like this:
{name,location,null,null,null,null,null}
So, null should match everything, so:
1. if i type only in the field for name: i have {name,
null,null,null,null,null,null}
2. if i type only in the field for location: i have {
null,location,null,null,null,null,null}
3. if i type in both fields: i have {name,location,null,null,null,null,null}
4. no type in fields: i have {
null,
null,null,null,null,null,null}
So:
1. is an example for OR search for name
2. is an example for OR search for location
3. is an example for AND search for name and location
4. is an example for search for all records
BUT
there is also another example for OR search that cannot be satisfied by this:
5. type in both fields and i want to have all the records that has this name (no matter what location) and that has this location (no matter what name)
For example:
database:
id name location ...
1. aa loc1
2. bb loc1
3. cc loc2
4. cc loc2
5. cc loc3
6. dd loc4
7. ee loc5
and assume that i want to type in my gui in both fields for name: cc and for location: loc1
so if i assume that my program does AND search if i typed in both fields i receive no records. But it can be so, that i want to receive the records that has
either name:cc or location:loc1. Then i should receive record: 1, 2, 3, 4, 5
So my find method should know what to do, if a typed in both fields something. Should he search for AND or for OR
What do you mean: is that necessary to define also the 5th kind of search, or the the first 4 are enough?
Because the sentence:
It must allow the user to search the data for all records, or for records where the name and/or location fields exactly match values specified by the user.
includes that:
It must allow the user to search the data for records where the name or location fields exactly match values specified by the user.
So what it means OR is not unambiguous. It can be only that i should provide the possibility to search with only one field typed in (1st and 2nd)
or the other thing (5th)