Package ptolemy.domains.metroII.kernel
Class EventDictionary
- java.lang.Object
 - 
- ptolemy.domains.metroII.kernel.EventDictionary
 
 
- 
- All Implemented Interfaces:
 java.lang.Cloneable
public class EventDictionary extends java.lang.Object implements java.lang.CloneableEventDictionary is a dictionary that associates the MetroII event name and the event ID. The event name is the key and the event ID is the value. When a new event name is added into the dictionary, a new id is created and associated with the added event name.
- Since:
 - Ptolemy II 11.0
 - Version:
 - $Id$
 - Author:
 - Liangpeng Guo
 - Pt.AcceptedRating:
 - Red (glp)
 - Pt.ProposedRating:
 - Red (glp)
 
 
- 
- 
Constructor Summary
Constructors Constructor Description EventDictionary()Construct an EventDictionary. 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(java.lang.String name)Add a new event name into the dictionary.voidclear()Clears all the event ID mapping.EventDictionaryclone()Clone an EventDictionary.intgetID(java.lang.String name)Return the event ID associated with the event name. 
 - 
 
- 
- 
Method Detail
- 
clone
public EventDictionary clone() throws java.lang.CloneNotSupportedException
Clone an EventDictionary.- Overrides:
 clonein classjava.lang.Object- Throws:
 java.lang.CloneNotSupportedException- the object's class does not implement the Cloneable interface.
 
- 
clear
public void clear()
Clears all the event ID mapping. 
- 
getID
public int getID(java.lang.String name)
Return the event ID associated with the event name. If the event name is not in the dictionary, return -1;- Parameters:
 name- Event name- Returns:
 - Event ID
 
 
- 
add
public void add(java.lang.String name)
Add a new event name into the dictionary. If the name is already in the dictionary, do nothing. If the name is new, add the name and create a new ID. Associate the ID the the name.- Parameters:
 name- Event name
 
 - 
 
 -