Class EventDictionary

  • All Implemented Interfaces:
    java.lang.Cloneable

    public class EventDictionary
    extends java.lang.Object
    implements java.lang.Cloneable

    EventDictionary 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
      void add​(java.lang.String name)
      Add a new event name into the dictionary.
      void clear()
      Clears all the event ID mapping.
      EventDictionary clone()
      Clone an EventDictionary.
      int getID​(java.lang.String name)
      Return the event ID associated with the event name.
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • EventDictionary

        public EventDictionary()
        Construct an EventDictionary.
    • Method Detail

      • clone

        public EventDictionary clone()
                              throws java.lang.CloneNotSupportedException
        Clone an EventDictionary.
        Overrides:
        clone in class java.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