de.upb.swtpra05.group03.shuttle
Class Navigation

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

public class Navigation
extends java.lang.Object
implements ShuttleModule, NavigationInterface

Navigation module which is responsible for all topology relatated tasks.

Version:
$Revision: 1.3 $

Field Summary
private  DoubleHashtable connectionHash
          contains the Connection-Objects.
private  Dijkstra dijkstraAlgorithm
          the dijkstraEngine
private  java.util.Hashtable executionGraph
           
(package private) static java.util.logging.Logger log
           
private  java.util.HashMap shortestPaths
           
private  ShuttleDataInterface shuttleData
          The shuttle data
private  TaskPlanInterface taskPlan
          The taskplan
 
Constructor Summary
Navigation()
          Constructor
 
Method Summary
 void addOrderBehind(ExtendedOrder order, TaskPlanInterface aTaskPlan, int lastStationBeforeUseableTasks, int currentTime)
          Adds the order to the taskplan after the current tasks of the taskplan, at least after the last station before useable tasks.
 void addOrderTo(ExtendedOrder order, TaskPlanInterface aTaskPlan, int lastStationBeforeUseableTasks, int currentTime)
          Adds the order to the taskplan after the last station before useable tasks.
protected  void checkForUnuseableNodes()
           
 GraphEdge getEdge(GraphNode start, GraphNode destination)
          Returns the execution graph edge between start and destination.
 GraphNode getLast(TaskPlanInterface aTaskPlan, int lastStationBeforeUseableTasks)
          Gets the last station on route if the the taskplan isn't empty else the last station before useable tasks.
 GraphNode getNode(int stationId)
          Returns the execution graph node with the station id.
 TaskPlanInterface getShortestBetween(GraphNode start, GraphNode destination, de.upb.swtpra.kernel.id.OrderID orderId, GraphEdge dontUse)
          Returns the shortest taskplan between start and destination without use of edge dontUse.
 TaskPlanInterface getShortestBetween(GraphNode start, GraphNode destination, de.upb.swtpra.kernel.id.OrderID orderId, GraphEdge dontUse, boolean roundAbout, int currentTime)
           
 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.
protected  void parseTopology(de.upb.swtpra.kernel.TopologyData td)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dijkstraAlgorithm

private Dijkstra dijkstraAlgorithm
the dijkstraEngine


executionGraph

private java.util.Hashtable executionGraph

connectionHash

private DoubleHashtable connectionHash
contains the Connection-Objects. Keys are two DijkstrNodes


shortestPaths

private java.util.HashMap shortestPaths

log

static final java.util.logging.Logger log

shuttleData

private ShuttleDataInterface shuttleData
The shuttle data


taskPlan

private TaskPlanInterface taskPlan
The taskplan

Constructor Detail

Navigation

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

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

addOrderTo

public void addOrderTo(ExtendedOrder order,
                       TaskPlanInterface aTaskPlan,
                       int lastStationBeforeUseableTasks,
                       int currentTime)
                throws java.lang.Exception
Description copied from interface: NavigationInterface
Adds the order to the taskplan after the last station before useable tasks. If the current taskplan contains the the load station [and the unload station] its [they're] reused if possible.

Specified by:
addOrderTo in interface NavigationInterface
Parameters:
order -
aTaskPlan -
lastStationBeforeUseableTasks -
currentTime -
Throws:
java.lang.Exception - Thrown if there isn't a path to add the order

addOrderBehind

public void addOrderBehind(ExtendedOrder order,
                           TaskPlanInterface aTaskPlan,
                           int lastStationBeforeUseableTasks,
                           int currentTime)
                    throws java.lang.Exception
Description copied from interface: NavigationInterface
Adds the order to the taskplan after the current tasks of the taskplan, at least after the last station before useable tasks.

Specified by:
addOrderBehind in interface NavigationInterface
Parameters:
order -
aTaskPlan -
lastStationBeforeUseableTasks -
currentTime -
Throws:
java.lang.Exception

getShortestBetween

public TaskPlanInterface getShortestBetween(GraphNode start,
                                            GraphNode destination,
                                            de.upb.swtpra.kernel.id.OrderID orderId,
                                            GraphEdge dontUse)
                                     throws java.lang.Exception
Description copied from interface: NavigationInterface
Returns the shortest taskplan between start and destination without use of edge dontUse. Tasks will added to the returned taskplan with the given order id.

Specified by:
getShortestBetween in interface NavigationInterface
Parameters:
start -
destination -
orderId -
dontUse -
Returns:
etp
Throws:
java.lang.Exception

getShortestBetween

public TaskPlanInterface getShortestBetween(GraphNode start,
                                            GraphNode destination,
                                            de.upb.swtpra.kernel.id.OrderID orderId,
                                            GraphEdge dontUse,
                                            boolean roundAbout,
                                            int currentTime)
                                     throws java.lang.Exception
Specified by:
getShortestBetween in interface NavigationInterface
Parameters:
start -
destination -
orderId -
roundAbout -
dontUse -
currentTime -
Returns:
etp
Throws:
java.lang.Exception

parseTopology

protected void parseTopology(de.upb.swtpra.kernel.TopologyData td)
Parameters:
td -

checkForUnuseableNodes

protected void checkForUnuseableNodes()

getNode

public GraphNode getNode(int stationId)
Description copied from interface: NavigationInterface
Returns the execution graph node with the station id.

Specified by:
getNode in interface NavigationInterface
Parameters:
stationId - The station id of the node
Returns:
The execution graph node with the station id

getEdge

public GraphEdge getEdge(GraphNode start,
                         GraphNode destination)
Description copied from interface: NavigationInterface
Returns the execution graph edge between start and destination.

Specified by:
getEdge in interface NavigationInterface
Parameters:
start - The start node of returned edge
destination - The destination node of returned edge
Returns:
The (first) execution graph edge between start and destination

getLast

public GraphNode getLast(TaskPlanInterface aTaskPlan,
                         int lastStationBeforeUseableTasks)
Description copied from interface: NavigationInterface
Gets the last station on route if the the taskplan isn't empty else the last station before useable tasks.

Specified by:
getLast in interface NavigationInterface
Parameters:
aTaskPlan - The taskplan to get the last station from
lastStationBeforeUseableTasks - The station before useable tasks will be returned in case of empty taskplan
Returns:
The last station on route