GridSim
v4.0

gridsim.auction
Class AuctionObserver

Object
  extended byThread
      extended byeduni.simjava.Sim_entity
          extended bygridsim.GridSimCore
              extended bygridsim.GridSim
                  extended bygridsim.auction.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

Field Summary
protected  Sim_port outputPort
          The Bidder output port.
 
Fields inherited from class gridsim.GridSim
PAUSE, rand, SimulationStartDate
 
Fields inherited from class gridsim.GridSimCore
input, output
 
Fields inherited from class eduni.simjava.Sim_entity
 
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()
          The method which defines the behaviour of the entity.
 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.GridSim
clock, Clock, getAdvancedReservationList, getEntityId, GetEntityId, getEntityName, GetEntityName, getEntityName, GetEntityName, getEntityName, getGISId, getGridInfoServiceEntityId, getGridResourceList, GetGridResourceList, getGridSimShutdownEntityId, getGridStatisticsEntityId, getNumFreePE, getNumFreePE, getNumPE, getNumPE, getResourceCharacteristics, GetResourceCharacteristics, getResourceDynamicInfo, GetResourceDynamicInformation, getSimulationCalendar, getSimulationStartDate, GetSimulationStartDate, GridInformationServiceEntityId, gridletCancel, gridletCancel, gridletMove, gridletMove, gridletPause, gridletPause, gridletReceive, GridletReceive, gridletReceive, gridletReceive, gridletResume, gridletResume, gridletStatus, gridletStatus, gridletSubmit, GridletSubmit, gridletSubmit, gridletSubmit, gridSimHold, GridSimHold, GridSimShutdownEntityId, GridStatisticsEntityId, init, init, init, Init, isResourceExist, isResourceExist, receiveEventObject, ReceiveEventObject, receiveEventObject, ReceiveEventObject, recordStatistics, RecordStatistics, recordStatistics, RecordStatistics, recordStatistics, RecordStatistics, recordStatistics, RecordStatistics, resourceSupportAR, resourceSupportAR, setGIS, shutdownGridStatisticsEntity, ShutdownGridStatisticsEntity, shutdownUserEntity, ShutdownUserEntity, Start, startGridSimulation, Stop, stopGridSimulation
 
Methods inherited from class gridsim.GridSimCore
finalize, finalizeGridSimulation, getLink, getPingResult, isNetworked, IsNetworked, ping, ping, ping, ping, pingBlockingCall, pingBlockingCall, pingBlockingCall, pingBlockingCall, send, Send, send, Send, send, Send, send, Send, send, Send, send, Send, setBackgroundTraffic, setBackgroundTraffic, TerminateInputOutputEntities, terminateIOEntities
 
Methods inherited from class eduni.simjava.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, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class Object
equals, 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()
Description copied from class: Sim_entity
The method which defines the behaviour of the entity. This method should be overidden in subclasses of Sim_entity.

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
v4.0

The University of Melbourne, Australia, 2006