The specification for B&S states that the interface _must_ allow the user to search "... for records where the name and/or location fields exactly match values specified by the user". The contradition is that the find method states that "A non-null value in criteria[n] matches any field value that begins with criteria[n]". Now, when the user performs a search we call the find method which will return to us records that begin with what he asked for. But the document says that we _must_ return records that exactly match. Our method returns too much information. What have others done in this instance?
I have just done B&S. What the assignment states there is that your findByCriteria() method should return those records which "A non-null value in criteria[n] matches any field value that begins with criteria[n]". (fred matches freddy)
However that is telling you that before the search results are sent to the GUI class to show them in the JTable, you need to re-filter them for those records which EXACTLY match the user's request.
I.e. GUI.java - MiddleClass.java - Data.java - DBFile
Data.java gets parital matching records from dbfile and passes them to your middleclass. The middleclass re-filters those results and passes only those records exactly matching the user's request to the GUI.
That's how it should be done. The middleclass i portrayed there should be the client class which performs the logic and calls the data.java methods
posted 13 years ago
Thanks Chris, I'm just wondering if that is the interpretation that other people have come up with for this requirement or has someone else thought of doing it differently?
Chris is right. This is not necessarily a contradiction. The find method must return records according to the accompanying comment, and the user interface filters these results to records which strictly match.
However, this subject has been repeatedly covered on this forum. Did you perform a search on it?
Hello everybody! sorry for my english (is very poor)... But: I am at last steps on my B&S assignment and have following:
"...fields exactly match values specified by the user." I see this for me as "no wild cards are allowed to input" and the db interface is so passed with the find method "...matches any field value that begins with criteria...". I think, if the user searches for name (32 length) and/or location (64 length), they want no typing entire names. See somebody this wrong?