public class Path
extends java.lang.Object
| Constructor and Description |
|---|
Path(int startX,
int startY,
Direction[] directions)
Constructs a path which starts at the specified point in the plane.
|
Path(int startX,
int startY,
java.util.List<Direction> directions)
Convenience constructor that converts the supplied direction list into an
array which is then passed to another constructor.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object obj)
Two paths are equal if they have the same origin and the same directions.
|
java.util.List<Direction> |
getDirections() |
double |
getLength() |
int |
getOriginX() |
int |
getOriginY() |
int |
getTerminalX() |
int |
getTerminalY() |
int |
hashCode() |
boolean |
isClosed() |
java.lang.String |
toString() |
Path |
translate(int deltaX,
int deltaY)
Creates a new path by translating this path in the plane.
|
public Path(int startX,
int startY,
Direction[] directions)
startX - the x coordinate of the path's origin in the planestartY - the y coordinate of the path's origin in the planedirections - an array of directions, never nullpublic Path(int startX,
int startY,
java.util.List<Direction> directions)
startX - the x coordinate of the path's origin in the planestartY - the y coordinate of the path's origin in the planedirections - a list of the directions in the pathpublic java.util.List<Direction> getDirections()
public int getOriginX()
public int getOriginY()
public int getTerminalX()
public int getTerminalY()
public double getLength()
public boolean isClosed()
public Path translate(int deltaX, int deltaY)
deltaX - the change in the path's x coordinatedeltaY - the change in the path's y coordinatepublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Object