Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

criteriaFind()

 
foolsee
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, all.
I have some questions about criteriaFind().
1. I think we only need to implement this method for Origin airport
and Destination airport. Am I correct? Or should I do this for
every possible fieldName?
2. in any cases, should I use StringTokenizer to get fieldName or can
I just hard code it from DataSet?
3. I used Vector class to store DataInfo[], however mine looks like
it returns the last record not the record of the record number.
Could you tell me what is wrong?
Please comment.
Thank you in advance.
Jodie.
 
gemini kenny
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have done it only for 'Origin' and 'Destination' fields and was wondering whether we should do it for other fields as well. But I don't understand why we need to do it for other fields anyway....
Any suggestions will be greatly appreciated.
 
Ajith Kallambella
Sheriff
Posts: 5782
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
PROPER NAMES ARE NOW REQUIRED!!
Read this post for details.
Ajith
 
scott irwin
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've implemented a generic find that works with whatever schema is used as a database. If you got specific to just two fields, I think you going down the wrong path!!
 
Subha Ambigapathy
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah I too accept with scott. Try to implement as much as possible tob e generic.
 
joey phillip
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
(1)Can anyone suggest me how to implement criteriaFind method to search for multiple fields like "Career='SpeedyAir',Destination='SFO'".
(2) How to design GUI for this search. by creating individual JTextField for everyfield or by creating general search

joey
 
Sam Wong
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
CriteriaFind should be as generic as possible whereas the GUI, imo, should allow origin/destination as search criteria. This would be the most concise presentation to the user.
 
Adrian Yan
Ranch Hand
Posts: 688
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What type of algorithm should we implement? I'm kind of stuck at this point, I'm trying to find the correct algorithm.
Any help is welcome.
 
Abhijeet Premkumar
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jodie,
To answer your questions
1. No. The criteriaFind method should be generic and be able to take apart a criteria string of any length. It should not be dependant on the underlying database as well.
2. I do not understand what you mean. Please rephrase.
3. You will need to explain the problem in greater detail.
With warm regards
Abhijeet

Originally posted by foolsee:
Hi, all.
I have some questions about criteriaFind().
1. I think we only need to implement this method for Origin airport
and Destination airport. Am I correct? Or should I do this for
every possible fieldName?
2. in any cases, should I use StringTokenizer to get fieldName or can
I just hard code it from DataSet?
3. I used Vector class to store DataInfo[], however mine looks like
it returns the last record not the record of the record number.
Could you tell me what is wrong?
Please comment.
Thank you in advance.
Jodie.

 
Abhijeet Premkumar
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I've implemented a simple linear search. I don't see any point in complicating matters.
With warm regards
Abhijeet
Originally posted by Adrian Yan:
What type of algorithm should we implement? I'm kind of stuck at this point, I'm trying to find the correct algorithm.
Any help is welcome.

 
Abhijeet Premkumar
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Joey,
Well. To answer your questions....
1. The easiest way to implement the criteriaFind method is to take a look at the find method provided in the data class. Find checks only the first field. You only need to copy it to your criteriaFind method and extend its functionality to take other database fields into account. You may also need to decide now how you will implement the ANY parameter search.
2. The GUI is the easy part. You may use any component like JList Box or JComboBox or JTextField. You will only need to justify why
you used the controls you did. You will then need to create your criteria String from the User selection in the GUI and pass it to your criteriaFind method. But that I believe comes much later.
I hope this helps.
With warm regards
Abhijeet
Originally posted by joey phillip:
(1)Can anyone suggest me how to implement criteriaFind method to search for multiple fields like "Career='SpeedyAir',Destination='SFO'".
(2) How to design GUI for this search. by creating individual JTextField for everyfield or by creating general search

joey

 
Douglas Kent
Ranch Hand
Posts: 171
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I implemented criteriaFind so that no matter what the schema, it would work. I used a very general, "brute force" search of the text retrieved from the DB. I believe this is a significant point that the graders will be looking at, due to the fact that the instructions state that that FBN is "growing" and that your design should be amenable to change. I did justify my design in the in-line comments in the code.
Hope this helps,
Doug
 
Sam Wong
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In a way, I'm struggling to decide how far is too far. Given that the search criteria will most likely be origin and destination, you may want to use a search algorithm that maximizes performance. A simple linear search is probably sufficient for this assignment. However, I am tempted to implement some sort of index to facilitate the searching routine. This would handle future growth of the db but is it too much?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic