|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectde.upb.swtpra05.group03.shuttle.SpreadingControl
Controls the spreading of the shuttles of one company on the topology at simulation begin.
| Nested Class Summary | |
(package private) class |
SpreadingControl.SpreadingShuttleData
spreading shuttle data |
(package private) class |
SpreadingControl.SpreadingStationData
spreading station data |
| Field Summary | |
private ShuttleControlInterface |
agent
|
private boolean |
allowed
Is this Shuttle allowed to do the Calculation and Spreading Control Only the Shuttle with the smallest ID is allowed to do that |
private java.util.Vector |
associateIDs
Vector with all associated Shuttles in this Company |
private boolean |
associatesreceived
are the associates received? |
(package private) java.util.HashMap |
CalculatedPositions
Stores all Calculated Positions so they can be send to other Shuttles |
private ExecutionInterface |
execution
|
private static int |
HORIZONTAL
Constant for sorting Horizontal |
private SpreadingControl.SpreadingStationData[] |
horizontalSortedStations
Array of the Stations in horizontal Order |
private boolean |
isCalculating
are we already calculating, or did we already calculate? |
private static java.util.logging.Logger |
log
Logger |
private int |
myID
The ID of this Shuttle |
private NavigationInterface |
navigation
|
private java.util.LinkedList |
needPositionIDs
List with ShuttleIDs of wich we need the Positions |
private boolean |
positionMessageSent
Indicates wheater the shuttle has sent its position to the SpreadingControl of the Mastershuttle |
private boolean |
positionsreceived
the position of the other shuttles received? |
private java.util.HashMap |
ratedStations
HashMap with the already rated Stations |
private java.util.HashMap |
ShuttleMap
HashMap that stores SpreadingShuttleData Objects |
private java.util.LinkedList |
stations
List of SpreadingStationObjects |
private StrategyControlInterface |
strategy
The StrategyControl |
private boolean |
topologyreceived
is the topology already received? |
private static int |
VERTICAL
Constant for sorting Vertical |
private SpreadingControl.SpreadingStationData[] |
verticalSortedStations
Array of Stations in vertical Order |
| Constructor Summary | |
SpreadingControl()
Constructor |
|
| Method Summary | |
private void |
associatesreceived(de.upb.swtpra.kernel.message.ShuttleAssociates msg)
Associates are received. |
void |
calculateOptimalPositions(java.util.HashMap shuttles)
Calculates a good Station for every Shuttle. |
private void |
doCalculation()
|
private void |
exchange(SpreadingControl.SpreadingStationData[] a,
int m,
int n)
Exchange 2 SpreadingStationData Object in the give Array |
private de.upb.swtpra.kernel.id.ID[] |
getBestShuttleCombination(java.util.HashMap Shuttles)
Determines the best Shuttle for each Region. if there is more than one shuttle for a region find a good solution. |
void |
init(ModuleContainerInterface manager)
Initializes this module. |
void |
log(java.lang.String s)
Write a String to the Log |
void |
newMessageReceived(de.upb.swtpra.kernel.message.Message msg)
React on the received message of the shuttle or not. |
private void |
parseTopology(de.upb.swtpra.kernel.TopologyData td)
Parses the Topology to find all adjacent Stations for each Station in the Topology. |
private int |
partition(SpreadingControl.SpreadingStationData[] a,
int m,
int n,
int direction)
Partition Method |
private void |
quicksort(SpreadingControl.SpreadingStationData[] a,
int l,
int r,
int direction)
quicksort Method |
private void |
rateRegion(SpreadingControl.SpreadingStationData[] data,
int maindirection,
int anf,
int end,
int RegionNumber)
Rates the given Region by Coordinates |
private void |
rateStations(SpreadingControl.SpreadingStationData[] sortedstations,
int direction,
int numberofShuttles)
Rates all Stations by Regions |
void |
sendPositions(java.util.HashMap positions)
Sends Calculated Positions to Shuttles |
private void |
sort(SpreadingControl.SpreadingStationData[] data,
int direction,
int size)
Sorts the given Array in the given Direction (Vertical/Horizontal) |
private void |
sortbydistance(SpreadingControl.SpreadingStationData[] data,
int num,
SpreadingControl.SpreadingShuttleData shuttle)
Sorts the Array of Stations by the Distance to the given Shuttle |
private void |
sortStations()
Sorts all Stations in Vertical and Horizontal Order Stores data in verticalSortedStations, horizontalSortedStations. |
private void |
trackdown(de.upb.swtpra.kernel.TopologyDataObject tdobject,
java.util.LinkedList adjacent)
Tracks down a given Track and adds all found Stations to the adjacent List. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private static final java.util.logging.Logger log
java.util.HashMap CalculatedPositions
private static final int VERTICAL
private static final int HORIZONTAL
private boolean allowed
private boolean topologyreceived
private boolean associatesreceived
private boolean positionsreceived
private boolean isCalculating
private java.util.LinkedList needPositionIDs
private java.util.HashMap ShuttleMap
private java.util.LinkedList stations
private java.util.HashMap ratedStations
private SpreadingControl.SpreadingStationData[] horizontalSortedStations
private SpreadingControl.SpreadingStationData[] verticalSortedStations
private java.util.Vector associateIDs
private int myID
private ShuttleControlInterface agent
private ExecutionInterface execution
private NavigationInterface navigation
private StrategyControlInterface strategy
private boolean positionMessageSent
| Constructor Detail |
public SpreadingControl()
| Method Detail |
public void init(ModuleContainerInterface manager)
Module
init in interface Modulemanager - The module manager which contain all modulespublic void log(java.lang.String s)
s -
private void exchange(SpreadingControl.SpreadingStationData[] a,
int m,
int n)
a - m - n -
private int partition(SpreadingControl.SpreadingStationData[] a,
int m,
int n,
int direction)
a - m - n - direction -
private void quicksort(SpreadingControl.SpreadingStationData[] a,
int l,
int r,
int direction)
a - l - r - direction -
private void sort(SpreadingControl.SpreadingStationData[] data,
int direction,
int size)
data - direction - size -
private void rateRegion(SpreadingControl.SpreadingStationData[] data,
int maindirection,
int anf,
int end,
int RegionNumber)
data - maindirection - anf - end - RegionNumber -
private void rateStations(SpreadingControl.SpreadingStationData[] sortedstations,
int direction,
int numberofShuttles)
sortedstations - direction - numberofShuttles - private void sortStations()
public void calculateOptimalPositions(java.util.HashMap shuttles)
shuttles -
private void sortbydistance(SpreadingControl.SpreadingStationData[] data,
int num,
SpreadingControl.SpreadingShuttleData shuttle)
data - num - shuttle - private de.upb.swtpra.kernel.id.ID[] getBestShuttleCombination(java.util.HashMap Shuttles)
Shuttles -
private void trackdown(de.upb.swtpra.kernel.TopologyDataObject tdobject,
java.util.LinkedList adjacent)
tdobject - adjacent - private void parseTopology(de.upb.swtpra.kernel.TopologyData td)
td - private void associatesreceived(de.upb.swtpra.kernel.message.ShuttleAssociates msg)
msg - public void newMessageReceived(de.upb.swtpra.kernel.message.Message msg)
ShuttleModule
newMessageReceived in interface ShuttleModulemsg - The received message of the shuttleprivate void doCalculation()
public void sendPositions(java.util.HashMap positions)
positions -
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||