ValueType
- The type of value to be indexed.public interface Indexer<ValueType>
DefaultIndexer
Modifier and Type | Method and Description |
---|---|
java.lang.Integer |
add(ValueType value)
Adds a value to the indexer and returns the index assigned to the value.
|
void |
addAll(java.lang.Iterable<? extends ValueType> values)
Adds all of the given values to the index.
|
java.util.Map<ValueType,java.lang.Integer> |
asMap()
Gets mapping of values to indices.
|
void |
clear()
Clears the contents of this index.
|
java.lang.Integer |
getIndex(ValueType value)
Gets the index associated with the value.
|
ValueType |
getValue(int index)
Gets the value associated with the given index.
|
ValueType |
getValue(java.lang.Integer index)
Gets the value associated with the given index.
|
boolean |
hasIndex(int index)
Determines if the given index is valid for this indexer, which means it
has a value associated with it.
|
boolean |
hasIndex(java.lang.Integer index)
Determines if the given index is valid for this indexer, which means it
has a value associated with it.
|
boolean |
hasValue(ValueType value)
Determines if the given value is known to the indexer and has an index.
|
boolean |
isEmpty()
Returns true if this indexer is empty, which means it has no values.
|
int |
size()
Gets the number of items in the index.
|
java.util.List<ValueType> |
valueList()
Gets the list of values in the index.
|
java.util.Set<ValueType> |
valueSet()
Gets the set of values in the index.
|
java.lang.Integer add(ValueType value)
value
- The value to add.void addAll(java.lang.Iterable<? extends ValueType> values)
values
- The values to add.java.lang.Integer getIndex(ValueType value)
value
- The value to get the index of.ValueType getValue(int index)
index
- The index to get.ValueType getValue(java.lang.Integer index)
index
- The index to get.boolean hasValue(ValueType value)
value
- The value.boolean hasIndex(int index)
index
- The index.boolean hasIndex(java.lang.Integer index)
index
- The index.boolean isEmpty()
int size()
java.util.Set<ValueType> valueSet()
java.util.List<ValueType> valueList()
java.util.Map<ValueType,java.lang.Integer> asMap()
void clear()