|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectairspace.AirControl
public class AirControl
This class controls the planes on the map.
Field Summary | |
---|---|
private java.util.ArrayList[] |
arcPoints
ArrayList of arcPoints. |
private int |
arrivedPlanes
How many Planes has arrived to airport. |
private BuildTree |
buildTree
Instance of BuildTree class. |
private java.awt.Color |
colorAlert
Alert color of Plane. |
private java.awt.Color |
colorNormal
Normal color of Plane. |
private int |
createmultiplier
How many planes are created at a time. |
(package private) double |
interval
TimeInterval of updates. |
private static int |
leafNumber
Number of leaf of Tree where Plane is created. |
private int |
minSafeDistance
Minimun safe distance between Planes. |
private int |
numberOfPlanes
How many Planes does AirControl have. |
private Parameters |
parameters
Instance of Parameters class. |
private static int |
planeCreateCounter
Counter for creating Planes. |
private int |
planeCreateInterval
How often Plane is created. |
private java.util.ArrayList<Plane> |
planes
ArrayList of Planes currently on map. |
private Tree |
tree
Instance of BuildTree class. |
Constructor Summary | |
---|---|
AirControl(Parameters parameters,
java.util.ArrayList[] arcPoints)
AirControl constructor. |
Method Summary | |
---|---|
private void |
addPlane()
Creates a plane or planes for the AirControl. |
private TreeNode |
closestMergePoint(Plane plane,
int arc)
Find the closest merge point to Plane. |
private TreeNode |
closestTNToPlane(Plane plane)
Find closest TreeNode to Plane. |
private void |
controlPlanes()
Controls planes. |
private boolean |
flyPlane(Plane plane)
Calculates distance to travel and the tells Plane to fly it. |
boolean |
getAirportStatus()
Returns airport status. |
int |
getArrivedPlanes()
Returns number of Planes that have arrived to airport. |
BuildTree |
getBuildTree()
Returns BuildTree of AirControl. |
int |
getNumberOfPlanes()
Returns number of Planes currently on map. |
java.util.ArrayList<Plane> |
getPlanes()
Returns list of Planes currently on map. |
private void |
newPath(Plane plane)
Creates a new path for Plane to fly. |
private void |
safetyZoneCheck()
Checks if two planes are too close and colors the one further away from airport red if they are too close. |
void |
setBuildTree(BuildTree buildTree)
Sets BuildTree for airControl. |
void |
setTree(Tree tree)
Sets BuildTree for airControl. |
private java.util.ArrayList[] |
sort(java.util.ArrayList<TreeNode> al)
Sorts merge point ArrayList to ArrayList[] based on distance from airport. |
void |
testingAddPlane()
Created for testing addPlane. |
TreeNode |
testingclosestMergePoint(Plane plane,
int arc)
Created for testing closestMergePoint. |
TreeNode |
testingClosestTNToPlane(Plane plane)
Created for testing closestTNToPlane. |
boolean |
testingFlyPlane(Plane plane)
Created for testing flyPlane. |
void |
testingNewPath(Plane plane)
Created for testing newPath. |
void |
testingSafetyZoneCheck()
Created for testing safetyZoneCheck. |
java.util.ArrayList[] |
testingSorted(java.util.ArrayList<TreeNode> al)
Created for testing sort. |
void |
update()
Update method. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private java.util.ArrayList[] arcPoints
private int arrivedPlanes
private BuildTree buildTree
private final java.awt.Color colorAlert
private final java.awt.Color colorNormal
private final int createmultiplier
double interval
private static int leafNumber
private int minSafeDistance
private int numberOfPlanes
private Parameters parameters
private static int planeCreateCounter
private int planeCreateInterval
private java.util.ArrayList<Plane> planes
private Tree tree
Constructor Detail |
---|
public AirControl(Parameters parameters, java.util.ArrayList[] arcPoints)
parameters
- Instance of ParametersarcPoints
- Arc points of Graph.Method Detail |
---|
private void addPlane()
private TreeNode closestMergePoint(Plane plane, int arc)
plane
- Plane that we are finding closest TreeNodearc
- Number of arc where to look from
private TreeNode closestTNToPlane(Plane plane)
plane
- Plane to calculate closest TreeNode
private void controlPlanes()
private boolean flyPlane(Plane plane)
plane
- Plane to fly.
public boolean getAirportStatus()
public int getArrivedPlanes()
getArrivedPlanes
in interface AirControlInterface
public final BuildTree getBuildTree()
public int getNumberOfPlanes()
getNumberOfPlanes
in interface AirControlInterface
public final java.util.ArrayList<Plane> getPlanes()
getPlanes
in interface AirControlInterface
private void newPath(Plane plane)
plane
- Calculate new path for this Planeprivate void safetyZoneCheck()
public void setBuildTree(BuildTree buildTree)
buildTree
- set this as instance of BuildTreepublic void setTree(Tree tree)
tree
- set this as instance of Treeprivate java.util.ArrayList[] sort(java.util.ArrayList<TreeNode> al)
al
- ArrayList of merge points to sort
public void testingAddPlane()
public TreeNode testingclosestMergePoint(Plane plane, int arc)
plane
- Plane that we are finding closest TreeNodearc
- Number of arc whre to look from
public TreeNode testingClosestTNToPlane(Plane plane)
plane
- Plane to calculate closest TreeNode
public boolean testingFlyPlane(Plane plane)
plane
- Plane to fly.
public void testingNewPath(Plane plane)
plane
- Calculate new path for this Planepublic void testingSafetyZoneCheck()
public java.util.ArrayList[] testingSorted(java.util.ArrayList<TreeNode> al)
al
- ArrayList of merge points to sort
public final void update()
update
in interface AirControlInterface
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |