com.distributed.api
Class Message

java.lang.Object
  |
  +--com.distributed.api.Message

public class Message
extends java.lang.Object

Class to hold a Message


Field Summary
 java.lang.String clock
          String Value of Clock of the Message
 int clocktype
          Clock Value of the Message
static int CONSENSUS_PROPOSITION
          Constant used in the Class, Type of Message, Consensus Section
static int CONSENSUS_START
          Constant used in the Class, Type of Message, Consensus Section
static int CS_REQUEST
          Constant used in the Class, Type of Message, Lock section
 int dest
          Destination of the Message
static int LEADER_ACCEPTED
          Constant used in the Class, Type of Message, Election Section
static int LEADER_PROPOSITION
          Constant used in the Class, Type of Message, Election Section
static int MARKER
          Constant used in the Class, Type of Message, Camera Section
 java.lang.String messg
          Program part of message of the Message
 int messgtype
          Type of the Message
static int NEW_COORDINATOR
          Constant used in the Class, Type of Message, Election Section
static int NORMAL_MESSAGE
          Constant used in the Class, Type of Message
static int OK_MESSAGE
          Constant used in the Class, Type of Message, Lock Section
 boolean red_message
          Indicator if message is Red or white
static int SNAPSHOT_REQUEST
          Constant used in the Class, Type of Message, Camera Section
static int SNAPSHOT_RESPONSE
          Constant used in the Class, Type of Message, Camera Section
 int source
          Source of the Message
 
Constructor Summary
Message(int spid, int mtype, java.lang.String m, boolean red, java.lang.String c, int ct)
          Constructor to be normally used
 
Method Summary
static java.lang.String constructMessage(int spid, int messgtype, java.lang.String messg, boolean red_message, java.lang.String clock, int clock_type)
          Method to return a String composing the Message.
static Message decodeMessage(java.lang.String m)
          Method to convert a String received over channel into a Message Object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

clock

public java.lang.String clock
String Value of Clock of the Message


clocktype

public int clocktype
Clock Value of the Message


CONSENSUS_PROPOSITION

public static final int CONSENSUS_PROPOSITION
Constant used in the Class, Type of Message, Consensus Section

See Also:
Constant Field Values

CONSENSUS_START

public static final int CONSENSUS_START
Constant used in the Class, Type of Message, Consensus Section

See Also:
Constant Field Values

CS_REQUEST

public static final int CS_REQUEST
Constant used in the Class, Type of Message, Lock section

See Also:
Constant Field Values

dest

public int dest
Destination of the Message


LEADER_ACCEPTED

public static final int LEADER_ACCEPTED
Constant used in the Class, Type of Message, Election Section

See Also:
Constant Field Values

LEADER_PROPOSITION

public static final int LEADER_PROPOSITION
Constant used in the Class, Type of Message, Election Section

See Also:
Constant Field Values

MARKER

public static final int MARKER
Constant used in the Class, Type of Message, Camera Section

See Also:
Constant Field Values

messg

public java.lang.String messg
Program part of message of the Message


messgtype

public int messgtype
Type of the Message


NEW_COORDINATOR

public static final int NEW_COORDINATOR
Constant used in the Class, Type of Message, Election Section

See Also:
Constant Field Values

NORMAL_MESSAGE

public static final int NORMAL_MESSAGE
Constant used in the Class, Type of Message

See Also:
Constant Field Values

OK_MESSAGE

public static final int OK_MESSAGE
Constant used in the Class, Type of Message, Lock Section

See Also:
Constant Field Values

red_message

public boolean red_message
Indicator if message is Red or white


SNAPSHOT_REQUEST

public static final int SNAPSHOT_REQUEST
Constant used in the Class, Type of Message, Camera Section

See Also:
Constant Field Values

SNAPSHOT_RESPONSE

public static final int SNAPSHOT_RESPONSE
Constant used in the Class, Type of Message, Camera Section

See Also:
Constant Field Values

source

public int source
Source of the Message

Constructor Detail

Message

public Message(int spid,
               int mtype,
               java.lang.String m,
               boolean red,
               java.lang.String c,
               int ct)
Constructor to be normally used

Parameters:
spid - Source of the message
mtype - Message Type
m - Message Part
red - Whether message is red or white
c - Clock value
ct - Clock Type
Method Detail

constructMessage

public static java.lang.String constructMessage(int spid,
                                                int messgtype,
                                                java.lang.String messg,
                                                boolean red_message,
                                                java.lang.String clock,
                                                int clock_type)
Method to return a String composing the Message. This string will be sent over the Network

Parameters:
spid - Source of the message
messgtype - Message Type
messg - Message Part
red_message - Whether message is red or white
clock - Clock value
clock_type - Clock Type

decodeMessage

public static Message decodeMessage(java.lang.String m)
                             throws java.lang.Exception
Method to convert a String received over channel into a Message Object

Parameters:
m - String form
Returns:
Message Object corresponding to string
java.lang.Exception