com.topologi.diffx.event.lang
Class Repertory

java.lang.Object
  extended bycom.topologi.diffx.event.lang.Repertory

public final class Repertory
extends Object

A repertory of words.

Use this class to store word events in order to avoid creating new instances.

Version:
15 December 2004
Author:
Christophe Lauret

Constructor Summary
Repertory()
          Creates a new repertoire.
 
Method Summary
 boolean contains(String word)
          Returns the true if this repertory contains the specified word.
 WordEvent get(String word)
          Returns the WordEvent corresponding to the specified word.
 void put(String word)
          Adds a new word to this repertory.
 int size()
          Returns the number of words in the repertory.
 WordEvent update(String word)
          Returns the WordEvent corresponding to the specified word.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Repertory

public Repertory()
Creates a new repertoire.

Method Detail

put

public void put(String word)
Adds a new word to this repertory.

Parameters:
word - The word to be added.

get

public WordEvent get(String word)
Returns the WordEvent corresponding to the specified word.

Parameters:
word - The word to be retrieved.
Returns:
The corresponding WordEvent or null.

update

public WordEvent update(String word)
Returns the WordEvent corresponding to the specified word.

This method will add the word to the repertory if it does not already exist.

Parameters:
word - The word to be added and retrieved.
Returns:
The corresponding WordEvent.

contains

public boolean contains(String word)
Returns the true if this repertory contains the specified word.

Parameters:
word - The word to be searched.
Returns:
true if this repertory contains the word; false otherwise.

size

public int size()
Returns the number of words in the repertory.

Returns:
The number of words in the repertory.