Hello,
I have made some changes in my algorithm, code and tested the criteria find. It is working fine. Here's my updated algorithm for criteriaFind.
Duplicated fields and its value in the criteria string will be ignored during parsing of the criteria string.
Invalid fields and its value will be ignored during parsing of the criteria string.
Parse Algorithm
0. Set boolean isKey to false. Create key and value Strings. Create searchCriteria using a HashMap.
1. Create a tokenizer st1 using the criteria string and strip all quotations; i.e.both double and single and commas.
2. Iterate the tokenizer st1.
3. Create a tokenizer st2 using each token of tokenizer st1 and strip all "=".
4. Iterate the tokenizer st2.
5. If token is a valid Field, assign token to key and set isKey to true.
6. If token is not a valid Field, do task 7 to 9
7. If isKey is true, assign token to value.
8. If searchCriteria does not contain key, put the key/value pair into searchCriteria.
9. Set isKey to false;
10. End Iterator for the tokenizer st2.
11. End Iterator for the tokenizer st1.
Search Algorithm
0. Create a dataInfoList using an ArrayList, Get the searchCriteria.
1. Iterate the list of records.
2. Skip deleted records.
3. Get the number count of criteria that the record must fullfilled before it is considered a match from searchCriteria.
4. Iterate the record's fields.
5. If searchCriteria.containsKey(record's field), do task 6 to 8.
6. Get the matching field's value from the searchCriteria.
7. If the two value matches, decrement number count; i.e. one criteria is fullfilled.
8. If number count is zero, add record to dataInfoLIst; i.e. all criteria fullfilled, record found.
9. End Iterator for the record's fields.
10. End Iterator for the list of records.
Thanks Peter for the great help in streamlining my algos.
Richard