• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

B&S: question on gui search

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
my spec says: 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.

does that mean if user type "Fred" in name field in gui and click on search, it must return all contractors with "Fred" not "Freddy"? and is case sensitive? currently my program is not case sensitivy and uses .startswith().

thanks in advance
 
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi


Yes you are right. The result should be Fred alone as spec says exactly match.

My assignment has the same sentence about exact match.

I am not sure about the case sensitive, but I would assume that it should be case sensitive too. anyway lets hear what other have to say...
 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
These are the instructions in my project.

User Interface instructions

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.

DDBMain Interface

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



My understanding from the above is, if i pass a string "Fred" the query should return records that has name starting with Fred or Freddy.

for example if the data has three records

First Name
---------------
Fred Campbell
Freddy Jones
Fredricks Doe

I would return the three records as they all start with Fred.

OR

Let my interface return three records. but my support method which calls the find(String[] criteria)method should filter the other two records(Freddy,Fredricks). This way both the requirements are satisfied.

which way is right?


Please correct me if i am not understanding it properly.

----------------------

John

[ April 10, 2008: Message edited by: John Mattman ]
[ April 10, 2008: Message edited by: John Mattman ]
 
fei lin
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i think none of the above 3 record should be returned, because it not exact, Campbell is extra.
If user search "Fred" only and only "Fred" is returned, please correct me if i am wrong, i am confused
 
John Mattman
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
fei,
I am sorry for confusing you. I think it should return only the exact match. I was confused by conflicting instructions being provided. I would change my code to do the exact match.

John
[ April 11, 2008: Message edited by: John Mattman ]
 
fei lin
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks guys, i will use exact match,,,, its not user friendly.
 
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello guys,

i think there is a misunderstanding in this thread : when you talk about
the search feature, remember there is two levels :
* the find method of the interface you have to implement.
* the search feature of the GUI relying on the first one.

So at first glance, it may seems that your assignment instructions are
inconsistent, but if you pay close attention, you'll see that the exact
match is required for the GUI, while the "startWith" match is required for
the interface. So, this is possible to implement this way (not very
efficient, because it implies a post processing, but you have to follow
Sun's orders and implement the interface).

Hope it helps,

Gilles
 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I interpreted the search as follows. I used the indexOf method to match exactly the values specified by the user in the name and/or location field. So, if the name is 'Company Freddy' or 'Fred's Company' and you are searching for 'Fred' than both records will match, but 'fred' will not.

Johan
 
reply
    Bookmark Topic Watch Topic
  • New Topic