messif.buckets.index
Interface ModifiableIndex<T>

Type Parameters:
T - the type of objects stored in this index
All Superinterfaces:
Addible<T>, Index<T>
All Known Subinterfaces:
IntStorageIndexed<T>, LongStorageIndexed<T>, ModifiableOrderedIndex<C,T>, StorageIndexed<T>
All Known Implementing Classes:
AbstractArrayIndex, AddressStorageIndex, AlgorithmStorageBucket, DatabaseStorage, DiskStorage, IntStorageIndex, LongStorageIndex, LongStorageMemoryIndex, MemoryStorage

public interface ModifiableIndex<T>
extends Index<T>, Addible<T>

Defines a modifiable index interface on objects. This index allows to add objects and remove them using Removable.remove() method of the search results.


Method Summary
 void destroy()
          Destroy this index.
 void finalize()
          Finalize this index.
 ModifiableSearch<T> search()
          Returns a search for all objects in this index.
<C> ModifiableSearch<T>
search(IndexComparator<? super C,? super T> comparator, C key)
          Returns a search for objects in this index that have any of the specified keys.
<C> ModifiableSearch<T>
search(IndexComparator<? super C,? super T> comparator, C from, C to)
          Returns a search for objects in this index that are within the specified key-range.
<C> ModifiableSearch<T>
search(IndexComparator<? super C,? super T> comparator, java.util.Collection<? extends C> keys)
          Returns a search for objects in this index that have any of the specified keys.
 
Methods inherited from interface messif.buckets.index.Index
size
 
Methods inherited from interface messif.buckets.Addible
add
 

Method Detail

search

ModifiableSearch<T> search()
                           throws java.lang.IllegalStateException
Description copied from interface: Index
Returns a search for all objects in this index.

Specified by:
search in interface Index<T>
Returns:
a search for all objects in this index
Throws:
java.lang.IllegalStateException - if there was an error initializing the search on this index

search

<C> ModifiableSearch<T> search(IndexComparator<? super C,? super T> comparator,
                               C key)
                           throws java.lang.IllegalStateException
Description copied from interface: Index
Returns a search for objects in this index that have any of the specified keys. The equality is checked exclusively by using the specified comparator, thus key need not necessarily be of the same class as the objects stored in this index and also consistency with equals is not required.

Note that objects are not necessarily returned in the order defined by the comparator

Specified by:
search in interface Index<T>
Type Parameters:
C - the type of the key used by the search
Parameters:
comparator - compares the key with the stored objects
key - the key 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

<C> ModifiableSearch<T> search(IndexComparator<? super C,? super T> comparator,
                               java.util.Collection<? extends C> keys)
                           throws java.lang.IllegalStateException
Description copied from interface: Index
Returns a search for objects in this index that have any of the specified keys. The equality is checked exclusively by using the specified comparator, thus key need not necessarily be of the same class as the objects stored in this index and also consistency with equals is not required.

Note that objects are not necessarily returned in the order defined by the comparator

Specified by:
search in interface Index<T>
Type Parameters:
C - the type of the keys used by the search
Parameters:
comparator - compares the keys with the stored objects
keys - the keys to search for (at least one key must be given)
Returns:
a search for objects in this index
Throws:
java.lang.IllegalStateException - if there was an error initializing the search on this index

search

<C> ModifiableSearch<T> search(IndexComparator<? super C,? super T> comparator,
                               C from,
                               C to)
                           throws java.lang.IllegalStateException
Description copied from interface: Index
Returns a search for objects in this index that are within the specified key-range. The key boundaries [from, to] need not necessarily be of the same class as the objects stored in this index, however, the comparator must be able to compare the boundaries and the internal objects.

Note that objects are not returned in the order defined by the comparator

Specified by:
search in interface Index<T>
Type Parameters:
C - the type the boundaries used by the search
Parameters:
comparator - compares the boundaries [from, to] with the stored objects
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

finalize

void finalize()
              throws java.lang.Throwable
Finalize this index. All transient resources associated with this index are released. After this method is called, the store and retrieval methods' behavior is unpredictable.

Throws:
java.lang.Throwable - if there was an error while cleaning

destroy

void destroy()
             throws java.lang.Throwable
Destroy this index. This method releases all resources (transient and persistent) associated with this index. After this method is called, the store and retrieval methods' behavior is unpredictable.

Throws:
java.lang.Throwable - if there was an error while cleaning