com.sun.labs.minion.indexer.dictionary
Interface Dictionary

All Superinterfaces:
java.lang.Iterable<QueryEntry>
All Known Implementing Classes:
CachedDiskDictionary, CachedTermStatsDictionary, DiskBiGramDictionary, DiskDictionary, MemoryBiGramDictionary, MemoryDictionary, UncachedTermStatsDictionary

public interface Dictionary
extends java.lang.Iterable<QueryEntry>

An interface for dictionaries. This interface only supports a few methods that both in memory and disk resident dictionaries will need.

A dictionary is a map from entry names to entries. An entry name can be any class that defines Comparator.

See Also:
Entry

Method Summary
 QueryEntry get(java.lang.Object name)
          Gets a entry from the dictionary, given the name for the entry.
 Partition getPartition()
          Gets the partition to which this dictionary belongs.
 DictionaryIterator iterator()
          Gets an iterator for the entries in the dictionary.
 IndexEntry put(java.lang.Object name, IndexEntry e)
          Puts a entry into the dictionary.
 int size()
          Gets the number of entries in the dictionary.
 

Method Detail

put

IndexEntry put(java.lang.Object name,
               IndexEntry e)
Puts a entry into the dictionary. This will assign an ID to the entry if it is not already in the dictionary.

Parameters:
name - The name of the entry to put in the dictionary.
e - The entry to put in the dictionary.
Returns:
Any previous entry stored in the dictionary under the given name.

get

QueryEntry get(java.lang.Object name)
Gets a entry from the dictionary, given the name for the entry.

Parameters:
name - The name of the entry.
Returns:
The entry associated with the name, or null if the name doesn't appear in the dictionary.

getPartition

Partition getPartition()
Gets the partition to which this dictionary belongs.

Returns:
the partition to which the dictionary belongs

size

int size()
Gets the number of entries in the dictionary.

Returns:
the number of entries in the dictionary.

iterator

DictionaryIterator iterator()
Gets an iterator for the entries in the dictionary.

Specified by:
iterator in interface java.lang.Iterable<QueryEntry>
Returns:
An iterator for the entries in the dictionary.