Cheers, Roberto Perillo
SCJP, SCWCD, SCJD, SCBCD
Cheers, Roberto Perillo
SCJP, SCWCD, SCJD, SCBCD
Cheers, Roberto Perillo
SCJP, SCWCD, SCJD, SCBCD
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.
Kris Krason<br />SCJP1.4 (96%)<br />SCJP1.5 (91%)<br /> <br />See my <a href="http://krisreviews.com/2006/12/code-complete-second-edition/" target="_blank" rel="nofollow">Code Complete review</a><br /> <br /><a href="http://www.coderookie.com/2006/tutorial/the-pseudocode-programming-process/" target="_blank" rel="nofollow">Pseudocode Programming Process</a>
So there is no need of filtering.
And I think that or search with those fields that we have, doesn't make sense
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.
Cheers, Roberto Perillo
SCJP, SCWCD, SCJD, SCBCD
must allow to search for records where the name or location fields exactly match values specified by the user
Cheers, Roberto Perillo
SCJP, SCWCD, SCJD, SCBCD
your Data-class returns a record if the record has at least one field-value
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.
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".)
K. Tsang CEng MBCS PMP PMI-ACP OCMJEA OCPJP
K. Tsang wrote:Maybe I can assist a bit. The requirement says in the User Interface section:
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.
Now in the interface
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".)
Yet somewhat contradicting but stick to the requirement, which means:
1) search for ALL records
2) search for name AND/OR location fields EXACTLY MATCH...
Point 2 definitely contradict with the example given in the interface description. The AND/OR part. To satisfy OR, what is needed. Name only OR location only right? Now AND part - this allows users to select or type in both name and location. But wait what happens if they select AND and only input EITHER name OR location.... this makes it OR again. Another way of looking is for AND, you can require the user to enter both name and location to make ensure both name and location are NOT NULL.
Hope this helps
K. Tsang CEng MBCS PMP PMI-ACP OCMJEA OCPJP
K. Tsang wrote:1) all records (all null fields in the array)
Cheers, Roberto Perillo
SCJP, SCWCD, SCJD, SCBCD
K. Tsang wrote:OK let me rephrase what I want to say. From the requirements there can be 3 possibles cases for find:
1) all records (all null fields in the array)
2) name or location only (only one non-null field in array)
3) name and location (2 or more non-null fields in array)
K. Tsang wrote:
Now to cater for exactly match vs start with. In my GUI I used combo boxes to present the names/locations. This guarantees exact match right? Now in my find method I used "startWith" to produce the results which satisfy "Fred" matches "Freddy" or "Fred" right?
K. Tsang wrote:
Some people uses text fields in their GUI which can be confusing. For example you have a set of radio buttons in the search UI saying name only, location only, or name and location. Now if you select name and location radio button, the name and location text fields can enter text. This is what I was mentioning:
In "name and location" option, if you JUST enter name and leave location blank ... what does this give you - name only right? So in your find method you would need to consider this too - a way to determine how many non-null fields.
Roberto Perillo wrote:
K. Tsang wrote:1) all records (all null fields in the array)
Howdy, K!
Partner, just one question, if I call your find() method, passing a String array, only with null values, will I get all records?
K. Tsang CEng MBCS PMP PMI-ACP OCMJEA OCPJP
Sergiy Kononenko wrote:I use text fields too. Do you use comboboxes? But when do you refresh them? Do they not always contain names and locations of previous search?
Why I need radio buttons? In my GUI if the user want to search only by one criterion, he must just let other criterion blank. Do you see any troubles in this solution?
K. Tsang CEng MBCS PMP PMI-ACP OCMJEA OCPJP
Sergiy Kononenko wrote:Do you see any troubles, Roberto?
Cheers, Roberto Perillo
SCJP, SCWCD, SCJD, SCBCD
K. Tsang wrote:
Sergiy Kononenko wrote:I use text fields too. Do you use comboboxes? But when do you refresh them? Do they not always contain names and locations of previous search?
Why I need radio buttons? In my GUI if the user want to search only by one criterion, he must just let other criterion blank. Do you see any troubles in this solution?
I used combo boxes. My boxes don't contain the previous search items. If you do, it is really a Swing problem (where you instantiate the window).
My GUI combo boxes are disabled by default until the user clicks one of the radio buttons and activate the appropriate combo box. The default item is "ALL" meaning null for the find method array.
K. Tsang CEng MBCS PMP PMI-ACP OCMJEA OCPJP
Roberto Perillo wrote:
Sergiy Kononenko wrote:Do you see any troubles, Roberto?
Well, I implemented it differently; if I pass a String array with only null values, then no records will be retrieved. To retrieve all records, I added a method called getAllRecords in the interface I created and that extends the interface provided by Sun. But I guess this is also a matter of choice, so there should be no problems.
K. Tsang wrote:But do look out for capitalization in the first letter.
Sergiy Kononenko wrote:
K. Tsang wrote:But do look out for capitalization in the first letter.
If I do it, this would contradict the requirements. The value must exactly match the specified criterion.
K. Tsang CEng MBCS PMP PMI-ACP OCMJEA OCPJP
K. Tsang wrote:
Sergiy Kononenko wrote:
K. Tsang wrote:But do look out for capitalization in the first letter.
If I do it, this would contradict the requirements. The value must exactly match the specified criterion.
That's why I didn't use text fields. For example in the database file the location may be "Smallville". Now you type "smallville" ... the find method will not find records because the first letter does not match. Of course you can always cater this somewhere. And I doubt this is an easier task depends on what the value is.
Roberto Perillo wrote:
K. Tsang wrote:1) all records (all null fields in the array)
Howdy, K!
Partner, just one question, if I call your find() method, passing a String array, only with null values, will I get all records?
Roel De Nijs wrote:...but this whole discussion makes me doubt about the consistency of my implementation
Cheers, Roberto Perillo
SCJP, SCWCD, SCJD, SCBCD
Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
2. The search in the GUI:
Beside the ability to search for all reacords and for records where both criteria match
a) The GUI must allow the user to search for records where the name field or the location field exactly match values specified by the user.
b) The GUI must allow the user to search f
mohamed sulibi wrote:
also i will not write any think in my choices.txt file regarding this issue because it a requirement. i think any one alter this behavior must write in choices.txt about his thought so the examiner will understand his thought. may be or may be i am wrong and i will fail after 5 weeks.
what do you think ?
Dont worry, I let you know if you are wrong before. ;)
mohamed sulibi wrote:dears;
Dont worry, I let you know if you are wrong before. ;)
thank you ... so i will give you half of the re-submission fee.![]()
please did you write in you choices.txt about this interpretations or thought ? because i think it is not needed to state that "i consider this javadoc mean ... ".
Best regards.
Mohamed Sulibi
SCJP, SCJD in progress (From 1/8/2007 till now)
SCJP 6, OCMJD6
SCJP 6, OCMJD6
Roel De Nijs wrote:Hi Olu,
I have another implementation:
return all records if all criteria are null if not all criteria are null, the null criteria are ignored and the others are used to search for records: a record is a match if at least one field of the record starts with the corresponding (not-null) criterium (in a case-insensitive way)
But of course that's not the only valid implementation.
Kind regards,
Roel