input
Class MessageRelayEvent

java.lang.Object
  extended by input.ExternalEvent
      extended by input.MessageEvent
          extended by input.MessageRelayEvent
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<ExternalEvent>

public class MessageRelayEvent
extends MessageEvent

External event for all the stages of relaying a message between two hosts (start and possible abort or delivery).

See Also:
Serialized Form

Field Summary
static int ABORTED
          Message relay stage constant for aborted delivery
static int SENDING
          Message relay stage constant for start of sending
static java.lang.String[] STAGE_STRINGS
          Stage constant -> String representation mapping
static int TRANSFERRED
          Message relay stage constant for ready delivery
 
Fields inherited from class input.MessageEvent
fromAddr, id, toAddr
 
Fields inherited from class input.ExternalEvent
time
 
Constructor Summary
MessageRelayEvent(int from, int to, java.lang.String id, double time, int stage)
          Creates a message relaying event
 
Method Summary
 void processEvent(World world)
          Relays the message
 java.lang.String toString()
          Returns a String representation of the event
 
Methods inherited from class input.ExternalEvent
compareTo, getTime
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SENDING

public static final int SENDING
Message relay stage constant for start of sending

See Also:
Constant Field Values

TRANSFERRED

public static final int TRANSFERRED
Message relay stage constant for ready delivery

See Also:
Constant Field Values

ABORTED

public static final int ABORTED
Message relay stage constant for aborted delivery

See Also:
Constant Field Values

STAGE_STRINGS

public static final java.lang.String[] STAGE_STRINGS
Stage constant -> String representation mapping

Constructor Detail

MessageRelayEvent

public MessageRelayEvent(int from,
                         int to,
                         java.lang.String id,
                         double time,
                         int stage)
Creates a message relaying event

Parameters:
from - Where the message comes from (at this hop)
to - Who the message goes to (at this hop)
id - ID of the message
time - Time when this event happens
stage - The stage of the event (SENDING, TRANSFERRED, or ABORTED)
Method Detail

processEvent

public void processEvent(World world)
Relays the message

Overrides:
processEvent in class ExternalEvent
Parameters:
world - World where the actors of the event are

toString

public java.lang.String toString()
Description copied from class: ExternalEvent
Returns a String representation of the event

Overrides:
toString in class MessageEvent
Returns:
a String representation of the event