infoservice.agreement.paxos.messages
Class PaxosMessage

java.lang.Object
  extended by infoservice.agreement.paxos.messages.PaxosMessage
Direct Known Subclasses:
CollectMessage, FreezeProofMessage

public class PaxosMessage
extends java.lang.Object


Field Summary
static java.lang.String COLLECT
          Static type of a collect message
static java.lang.String DECIDE
          Static type of a decide message
static java.lang.String FREEZE
          Static type of a freeze message
static java.lang.String FREEZEPROOF
          Static type of a freeze-proof message
private  java.lang.String m_initiator
           
private  java.lang.String m_messageType
           
private  java.lang.String m_paxosInstanceIdentifier
           
private  java.lang.String m_proposal
           
private  int m_round
           
private  java.lang.String m_sender
           
static java.lang.String PROPOSE
          Static type of a propose message
static java.lang.String REJECT
          Static type of a reject message
static java.lang.String STRONG
          Static type of a strong accept message
static java.lang.String WEAK
          Static type of a weak accept message
 
Constructor Summary
PaxosMessage(java.lang.String a_messageType)
          Creates a new PaxosMessage of the given type
 
Method Summary
 boolean belongsTo(PaxosExecution a_execution)
          Indicates if this message belongs to the given execution
 boolean belongsTo(PaxosInstance a_instance)
          Indicates if this message belongs to the given paxos instance
 boolean belongsTo(PaxosRound a_round)
          Indicates if this message belongs to the given round
 boolean equals(java.lang.Object ob)
           
 java.lang.String getInitiator()
          Returns the ID of the initiator of this messages execution
 java.lang.String getMessageType()
          Returns the message type of this message
 java.lang.String getPaxosInstanceIdentifier()
          Returns the round number of this message
 java.lang.String getProposal()
          Returns the proposal of this execution
 int getRound()
           
 java.lang.String getSender()
          Returns the ID of the sender of this message
 void setInitiator(java.lang.String a_initiator)
          Sets the initiator of the executions this message belongs to
 void setPaxosInstanceIdentifier(java.lang.String a_value)
           
 void setProposal(java.lang.String a_proposal)
          Sets the proposal of this message
 void setRound(int a_round)
           
 void setSender(java.lang.String a_sender)
          Sets the ID of the sender of this message
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPOSE

public static java.lang.String PROPOSE
Static type of a propose message


WEAK

public static java.lang.String WEAK
Static type of a weak accept message


STRONG

public static java.lang.String STRONG
Static type of a strong accept message


DECIDE

public static java.lang.String DECIDE
Static type of a decide message


FREEZE

public static java.lang.String FREEZE
Static type of a freeze message


REJECT

public static java.lang.String REJECT
Static type of a reject message


FREEZEPROOF

public static java.lang.String FREEZEPROOF
Static type of a freeze-proof message


COLLECT

public static java.lang.String COLLECT
Static type of a collect message


m_messageType

private java.lang.String m_messageType

m_proposal

private java.lang.String m_proposal

m_paxosInstanceIdentifier

private java.lang.String m_paxosInstanceIdentifier

m_initiator

private java.lang.String m_initiator

m_sender

private java.lang.String m_sender

m_round

private int m_round
Constructor Detail

PaxosMessage

public PaxosMessage(java.lang.String a_messageType)
Creates a new PaxosMessage of the given type

Parameters:
a_messageType - One of the message types
Method Detail

getMessageType

public java.lang.String getMessageType()
Returns the message type of this message

Returns:
The message type of this message

equals

public boolean equals(java.lang.Object ob)
Overrides:
equals in class java.lang.Object

getRound

public int getRound()

getInitiator

public java.lang.String getInitiator()
Returns the ID of the initiator of this messages execution

Returns:
The ID of the initiator of this messages execution

getProposal

public java.lang.String getProposal()
Returns the proposal of this execution

Returns:
The proposal of this execution

getPaxosInstanceIdentifier

public java.lang.String getPaxosInstanceIdentifier()
Returns the round number of this message

Returns:
The round number of this message

getSender

public java.lang.String getSender()
Returns the ID of the sender of this message

Returns:
The ID of the sender of this message

setRound

public void setRound(int a_round)

setInitiator

public void setInitiator(java.lang.String a_initiator)
Sets the initiator of the executions this message belongs to

Parameters:
a_initiator - The ID of the initiator of the executions this message belongs to

setProposal

public void setProposal(java.lang.String a_proposal)
Sets the proposal of this message

Parameters:
a_proposal - The proposal contained in this message

setPaxosInstanceIdentifier

public void setPaxosInstanceIdentifier(java.lang.String a_value)

setSender

public void setSender(java.lang.String a_sender)
Sets the ID of the sender of this message

Parameters:
a_sender - The ID of the sender of this message

belongsTo

public boolean belongsTo(PaxosInstance a_instance)
Indicates if this message belongs to the given paxos instance

Parameters:
a_instance - The instance to be tested
Returns:
true if the message belongs to that instance, false otherwise

belongsTo

public boolean belongsTo(PaxosExecution a_execution)
Indicates if this message belongs to the given execution

Parameters:
a_execution - The execution to be tested
Returns:
true if the message belongs to that execution, false otherwise

belongsTo

public boolean belongsTo(PaxosRound a_round)
Indicates if this message belongs to the given round

Parameters:
a_round - The round to be tested
Returns:
true if the message belongs to that round, false otherwise