• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

B&S find() may miss contractor?

 
Yan Zhou
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a question on implementing find(), here is my assignment spec on find():

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)

If so, it is not possible to locate contractors with matching specialty but not at the beginning of its record value. For example, say, a contractor has specialty string in its record as:"Roofing, Carpeting", and user is searching for "Carpeting". According to spec of find(), this is not a match becaues the contractor's specialty does not begin with "Carpeting".

Is that the way we suppose to return results to UI, i.e., only contractors with matching specialty at its very beginning is returned?

In addition, this implements a case-sensitive search, but I assume that is what the spec. wants us to do.

Thanks.
Yan
 
Anton Golovin
Ranch Hand
Posts: 476
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Yan. I was wondering if the list of specialties was standartized, i.e., comma-separated as a rule. Then, you could search for all specialties by separating the specialties String by comma.
 
Yan Zhou
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know how to implement it.

But I am just wondering if "Roofing, Carpeting" is considered as a match for "Carpeting", does not that violate the spec. of find(), which it specifically says "the beginning...."?

Yan
 
Anton Golovin
Ranch Hand
Posts: 476
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am sure in this case they mean the beginning of a specialty name, not the list of specialties - so you should be ok to implement it. When I was working on my project, I found it helpful to account for items I had doubts about in the choices.txt; I made some choices when the requirement was ambiguously worded - and the project passed.
[ November 11, 2004: Message edited by: Anton Golovin ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic