Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

B&S: Find Method

 
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Folks,

Find method says
// 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)

According to my understanding, these criteria can return multiple or all records which GUI shall display in table. I am using name and location as primary key so no duplication is allowed but definitely find operation can return multiple records.

The User Interface part of my assignment 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 " which means that the example of "Fred" or "Freddy" mentioned in the interface does not follow this EXACTLY matching criteria. Am I right?

Please help!

Regards,
Shafique
 
Ranch Hand
Posts: 1847
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That is correct. The requirements of the user interface are at odds here with the description of the functionality of the DB interface.
It's up to you to make sure your application satisfies BOTH these criteria.
 
Muhammad Shafique
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Jeroen for your reply!
In my case, since I am using name and location as PK, if user enters some input for search then either ony one or no record should be returned. Although it required in assignment and I MUST stick to that, but it seems odd to use table to display only one/no record in this case.

Regards,
Shafique
 
It's a beautiful day in this neighborhood - Fred Rogers. Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic