|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjfreerails.world.train.PathOnTiles
public class PathOnTiles
An immutable class that stores a path made up of OneTileMoveVectors.
| Field Summary | |
|---|---|
private static long |
serialVersionUID
|
private ImPoint |
start
|
private ImList<Step> |
vectors
|
| Constructor Summary | |
|---|---|
PathOnTiles(ImPoint start,
java.util.List<Step> vectorsList)
|
|
PathOnTiles(ImPoint start,
Step... vectors)
|
|
| Method Summary | |
|---|---|
PathOnTiles |
addSteps(Step... newSteps)
|
boolean |
equals(java.lang.Object o)
|
double |
getDistance(int steps)
|
PositionOnTrack |
getFinalPosition()
|
ImPoint |
getPoint(double distance)
Returns the coordinates of the point you would be standing at if you walked the specified distance along the path from the start point. |
ImPoint |
getStart()
|
Step |
getStep(int i)
|
int |
getStepIndex(int distance)
Returns the index of the step that takes the distance travelled over the specified distance. |
double |
getTotalDistance()
Returns the distance you would travel if you walked the all the way along the path. |
int |
hashCode()
|
int |
steps()
|
FreerailsPathIterator |
subPath(double offset,
double length)
Returns a FreerailsPathIterator that exposes a sub section of the path this object represents. |
java.util.Iterator<ImPoint> |
tiles()
|
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private static final long serialVersionUID
private final ImPoint start
private final ImList<Step> vectors
| Constructor Detail |
|---|
public PathOnTiles(ImPoint start,
java.util.List<Step> vectorsList)
java.lang.NullPointerException - if null == start
java.lang.NullPointerException - if null == vectorsList
java.lang.NullPointerException - if null == vectorsList.get(i) for any i;
public PathOnTiles(ImPoint start,
Step... vectors)
java.lang.NullPointerException - if null == start
java.lang.NullPointerException - if null == vectors
java.lang.NullPointerException - if null == vectors[i] for any i;| Method Detail |
|---|
public boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic double getTotalDistance()
public double getDistance(int steps)
public ImPoint getPoint(double distance)
java.lang.IllegalArgumentException - if distance < 0
java.lang.IllegalArgumentException - if distance > getLength()public ImPoint getStart()
public Step getStep(int i)
public PositionOnTrack getFinalPosition()
public int getStepIndex(int distance)
java.lang.IllegalArgumentException - if distance < 0
java.lang.IllegalArgumentException - if distance > getLength()public int hashCode()
hashCode in class java.lang.Objectpublic int steps()
public PathOnTiles addSteps(Step... newSteps)
public FreerailsPathIterator subPath(double offset,
double length)
java.lang.IllegalArgumentException - if offset < 0
java.lang.IllegalArgumentException - if length <= 0
java.lang.IllegalArgumentException - if offset + length > getLength()public java.util.Iterator<ImPoint> tiles()
public 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 | |||||||||