com.neeve.query.index
Interface IdxIndex<T,ID>

Type Parameters:
T - The type of key for the index.
ID - The value type being indexed.
All Known Subinterfaces:
IdxNonUniqueIndex<K,ID>, IdxUniqueIndex<T,ID>

public interface IdxIndex<T,ID>

Base interface for an index. An index maps a key type to an associated ID or set of IDs depending on its uniqueness.


Nested Class Summary
static interface IdxIndex.Stats<K>
          Stats describe the size and composition of an IdxIndex.
 
Method Summary
 Iterable<Map.Entry<T,ID>> allEntries(boolean ascending)
          Retrieve all of the indexed values.
 Iterable<ID> allIds(boolean ascending)
          Retrieve all record ids from the index.
 boolean containsKey(T value)
          Determine whether the index contains the specified key.
<KEY extends Comparable<KEY>>
Iterable<Map.Entry<T,ID>>
getEntries(IdxRange<KEY> range, boolean ascending)
          Retrieve the indexed values within the specified range.
<REC> IdxField<REC,T>
getField()
          Retrieve the IdxField on which the index is defined.
<KEY extends Comparable<KEY>>
Iterable<ID>
getIds(IdxRange<KEY> range)
          Gets the an Iterable of the IDs in the given IdxRange
<KEY extends Comparable<KEY>>
Iterable<ID>
getIds(IdxRange<KEY> range, Comparator<ID> valueSorter)
          Gets the an Iterable of the IDs in the given IdxRange
 String getName()
          Gets the name of the index.
 IdxIndex.Stats<T> getStats()
          Retrieve the IdxIndex.Stats for this index.
 boolean isUnique()
          Tests if this is a unique index.
 void put(T value, ID id)
          Store a key/value pair in the index.
 void remove(T value, ID id)
          Removes a key/value paid from the index.
 int valueCount(Iterable<? extends Object> values)
          Gets the number of values for the given key.
 

Method Detail

getName

String getName()
Gets the name of the index.


put

void put(T value,
         ID id)
Store a key/value pair in the index.

Parameters:
value - The key to be indexed.
id - The value to index.

remove

void remove(T value,
            ID id)
Removes a key/value paid from the index.

Parameters:
value - The key to remove.
id - The value to remove.

containsKey

boolean containsKey(T value)
Determine whether the index contains the specified key.

Parameters:
value - The key to look for.
Returns:
Whether or not the index contains the key.

getStats

IdxIndex.Stats<T> getStats()
Retrieve the IdxIndex.Stats for this index.

Returns:
The IdxIndex.Stats for this index.

getField

<REC> IdxField<REC,T> getField()
Retrieve the IdxField on which the index is defined.

Returns:
The field that this IdxIndex indexes.

isUnique

boolean isUnique()
Tests if this is a unique index.

Returns:
true If this is a unique index

allIds

Iterable<ID> allIds(boolean ascending)
Retrieve all record ids from the index.

Parameters:
ascending - Indicates whether the index is read in ascending key order or descending key order.
Returns:
An iterable of all of the ids.

getIds

<KEY extends Comparable<KEY>> Iterable<ID> getIds(IdxRange<KEY> range)
Gets the an Iterable of the IDs in the given IdxRange

Parameters:
range - The range whose IDs should be retrieved.
Returns:
An Iterable of the IDs in the given IdxRange

getIds

<KEY extends Comparable<KEY>> Iterable<ID> getIds(IdxRange<KEY> range,
                                                  Comparator<ID> valueSorter)
Gets the an Iterable of the IDs in the given IdxRange

Parameters:
range - The range whose IDs should be retrieved.
valueSorter - If specified the comparator will be used to order the resulting values.
Returns:
An Iterable of the IDs in the given IdxRange

allEntries

Iterable<Map.Entry<T,ID>> allEntries(boolean ascending)
Retrieve all of the indexed values.

Returns:
The indexed values.

getEntries

<KEY extends Comparable<KEY>> Iterable<Map.Entry<T,ID>> getEntries(IdxRange<KEY> range,
                                                                   boolean ascending)
Retrieve the indexed values within the specified range.

Parameters:
range - The range of indexed values
Returns:
The specific indexed values within that range.

valueCount

int valueCount(Iterable<? extends Object> values)
Gets the number of values for the given key.

Parameters:
values - The list of keys for which to count values
Returns:
The number of values associated with the list of keys.


Copyright © 2016 Neeve Research, LLC. All Rights Reserved.