de.upb.swtpra05.group03.shuttle
Class OfferingControl

java.lang.Object
  extended byde.upb.swtpra05.group03.shuttle.OfferingControl
All Implemented Interfaces:
Module, OfferingControlInterface, ShuttleModule

public class OfferingControl
extends java.lang.Object
implements ShuttleModule, OfferingControlInterface

Controls the offering and observes the success or failure of the offers.

Version:
$Revision: 1.3 $

Field Summary
protected  ShuttleControlInterface agent
          The shuttle agent which has instanciated this module
private static java.util.logging.Logger log
          Logger for debugging
protected  int maxOfferCount
          Comment for maxOfferCount
protected  DoubleMap offeredOrders
          Map of OrderIDs (B) with the wakeupTime (A) the offer to this order should be assigned.
protected static int OFFERTIME_VARIANZ
          Time between the end time of the offering and a possible assign order message
protected  UnsuccessfulOfferInterface unsuccessfulOffer
          The unsuccessfulOffer
 
Fields inherited from interface de.upb.swtpra05.group03.shuttle.OfferingControlInterface
NO_OFFER
 
Constructor Summary
OfferingControl()
          Constructor
 
Method Summary
protected  void assignOrder(de.upb.swtpra.kernel.message.AssignOrder msg)
          Receives
 int getMaxOfferCount()
          Returns the max offer count.
 int getOfferCount()
          Returns the current offer count.
 void init(ModuleContainerInterface container)
          Initializes this module.
 void newMessageReceived(de.upb.swtpra.kernel.message.Message msg)
          React on the received message of the shuttle or not.
 void sendOffer(ExtendedOrder eo)
          Sends an offer to the kernel for given extended order.
 void setMaxOfferCount(int offerCount)
           
protected  void wakeUpCall(de.upb.swtpra.kernel.message.WakeUpCallMessage msg)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OFFERTIME_VARIANZ

protected static final int OFFERTIME_VARIANZ
Time between the end time of the offering and a possible assign order message

See Also:
Constant Field Values

agent

protected ShuttleControlInterface agent
The shuttle agent which has instanciated this module


unsuccessfulOffer

protected UnsuccessfulOfferInterface unsuccessfulOffer
The unsuccessfulOffer


offeredOrders

protected final DoubleMap offeredOrders
Map of OrderIDs (B) with the wakeupTime (A) the offer to this order should be assigned. If the order is assigned to us before, remove it from this map.


maxOfferCount

protected int maxOfferCount
Comment for maxOfferCount


log

private static final java.util.logging.Logger log
Logger for debugging

Constructor Detail

OfferingControl

public OfferingControl()
Constructor

Method Detail

init

public void init(ModuleContainerInterface container)
Description copied from interface: Module
Initializes this module. References to other modules should be set here to avoid circle dependencies.

Specified by:
init in interface Module
Parameters:
container - The module manager which contain all modules

getOfferCount

public int getOfferCount()
Description copied from interface: OfferingControlInterface
Returns the current offer count.

Specified by:
getOfferCount in interface OfferingControlInterface
Returns:
the current offer count

setMaxOfferCount

public void setMaxOfferCount(int offerCount)
Parameters:
offerCount -

getMaxOfferCount

public int getMaxOfferCount()
Description copied from interface: OfferingControlInterface
Returns the max offer count.

Specified by:
getMaxOfferCount in interface OfferingControlInterface
Returns:
the max offer count

newMessageReceived

public void newMessageReceived(de.upb.swtpra.kernel.message.Message msg)
Description copied from interface: ShuttleModule
React on the received message of the shuttle or not.

Specified by:
newMessageReceived in interface ShuttleModule
Parameters:
msg - The received message of the shuttle

wakeUpCall

protected void wakeUpCall(de.upb.swtpra.kernel.message.WakeUpCallMessage msg)
Parameters:
msg -

assignOrder

protected void assignOrder(de.upb.swtpra.kernel.message.AssignOrder msg)
Receives

Parameters:
msg -

sendOffer

public void sendOffer(ExtendedOrder eo)
Description copied from interface: OfferingControlInterface
Sends an offer to the kernel for given extended order.

Specified by:
sendOffer in interface OfferingControlInterface
Parameters:
eo - The extended order to send an offer for