messif.buckets.index
Interface OrderedIndex<C,T>

Type Parameters:
C - the type keys this index is ordered by
T - the type of objects stored in this index
All Superinterfaces:
Index<T>
All Known Subinterfaces:
ModifiableOrderedIndex<C,T>
All Known Implementing Classes:
AbstractArrayIndex, AddressStorageIndex, IntStorageIndex, LongStorageIndex, LongStorageMemoryIndex

public interface OrderedIndex<C,T>
extends Index<T>

Defines an ordered index interface on objects. The order is defined by IndexComparator that can be accessed via comparator() method.


Method Summary
 IndexComparator<C,T> comparator()
          Returns the comparator that defines order of this index.
 Search<T> search(C key, boolean restrictEqual)
          Returns a search for objects in this index using the internal comparator() of this index.
 Search<T> search(C from, C to)
          Returns a search for objects in this index using the internal comparator() of this index.
 Search<T> search(C startKey, C from, C to)
          Returns a search for objects in this index using the internal comparator() of this index.
 Search<T> search(java.util.Collection<? extends C> keys)
          Returns a search for objects in this index using the internal comparator() of this index.
 
Methods inherited from interface messif.buckets.index.Index
search, search, search, search, size
 

Method Detail

comparator

IndexComparator<C,T> comparator()
Returns the comparator that defines order of this index.

Returns:
the comparator that defines order of this index

search

Search<T> search(C key,
                 boolean restrictEqual)
                 throws java.lang.IllegalStateException
Returns a search for objects in this index using the internal comparator() of this index. If the restrictEqual is true, the search returns only objects that are comparator-equal to key.

Objects are returned in the order defined by this index.

Parameters:
key - the key to search for
restrictEqual - if true, the search is restricted only to objects that are comparator-equal to key
Returns:
a search for objects in this index
Throws:
java.lang.IllegalStateException - if there was an error initializing the search on this index

search

Search<T> search(java.util.Collection<? extends C> keys)
                 throws java.lang.IllegalStateException
Returns a search for objects in this index using the internal comparator() of this index. All objects that are comparator-equal to any of the given keys are returned.

Objects are returned in the order defined by this index.

Parameters:
keys - the keys to search for
Returns:
a search for objects in this index
Throws:
java.lang.IllegalStateException - if there was an error initializing the search on this index

search

Search<T> search(C from,
                 C to)
                 throws java.lang.IllegalStateException
Returns a search for objects in this index using the internal comparator() of this index. All objects from the interval [from, to] are returned. If a null value is specified as a boundary, that bound is not restricted. That means that search(x, null) will return all objects from this index that are bigger than or equal to x.

Objects are returned in the order defined by this index.

Parameters:
from - the lower bound on the searched objects, i.e. objects greater or equal are returned
to - the upper bound on the searched objects, i.e. objects smaller or equal are returned
Returns:
a search for objects in this index
Throws:
java.lang.IllegalStateException - if there was an error initializing the search on this index

search

Search<T> search(C startKey,
                 C from,
                 C to)
                 throws java.lang.IllegalStateException
Returns a search for objects in this index using the internal comparator() of this index. All objects from the interval [from, to] are returned. Search starts at the object nearest to the given startKey. If a null value is specified as a boundary, that bound is not restricted. That means that search(start, x, null) will return all objects from this index that are bigger than or equal to x starting at object with key start.

Objects are returned in the order defined by this index.

Parameters:
startKey - the key from which to start the search
from - the lower bound on the searched objects, i.e. objects greater or equal are returned
to - the upper bound on the searched objects, i.e. objects smaller or equal are returned
Returns:
a search for objects in this index
Throws:
java.lang.IllegalStateException - if there was an error initializing the search on this index