public class Path
extends java.lang.Object
Constructor and Description |
---|
Path()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
appendStep(int x,
int y)
Append a step to the path.
|
boolean |
contains(int x,
int y)
Check if this path contains the given step.
|
int |
getLength()
Get the length of the path, i.e. the number of steps.
|
int |
getX(int index)
Get the x coordinate for the step at the given index.
|
int |
getY(int index)
Get the y coordinate for the step at the given index.
|
void |
prependStep(int x,
int y)
Prepend a step to the path.
|
public void appendStep(int x, int y)
x
- The x coordinate of the new step.y
- The y coordinate of the new step.public void prependStep(int x, int y)
x
- The x coordinate of the new step.y
- The y coordinate of the new step.public int getLength()
public int getX(int index)
index
- The index of the step whose x coordinate should be retrieved.public int getY(int index)
index
- The index of the step whose y coordinate should be retrieved.public boolean contains(int x, int y)
x
- The x coordinate of the step to check for.y
- The y coordinate of the step to check for.true
if the path contains the given step, false
else.