de.upb.swtpra05.group03.shuttle
Class RouteManagement

java.lang.Object
  extended byde.upb.swtpra05.group03.shuttle.RouteManagement
All Implemented Interfaces:
Module, RouteManagementInterface

public class RouteManagement
extends java.lang.Object
implements Module, RouteManagementInterface

Manages the route of the shuttle.

Version:
$Revision: 1.3 $

Field Summary
private  ExecutionInterface execution
          The Execution Unit
private static java.util.logging.Logger log
          Logger for debugging
private  NavigationInterface navigation
          The navigation of the shuttle
private  OrderContainerInterface orderContainer
          Collection which holds all order the shuttle is working on
private  ShuttleDataInterface shuttleData
          Container class, contains the constants, currentStretch, etc.
private  TaskPlanInterface taskPlan
          The main TaskPlan, describes the actions the execution has to do
 
Fields inherited from interface de.upb.swtpra05.group03.shuttle.RouteManagementInterface
NOTADDABLE
 
Constructor Summary
RouteManagement()
          Constructor
 
Method Summary
 int addOrder(ExtendedOrder eo, int currentTime)
          Adds an order to the current route of the shuttle.
protected  boolean checkCapacity()
          Checks if the capacity of the shuttle is lower or the same as the maximum capacity of the shuttle for all order in the current route
protected  void checkEdgesFinancedByStatus()
          Checks for alle Edges in the route whether they are financed by loaded or assigned order or not
 void connectionDisabled(int startStationId, int destinationStationId, int disabledUntilTime, int currentTime)
          Reacts on disabling of a connection by waiting for reenabling or by calculation of an roundabout route.
protected  int getLastStation()
          Returns the last station in the taskplan.
protected  int getOrderCosts(de.upb.swtpra.kernel.id.OrderID orderId)
          Gets the costs for the order in the taskplan
 void init(ModuleContainerInterface manager)
          Initializes this module.
 void removeOrder(de.upb.swtpra.kernel.id.OrderID orderId)
          Removes all tasks which belong to the order id from the current route of the shuttle.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

execution

private ExecutionInterface execution
The Execution Unit


orderContainer

private OrderContainerInterface orderContainer
Collection which holds all order the shuttle is working on


navigation

private NavigationInterface navigation
The navigation of the shuttle


log

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


taskPlan

private TaskPlanInterface taskPlan
The main TaskPlan, describes the actions the execution has to do


shuttleData

private ShuttleDataInterface shuttleData
Container class, contains the constants, currentStretch, etc.

Constructor Detail

RouteManagement

public RouteManagement()
Constructor

Method Detail

init

public void init(ModuleContainerInterface manager)
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:
manager - The module manager which contain all modules

addOrder

public int addOrder(ExtendedOrder eo,
                    int currentTime)
Description copied from interface: RouteManagementInterface
Adds an order to the current route of the shuttle.

Specified by:
addOrder in interface RouteManagementInterface
Parameters:
eo - The extended order to be added to the route.
currentTime - The current time at which the order will be added
Returns:
Returns the selfcosts of the order or NOTADDABLE if the shuttle won't be able to execute the order properly.

getLastStation

protected int getLastStation()
Returns the last station in the taskplan. If taskplan is empty the current station is returned.

Returns:
The last station in the taskplan or if it's empty the current station.

removeOrder

public void removeOrder(de.upb.swtpra.kernel.id.OrderID orderId)
Description copied from interface: RouteManagementInterface
Removes all tasks which belong to the order id from the current route of the shuttle.

Specified by:
removeOrder in interface RouteManagementInterface
Parameters:
orderId - The order to be removed from the current route of the shuttle

connectionDisabled

public void connectionDisabled(int startStationId,
                               int destinationStationId,
                               int disabledUntilTime,
                               int currentTime)
Description copied from interface: RouteManagementInterface
Reacts on disabling of a connection by waiting for reenabling or by calculation of an roundabout route.

Specified by:
connectionDisabled in interface RouteManagementInterface
Parameters:
startStationId - The start station of the disabled connection
destinationStationId - The destination station of the disable connection
disabledUntilTime - The time until the connection is disabled
currentTime - The current time

checkCapacity

protected boolean checkCapacity()
Checks if the capacity of the shuttle is lower or the same as the maximum capacity of the shuttle for all order in the current route

Returns:
true if the capacity is lower, false else

getOrderCosts

protected int getOrderCosts(de.upb.swtpra.kernel.id.OrderID orderId)
Gets the costs for the order in the taskplan

Parameters:
orderId - The id of the order to calculate the costs for
Returns:
The selfcosts of the order

checkEdgesFinancedByStatus

protected void checkEdgesFinancedByStatus()
Checks for alle Edges in the route whether they are financed by loaded or assigned order or not