org.moyoman.module.loosegroups
Interface SingleLooseGroup

All Known Implementing Classes:
SingleLGImpl

public interface SingleLooseGroup

A class that implements this interface represents a single loose group. A loose group consists of one or more groups of stones of the same color which tend to act as a single unit. An example is the stones of a shimari, or two adjacent stones on the third and fourth lines, and another stone on the third line three spaces away.


Method Summary
 Object clone()
          Override the Object.clone() method.
 Stone getAnyStone()
          Return one stone from the group.
 Stone[] getClosestStones(Point pt)
          Get the closest stones to the specified point.
 Color getColor()
          Get the color of the stones in this loose group.
 short getDistanceToClosestStones(Point pt)
          Get the distance to the closest stone in the group.
 short getMaxX()
          Get the maximum horizontal value of any stone in the loose group.
 short getMaxY()
          Get the maximum vertical value of any stone in the loose group.
 short getMinX()
          Get the minimum horizontal value of any stone in the loose group.
 short getMinY()
          Get the minimum vertical value of any stone in the loose group.
 SingleGroup[] getSingleGroups()
          Return the single groups that comprise this loose group.
 Stone[] getStones()
          Return all of the stones in this group.
 short getTotalSingleGroups()
          Return the total number of single groups that comprise this loose group.
 boolean isInBoundingBox(Point pt)
          Determine if the point is in the bounding box for the loose group.
 boolean isInSingleLooseGroup(SingleGroup sg)
          Return whether the single group is in the single loose group.
 boolean isInSingleLooseGroup(Stone stone)
          Return whether the stone is in the single loose group.
 

Method Detail

isInSingleLooseGroup

public boolean isInSingleLooseGroup(Stone stone)
Return whether the stone is in the single loose group.

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

isInSingleLooseGroup

public boolean isInSingleLooseGroup(SingleGroup sg)
Return whether the single group is in the single loose group.

Parameters:
sg - The single group in question.
Returns:
true if the single group is in the loose group, or false.

getSingleGroups

public SingleGroup[] getSingleGroups()
Return the single groups that comprise this loose group.

Returns:
An array of SingleGroup objects.

getTotalSingleGroups

public short getTotalSingleGroups()
Return the total number of single groups that comprise this loose group.

Returns:
The total number of single groups.

getAnyStone

public Stone getAnyStone()
Return one stone from the group.

Returns:
A Stone object that is in the group.

getClosestStones

public Stone[] getClosestStones(Point pt)
Get the closest stones to the specified point. This method returns an array since there might be more than one stone in the group equally close to the given point.

Parameters:
pt - The point in question.
Returns:
An array of Stone objects.

getDistanceToClosestStones

public short getDistanceToClosestStones(Point pt)
Get the distance to the closest stone in the group. The distance is the square of the geometric distance, so if the closest stone is 4 horizontal and 3 vertical, then this method returns 25. Use the org.moyoman.util.Sqrt class to get the actual distance if needed.

Parameters:
pt - The point in question.
Returns:
A short which is the square of the distance.

getStones

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

Returns:
An array of Stone objects.

getMinX

public short getMinX()
Get the minimum horizontal value of any stone in the loose group.

Returns:
A short which is the minimum horizontal value.

getMaxX

public short getMaxX()
Get the maximum horizontal value of any stone in the loose group.

Returns:
A short which is the maximum horizontal value.

getMinY

public short getMinY()
Get the minimum vertical value of any stone in the loose group.

Returns:
A short which is the minimum vertical value.

getMaxY

public short getMaxY()
Get the maximum vertical value of any stone in the loose group.

Returns:
A short which is the maximum vertical value.

isInBoundingBox

public boolean isInBoundingBox(Point pt)
Determine if the point is in the bounding box for the loose group.

Parameters:
pt - The point in question.
Returns:
true if the point is in the bounding box, or false.

getColor

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

Returns:
A Color object.

clone

public Object clone()
Override the Object.clone() method.

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