Package jadex.bridge.service.search
Class Indexer<T>
- java.lang.Object
- 
- jadex.bridge.service.search.Indexer<T>
 
- 
 public class Indexer<T> extends java.lang.ObjectIndexer for values.
- 
- 
Field SummaryFields Modifier and Type Field Description protected booleanincludenullInclude null values during indexing.protected java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.util.Set<T>>>indexedvaluesThe index of published values.static intINTERSECT_CUTOFFCutoff value for building index set intersections.protected IKeyExtractor<T>keyextractorService key extractor.protected java.util.Set<T>valuesAll values.
 - 
Constructor SummaryConstructors Constructor Description Indexer(IKeyExtractor<T> keyextractor, boolean includenull, java.lang.String... indextypes)Create a new ServiceIndexer.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddValue(T value)Add a value to the indexer.voidclear()Clears all contained values.java.util.Set<T>getAllValues()Returns all values.IKeyExtractor<T>getKeyExtractor()Gets the key extractor used by the service.java.util.Set<T>getValues(java.lang.String keytype, java.lang.String key)Get values per type.Tuple2<java.util.Set<T>,java.lang.Object>getValues(java.util.List<Tuple3<java.lang.String,java.lang.String[],java.lang.Boolean>> spec)Get values per specification.java.util.Set<T>getValuesInverted(java.util.List<Tuple2<java.lang.String,java.lang.String[]>> spec)Get values per specification (multivalues considered as OR match, when queries are the values).booleanisIndexed(java.lang.String indexname)Test if a property is indexed per name.static voidmain(java.lang.String[] args)Main for testing.booleanmatch(java.util.List<Tuple3<java.lang.String,java.lang.String[],java.lang.Boolean>> spec, T value)Tests if the search specification matches a value (spec=query).booleanmatchOr(java.util.List<Tuple2<java.lang.String,java.lang.String[]>> spec, T value)Tests if the search specification matches a value (spec=service, value=query).voidremoveValue(T value)Remove a value from the indexer.voidupdateIndex(java.lang.String indexname)Update an index for all values.
 
- 
- 
- 
Field Detail- 
INTERSECT_CUTOFFpublic static final int INTERSECT_CUTOFF Cutoff value for building index set intersections.- See Also:
- Constant Field Values
 
 - 
keyextractorprotected IKeyExtractor<T> keyextractor Service key extractor.
 - 
valuesprotected java.util.Set<T> values All values.
 - 
indexedvaluesprotected java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.util.Set<T>>> indexedvalues The index of published values. First string is the index key name.
 - 
includenullprotected boolean includenull Include null values during indexing.
 
- 
 - 
Constructor Detail- 
Indexerpublic Indexer(IKeyExtractor<T> keyextractor, boolean includenull, java.lang.String... indextypes) Create a new ServiceIndexer.
 
- 
 - 
Method Detail- 
isIndexedpublic boolean isIndexed(java.lang.String indexname) Test if a property is indexed per name.- Parameters:
- indexname- The index name.
- Returns:
- True, if is indexed.
 
 - 
getValuespublic Tuple2<java.util.Set<T>,java.lang.Object> getValues(java.util.List<Tuple3<java.lang.String,java.lang.String[],java.lang.Boolean>> spec) Get values per specification. 'And' relates to inter-term, i.e. example type=ICMS, tags=a,b means an object must have both fulfilled. For multi-valued intra-term values it can be 'and' or 'or' as well.- Parameters:
- spec- The key values (first element is key name and array are values)
- Returns:
- The values matching the spec.
 
 - 
getValuesInvertedpublic java.util.Set<T> getValuesInverted(java.util.List<Tuple2<java.lang.String,java.lang.String[]>> spec) Get values per specification (multivalues considered as OR match, when queries are the values).- Parameters:
- spec- The key values (first element is key name and array are values)
- Returns:
- The values matching the spec.
 
 - 
getValuespublic java.util.Set<T> getValues(java.lang.String keytype, java.lang.String key) Get values per type.- Parameters:
- keytype- the key type.
- key- The key value.
- Returns:
- The values matching the key.
 
 - 
getAllValuespublic java.util.Set<T> getAllValues() Returns all values.- Returns:
- All values.
 
 - 
addValuepublic void addValue(T value) Add a value to the indexer.- Parameters:
- value- The value.
 
 - 
removeValuepublic void removeValue(T value) Remove a value from the indexer.- Parameters:
- value- The value.
 
 - 
matchpublic boolean match(java.util.List<Tuple3<java.lang.String,java.lang.String[],java.lang.Boolean>> spec, T value) Tests if the search specification matches a value (spec=query).- Parameters:
- value- The value.
- Returns:
- True, if the value matches.
 
 - 
matchOrpublic boolean matchOr(java.util.List<Tuple2<java.lang.String,java.lang.String[]>> spec, T value) Tests if the search specification matches a value (spec=service, value=query).- Parameters:
- value- The value.
- Returns:
- True, if the value matches.
 
 - 
getKeyExtractorpublic IKeyExtractor<T> getKeyExtractor() Gets the key extractor used by the service.- Returns:
- The key extractor.
 
 - 
clearpublic void clear() Clears all contained values.
 - 
updateIndexpublic void updateIndex(java.lang.String indexname) Update an index for all values.
 - 
mainpublic static void main(java.lang.String[] args) Main for testing.
 
- 
 
-