visidia.simulation.command
Class SendMessageCommand

java.lang.Object
  extended by visidia.simulation.command.Command
      extended by visidia.simulation.command.SendMessageCommand
All Implemented Interfaces:
java.io.Serializable

public class SendMessageCommand
extends Command

SendMessageCommand is the command involved when a message is sent.

See Also:
Serialized Form

Constructor Summary
SendMessageCommand(int senderId, int receiverId, MessagePacket msgPacket)
          Instantiates a new command to send a message.
 
Method Summary
 void deserialize(java.io.ObjectInputStream in)
          Deserialize.
 void executeAfterAck()
          Instructions to be executed after ack.
 void executeBeforeAck(VisidiaEvent event)
          Instructions to be executed before ack.
 boolean generateImmediateAck()
          Defines if an ack is to be generated immediately.
 boolean needSynchronization()
          Defines if command needs synchronization.
 void serialize(java.io.ObjectOutputStream out)
          Serialize.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SendMessageCommand

public SendMessageCommand(int senderId,
                          int receiverId,
                          MessagePacket msgPacket)
Instantiates a new command to send a message.

Parameters:
receiverId - the receiver id
msgPacket - the message packet
senderId - the sender id
Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

needSynchronization

public boolean needSynchronization()
Description copied from class: Command
Defines if command needs synchronization.

Specified by:
needSynchronization in class Command
Returns:
true, if to be synchronized

generateImmediateAck

public boolean generateImmediateAck()
Description copied from class: Command
Defines if an ack is to be generated immediately.

Specified by:
generateImmediateAck in class Command
Returns:
true, if an ack must be generated immediately

executeBeforeAck

public void executeBeforeAck(VisidiaEvent event)
Description copied from class: Command
Instructions to be executed before ack.

Specified by:
executeBeforeAck in class Command
Parameters:
event - the event

executeAfterAck

public void executeAfterAck()
                     throws java.lang.InterruptedException
Description copied from class: Command
Instructions to be executed after ack.

Specified by:
executeAfterAck in class Command
Throws:
java.lang.InterruptedException - the interrupted exception

serialize

public void serialize(java.io.ObjectOutputStream out)
               throws java.io.IOException
Description copied from class: Command
Serialize.

Specified by:
serialize in class Command
Parameters:
out - the output stream
Throws:
java.io.IOException - Signals that an I/O exception has occurred.

deserialize

public void deserialize(java.io.ObjectInputStream in)
                 throws java.io.IOException,
                        java.lang.ClassNotFoundException
Description copied from class: Command
Deserialize.

Specified by:
deserialize in class Command
Parameters:
in - the input stream
Throws:
java.io.IOException - Signals that an I/O exception has occurred.
java.lang.ClassNotFoundException - the class not found exception