I was confused about the find/search requirment but after searching a few posts, I'm even more confused
. Hope you guys can help me clarify it
The requirement in the interface is as follows:
// Returns an array of record numbers that match the specified
// criteria. Field n in the database file is described by
// criteria[n]. A null value in criteria[n] matches any field
// value. A non-null value in criteria[n] matches any field
// value that begins with criteria[n]. (For example, "Fred"
// matches "Fred" or "Freddy".)
public int[] find(
String[] criteria);
The requirment in the document:
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.
The way I was going to implment this was too as per Roel's post long time ago:
GUI contains 2 fields: one for location and for name. So the user has 4 possibilities:
- retrieve all hotel rooms (leave both input fields empty)
- search on a name (enter a value in the input field name and leave the input field location empty)
- search on a location (enter a value in the input field location and leave the input field name empty)
- search on both name and location (enter a value in both input fields)
The thing that is confusing me the most is that in the interface states that "value that begins with criteria[n]. (For example, "Fred" matches "Fred" or "Freddy".)" but in the document search "records where the name and/or location fields exactly match values specified by the user" - These seem to say the opposite - Any thoughts to clarify this for me
Or how did others implement the search?
Thanks