GridSim 5.0 beta

gridsim.auction
Class Auction

Object
  extended by Thread
      extended by Sim_entity
          extended by GridSimCore
              extended by GridSim
                  extended by Auction
All Implemented Interfaces:
Cloneable, Runnable
Direct Known Subclasses:
DoubleAuction, OneSidedAuction

public abstract class Auction
extends GridSim

This class represents an auction. This is class has generic attributes common to all auctions

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

Nested Class Summary
 
Nested classes/interfaces inherited from class Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
protected  Sim_port outputPort
          The Auction output port.
 
Fields inherited from class GridSim
GRIDSIM_VERSION_STRING, PAUSE
 
Fields inherited from class GridSimCore
input, NETWORK_TYPE, output
 
Fields inherited from class Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
Auction(String auctionName, int auctionProtocol)
          Constructor
Auction(String auctionName, int auctioneerID, int auctionProtocol, Sim_port output)
          Default constructor
 
Method Summary
 void body()
           
protected  boolean broadcastMessage(Message msg)
          Brodcasts a message to all bidders engaged in the auction
 Object getAttribute(Object key)
          Returns a given attribute of the auction
protected  Hashtable getAttributes()
          Returns a Hashtable with the attributes defined in the auction.
 int getAuctioneerID()
          Returns the auctioneer ID
 int getAuctionID()
          Returns the ID of this auction
protected  int getAuctionProtocol()
          Returns the auction protocol
 LinkedList getBidders()
          Returns the list of bidders
protected  Sim_port getOutputPort()
          Returns the output port used by this auction to send messages
 double getStartingTime()
          Returns the initial time of the auction
protected abstract  void processEvent(Sim_event ev)
           
 boolean setAttribute(Object key, Object value)
          Sets an attribute to this auction.
 boolean setAuctioneerID(int auctioneerID)
          Sets the id of the auctioneer responsible for this auction
 boolean setAuctionID(int id)
          Sets the auction's ID manually
protected  boolean setAuctionProtocol(int protocol)
          Sets the auction protocol used by the auction
 boolean setBidders(LinkedList list)
          Sets a list of the bidders associated with this auction
 boolean setOutputPort(Sim_port output)
          Sets the output port to be used by this auction.
protected  boolean setStartingTime(double time)
          Sets the initial time of the auction
abstract  void startAuction()
           
 
Methods inherited from class GridSim
clock, disableDebugMode, enableDebugMode, getAdvancedReservationList, getEntityId, getEntityName, getEntityName, getEntityName, getGISId, getGridInfoServiceEntityId, getGridResourceList, getGridSimShutdownEntityId, getGridStatisticsEntityId, getNetworkType, getNumFreePE, getNumFreePE, getNumPE, getNumPE, getResourceCharacteristics, getResourceDynamicInfo, getSimulationCalendar, getSimulationStartDate, getVisualizer, gridletCancel, gridletCancel, gridletMove, gridletMove, gridletPause, gridletPause, gridletReceive, gridletReceive, gridletReceive, gridletResume, gridletResume, gridletStatus, gridletStatus, gridletSubmit, gridletSubmit, gridletSubmit, gridSimHold, init, init, init, initNetworkType, isDebugModeEnabled, isResourceExist, isResourceExist, isTraceEnabled, pauseSimulation, pauseSimulation, receiveEventObject, receiveEventObject, recordStatistics, recordStatistics, recordStatistics, recordStatistics, resourceSupportAR, resourceSupportAR, resumeSimulation, setGIS, shutdownGridStatisticsEntity, shutdownUserEntity, startGridSimulation, startGridSimulation, stopGridSimulation
 
Methods inherited from class GridSimCore
finalizeGridSimulation, getLink, getPingResult, isNetworked, ping, ping, ping, ping, pingBlockingCall, pingBlockingCall, pingBlockingCall, pingBlockingCall, send, send, send, send, send, send, setBackgroundTraffic, setBackgroundTraffic, terminateIOEntities
 
Methods inherited from class Sim_entity
add_generator, add_param, add_port, clone, get_id, get_name, get_port, get_port, get_stat, run, send_on, set_invisible, set_stat, sim_cancel, sim_completed, sim_current, sim_get_next, sim_get_next, sim_hold_for, sim_hold, sim_pause_for, sim_pause_for, sim_pause_until, sim_pause_until, sim_pause, sim_process_for, sim_process_for, sim_process_until, sim_process_until, sim_process, sim_putback, sim_schedule, sim_schedule, sim_schedule, sim_schedule, sim_schedule, sim_schedule, sim_select, sim_trace, sim_wait_for, sim_wait_for, sim_wait_for, sim_wait, sim_waiting, sim_waiting
 
Methods inherited from class Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

outputPort

protected Sim_port outputPort
The Auction output port. This port is mainly used to send messages generated by this Auction class. This is because an Auction class has to send messages on the auctioneer's behalf

Constructor Detail

Auction

public Auction(String auctionName,
               int auctioneerID,
               int auctionProtocol,
               Sim_port output)
        throws Exception
Default constructor

Parameters:
auctionName - name for the auction
auctioneerID - the ID of the auctioner because the auction sends messages on the auctioneer's behalf
auctionProtocol - an int representing the auction protocol
output - the auctioneer's output port
Throws:
Exception
See Also:
GridSim

Auction

public Auction(String auctionName,
               int auctionProtocol)
        throws Exception
Constructor

Parameters:
auctionName - name for the auction on the auctioneer's behalf
auctionProtocol - an int representing the auction protocol
Throws:
Exception
See Also:
GridSim
Method Detail

getAuctioneerID

public int getAuctioneerID()
Returns the auctioneer ID

Returns:
the ID of a GridSim entity

setAuctioneerID

public boolean setAuctioneerID(int auctioneerID)
Sets the id of the auctioneer responsible for this auction

Parameters:
auctioneerID - the auctioneer ID
Returns:
true if the id was properly set

setOutputPort

public boolean setOutputPort(Sim_port output)
Sets the output port to be used by this auction. The output port is the auctioneer's output port since the auction sends messages on the auctioneer's behalf

Parameters:
output - the port to be used
Returns:
true if the output port was properly set

setAuctionID

public boolean setAuctionID(int id)
Sets the auction's ID manually

Parameters:
id - the id to be used by the auction
Returns:
true if the ID has been set; false otherwise.

getAuctionID

public int getAuctionID()
Returns the ID of this auction

Returns:
auction ID

setBidders

public boolean setBidders(LinkedList list)
Sets a list of the bidders associated with this auction

Parameters:
list - of bidders. The IDs must be entities' ids
Returns:
true if the bidders were correctly set
Pre Condition:
list != null

getBidders

public LinkedList getBidders()
Returns the list of bidders

Returns:
list of GridSim entities' IDs

getOutputPort

protected Sim_port getOutputPort()
Returns the output port used by this auction to send messages

Returns:
the output port

setAttribute

public boolean setAttribute(Object key,
                            Object value)
Sets an attribute to this auction. Anything additional has to be set as an attribute of the auction.

Parameters:
key - the key used to retrieve the value of the attribute
value - the value of the attribute
Returns:
true if the value of the attribute was correctly set
Pre Condition:
key != null && value !=null

getAttributes

protected Hashtable getAttributes()
Returns a Hashtable with the attributes defined in the auction.

Returns:
the attributes defined in this auction

getAttribute

public Object getAttribute(Object key)
Returns a given attribute of the auction

Parameters:
key - used to retrieve the attribute
Returns:
the attribute

setAuctionProtocol

protected boolean setAuctionProtocol(int protocol)
Sets the auction protocol used by the auction

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

getAuctionProtocol

protected int getAuctionProtocol()
Returns the auction protocol

Returns:
int representing the auction protocol

setStartingTime

protected boolean setStartingTime(double time)
Sets the initial time of the auction

Parameters:
time - is the simulation time
Returns:
true if the starting time was properly set
Pre Condition:
time >= 0.0D

getStartingTime

public double getStartingTime()
Returns the initial time of the auction

Returns:
the simulation time in which the auction started

broadcastMessage

protected boolean broadcastMessage(Message msg)
Brodcasts a message to all bidders engaged in the auction

Parameters:
msg - Message to be broadcast
Returns:
true if the message was properly broadcast
Pre Condition:
Message != null

body

public void body()
Overrides:
body in class Sim_entity

processEvent

protected abstract void processEvent(Sim_event ev)

startAuction

public abstract void startAuction()

GridSim 5.0 beta

The University of Melbourne, Australia, 2009