|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectairspace.Plane
public class Plane
This class represents an airplane.
Field Summary | |
---|---|
private java.awt.Color |
color
Color of Plane. |
private TreeNode |
currentNode
Current TreeNode of Plane. |
private double |
direction
Direction of Plane in degrees. |
private double |
distToAirport
Distance of Plane from airport. |
private double |
lat
Latitude property of Plane. |
private double |
lon
Longitude property of Plane. |
private double |
maxspeed
Maximum speed of Plane. |
private double |
minspeed
Minimum speed of Plane. |
private int |
nextArc
Number of the arc that the plane is flying next. |
private java.util.ArrayList<TreeNode> |
path
Path of plane from current TreeNode to the airport. |
private int |
planeId
ID number of Plane. |
private static int |
planeIdCounter
Counter for ID of Planes. |
private TreeNode |
root
Root of Tree. |
private double |
safetyZone
Safetyzone property of Plane. |
private double |
speed
Speed property of Plane. |
Constructor Summary | |
---|---|
Plane(TreeNode startNode,
java.util.ArrayList[] arcPoints,
Parameters parameters,
TreeNode root)
Constructor of Plane class. |
Method Summary | |
---|---|
void |
addToPath(java.util.ArrayList<TreeNode> pathToAdd,
TreeNode joinPoint)
Clears old path, sests new path that star from airport to joinPoint and adds pathToAdd. |
private void |
checkArc()
Loops through TreeNodes to check if we got to nextArc. |
private void |
checkSpeeds()
Checks that minspeed and maxspeed are not negative. |
void |
clearPath()
Clears path of Plane. |
int |
compareTo(Plane other)
This method is required to implement the Comparable interface. |
double |
distanceOfPoints(double currLat,
double currLon,
double targLat,
double targLon)
Calculates distance between two points. |
double |
distanceTo(double targlat,
double targlon)
Calculates distance between Plane and given coordinates. |
double |
distanceTo(Plane other)
Calculates distance between two planes. |
double |
distanceTo(Vertex other)
Calculates distance between Plane and given Vertex. |
boolean |
fly(double travelDistance)
Updates lon/lat of plane according to how much we have to travel. |
java.awt.Color |
getColor()
Returns color of Plane. |
TreeNode |
getCurrentNode()
Returns current TreeNode of Plane. |
double |
getDir()
Gets direction of Plane. |
double |
getDistToAirport()
Gets distance of Plane and airport. |
int |
getId()
Returns the id of this Plane. |
double |
getLat()
Returns the latitude of this Plane. |
double |
getLon()
Returns the longitude of this Plane. |
int |
getNextArc()
Returns next arc of Plane. |
java.util.ArrayList<TreeNode> |
getPath()
Returns the path of this Plane. |
double |
getSafetyZone()
Returns safety zone of Plane. |
double |
getSpeed()
Returns speed of Plane. |
boolean |
isOnArrivalTree(TreeNode node,
int hashCode)
Checks if TreeNode is on current Tree. |
void |
setColor(java.awt.Color color)
Sets color of plane. |
void |
setCurrentTreeNode(TreeNode node)
Sets new TreeNode for Plane. |
void |
setDir(double startLon,
double startLat,
double goalLon,
double goalLat)
Sets the direction of the plane as degrees (0 - 360) based on latitude and longitude coordinates of two points. |
void |
setDistToAirport(double dist)
Sets distance of Plane to airport. |
void |
setLat(double latitude)
Set latitude of plane. |
void |
setLon(double longitude)
Returns longitude of plane. |
void |
setPath(TreeNode currentNode)
Sets new path starting from currentNode. |
void |
setSpeed(double speed)
Sets speed of Plane. |
void |
testingCheckArc()
Created for testing checkArc. |
void |
testingCheckSpeeds()
Created for testing checkSpeeds. |
java.lang.String |
toString()
String presentation of Plane. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private java.awt.Color color
private TreeNode currentNode
private double direction
private double distToAirport
private double lat
private double lon
private double maxspeed
private double minspeed
private int nextArc
private java.util.ArrayList<TreeNode> path
private int planeId
private static int planeIdCounter
private TreeNode root
private double safetyZone
private double speed
Constructor Detail |
---|
public Plane(TreeNode startNode, java.util.ArrayList[] arcPoints, Parameters parameters, TreeNode root)
startNode
- TreeNode where the Plane enters map.arcPoints
- arc points of Graph.parameters
- instance of Parameters class.root
- root of Tree.Method Detail |
---|
public void addToPath(java.util.ArrayList<TreeNode> pathToAdd, TreeNode joinPoint)
pathToAdd
- path what to addjoinPoint
- place where to add fromprivate void checkArc()
private void checkSpeeds()
public void clearPath()
public final int compareTo(Plane other)
compareTo
in interface java.lang.Comparable<Plane>
other
- Plane to compare to
public double distanceOfPoints(double currLat, double currLon, double targLat, double targLon)
currLat
- current LatitudecurrLon
- current LongitudetargLat
- target latitudetargLon
- target lonfitude
public double distanceTo(double targlat, double targlon)
targlat
- target latitudetarglon
- target longitude
public double distanceTo(Plane other)
other
- plane which we want distance to
public double distanceTo(Vertex other)
other
- The other Vertex to compare to.
public boolean fly(double travelDistance)
travelDistance
- how much to travel
public final java.awt.Color getColor()
public final TreeNode getCurrentNode()
public double getDir()
public double getDistToAirport()
public final int getId()
public final double getLat()
public final double getLon()
public final int getNextArc()
public final java.util.ArrayList<TreeNode> getPath()
public final double getSafetyZone()
public final double getSpeed()
public boolean isOnArrivalTree(TreeNode node, int hashCode)
node
- treeNode that we are chekinghashCode
- hash code of Planes current TreeNode
public void setColor(java.awt.Color color)
color
- set as new color of Planepublic void setCurrentTreeNode(TreeNode node)
node
- set as new currentNodepublic void setDir(double startLon, double startLat, double goalLon, double goalLat)
startLon
- longitude coordinate of the first pointstartLat
- latitude coordinate of the first pointgoalLon
- longitude coordinate of the second pointgoalLat
- latitude coordinate of the second pointpublic void setDistToAirport(double dist)
dist
- set as distance from airportpublic void setLat(double latitude)
latitude
- set as new latitudepublic void setLon(double longitude)
longitude
- set as new longitudepublic void setPath(TreeNode currentNode)
currentNode
- is start of new pathpublic void setSpeed(double speed)
speed
- set as speed of Planepublic void testingCheckArc()
public void testingCheckSpeeds()
public final java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |