GridSim 5.0 beta

gridsim.auction
Class AuctionObserver

Object
  extended by Thread
      extended by Sim_entity
          extended by GridSimCore
              extended by GridSim
                  extended by AuctionObserver
All Implemented Interfaces:
Cloneable, Runnable

public class AuctionObserver
extends GridSim

This class is used by entities that want to participate as bidders in auctions.

To use this class, you need to redirect the events that the entity cannot treat. You need to call processEvent(Sim_event) passing the event that the entity is not able to process. If the event is related to the auctions (ie. has a tag code corresponding to an auction event) the observer is able to process it by passing the message to its Responder.

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

Nested Class Summary
 
Nested classes/interfaces inherited from class Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
protected  Sim_port outputPort
          The Bidder 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
AuctionObserver(int bidderID, String entityName, Sim_port port)
          Constructor
AuctionObserver(int bidderID, String entityName, Sim_port port, Responder responder)
          Constructor
 
Method Summary
 void body()
           
 Responder getResponder()
          Returns the responder that the observer is using
 boolean processEvent(Sim_event ev)
          Process an event.
 boolean setResponder(Responder responder)
          Sets a responder to this observer
 
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 Bidder output port. This port is mainly used to send messages generated by this AuctionObserver class. This is because an AuctionObserver class doesn't have networked entities (Input and Output).

Constructor Detail

AuctionObserver

public AuctionObserver(int bidderID,
                       String entityName,
                       Sim_port port)
                throws Exception
Constructor

Parameters:
bidderID - the bidder if, since it sends messages on the bidder's behalf
entityName - a name for this entity
port - the port to be used as output of messages
Throws:
Exception

AuctionObserver

public AuctionObserver(int bidderID,
                       String entityName,
                       Sim_port port,
                       Responder responder)
                throws Exception
Constructor

Parameters:
bidderID - the bidder if, since it sends messages on the bidder's behalf
entityName - entityName a name for this entity
responder - the responder which will deal with the messages that this responder receives
port - the port to be used as output of messages
Throws:
Exception
Method Detail

setResponder

public boolean setResponder(Responder responder)
Sets a responder to this observer

Parameters:
responder - the responder
Returns:
true if the responder was correctly set
Pre Condition:
responder != null

getResponder

public Responder getResponder()
Returns the responder that the observer is using

Returns:
the responder

body

public void body()
Overrides:
body in class Sim_entity

processEvent

public boolean processEvent(Sim_event ev)
Process an event.

Parameters:
ev -
Returns:
true if the event was treated; false otherwise.

GridSim 5.0 beta

The University of Melbourne, Australia, 2009