it.unitn.ds.peersim.messages
Class GenericMessage

java.lang.Object
  extended by it.unitn.ds.peersim.messages.GenericMessage
All Implemented Interfaces:
Message
Direct Known Subclasses:
BEBMessage, ConsensusMessage

public class GenericMessage
extends java.lang.Object
implements Message

Distributed Systems Course Project

Year: 2009/2010

University of Trento

GenericMessage - Generic message class.

Version:
1.0
Author:
Avancini Mattia, Giampaolo Farina
See Also:
http://peersim.sourceforge.net/

Constructor Summary
GenericMessage(int protocolID, long messageID, peersim.core.Node sender, peersim.core.Node receiver, java.lang.Object payload)
          Implements a general message.
 
Method Summary
 long getMessageID()
          Returns the message id.
 java.lang.Object getPayload()
          Returns the content of the message.
 int getProtocolID()
          Sets the protocol id.
 peersim.core.Node getReceiver()
          Returns the receiver of the message.
 peersim.core.Node getSender()
          Returns the sender of the message.
 void setReceiver(peersim.core.Node receiver)
          Sets the receiver field.
 java.lang.String toString()
          To string.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GenericMessage

public GenericMessage(int protocolID,
                      long messageID,
                      peersim.core.Node sender,
                      peersim.core.Node receiver,
                      java.lang.Object payload)
Implements a general message.

Parameters:
protocolID - the protocol id.
messageID - the message id.
sender - the sender of the message.
receiver - the receiver of the message.
payload - the content of the message.
Method Detail

getMessageID

public long getMessageID()
Returns the message id.

Specified by:
getMessageID in interface Message
Returns:
the messageID.

getPayload

public java.lang.Object getPayload()
Returns the content of the message.

Specified by:
getPayload in interface Message
Returns:
the payload.

getSender

public peersim.core.Node getSender()
Returns the sender of the message.

Specified by:
getSender in interface Message
Returns:
the sender.

getReceiver

public peersim.core.Node getReceiver()
Returns the receiver of the message.

Specified by:
getReceiver in interface Message
Returns:
the receiver

setReceiver

public void setReceiver(peersim.core.Node receiver)
Sets the receiver field.

Specified by:
setReceiver in interface Message
Parameters:
receiver - the receiver to set.

getProtocolID

public int getProtocolID()
Sets the protocol id.

Specified by:
getProtocolID in interface Message
Returns:
the protocolID

toString

public java.lang.String toString()
Description copied from interface: Message
To string.

Specified by:
toString in interface Message
Overrides:
toString in class java.lang.Object
Returns:
the string
See Also:
Object.toString()