Class Dictionary

java.lang.Object
  extended byDictionary

public class Dictionary
extends Object

Model a dictionary with a TreeMap of (word, Definition) pairs.

Version:
4
See Also:
Definition

Constructor Summary
Dictionary()
          Construct an empty Dictionary.
 
Method Summary
 void addEntry(String word, Definition definition)
          Add an entry to this Dictionary.
 Definition getEntry(String word)
          Look up an entry in this Dictionary.
 int getSize()
          Get the size of this Dictionary.
 String toString()
          Construct a String representation of this Dictionary.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Dictionary

public Dictionary()
Construct an empty Dictionary.

Method Detail

addEntry

public void addEntry(String word,
                     Definition definition)
Add an entry to this Dictionary.

Parameters:
word - the word being defined.
definition - the Definition of that word.

getEntry

public Definition getEntry(String word)
Look up an entry in this Dictionary.

Parameters:
word - the word whose definition is sought
Returns:
the Definition of that word, null if none.

getSize

public int getSize()
Get the size of this Dictionary.

Returns:
the number of words.

toString

public String toString()
Construct a String representation of this Dictionary.

Returns:
a multiline String representation.