org.moyoman.util
Class Handicap

java.lang.Object
  |
  +--org.moyoman.util.Handicap
All Implemented Interfaces:
Serializable

public class Handicap
extends Object
implements Serializable

This class represents a set of handicap stones.

See Also:
Serialized Form

Field Summary
private  boolean fixed
          True if handicap in fixed position, or false.
private static int MAX_STONES
          The maximum number of handicap stones.
private  Stone[] stones
           
private  int total
          The total number of handicap stones.
 
Constructor Summary
Handicap(int number)
          Create the Handicap object with the appropriate number of stones.
 
Method Summary
 Stone[] getStones()
           
 int getTotal()
          Return the size of the handicap.
 boolean isFixed()
          Determine whether the handicap stones are placed freely, or according to the standard pattern.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_STONES

private static final int MAX_STONES
The maximum number of handicap stones.

See Also:
Constant Field Values

stones

private Stone[] stones

fixed

private boolean fixed
True if handicap in fixed position, or false.


total

private int total
The total number of handicap stones.

Constructor Detail

Handicap

public Handicap(int number)
         throws IllegalArgumentException
Create the Handicap object with the appropriate number of stones. Place the handicap stones in the standard position.

Parameters:
number - The number of handicap stones.
Throws:
IllegalArgumentException - Thrown if the number of stones selected is not in the range of 0 to MAX_STONES.
Method Detail

getStones

public Stone[] getStones()

getTotal

public int getTotal()
Return the size of the handicap. Note that this is not necessarily the total number of handicap stones, for example, for a one stone handicap, no stone is actually placed, it just allows black to move first without komi. Use getStones().length for the number of actual handicap stones.

Returns:
The size of the handicap.

isFixed

public boolean isFixed()
Determine whether the handicap stones are placed freely, or according to the standard pattern. The method returns true if the stones are placed in the standard fashion, or false.

Returns:
A boolean that is true if the handicap stones are in the standard position.