|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcalculation.BuildTree
public class BuildTree
Class BuildTree implements the calculation process of the arrival tree for landing air planes. Each time the new tree is calculated, method "calculate" is called with a graph as a parameter.
Field Summary | |
---|---|
private Tree |
arrivalTree
Arrival Tree calculated. |
private boolean |
asked
An update variable. |
private DataCollection |
dataCollection
Data collection. |
private int |
finalPathCount
Keeps count on paths, so that paths can not come too close each other. |
private boolean |
flagArrivalTreeUpdated
flag is set true when tree updates. |
private Graph |
graph
Graph used in calculation. |
private java.util.ArrayList<Vertex> |
mergePoints
Merge points of the arrival tree for airplanes. |
private int |
pathCounter
Keeps count on which path is a "parent" path to path to be created. |
private int |
safetyDistance
Safety distance. |
Constructor Summary | |
---|---|
BuildTree()
Constructor for testing. |
|
BuildTree(DataCollection dataCollection)
Constructor. |
Method Summary | |
---|---|
java.util.ArrayList<Vertex> |
aStar(Vertex start,
Vertex goal)
Calculates an optimal path between two given vertices of a graph. |
void |
calculate()
Method to be called, when wanted to calculate a new arrival tree. |
private java.util.ArrayList<Vertex> |
calculatePath(Vertex startNode,
java.util.ArrayList<Vertex> endNodes)
Finds out the shortest path from startNode to all Vertexes in endNodes using method aStar. |
private boolean |
checkTree()
Method for checking if there is need to re-calculate the arrival-tree. |
java.util.ArrayList<Vertex> |
getCalculatePath(Vertex startNode,
java.util.ArrayList<Vertex> endNodes)
For testing. |
int |
getfinalPathCount()
For testing. |
Graph |
getGraph()
Returns this.graph. |
java.util.ArrayList<Vertex> |
getHalfTable(java.util.ArrayList<Vertex> endNodes,
boolean side)
For testing. |
int |
getPathCounter()
For testing. |
void |
getSetSafetyDistance(Vertex vertex,
boolean availability,
int distance,
boolean set)
For testing. |
void |
getSetSlidingSafetyDistance(Vertex startNode,
boolean sliding,
boolean availability)
For testing. |
int |
getTestSide(java.util.ArrayList<Vertex> path,
java.util.ArrayList<Vertex> endNodes)
For testing. |
Tree |
getTree()
Returns this.arrivalTree. |
void |
getTreeRecursion(Vertex startNode,
java.util.ArrayList<Vertex> endNodes)
For testing. |
private java.util.ArrayList<Vertex> |
halfTable(java.util.ArrayList<Vertex> endNodes,
boolean side)
Takes half of the ArrayList |
boolean |
isChanged()
Method for telling if arrival tree is changed. |
double |
pathLength(java.util.ArrayList<Vertex> path)
Returns the length of path. |
private void |
resetVertices(java.util.PriorityQueue<Vertex> openSet,
java.util.ArrayList<Vertex> closedSet)
Resets vertices which aStar used calling Vertex.reset() method for each Vertex whose fields were changed by aStar. |
private java.util.ArrayList<Vertex> |
resultPath(Vertex start,
Vertex goal,
java.util.PriorityQueue<Vertex> openSet,
java.util.ArrayList<Vertex> closedSet)
Creates the resulting path for aStar method. |
void |
setGraph(Graph graph)
For testing. |
void |
setNewTree(Tree tree)
For testing. |
private void |
setSafetyDistance(Vertex vertex,
boolean availability,
int distance,
boolean set)
Makes or removes the safety distance around the node. |
void |
setSafetyDistanceAirPlanes(Vertex vertex,
boolean availability,
int distance)
This method is similar that the method setSafetyDistance. |
private void |
setSlidingSafetyDistance(Vertex startNode,
boolean sliding,
boolean availability)
Sets a safety distance (true or false) to a certain area under the node, determined by value this.safetyDistance. |
private int |
testSide(java.util.ArrayList<Vertex> path,
java.util.ArrayList<Vertex> endNodes)
Tests if the end of the path went to left or right. |
void |
treeRecursion(Vertex parStartNode,
java.util.ArrayList<Vertex> endNodeTable)
The method which implements the recursion of the tree in calculation. |
boolean |
update(Graph graph)
Method for updating the arrival tree. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private Tree arrivalTree
private boolean asked
private DataCollection dataCollection
private int finalPathCount
private boolean flagArrivalTreeUpdated
private Graph graph
private java.util.ArrayList<Vertex> mergePoints
private int pathCounter
private int safetyDistance
Constructor Detail |
---|
public BuildTree()
public BuildTree(DataCollection dataCollection)
dataCollection
- DataCollection.Method Detail |
---|
public java.util.ArrayList<Vertex> aStar(Vertex start, Vertex goal)
start
- Start vertex of pathgoal
- Goal vertex of path
public void calculate()
private java.util.ArrayList<Vertex> calculatePath(Vertex startNode, java.util.ArrayList<Vertex> endNodes)
startNode
- Node from where aStar starts calculating path.endNodes
- Nodes to where aStar calculates paths.
private boolean checkTree()
public java.util.ArrayList<Vertex> getCalculatePath(Vertex startNode, java.util.ArrayList<Vertex> endNodes)
startNode
- StartNode for calculatePath.endNodes
- EndNodes for calculatePath.
public int getfinalPathCount()
public Graph getGraph()
public java.util.ArrayList<Vertex> getHalfTable(java.util.ArrayList<Vertex> endNodes, boolean side)
endNodes
- EndNodes for halfTable.side
- Side for halfTable.
public int getPathCounter()
public void getSetSafetyDistance(Vertex vertex, boolean availability, int distance, boolean set)
vertex
- Vertex for setSafetyDistance.availability
- Availability for setSafetyDistance.distance
- Distance for setSafetyDistance.set
- Set for setSafetyDistance.public void getSetSlidingSafetyDistance(Vertex startNode, boolean sliding, boolean availability)
startNode
- StartNode for setSlidingSafetyDistance.sliding
- Sliding for setSlidingSafetyDistance.availability
- Availability for setSlidingSafetyDistance.public int getTestSide(java.util.ArrayList<Vertex> path, java.util.ArrayList<Vertex> endNodes)
path
- Path for testSide.endNodes
- EndNodes for testSide.
public Tree getTree()
public void getTreeRecursion(Vertex startNode, java.util.ArrayList<Vertex> endNodes)
startNode
- StartNode for treeRecursion.endNodes
- EndNodes for treeRecursion.private java.util.ArrayList<Vertex> halfTable(java.util.ArrayList<Vertex> endNodes, boolean side)
endNodes
- End node table to be cut in half.side
- Side, which will be taken from the endNodes. True if left, False if right.
public boolean isChanged()
public double pathLength(java.util.ArrayList<Vertex> path)
path
- path in a graph
private void resetVertices(java.util.PriorityQueue<Vertex> openSet, java.util.ArrayList<Vertex> closedSet)
openSet
- Open set of aStarclosedSet
- Closed set of aStarprivate java.util.ArrayList<Vertex> resultPath(Vertex start, Vertex goal, java.util.PriorityQueue<Vertex> openSet, java.util.ArrayList<Vertex> closedSet)
aStar
method. Calls
resetVertices method to reset vertices which aStar used.
start
- Start vertex of pathgoal
- Goal vertex of pathopenSet
- Open set used by aStar methodclosedSet
- Closed set used by aStar method
public void setGraph(Graph graph)
graph
- Graph.public void setNewTree(Tree tree)
tree
- Tree.private void setSafetyDistance(Vertex vertex, boolean availability, int distance, boolean set)
vertex
- Safety distance is set around this node.availability
- Tells should the safety distance be removed or set.distance
- Tells the distance on how far the safety distance should be set from the node.set
- When the safety distance is set for the first time, set is true, so the pathSafetyDistance
values are set to be as this.finalPathCount. Otherwise false.public void setSafetyDistanceAirPlanes(Vertex vertex, boolean availability, int distance)
vertex
- Safety distance is set around this node.availability
- Tells should the safety distance be removed or set.distance
- Tells the distance on how far the safety distance should be set from the node.private void setSlidingSafetyDistance(Vertex startNode, boolean sliding, boolean availability)
startNode
- A node on where setting the sliding safety distance is started.sliding
- Tells should the safety distance be set "slidingly" or just "straight".availability
- Availability to be set for each nodes on certain area.private int testSide(java.util.ArrayList<Vertex> path, java.util.ArrayList<Vertex> endNodes)
path
- The shortest found path in graph.endNodes
- End node table.
public void treeRecursion(Vertex parStartNode, java.util.ArrayList<Vertex> endNodeTable)
parStartNode
- A node, from where aStar calculates paths to all
endNodeTable nodes and chooses the shortest one. When called
first time startNode will be the airport node.endNodeTable
- A table of Vertexes. A path will be calculated with aStar to
all Vertexes in this table.public boolean update(Graph graph)
graph
- Graph to be set as this.graph.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |