Class Message

java.lang.Object
  |
  +--Message
All Implemented Interfaces:
java.lang.Comparable

public class Message
extends java.lang.Object
implements java.lang.Comparable


Constructor Summary
Message(java.lang.String text, int sender, int receiver)
          Creates new Message

REQUIRES:
MODIFIES: this
EFFECTS: Sets the necessary object fields
 
Method Summary
 int compareTo(java.lang.Object otherID)
          Compares the sender IDs.
 int msgGetFrom()
          Provides the sender's ID field of the given message
 int msgGetSize()
          Provides the size field of the message
 java.lang.String msgGetText()
          Provides the text field of the message
 int msgGetTo()
          Provides thre receiver's ID field of the given message
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Message

public Message(java.lang.String text,
               int sender,
               int receiver)
Creates new Message

REQUIRES:
MODIFIES: this
EFFECTS: Sets the necessary object fields
Method Detail

msgGetText

public java.lang.String msgGetText()
Provides the text field of the message
Returns:
String Message text
REQUIRES:
MODIFIES:
EFFECTS: Returns the text of the message

msgGetSize

public int msgGetSize()
Provides the size field of the message
Returns:
int Message size
REQUIRES:
MODIFIES:
EFFECTS: Returns the size of the message

msgGetFrom

public int msgGetFrom()
Provides the sender's ID field of the given message
Returns:
int Sender's ID
REQUIRES:
MODIFIES:
EFFECTS: Returns the ID of the sender of the given message

msgGetTo

public int msgGetTo()
Provides thre receiver's ID field of the given message
Returns:
int Receiver's ID
REQUIRES:
MODIFIES:
EFFECTS: Returns the ID of the receiver of the given message

compareTo

public int compareTo(java.lang.Object otherID)
Compares the sender IDs. Implemented following Comparable interface. To be deployed in the subsequent version with addressing system, several hosts and ISP
Specified by:
compareTo in interface java.lang.Comparable
Returns:
int
REQUIRES:
MODIFIES:
EFFECTS: Returns a negative integer if the argument is greater than comparison; positive integer if the argument is less than comparison; and 0 if they are equal.