aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes B&S find() may miss contractor? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "B&S find() may miss contractor?" Watch "B&S find() may miss contractor?" New topic
Author

B&S find() may miss contractor?

Yan Zhou
Ranch Hand

Joined: Sep 02, 2003
Posts: 137
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

Joined: Jul 02, 2004
Posts: 476
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.


Anton Golovin (anton.golovin@gmail.com) SCJP, SCJD, SCBCD, SCWCD, OCEJWSD, SCEA/OCMJEA [JEE certs from Sun/Oracle]
Yan Zhou
Ranch Hand

Joined: Sep 02, 2003
Posts: 137
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

Joined: Jul 02, 2004
Posts: 476
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 ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: B&S find() may miss contractor?