GridSim 5.0 beta

gridsim.auction
Class Message

Object
  extended by Message
Direct Known Subclasses:
MessageAsk, MessageBid, MessageCallForBids, MessageInformOutcome, MessageInformStart, MessageRejectBid, MessageRejectCallForBid

public class Message
extends Object

This class represents a single message exchanged among auctioneers, bidders or sellers.

Since:
GridSim Toolkit 4.0
Author:
Marcos Dias de Assuncao
See Also:
AuctionTags

Field Summary
static int TO_ALL_BIDDERS
          This tag is used as destination of messages that are broadcast
 
Constructor Summary
Message(int auctionID, int protocol)
           
 
Method Summary
 Object getAttribute(Object key)
          Returns an attribute of the message.
protected  Hashtable getAttributes()
           
 int getAuctionID()
          Retruns the auction ID of this message
 int getDestinationID()
          Returns the ID of the entity that is the recipient of this message
 int getMessageID()
          Returns the message ID
 int getProtocol()
          Returns the auction protocol.
 double getScheduleTime()
          Returns how much time to waited to schedule the message
 int getSourceID()
          Returns the ID of the entity that generated the message
 boolean scheduleToBeSent(double time)
          The message can be scheduled to be sent at a given time.
 boolean setAttribute(Object key, Object value)
          Sets an attribute to the message.
protected  void setAttributes(Hashtable attrib)
           
 boolean setAuctionID(int auctionID)
          Sets the auction ID of this message
 boolean setDestinationID(int id)
          Sets the the GridSim entity that is the recipient of this message
protected  boolean setMessageID(int id)
          Sets the message ID
 boolean setProtocol(int protocol)
          Sets the auction protocol used this auction
 boolean setSourceID(int id)
          Sets the the GridSim entity that generates this message
 String toString()
          Converts message to String
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TO_ALL_BIDDERS

public static int TO_ALL_BIDDERS
This tag is used as destination of messages that are broadcast

Constructor Detail

Message

public Message(int auctionID,
               int protocol)
Parameters:
auctionID -
protocol -
Method Detail

getAttribute

public Object getAttribute(Object key)
Returns an attribute of the message.
Additional attributes may be defined to a message.

Parameters:
key - the key for the attribute to be retireved
Returns:
an Object which corresponds to the required attribute

setAttribute

public boolean setAttribute(Object key,
                            Object value)
Sets an attribute to the message.
Additional attributes may be defined to a message.

Parameters:
key - is the key used to retrieve the attribute.
value - is the object that corresponds to the attribute.
Returns:
true if the attribute was set correctly
Pre Condition:
key != null && value != null

getAttributes

protected Hashtable getAttributes()

setAttributes

protected void setAttributes(Hashtable attrib)

getMessageID

public int getMessageID()
Returns the message ID

Returns:
an integer that corresponds to the message ID.

setMessageID

protected boolean setMessageID(int id)
Sets the message ID

Parameters:
id - the new message ID
Returns:
true if the id was properly set
Pre Condition:
id > 0

setAuctionID

public boolean setAuctionID(int auctionID)
Sets the auction ID of this message

Parameters:
auctionID - the ID of the auction to which the message refers
Returns:
true if the auctionID was properly set
Pre Condition:
auctionID > 0

getAuctionID

public int getAuctionID()
Retruns the auction ID of this message

Returns:
the ID of the auction to which the message refers.

getProtocol

public int getProtocol()
Returns the auction protocol.

Returns:
an int which corresponds to an identification of the auction protocol

setProtocol

public boolean setProtocol(int protocol)
Sets the auction protocol used this auction

Parameters:
protocol -
Returns:
true if the protocol was properly set
Pre Condition:
protocol > 0

setSourceID

public boolean setSourceID(int id)
Sets the the GridSim entity that generates this message

Parameters:
id - the ID of an Gridsim entity
Returns:
true if the source id was properly set
Pre Condition:
id == some GridSim entity's ID

getSourceID

public int getSourceID()
Returns the ID of the entity that generated the message

Returns:
an int that is a GridSim entity ID.

setDestinationID

public boolean setDestinationID(int id)
Sets the the GridSim entity that is the recipient of this message

Parameters:
id - the ID of an Gridsim entity
Returns:
true if the destination id was properly set
Pre Condition:
id == some GridSim entity's ID

getDestinationID

public int getDestinationID()
Returns the ID of the entity that is the recipient of this message

Returns:
the ID of an Gridsim entity

scheduleToBeSent

public boolean scheduleToBeSent(double time)
The message can be scheduled to be sent at a given time. This way, the entity that dispatches such a message schedules the message to be sent after the specified time

Parameters:
time - the time to wait to send the message
Returns:
true if the scheduled time was properly set
Pre Condition:
time >= 0.0

getScheduleTime

public double getScheduleTime()
Returns how much time to waited to schedule the message

Returns:
the simulation time to wait

toString

public String toString()
Converts message to String

Overrides:
toString in class Object
Returns:
the string representation of the message

GridSim 5.0 beta

The University of Melbourne, Australia, 2009