|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.util.AbstractCollection<E>
java.util.AbstractSet<DictionaryEntry<C>>
com.aliasi.dict.AbstractDictionary<C>
public abstract class AbstractDictionary<C>
An AbstractDictionary is a dictionary with convenience
implementations of most methods. Like the AbstractSet
class it extends, the AbstractCollection.iterator() method must be defined by
concrete implementations to return an iterator over dictionary
entries. Unlike AbstractSet, even the size()
method is implemented in terms of the iterator.
The implementation of the mutable methods in this class all
throw unsupported operation exceptions. This includes the method
addEntry(DictionaryEntry entry) in the dictionary
interface, and the methods AbstractCollection.remove(Object) and AbstractCollection.add(Object) and their relatives in the set interface. Subclasses
may override any or all of these methods.
| Constructor Summary | |
|---|---|
protected |
AbstractDictionary()
Construct an abstract dictionary. |
| Method Summary | |
|---|---|
void |
addEntry(DictionaryEntry<C> entry)
Adds the specified dictionary entry to the dictionary. |
DictionaryEntry<C>[] |
categoryEntries(C category)
Returns the dictionary entries with the specified category. |
Iterator<DictionaryEntry<C>> |
categoryEntryIt(C category)
Returns an iterator over the dictionary entries with the specified category. |
void |
compileTo(ObjectOutput out)
Compiles this dictionary to the specified object output. |
DictionaryEntry<C>[] |
entries()
Returns all of the dictionary entries for this dictionary. |
DictionaryEntry<C>[] |
phraseEntries(String phrase)
Returns the dictionary entries with the specified phrase. |
Iterator<DictionaryEntry<C>> |
phraseEntryIt(String phrase)
Returns an iterator over the dictionary entries with the specified phrase. |
int |
size()
Returns the size of this dictionary as measured by number of dictionary entries. |
| Methods inherited from class java.util.AbstractSet |
|---|
equals, hashCode, removeAll |
| Methods inherited from class java.util.AbstractCollection |
|---|
add, addAll, clear, contains, containsAll, isEmpty, iterator, remove, retainAll, toArray, toArray, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Set |
|---|
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, toArray, toArray |
| Constructor Detail |
|---|
protected AbstractDictionary()
| Method Detail |
|---|
public Iterator<DictionaryEntry<C>> phraseEntryIt(String phrase)
Implementation Note: This implementation filters the
result of AbstractCollection.iterator() for entries with a matching
phrase.
phraseEntryIt in interface Dictionary<C>phrase - The phrase to look up.
public DictionaryEntry<C>[] phraseEntries(String phrase)
Implementation Note: This implementation buffers the
results of phraseEntryIt(String) in a collection and
then converts it to an array.
phraseEntries in interface Dictionary<C>phrase - The phrase to look up.
public Iterator<DictionaryEntry<C>> categoryEntryIt(C category)
Implementation Note: This implementation filters the
result of AbstractCollection.iterator() for entries with a matching
category.
categoryEntryIt in interface Dictionary<C>category - Category of entries.
public DictionaryEntry<C>[] categoryEntries(C category)
Implementation Note: This implementation buffers the
results of categoryEntryIt(Object) in a collection
and then converts it to an array.
categoryEntries in interface Dictionary<C>category - Category of entries.
public int size()
Implementation Note: The implementation here just
takes the length of entries(). Subclasses may
override this method for greater efficiency.
size in interface Dictionary<C>size in interface Collection<DictionaryEntry<C>>size in interface Set<DictionaryEntry<C>>size in class AbstractCollection<DictionaryEntry<C>>public DictionaryEntry<C>[] entries()
Implementation Note: This implementation buffers the
results of categoryEntryIt(Object) in a collection
and then converts it to an array.
entries in interface Dictionary<C>public void addEntry(DictionaryEntry<C> entry)
addEntry in interface Dictionary<C>entry - Dictionary entry to add.
UnsupportedOperationException - If this operation is not
supported by a subclass implementation.
public void compileTo(ObjectOutput out)
throws IOException
compileTo in interface Compilableout - Object output to which this dictionary is compiled.
UnsupportedOperationException - If this operation is not
supported by a subclass implementation.
IOException - If there is an I/O error writing the
object.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||