cgl.narada.event
Class EventID

java.lang.Object
  extended by cgl.narada.event.EventID

public class EventID
extends Object

The EventID is an ID which is unique in space and time. Using the event ID we can decipher if the event was an earlier event or a later event. This is what provides us with information pertaining to duplicate detection.


Constructor Summary
EventID(byte[] idBytes)
          This constructor provides for the unmarshalling of the eventID bytes that are received over a link
EventID(int _entityID, long _timeStamp, int _seqNum)
          Constructs a unique EventID based on the entityID, timeStamp, sequenceNumber and the incarnation associated with the publishing entity.
 
Method Summary
 boolean equals(Object obj)
          Compares two objects for equality.
 byte[] getBytes()
          This method provides a marshalling of the eventID bytes.
 int getEntityID()
          Returns the entity ID contained in the eventID
 int getSequenceNumber()
          This method returns the sequence number associated with the eventID instance.
 long getTimeStamp()
          This method returns the timeStamp that is associated with the eventID.
 int hashCode()
          Generates a hash code for the receiver.
static void main(String[] args)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EventID

public EventID(byte[] idBytes)
This constructor provides for the unmarshalling of the eventID bytes that are received over a link

Parameters:
idBytes - A byte stream representation of the event ID.

EventID

public EventID(int _entityID,
               long _timeStamp,
               int _seqNum)
Constructs a unique EventID based on the entityID, timeStamp, sequenceNumber and the incarnation associated with the publishing entity.

Parameters:
_entityID - The entityID
_timeStamp - The timestamp associated with the ID.
_seqNum - The sequence number
Method Detail

getEntityID

public int getEntityID()
Returns the entity ID contained in the eventID

Returns:
int entityID

getTimeStamp

public long getTimeStamp()
This method returns the timeStamp that is associated with the eventID.

Returns:
long timeStamp

getSequenceNumber

public int getSequenceNumber()
This method returns the sequence number associated with the eventID instance.

Returns:
int sequenceNumber

toString

public String toString()
Overrides:
toString in class Object

getBytes

public byte[] getBytes()
This method provides a marshalling of the eventID bytes.

Returns:
Byte stream representation of the eventID.

equals

public boolean equals(Object obj)
Compares two objects for equality. Returns a boolean that indicates whether this object is equivalent to the specified object. This method is used when an object is stored in a hashtable.

Overrides:
equals in class Object
Parameters:
obj - the Object to compare with
Returns:
true if these Objects are equal; false otherwise.
See Also:
Hashtable

hashCode

public int hashCode()
Generates a hash code for the receiver. This method is supported primarily for hash tables, such as those provided in java.util. If two objects are equal (equals(Object) returns true) they must have the same hash code

Overrides:
hashCode in class Object
Returns:
an integer hash code for the receiver

main

public static void main(String[] args)


For comments and suggestions please send e-mail to The NaradaBrokering Project