public final class GoPoint extends java.lang.Object implements java.lang.Comparable<GoPoint>
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_SIZE
Default board size.
|
static int |
MAX_SIZE
Maximum board size.
|
static int |
NUMBER_INDEXES
Upper limit (exclusive) for one-dimensional point index.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(GoPoint p)
Compare two points.
|
GoPoint |
down()
Return point below.
|
static boolean |
equals(GoPoint point1,
GoPoint point2)
Compare, including the case that the points can be null.
|
boolean |
equals(java.lang.Object obj)
Indicate if this object is equal to another object.
|
static GoPoint |
get(int x,
int y)
Factory method for creating a point.
|
int |
getIndex()
Integer for using points as indices in an array.
|
static int |
getIndex(int x,
int y)
See getIndex().
|
int |
getX()
X-Coordinate.
|
int |
getY()
Y-Coordinate.
|
int |
hashCode() |
boolean |
isOnBoard(int size) |
GoPoint |
left()
Return point left.
|
static GoPoint |
parsePoint(java.lang.String string,
int boardSize)
Parse point or null (PASS).
|
static PointList |
parsePointList(java.lang.String s,
int boardSize) |
GoPoint |
right(int max)
Return point right.
|
java.lang.String |
toString()
Convert to a string.
|
static java.lang.String |
toString(ConstPointList pointList)
Convert a list of points to a string.
|
static java.lang.String |
toString(GoPoint point)
Convert a point or null point (pass) to a string.
|
GoPoint |
up(int max)
Return point above.
|
public static final int MAX_SIZE
public static final int DEFAULT_SIZE
public static final int NUMBER_INDEXES
getIndex()
,
Constant Field Valuespublic int compareTo(GoPoint p)
compareTo
in interface java.lang.Comparable<GoPoint>
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public static boolean equals(GoPoint point1, GoPoint point2)
public static GoPoint get(int x, int y)
x
- x-coordinate [0...GoPoint.MAX_SIZE - 1]
y
- y-coordinate [0...GoPoint.MAX_SIZE - 1]
public int getIndex()
public static int getIndex(int x, int y)
public int hashCode()
hashCode
in class java.lang.Object
public GoPoint down()
public int getX()
public int getY()
public boolean isOnBoard(int size)
public GoPoint left()
public static GoPoint parsePoint(java.lang.String string, int boardSize) throws InvalidPointException
InvalidPointException
public static PointList parsePointList(java.lang.String s, int boardSize) throws InvalidPointException
InvalidPointException
public GoPoint right(int max)
max
- Current board size.public java.lang.String toString()
toString
in class java.lang.Object
public static java.lang.String toString(GoPoint point)
point
- Point or null for pass movespublic static java.lang.String toString(ConstPointList pointList)
public GoPoint up(int max)
max
- Current board size.