|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.moyoman.util.Color
This class represents the color of a point on the board. It may be black, white, or empty.
Field Summary | |
static Color |
BLACK
|
private static short |
BLACK_FLAG
The short value representing black. |
private short |
color
The color that this object encapsulates. |
static Color |
EMPTY
|
private static short |
EMPTY_FLAG
The short value representing an empty point. |
static Color |
WHITE
|
private static short |
WHITE_FLAG
The short value representing white. |
Constructor Summary | |
private |
Color(short val)
Create a Color object with the appopriate value. |
Method Summary | |
Object |
clone()
Clone the Color object. |
boolean |
equals(Object o)
Determine whether an object is equal to this one. |
Color |
flip()
Return the opposite color of the current color. |
int |
hashCode()
Return a hashcode for this object. |
boolean |
isBlack()
Return true if the color is black. |
boolean |
isEmpty()
Return true if the color is empty. |
boolean |
isWhite()
Return true if the color is white. |
String |
toString()
|
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
private static final short BLACK_FLAG
private static final short WHITE_FLAG
private static final short EMPTY_FLAG
public static final Color BLACK
public static final Color WHITE
public static final Color EMPTY
private short color
Constructor Detail |
private Color(short val) throws IllegalArgumentException
IllegalArgumentException
- Thrown if the val
parameter does not contain one of the legal values
defined for the Color class.Method Detail |
public boolean isBlack()
public boolean isWhite()
public boolean isEmpty()
public String toString()
toString
in class Object
public Color flip()
InconsistentStateException
- - Thrown if the current
color is empty.public int hashCode()
hashCode
in class Object
public boolean equals(Object o)
equals
in class Object
o
- The object to be compared to this one.
public Object clone()
clone
in class Object
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |