|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.moyoman.module.loosegroups.simplelgimpl.SingleLGImpl
This class 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. Two examples are the stones of a corner enclosure, or two adjacent stones on the third and fourth lines, and another stone on the third line three spaces away.
Field Summary | |
private Point[] |
edgePoints
Contains the associated edge points for this group. |
private HashSet |
singleGroup
Contains the SingleGroup objects which make up the loose group. |
Constructor Summary | |
protected |
SingleLGImpl(SingleGroup sg)
Create the SingleLGImpl object. |
Method Summary | |
protected void |
addSingleGroup(SingleGroup sg)
Add a single group to this loose group. |
protected void |
addSingleGroups(SingleGroup[] sgarr)
Add single groups to this loose group. |
Object |
clone()
Override the Object.clone() method. |
Stone |
getAnyStone()
Return one of the stones from this group. |
Stone[] |
getClosestStones(Point pt)
Return the stones which are closest to the given point. |
Color |
getColor()
Get the color of the stones in this group. |
private short |
getDistance(Point pt1,
Point pt2)
Get the square of the distance between two points. |
short |
getDistanceToClosestStones(Point pt)
Get the distance to the closest stone in the group. |
short |
getMaxX()
Get the largest horizontal value of any of the stones in this loose group. |
short |
getMaxY()
Get the largest vertical value of any of the stones in this loose group. |
short |
getMinX()
Get the smallest horizontal value of any of the stones in this loose group. |
short |
getMinY()
Get the smallest vertical value of any of the stones in this loose group. |
SingleGroup[] |
getSingleGroups()
Return the single groups that comprise this loose group. |
Stone[] |
getStones()
Get all of the stones in this loose group. |
short |
getTotalSingleGroups()
Return the total number of single groups that comprise this loose group. |
short |
getTotalStones()
Get the total number of stones in this group. |
boolean |
isInBoundingBox(Point pt)
Determine if the point is in the bounding box of 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. |
protected void |
removeSingleGroup(SingleGroup sg)
Remove a SingleGroup from this loose group. |
protected void |
removeSingleGroup(Stone stone)
Remove the single group which contains this stone. |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private HashSet singleGroup
private Point[] edgePoints
Constructor Detail |
protected SingleLGImpl(SingleGroup sg)
sg
- A SingleGroup object which makes up the loose group.Method Detail |
protected void addSingleGroup(SingleGroup sg)
sg
- The SingleGroup object to be added to this loose group.protected void addSingleGroups(SingleGroup[] sgarr)
sgarr
- An array of SingleGroup objects to be added to this loose group.protected void removeSingleGroup(SingleGroup sg)
sg
- The group to be removed.protected void removeSingleGroup(Stone stone)
stone
- The stone which is in the single group to be removed.public boolean isInSingleLooseGroup(Stone stone)
isInSingleLooseGroup
in interface SingleLooseGroup
stone
- The stone in question.
public boolean isInSingleLooseGroup(SingleGroup sg)
isInSingleLooseGroup
in interface SingleLooseGroup
sg
- The single group in question.
public Color getColor()
getColor
in interface SingleLooseGroup
public SingleGroup[] getSingleGroups()
getSingleGroups
in interface SingleLooseGroup
public Stone getAnyStone()
getAnyStone
in interface SingleLooseGroup
public Stone[] getClosestStones(Point pt)
getClosestStones
in interface SingleLooseGroup
pt
- The point in question.
private short getDistance(Point pt1, Point pt2)
pt1
- One of the points.pt2
- The other point.
public short getDistanceToClosestStones(Point pt)
SingleLooseGroup
getDistanceToClosestStones
in interface SingleLooseGroup
pt
- The point in question.
public short getMinX()
getMinX
in interface SingleLooseGroup
public short getMaxX()
getMaxX
in interface SingleLooseGroup
public short getMinY()
getMinY
in interface SingleLooseGroup
public short getMaxY()
getMaxY
in interface SingleLooseGroup
public boolean isInBoundingBox(Point pt)
isInBoundingBox
in interface SingleLooseGroup
pt
- The point in question.
public Stone[] getStones()
getStones
in interface SingleLooseGroup
public short getTotalStones()
public short getTotalSingleGroups()
getTotalSingleGroups
in interface SingleLooseGroup
public Object clone()
clone
in interface SingleLooseGroup
clone
in class Object
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |