• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

URLyBird Question on finder ?

 
steve mcdonald
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Guys,

You have been so helpful.

I have implemented this find method, and have made the following assumptions for the contract to the GUI, also the instructions are little unclear.
please let me know if i am ok.


1. Assumed that the criteria[] array size is equal to the number of fields starting with 0 index, not including the "Deleted flag". although internally i assumed that as a field with index 0 in all internal implementations.

2. the criteria[] for search will have all fields sent at al ltimes
a. null value criteria matches all field values
b. Matches field values when any of the following pattern's are sent
" Fred", or " Freddy" or "Fred" or "FRED" or "FrEdDy"
(Case Insensitive, and leading or trailing spaces are not a problem, because i trim both ends before matching.)

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

Thanks and Regards,
Steve.
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 12007
215
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Steve,

That all looks reasonable.
1. Assumed that the criteria[] array size is equal to the number of fields starting with 0 index, not including the "Deleted flag". although internally i assumed that as a field with index 0 in all internal implementations.
Based on the way the instructions are written, you could alternatively handle the delete flag separately from the record. That is - the delete flag will not be field[0] or any field at all - it is not part of the record. But that is just a matter of preference; your assumptions will work equally well.

Regards, Andrew
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic