nl.tudelft.simulation.event
Class EventType

java.lang.Object
  extended bynl.tudelft.simulation.event.EventType
All Implemented Interfaces:
java.io.Serializable

public final class EventType
extends java.lang.Object
implements java.io.Serializable

The EventType is a masker used for the subscription to asynchronous events. Eventtypes are used by EventProducers to show which events they potentially fire. EventTypes should be defined as static final fields.

The EventType class is made final for a number of reasons. The most important is to assure that the equals and hashcode methods are not overloaded.

(c) copyright 2003 Delft University of Technology , the Netherlands.
See for project information www.simulation.tudelft.nl
License of use: General Public License (GPL) , no warranty

Since:
1.0
Version:
1.08 2004-03-18
Author:
Peter Jacobs
See Also:
Serialized Form

Constructor Summary
EventType(java.lang.String name)
          constructs a new EventType.
 
Method Summary
 boolean equals(java.lang.Object arg0)
           
 int hashCode()
          Returns a hash code for the name of the this eventType.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EventType

public EventType(java.lang.String name)
constructs a new EventType.

Parameters:
name - the name of this eventType. Two values are not appreciated : null and "".
Method Detail

equals

public boolean equals(java.lang.Object arg0)
See Also:
Object.equals(java.lang.Object)

hashCode

public int hashCode()
Returns a hash code for the name of the this eventType. The hash code for an EventType object is computed as
 
   s[0]*31ˆ(n-1) + s[1]*31ˆ(n-2) + ... + s[n-1]
  
 
using int arithmetic, where s[i] is the i th character of the name of the eventType, n is the length of the name, and ^ indicates exponentiation. This algoritm assures JVM, host, time independency.

Returns:
a hash code value for this object.

toString

public java.lang.String toString()
See Also:
Object.toString()


Copyright © 2002-2004 Delft University of Technology, the Netherlands. All Rights Reserved.