Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

URLyBird Question on finder ?

 
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.
 
author and jackaroo
Posts: 12199
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • 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
 
You will always be treated with dignity. Now, strip naked, get on the probulator and hold this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic