Class StartsWithLookUpAgent
- All Implemented Interfaces:
ILookUp
Agent that looks up items of an locale-rules alphabetically sort ordered Vector that
start with a text. Those items will be returned as a List.
Supports two versions: with or without considering case sensitive.
- Version:
- 07/02/2008
- Author:
- Pablo Piqueras Bartolomé (pablo.piqueras@iver.es)
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new instance of the classStartsWithLookUpAgent. -
Method Summary
Modifier and TypeMethodDescriptiondoLookUpConsideringCaseSensitive(String text, Vector<Object> sortOrderedItems, StringComparator comp) This method should be used when is wanted to distinguish small letters from capital letters during the search.doLookUpIgnoringCaseSensitive(String text, Vector<Object> sortOrderedItems, StringComparator comp) This method should be used when is wanted not to distinguish small letters from capital letters during the search, and the comparison of items done according an algorithm we define.
-
Constructor Details
-
StartsWithLookUpAgent
public StartsWithLookUpAgent()Creates a new instance of the class
StartsWithLookUpAgent.
-
-
Method Details
-
doLookUpConsideringCaseSensitive
public List<Object> doLookUpConsideringCaseSensitive(String text, Vector<Object> sortOrderedItems, StringComparator comp) Description copied from interface:ILookUpThis method should be used when is wanted to distinguish small letters from capital letters during the search.
It's necessary that all items of the array implement the
Comparableinterface.It's also necessary that the value returned by the toString() method of each item (supposing they inherit from Object) would be the expected value user saw (that would be used to compare the items).
And elements of the
Vectorshould be sort ordered by aStringComparatorwith the same configuration ascomp.- Specified by:
doLookUpConsideringCaseSensitivein interfaceILookUp- Parameters:
text- java.lang.StringsortOrderedItems- java.util.Vectorcomp- AnStringComparatorobject which implements the compareTo() method. Must have the same configuration that was used to sort order the items ofsortOrderedItems.- Returns:
- A sublist with all items that carry out with the particular search algorithm requirements
-
doLookUpIgnoringCaseSensitive
public List<Object> doLookUpIgnoringCaseSensitive(String text, Vector<Object> sortOrderedItems, StringComparator comp) Description copied from interface:ILookUpThis method should be used when is wanted not to distinguish small letters from capital letters during the search, and the comparison of items done according an algorithm we define.
It's necessary that all items of the array implement the
Comparableinterface.It's also necessary that the value returned by the toString() method of each item (supposing they inherit from Object) would be the expected value user saw (that would be used to compare the items).
And elements of the
Vectorshould be sort ordered by aStringComparatorwith the same configuration ascomp.- Specified by:
doLookUpIgnoringCaseSensitivein interfaceILookUp- Parameters:
text- java.lang.StringsortOrderedItems- java.util.Vectorcomp- AnStringComparatorobject which implements the compareTo() method. Must have the same configuration that was used to sort order the items ofsortOrderedItems.- Returns:
- A sublist with all items that carry out with the particular search algorithm requirements
-