Hello, I am doing URLyBird and in the project requirement, it says:
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.
and in the comments of find method in the given interface, it is written:
// 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) throws RecordNotFoundException;
First one says "exactly match" whereas the other one says "matches any field value that begins with criteria[n]". Is the first requirement based on the find method? Or do only the values of the "name" and "location" have to match exactly? Can anybody please clarify this? Thanx! Kim
Hi Kim. Best would probably be to implement the find method exactly as the provided interface's comments specify. Then add another filter or method that refines the matches returned by the find method to return only exact matches to the GUI. J
Kim, Your 1st quote describes a requirement for your user interface code. Your 2nd quote describes a method that needs to be implemented in your persistence code. They are separate and distinct requirements that need to be individually addressed. The code that is used to meet the needs of the 1st requirement may call upon, either directly or indirectly, the code that meets the needs of the 2nd requirement.
kktec<br />SCJP, SCWCD, SCJD<br />"What we observe is not nature itself, but nature exposed to our method of questioning." - Werner Heisenberg
Of course another view on this question could focus on the use of the word "allow". You could suggest that If I did a search for the location "Smallville" (or something!) then if I got results that had "SmallvilleTown","SmallvilleCity" and "Smallville" then I have allowed the user to perform an exact search as in the results he/she has an exact match. but then what if they type in "Small" and get the same result. this couldn't be interpretted as an exact match, but it would "allow" the user to find an exact match. I keep it simple and implement the interface defined version (as that is clear), while the other criteria is more vague (i.e the phrase used is a bit vague - it doesn't say the returned search must only contain exact matches!) Steve.