Package xal.tools.data
Class KeyValueListFilter<T>
java.lang.Object
xal.tools.data.KeyValueListFilter<T>
filter a list of objects according to the values associated with the
specified keys
-
Constructor Summary
ConstructorsConstructorDescriptionKeyValueListFilter
(KeyValueAdaptor adaptor, List<T> allRecords, String... matchingKeyPaths) Primary Constructor -
Method Summary
Modifier and TypeMethodDescriptionfilterRecords
(String text) Filter the records for those that match (case insensitive) every word in the specified text.void
filterRecordsTo
(String text, List<T> matchingRecords) Filter the records for those that match (case insensitive) every word in the specified text.void
index all records by the keyed values in the listvoid
reIndexRecord
(T recordType) re-index the specified record (e.g. if a value in the record has changed )void
setAllRecords
(List<T> allRecords) Set the list of all objects to filtervoid
setMatchingKeyPaths
(String... matchingKeyPaths) Set the matching key paths
-
Constructor Details
-
KeyValueListFilter
Primary Constructor- Parameters:
adaptor
- key value adaptor to use to get the keyed values for the objectsallRecords
- all of the objects to filtermatchingKeyPaths
- the key paths corresponding to an object's keyed values to use for matching
-
-
Method Details
-
setAllRecords
Set the list of all objects to filter -
setMatchingKeyPaths
Set the matching key paths -
indexRecords
public void indexRecords()index all records by the keyed values in the list -
reIndexRecord
re-index the specified record (e.g. if a value in the record has changed ) -
filterRecordsTo
Filter the records for those that match (case insensitive) every word in the specified text.- Parameters:
text
- the text whose every word is matched against each recordmatchingRecords
- the container (first gets cleared) into which the matching records are placed preserving order
-
filterRecords
Filter the records for those that match (case insensitive) every word in the specified text.- Parameters:
text
- the text whose every word is matched against each record- Returns:
- the list of matching records preserving order
-