wood burning stoves 2.0*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes B&S - Bussiness logic for public int[] find(String[] criteria) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "B&S - Bussiness logic for public int[] find(String[] criteria)" Watch "B&S - Bussiness logic for public int[] find(String[] criteria)" New topic
Author

B&S - Bussiness logic for public int[] find(String[] criteria)

Ezio A. Ehlke Carrion
Greenhorn

Joined: Jul 05, 2007
Posts: 4

Hi everyone

I'm have a question how the find method should be implemented because I didn't understand very well what the specification tells

// 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;

In my point of view I should create a search gui which all field from file should be available for the user input any value, in case any of available field be empty the position of such field in array should be null. Once the user clicks on search button the populated array is passed to find method to be used to search. If the user does not fill any field and click on submit button the array should be empty and all records should be returned.

In case two or field were chose, the criteria should use "and" to do the match against the data and any field needs to use the logic to search search for string using String.startWith

Please let me know whether I'm in correct way or not.

Thanks in advance

Ezio


SCJP, SCJD, SCWCD, SCBCD 5, SCEA 5, CSM & PMP
Jethro Borsje
Ranch Hand

Joined: Jul 22, 2008
Posts: 100
Some things with respect to the searching capabilities of the application are vague in the assignment on purpose. Sun wants you to make a choice and document this in your design choices.txt file.


SCJP, SCJD
 
Don't get me started about those stupid light bulbs.
 
subject: B&S - Bussiness logic for public int[] find(String[] criteria)
 
Similar Threads
nx:All of URLy Bird 1.1.3 find and search method
interface spec.
NX: URLyBird1.1.3, about the find method in Data class.
find method in B&S
nx:All of URLy Bird 1.1.3 read/write lock and create()