jQuery in Action, 3rd edition
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes B&S: Find Method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "B&S: Find Method" Watch "B&S: Find Method" New topic

B&S: Find Method

Muhammad Shafique
Ranch Hand

Joined: Sep 30, 2006
Posts: 59
Hi Folks,

Find method says
// 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)

According to my understanding, these criteria can return multiple or all records which GUI shall display in table. I am using name and location as primary key so no duplication is allowed but definitely find operation can return multiple records.

The User Interface part of my assignment 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 " which means that the example of "Fred" or "Freddy" mentioned in the interface does not follow this EXACTLY matching criteria. Am I right?

Please help!

Jeroen T Wenting
Ranch Hand

Joined: Apr 21, 2006
Posts: 1847
That is correct. The requirements of the user interface are at odds here with the description of the functionality of the DB interface.
It's up to you to make sure your application satisfies BOTH these criteria.

Muhammad Shafique
Ranch Hand

Joined: Sep 30, 2006
Posts: 59
Thanks Jeroen for your reply!
In my case, since I am using name and location as PK, if user enters some input for search then either ony one or no record should be returned. Although it required in assignment and I MUST stick to that, but it seems odd to use table to display only one/no record in this case.

I agree. Here's the link: http://aspose.com/file-tools
subject: B&S: Find Method
It's not a secret anymore!