new mlp benchmark
[IRC.git] / Robust / src / Benchmarks / mlp / directto / mlp-java / Trajectory.java
diff --git a/Robust/src/Benchmarks/mlp/directto/mlp-java/Trajectory.java b/Robust/src/Benchmarks/mlp/directto/mlp-java/Trajectory.java
new file mode 100755 (executable)
index 0000000..968e1ad
--- /dev/null
@@ -0,0 +1,60 @@
+// class that implements the trajectory and some methods of access
+
+//import java.util.*;
+
+class Trajectory {
+
+  public int noPoints;  // the number of points in the trajectory
+  private int current;
+  public double distToDest, timeToDest; // estimated time&distance to end fix
+  public int nextFixIndex; // index of the next fix in the trajectory of the flight;
+  public Fix nextFix; // the next fix in the trajectory of the flight
+  public Velocity startVelocity; // velocity at the first point in the trajectory;
+  public Vector p; // the points in the trajectory
+
+  public Trajectory(int np) {
+    noPoints=np;
+    p=new Vector(noPoints);
+    current=0;
+  }
+
+  // adds a point to the trajectory at the position "pos"
+  public void setPoint (int pos, Point4d point) {
+    p.insertElementAt((Point4d) point, pos);
+  }
+  
+  public void setNoPoints (int noP) {
+    noPoints=noP;
+  }
+
+  public Point4d getCurrent () {
+    return (Point4d) p.elementAt(current);
+  }
+  
+  public Point4d getPointAt (int index) {
+    return (Point4d) p.elementAt(index);
+  }
+
+  public double distanceToDestination() {
+       return distToDest;
+  }
+  
+  public double timeToDestination(double time) {
+    return (timeToDest-time);
+  }
+
+  public double timeToDestination(int time) {
+    return (timeToDest-time);
+  }
+
+  public Velocity getVelocity() {
+    return startVelocity;
+  }
+
+  public void printInfo() {
+    System.out.println("New trajectory: ");
+    for (int i=0 ; i<noPoints ; i++) {
+      System.out.println(getPointAt(i));
+    }    
+  }  
+}