Forums Register Login

find method in the interface

+Pie Number of slices to send: Send
Hi All,

I am working on urlybird, the find method defined from the interface as this:
// 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)

for the find method, i read some of the posts here. They are really useful, cleared most of my doubts.
I still thinking if i need to provide search function for all the room attributes, like date, max_occupancy, price and smoking.

if I add these attribute in the search function, does it mean that i need to use the startWith() for the criteria matching as indicate in the interface.
If I use equal() to match those parameters like price , date. will i violate the requirement ?



+Pie Number of slices to send: Send
Heilien ,

In my instructions documents it specifies the following:

It must allow the user to search the data for all records, or for records where the name and/or location fields exactly match values specified by the user.



It is you choise if you will choose to supply search criteria for all the fields, but the instructions sais that you sould provide for and name/location combinations.

Regards,
Nicolas
+Pie Number of slices to send: Send
Hi Heilien,

In my opinion there is a difference between the implementation in your Data class of the find-method and the search criteria you provide in your GUI. My find-method in the Data class is able to search on every possible room attribute (and I tested its functioning with a JUnit test, just like all other methods of my Data class). But in my GUI I provide just the 2 required search criteria: name and location, so in my GUI I just have 2 input fields, 1 for each criterium.

Adding more search criteria now to your gui has no added value, because it is not required.

Kind regards,
Roel
+Pie Number of slices to send: Send
Hi Nicolas , Roel

thanks for the advice. I am planning to implement the find method for all attributes in the data class.
while in the GUI , only search for the location and hotel name for exact match.

in the data class, the interface specified that using
"Fred" matches "Fred" or "Freddy" as the example

In the data class, I think it is appropriate of using startWith() for hotelName and city
but for the maxOccupancy, smoking, price, date and customer using equal() exact match.
I am not sure if I should do this. The interface seems that it only restrict the find method to use startWith() for the search criteria


+Pie Number of slices to send: Send
Hi Heilien,

I made in find-method no difference between location, name and the other ones, so all attributes were tested with startsWith. Because in the comments of the find-method there is also no difference:

A non-null value in criteria[n] matches any field value that begins with criteria[n]. (For example, "Fred" matches "Fred" or "Freddy".)



Kind regards,
Roel
I love a good mentalist. And so does this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1347 times.
Similar Threads
UrlyBird Functional Requirements
URLyBird 1.3.2 : find method ambiguos
Do we need to filter the search result data?
A null value in criteria[n] matches any field value
URLBird find by Hotel or Name
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 09:20:45.