Package jsl.modeling.elements.spatial
Class Path
- java.lang.Object
-
- jsl.modeling.elements.spatial.Path
-
- All Implemented Interfaces:
java.lang.Iterable<CoordinateIfc>
public class Path extends java.lang.Object implements java.lang.Iterable<CoordinateIfc>
-
-
Constructor Summary
Constructors Constructor Description Path(SpatialModel model)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(CoordinateIfc point)Adds a point to the path.voidclear()Clears the underlying list, sets the origin to null and resets the length of the path to zerobooleancontains(CoordinateIfc arg0)Checks if the given Vector2D is in the pathCoordinateIfcgetOrigin()The coordinate of the origin of the pathdoublegetTotalDistance()Gets the total distance associated with linear pt.booleanisEmpty()Checks whether the path is emptyjava.util.Iterator<CoordinateIfc>iterator()Returns an iterator over the pathjava.util.ListIterator<CoordinateIfc>listIterator()Returns a ListIterator over the pathvoidsetOrigin(CoordinateIfc origin)Sets the origin associated with the pathintsize()The number of points in the path.CoordinateIfc[]toArray(CoordinateIfc[] arg0)Converts the paths to an arrayjava.lang.StringtoString()
-
-
-
Constructor Detail
-
Path
public Path(SpatialModel model)
-
-
Method Detail
-
getOrigin
public final CoordinateIfc getOrigin()
The coordinate of the origin of the path- Returns:
-
setOrigin
public final void setOrigin(CoordinateIfc origin)
Sets the origin associated with the path- Parameters:
origin-
-
getTotalDistance
public final double getTotalDistance()
Gets the total distance associated with linear pt. to pt. travel on the path- Returns:
- Returns the totalDistance.
-
add
public boolean add(CoordinateIfc point)
Adds a point to the path. The origin is not on the path. The method setOrigin() must be called prior to adding any points to the path; otherwise an IllegalArgumentException will be thrown.- Parameters:
point-- Returns:
-
clear
public final void clear()
Clears the underlying list, sets the origin to null and resets the length of the path to zero
-
contains
public boolean contains(CoordinateIfc arg0)
Checks if the given Vector2D is in the path- Parameters:
arg0-- Returns:
-
isEmpty
public final boolean isEmpty()
Checks whether the path is empty- Returns:
-
iterator
public final java.util.Iterator<CoordinateIfc> iterator()
Returns an iterator over the path- Specified by:
iteratorin interfacejava.lang.Iterable<CoordinateIfc>- Returns:
-
listIterator
public final java.util.ListIterator<CoordinateIfc> listIterator()
Returns a ListIterator over the path- Returns:
-
size
public final int size()
The number of points in the path.- Returns:
-
toArray
public final CoordinateIfc[] toArray(CoordinateIfc[] arg0)
Converts the paths to an array- Parameters:
arg0-- Returns:
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-