org.moyoman.util
Class Move

java.lang.Object
  |
  +--org.moyoman.util.Move
All Implemented Interfaces:
Cloneable, Serializable
Direct Known Subclasses:
RatedMove

public class Move
extends Object
implements Cloneable, Serializable

This class represents one move, which can be placing a stone, passing, or resigning.

See Also:
Serialized Form

Field Summary
private  Color color
          The color of the move.
private  short moveNumber
          The move number.
private  NumberedStone nstone
          The stone that was played as this move.
static short PASS
          The type corresponding to a pass.
static short RESIGNATION
          The type corresponding to a resignation.
static short STONE_PLAYED
          The type corresponding to a stone being played.
private  short type
          The type of move.
 
Constructor Summary
Move(NumberedStone stone)
          Create a move object by placing a stone.
Move(short tp, short num, Color c)
          Create a move object which is either a pass, or a resignation.
Move(short number, Stone stone)
          Create a move object by placing a stone.
 
Method Summary
 Object clone()
          Clone the move object.
 Color getColor()
          Get the color of the move.
 short getMoveNumber()
          Get the move number.
 NumberedStone getNumberedStone()
          Get the NumberedStone object.
 boolean isNumberedStone()
          Return true if the move is a stone.
 boolean isPass()
          Return true if the move is a pass.
 boolean isResignation()
          Return true if the move is a resignation.
 String toString()
          Get a string representing the move.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PASS

public static final short PASS
The type corresponding to a pass.

See Also:
Constant Field Values

RESIGNATION

public static final short RESIGNATION
The type corresponding to a resignation.

See Also:
Constant Field Values

STONE_PLAYED

public static final short STONE_PLAYED
The type corresponding to a stone being played.

See Also:
Constant Field Values

nstone

private NumberedStone nstone
The stone that was played as this move.


type

private short type
The type of move.


moveNumber

private short moveNumber
The move number.


color

private Color color
The color of the move.

Constructor Detail

Move

public Move(NumberedStone stone)
Create a move object by placing a stone.

Parameters:
stone - - The numbered stone which is the move.

Move

public Move(short number,
            Stone stone)
Create a move object by placing a stone.

Parameters:
number - The move number
stone - The stone which is the move.

Move

public Move(short tp,
            short num,
            Color c)
     throws IllegalArgumentException
Create a move object which is either a pass, or a resignation.

Throws:
IllegalArgumentException - Thrown if type is not either PASS or RESIGNATION.
Method Detail

getNumberedStone

public NumberedStone getNumberedStone()
                               throws NoSuchDataException
Get the NumberedStone object.

Returns:
The NumberedStone object which represents the move.
Throws:
NoSuchDataException - Thrown if the move is not a stone being played.

isPass

public boolean isPass()
Return true if the move is a pass.

Returns:
true if the move is a pass, or false.

isNumberedStone

public boolean isNumberedStone()
Return true if the move is a stone.

Returns:
true if the move is a stone, or false.

isResignation

public boolean isResignation()
Return true if the move is a resignation.

Returns:
true if the move is a resignation, or false.

getMoveNumber

public short getMoveNumber()
Get the move number.

Returns:
A short which is the move.

getColor

public Color getColor()
Get the color of the move.

Returns:
A Color object.

toString

public String toString()
Get a string representing the move.

Overrides:
toString in class Object
Returns:
A String representation of the move.

clone

public Object clone()
Clone the move object.

Overrides:
clone in class Object
Returns:
A Move object which is a clone of this one.