• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NX:find method - please help

 
Bill Robertson
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my assignment, the contractors, i must implement the following
find method. They state:

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

I have a few questions:
1. I am not understanding why the criteria is an array. When I think of
a criteria I think of some string value. So my question is what exactly
is criteria holding? Is each index a different search string?
2. I have no clue what they mean by "Field n in the database file is described by criteria[n]". Could someone explain this to me with an example.
If I understand this I think I will understand number 1.
 
Philippe Maquet
Bartender
Posts: 1872
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Bill,
2. I have no clue what they mean by "Field n in the database file is described by criteria[n]". Could someone explain this to me with an example.


If I understand this I think I will understand number 1.

I confirm that you will.
Criteria[0] is a criteria value for a search to be performed on field[0] ...
Criteria[1] is a criteria value for a search to be performed on field[1] ...
...
Criteria[n] is a criteria value for a search to be performed on field[n]
Best,
Phil.
 
Bill Robertson
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
now the lights are on, thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic