|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectrl.common.mapping.Coordinate
public class Coordinate
Coords stores x and y values. Since these are hexes, coordinates with odd x values are a half-hex down. Directions work clockwise around the hex, starting with zero at the top. -y 0 _____ 5 / \ 1 -x / \ +x \ / 4 \_____/ 2 3 +y Code in this class copyright BMazur and curtesy of the MegaMek project http://megamek.sourceforge.org portions based off of http://www.rossmack.com/ab/RPG/traveller/AstroHexDistance.asp
| Field Summary | |
|---|---|
static double |
HEXSIDE
|
(package private) static long |
serialVersionUID
|
int |
x
|
int |
y
|
| Constructor Summary | |
|---|---|
Coordinate()
Constructs a new coordinate pair at (0, 0). |
|
Coordinate(Coordinate c)
Constructs a new coordinate pair that is a duplicate of the parameter. |
|
Coordinate(int x,
int y)
Constructs a new coordinate pair at (x, y). |
|
| Method Summary | |
|---|---|
boolean |
equals(java.lang.Object object)
Coordinate are equal if their x and y components are equal |
java.lang.String |
getBoardNum()
Returns a string representing a coordinate in "board number" format. |
int |
hashCode()
Add by Daniel Cleyne. |
boolean |
isXOdd()
Tests whether the x coordinate of this coordinate is odd. |
void |
setCoordinate(int x,
int y)
|
java.lang.String |
toShortString()
|
java.lang.String |
toString()
|
Coordinate |
translated(int dir)
Returns a new coordinate that represents the coordinate 1 unit in the specified direction. |
static int |
xInDir(int x,
int y,
int dir)
Returns the x parameter of the coordinates in the direction |
static int |
yInDir(int x,
int y,
int dir)
Returns the y parameter of the coordinates in the direction |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
static final long serialVersionUID
public int x
public int y
public static final double HEXSIDE
| Constructor Detail |
|---|
public Coordinate()
public Coordinate(int x,
int y)
public Coordinate(Coordinate c)
| Method Detail |
|---|
public int hashCode()
hashCode in class java.lang.Object
public void setCoordinate(int x,
int y)
public final Coordinate translated(int dir)
dir - the direction.
public static final int xInDir(int x,
int y,
int dir)
public static final int yInDir(int x,
int y,
int dir)
public boolean isXOdd()
public final java.lang.String getBoardNum()
public boolean equals(java.lang.Object object)
equals in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String toShortString()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||