• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Ezio A. Ehlke Carrion
Greenhorn
Posts: 4
C++ Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Jethro Borsje
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic