de.upb.swtpra05.group03.shuttle
Class RiskControl

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

public class RiskControl
extends java.lang.Object
implements RiskControlInterface, ShuttleModule

Controls the risk level of the shuttle and calculates the risk addition of an order according to its riskiness.

Version:
$Revision: 1.3 $

Field Summary
private  ExecutionInterface execution
          The reference to Execution
private static java.util.logging.Logger log
          Logger for debugging
protected  float[] maxOrderRisk
          The maximal order risk at which we should offer for the order
private  OrderContainerInterface orderContainer
          The order container
protected  int reserveDefConnections
          Number of connections at which we add the complete time reserve
protected  float reserveFactor
          factor by which the time reserve is inremented for each order in line
protected  int reserveMinConnections
          Number of connections before we add a time reserve
protected  int riskLevel
          The current risk level of the our company
protected  float[] slope
          The factor order risk is multiplied with to calculate the risk factor
private  TaskPlanInterface taskPlan
          the current taskPlan
protected  int[] timeReserve
          The time reserve between the order finished time and order limit time
protected  float[] zero
          The order risk from which upwards we add a risk addition
 
Fields inherited from interface de.upb.swtpra05.group03.shuttle.RiskControlInterface
ERROR, HIGH_RISK, LOW_RISK, MEDIUM_RISK
 
Constructor Summary
RiskControl()
          Constructor
 
Method Summary
protected  float calculateLevelRisk(float risk)
           
protected  float calculateOrderRisk(ExtendedOrder eo)
          calculates the risk value of the order
 float calculateRisk(ExtendedOrder eo)
          Calculates the risk addition of an order according to its riskiness.
 int getCurrentRiskLevel()
          Returns the current risk level.
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

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


riskLevel

protected int riskLevel
The current risk level of the our company


execution

private ExecutionInterface execution
The reference to Execution


orderContainer

private OrderContainerInterface orderContainer
The order container


zero

protected final float[] zero
The order risk from which upwards we add a risk addition


slope

protected final float[] slope
The factor order risk is multiplied with to calculate the risk factor


maxOrderRisk

protected final float[] maxOrderRisk
The maximal order risk at which we should offer for the order


timeReserve

protected final int[] timeReserve
The time reserve between the order finished time and order limit time


reserveFactor

protected final float reserveFactor
factor by which the time reserve is inremented for each order in line


reserveMinConnections

protected final int reserveMinConnections
Number of connections before we add a time reserve


reserveDefConnections

protected final int reserveDefConnections
Number of connections at which we add the complete time reserve


taskPlan

private TaskPlanInterface taskPlan
the current taskPlan

Constructor Detail

RiskControl

public RiskControl()
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

calculateRisk

public float calculateRisk(ExtendedOrder eo)
Description copied from interface: RiskControlInterface
Calculates the risk addition of an order according to its riskiness.

Specified by:
calculateRisk in interface RiskControlInterface
Parameters:
eo - order to calculate the risk addition for
Returns:
the risk addition of an order according to its riskiness.

calculateLevelRisk

protected float calculateLevelRisk(float risk)
Parameters:
risk -
Returns:
risk in current risk level

getCurrentRiskLevel

public int getCurrentRiskLevel()
Description copied from interface: RiskControlInterface
Returns the current risk level.

Specified by:
getCurrentRiskLevel in interface RiskControlInterface
Returns:
the current risk level

calculateOrderRisk

protected float calculateOrderRisk(ExtendedOrder eo)
calculates the risk value of the order

Parameters:
eo - the order to check
Returns:
the risk value of the order

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