This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
Are we suppose to create this function and place it in the data class. Also do we only use this function for an exact match or to populate all records via a wild character such as *.* or all? etc etc... Thanks any examples of this search method would be appreciated. Thanks Randy.
Lisa Foster
Ranch Hand
Joined: Feb 28, 2001
Posts: 116
posted
0
Hi I have the same question I just started my assignment. Any Help graetly appreciated for I am new to Java. Thanks Lisa
Adrian Yan
Ranch Hand
Joined: Oct 02, 2000
Posts: 688
posted
0
criteriaFind method is a method that you need to implement. It basically does the searching of the database. A client will enter a query "Original ariport=SFO", it should return all records that have SFO as its' Original airport. The "any" criteria is just like a wild card.
Lisa Foster
Ranch Hand
Joined: Feb 28, 2001
Posts: 116
posted
0
Thanks alot I believe I will use the find method and use alot of its implementation in my criteriaFind method. Am I on the right track? Thanks Lisa
Rudy Yeung
Ranch Hand
Joined: Dec 27, 2000
Posts: 183
posted
0
In my opinion, you are not able to use the given find() method to implement your criteriaFind() because it is of limited usuage. For my case, I overload the find() method to extend the usuage, and call ed overloaded find() method from within the criterFind() method. Hope this helps. Rudy
Ihor Strutynskyj
Greenhorn
Joined: Mar 28, 2000
Posts: 22
posted
0
Rudy, If you call find() from criteriaFind you will be searching the whole database per EACH column in your search criteria. More efficient way would be to use the code from find() as an example of how to write criteriaFind() which will do one database scan per all columns in the search criteria. Sun does look at the efficiency of criteriaFind. Regards, Ihor
Rudy Yeung
Ranch Hand
Joined: Dec 27, 2000
Posts: 183
posted
0
Ihor, My overloaded find() method will not scan the whole database per column. Instead it will scan the whole database per record. Simply speaking, I have the criteriaFind() method tokenizes the string criteria passed in. The tokenized criteria in the form of key/value pair will then be passed into my overloaded find() method in the form of a collection object like vector. Inside my overloaded find() method, I will read record one by one, and any record that does not satisfy the criteria specified in the collection object will be skipped. Please feel free to give comments or any better way to improve the efficiency based on my approach. Rudy
Ihor Strutynskyj
Greenhorn
Joined: Mar 28, 2000
Posts: 22
posted
0
Rudy, Now it's more clear what your overloaded find() does. I did the same but inside the criteriaFind() with the little difference that my criteria is stored in the array of ArrayLists which is a bit more efficient to traverse than synchronized Vector. I also keep separate int[] of indexes for even faster scanning of search criteria. Regards, Ihor
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.