movement
Class Path

java.lang.Object
  extended by movement.Path

public class Path
extends java.lang.Object

A Path between multiple Coordinates.


Constructor Summary
Path()
          Creates a path with zero speed.
Path(double speed)
          Creates a path with constant speed
 
Method Summary
 void addWaypoint(Coord wp)
          Adds a new waypoint to the end of the path.
 void addWaypoint(Coord wp, double speed)
          Adds a new waypoint with a speed towards that waypoint
 java.util.List<Coord> getCoords()
          Returns a refence to the coordinates of this path
 Coord getNextWaypoint()
          Returns the next waypoint on this path
 double getSpeed()
          Returns the speed towards the next waypoint (asked with getNextWaypoint().
 boolean hasNext()
          Returns true if the path has more waypoints, false if not
 void setSpeed(double speed)
          Sets a constant speed for the whole path.
 java.lang.String toString()
          Returns a string presentation of the path's coordinates
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Path

public Path()
Creates a path with zero speed.


Path

public Path(double speed)
Creates a path with constant speed

Parameters:
speed - The speed on the path
Method Detail

setSpeed

public void setSpeed(double speed)
Sets a constant speed for the whole path. Any previously set speed(s) is discarded.


getCoords

public java.util.List<Coord> getCoords()
Returns a refence to the coordinates of this path

Returns:
coordinates of the path

addWaypoint

public void addWaypoint(Coord wp)
Adds a new waypoint to the end of the path.

Parameters:
wp - The waypoint to add

addWaypoint

public void addWaypoint(Coord wp,
                        double speed)
Adds a new waypoint with a speed towards that waypoint

Parameters:
wp - The waypoint
speed - The speed towards that waypoint

getNextWaypoint

public Coord getNextWaypoint()
Returns the next waypoint on this path

Returns:
the next waypoint

hasNext

public boolean hasNext()
Returns true if the path has more waypoints, false if not

Returns:
true if the path has more waypoints, false if not

getSpeed

public double getSpeed()
Returns the speed towards the next waypoint (asked with getNextWaypoint().

Returns:
the speed towards the next waypoint

toString

public java.lang.String toString()
Returns a string presentation of the path's coordinates

Overrides:
toString in class java.lang.Object
Returns:
Path as a string