danbikel.parser
Class AbstractEvent
java.lang.Object
danbikel.parser.AbstractEvent
- All Implemented Interfaces:
- Event, Serializable
- Direct Known Subclasses:
- SexpEvent
public abstract class AbstractEvent
- extends Object
- implements Event
A convenience class that simply implements the equals
method, as specified by the contract in Event.equals(Object)
. For efficiency, subclasses are encouraged
to override this method, using its result only when the two objects
being compared are both instances of Event
but are not
of identical run-time types (this is the strategy employed by
SexpEvent
).
- See Also:
SexpEvent.equals(Object)
,
Serialized Form
Method Summary |
boolean |
genericEquals(Object obj)
Compares this Event object to the specified object for equality. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
genericEquals
public boolean genericEquals(Object obj)
- Compares this Event object to the specified object for equality.
Two Event objects are equal if the following conditions are met:
- they both accept the same number of types, as deteremined by their
Event.numTypes()
methods
- they both have the same number of components, as determined by their
Event.numComponents()
methods
- for each type, the two objects' corresponding sequences are of the same
size (that is, contain the same number of components, as determined by
their
Event.numComponents(int)
methods)
- for each type, the two objects' corresponding sequences of components
are equal, where two sequences are defined to be equal if their elements
are pairwise equal (as determined by the equals(Object) method
of one object in the pair applied to the other)
N.B.: For efficiency, subclasses are encouraged to override this
method, using its result only when the two objects being compared are both
instaces of Event but are not of identical run-time types.
- Parameters:
obj
- the object to be tested for equality to this object
- Returns:
- whether this Event is equal to the specified object
Author: Dan Bikel.