-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCollision.java
More file actions
90 lines (79 loc) · 3.11 KB
/
Collision.java
File metadata and controls
90 lines (79 loc) · 3.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
// Collision.java
import java.util.Date;
/**
* Representation of an impending collision between the "ownship" aircraft and
* another aircraft.
*/
public class Collision implements Comparable<Collision> {
/** A String representation of the ID of this aircraft */
private final Aircraft ownship;
/** The other aircraft that may collide with this one */
private final Aircraft othership;
/** The time when the collision is predicted to occur */
private Date predictedTime;
/**
* Sole public constructor, taking parameters for all fields.
* @param ownship a String representation of the ID of this aircraft
* @param othership a String representation of the ID of the other
* aircraft that may collide with this one
* @param predictedTime the time when the collision is predicted to occur
*/
public Collision(Aircraft ownship, Aircraft othership, Date predictedTime) {
this.ownship = ownship;
this.othership = othership;
// Make a defensive copy
this.predictedTime = new Date(predictedTime.getTime());
}
/**
* Collision objects are compared to each other based only on their time
* values
* @param o the Collision object to be compared
* @return a negative integer, zero, or a positive integer as this object is
* less than, equal to, or greater than the specified object
*/
@Override
public int compareTo(Collision o) {
throw new UnsupportedOperationException("Not implemented yet.");
}
/**
* Accessor for the object representing this aircraft
* @return a representation of this aircraft
*/
public Aircraft getOwnship() {
throw new UnsupportedOperationException("Not implemented yet.");
}
/**
* Accessor for the the other aircraft that may collide with this one
* @return a representation of the other craft
*/
public Aircraft getOthership() {
throw new UnsupportedOperationException("Not implemented yet.");
}
/**
* Accessor for the predicted time of the collision
* @return a defensive copy of the Date object representing the time when
* the collision is predicted to occur
*/
public Date getTime() {
throw new UnsupportedOperationException("Not implemented yet.");
}
/**
* Calculate the predicted location of the collision, using ownship to find
* the current vector and location of this aircraft, and from that
* determining where it will be at the time stored in this Collision object
* @return the location where this aircraft will be at the predicted time of
* the collision
*/
public double[] getLocation() {
throw new UnsupportedOperationException("Not implemented yet.");
}
/**
* Calculate (this craft's altitude - other craft's altitude) by using
* ownship and othership to find the locations of each craft, assuming
* constant altitudes
* @return this craft's altitude - other craft's altitude
*/
public double getRelativeAltitude() {
throw new UnsupportedOperationException("Not implemented yet.");
}
}