org.moyoman.module.groups
Interface SingleGroup

All Superinterfaces:
Cloneable, Serializable
All Known Implementing Classes:
SingleGroupImpl

public interface SingleGroup
extends Cloneable, Serializable

A class that implements this interface is computing information about a single group of stones, where a group of stones is defined as the maximal set of stones of one color that is captured as a unit.


Method Summary
 Object clone()
           
 Stone[] getAdjacentOpponentStones()
          Get all of the opponents stones adjacent to this group.
 Stone getAnyStone()
          Return one of the stones in the group.
 Color getColor()
          Get the color of the stones in this group.
 Point[] getLiberties()
          Get all points which are liberties of this group.
 int getMaxX()
          Get the largest horizontal value for a stone in this group.
 int getMaxY()
          Get the largest vertical value for a stone in this group.
 int getMinX()
          Get the smallest horizontal value for a stone in this group.
 int getMinY()
          Get the smallest vertical value for a stone in this group.
 Stone[] getStones()
          Get all of the stones in the group.
 short getTotalLiberties()
          Get the total number of liberties for this group.
 short getTotalStones()
          Get the total number of stones in this group.
 boolean isInSingleGroup(Stone stone)
          Return whether the stone is contained in this group.
 boolean isLibertyOfSingleGroup(Point pt)
          Return whether this point is a liberty of the group.
 void recompute(Board board)
          Recompute all information for this group.
 

Method Detail

isInSingleGroup

public boolean isInSingleGroup(Stone stone)
Return whether the stone is contained in this group.

Parameters:
stone - The stone in question.
Returns:
Return true if the stone is in the group, or false.

isLibertyOfSingleGroup

public boolean isLibertyOfSingleGroup(Point pt)
Return whether this point is a liberty of the group.

Parameters:
pt - The point in question.
Returns:
Return true if the point is empty and adjacent to the group, or false.

getAnyStone

public Stone getAnyStone()
Return one of the stones in the group. Some methods take a Stone as an argument, and so it may not matter which stone from the group is used. This provides a shortcut to calling getStones()[0].

Returns:
A Stone object.

getStones

public Stone[] getStones()
Get all of the stones in the group.

Returns:
An array of stone objects.

getTotalStones

public short getTotalStones()
Get the total number of stones in this group.

Returns:
The number of stones in this group.

getLiberties

public Point[] getLiberties()
Get all points which are liberties of this group.

Returns:
An array of Point objects.

getTotalLiberties

public short getTotalLiberties()
Get the total number of liberties for this group.

Returns:
The number of liberties for the group.

getAdjacentOpponentStones

public Stone[] getAdjacentOpponentStones()
Get all of the opponents stones adjacent to this group.

Returns:
An array of Stone objects.

getColor

public Color getColor()
Get the color of the stones in this group.

Returns:
A Color object.

getMaxX

public int getMaxX()
Get the largest horizontal value for a stone in this group.

Returns:
The horizontal value.

getMinX

public int getMinX()
Get the smallest horizontal value for a stone in this group.

Returns:
The horizontal value.

getMinY

public int getMinY()
Get the smallest vertical value for a stone in this group.

Returns:
The vertical value.

getMaxY

public int getMaxY()
Get the largest vertical value for a stone in this group.

Returns:
The vertical value.

recompute

public void recompute(Board board)
Recompute all information for this group.


clone

public Object clone()
Overrides:
clone in class Object