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.
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.
Joined: Feb 28, 2001
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
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
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
Joined: Dec 27, 2000
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
Joined: Mar 28, 2000
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