|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjfreerails.world.common.Step
public final class Step
This class represents a movement from a tile to any one of the surrounding eight tiles.
| Field Summary | |
|---|---|
int |
deltaX
The X and Y components of the vector. |
int |
deltaY
The X and Y components of the vector. |
static Step |
EAST
East. |
private int |
flatTrackTemplate
|
private double |
length
|
private static Step[] |
list
Another array of OneTileMoveVectors representing the 8 compass directions going clockwise from North. |
static Step |
NORTH
North. |
static Step |
NORTH_EAST
North-East. |
static Step |
NORTH_WEST
North West. |
private static long |
serialVersionUID
|
static Step |
SOUTH
South. |
static Step |
SOUTH_EAST
South East. |
static Step |
SOUTH_WEST
South West. |
static double |
TILE_DIAGONAL
|
static int |
TILE_DIAMETER
|
private static Step[][] |
vectors
A 3x3 array of OneTileMoveVectors, representing vectors to eight adjacent tiles plus a zero-distance vector. |
static Step |
WEST
West. |
| Constructor Summary | |
|---|---|
private |
Step(int x,
int y,
int t)
Create a new OneTileMoveVector. |
| Method Summary | |
|---|---|
static boolean |
checkValidity(ImPoint a,
ImPoint b)
|
static boolean |
checkValidity(int x,
int y)
Returns true if the values passed could be used to create a valid vector. |
boolean |
contains(FlatTrackTemplate ftt)
|
ImPoint |
createRelocatedPoint(ImPoint from)
|
int |
get8bitTemplate()
|
int |
get9bitTemplate()
|
double |
getDirection()
|
int |
getDx()
Returns the X component of the vector. |
int |
getDy()
Returns the Y component of the vector. |
int |
getID()
|
static Step |
getInstance(int number)
|
static Step |
getInstance(int dx,
int dy)
|
double |
getLength()
|
static Step[] |
getList()
|
static Step |
getNearestVector(int dx,
int dy)
|
Step |
getOpposite()
Returns a new oneTileMoveVector whose direction is opposite to that the current one. |
boolean |
isDiagonal()
|
static ImPoint |
move(ImPoint p,
Step... path)
|
private java.lang.Object |
readResolve()
|
private static Step[][] |
setupVectors()
|
java.lang.String |
toAbrvString()
|
java.lang.String |
toString()
Returns the name of the vector. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private static final long serialVersionUID
public static final int TILE_DIAMETER
public static final double TILE_DIAGONAL
public static final Step NORTH
public static final Step WEST
public static final Step SOUTH_EAST
public static final Step NORTH_EAST
public static final Step EAST
public static final Step SOUTH
public static final Step SOUTH_WEST
public static final Step NORTH_WEST
private static final Step[][] vectors
private static Step[] list
public final int deltaX
public final int deltaY
private final int flatTrackTemplate
private final double length
| Constructor Detail |
|---|
private Step(int x,
int y,
int t)
x - Tile coordinate.y - Tile coordinatet - an integer representing the track template this vector
corresponds to.| Method Detail |
|---|
private static Step[][] setupVectors()
public static ImPoint move(ImPoint p,
Step... path)
public int getDx()
public int getDy()
public Step getOpposite()
public java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String toAbrvString()
public static Step getInstance(int number)
public static boolean checkValidity(ImPoint a,
ImPoint b)
public static Step getInstance(int dx,
int dy)
public static boolean checkValidity(int x,
int y)
public ImPoint createRelocatedPoint(ImPoint from)
public boolean contains(FlatTrackTemplate ftt)
contains in interface FlatTrackTemplateftt - the FlatTrackTemplate which may be a subset of this
FlatTrackTemplate.
public int get9bitTemplate()
get9bitTemplate in interface FlatTrackTemplatepublic static Step[] getList()
public double getLength()
public double getDirection()
public int getID()
private java.lang.Object readResolve()
throws java.io.ObjectStreamException
java.io.ObjectStreamException
public static Step getNearestVector(int dx,
int dy)
public boolean isDiagonal()
public int get8bitTemplate()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||