|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--org.moyoman.module.groups.groupsimpl.SingleGroupImpl
This class implements the SingleGroup interface. It represents a set of stones which are captured as one unit.
| Field Summary | |
private Color |
color
The color of the group. |
private GroupsImpl |
groups
The GroupsImpl object. |
private HashSet |
liberties
The empty Point objects which are the liberties of the group. |
private int |
maxx
The maximum horizontal value of any stone in the group. |
private int |
maxy
The maximum vertical value of any stone in the group. |
private int |
minx
The minimum horizontal value of any stone in the group. |
private int |
miny
The minimum vertical value of any stone in the group. |
private HashSet |
opponent
Stone objects of the opposite color to the group which are directly adjacent. |
private HashSet |
stones
The Stone objects which make up this group. |
| Constructor Summary | |
protected |
SingleGroupImpl(Stone s,
Board board,
GroupsImpl g)
Create the new SingleGroupImpl object. |
| Method Summary | |
Object |
clone()
Override the Object.clone() method. |
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 this group. |
Point[] |
getLiberties()
Get the points which are the liberties of this group. |
int |
getMaxX()
Return the largest horizontal coordinate. |
int |
getMaxY()
Return the largest vertical coordinate. |
int |
getMinX()
Return the smallest horizontal coordinate. |
int |
getMinY()
Return the smallest vertical coordinate. |
Stone[] |
getStones()
Return the stones in the group. |
short |
getTotalLiberties()
Get the total number of liberties for this group. |
short |
getTotalStones()
Return the total number of stones in this group. |
boolean |
isInSingleGroup(Stone stone)
Determine if the stone is in this group. |
boolean |
isLibertyOfSingleGroup(Point pt)
Determine if the point is a liberty of this group. |
void |
recompute(Board board)
Recompute the liberties and opponents for this group. |
String |
toString()
Get a String representation of this object. |
protected void |
update(SingleGroupImpl sgi,
Board board)
Add the stones from a group to this one. |
protected void |
update(Stone s,
Board board)
Add the stone to this group. |
private void |
updateBounds(Stone s)
Update the bounding box for this group. |
private void |
updateLibertiesAndOpponents(Stone s,
Board board)
Update the liberties and opponent data structures. |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
private HashSet stones
private HashSet liberties
private HashSet opponent
private Color color
private int minx
private int maxx
private int miny
private int maxy
private GroupsImpl groups
| Constructor Detail |
protected SingleGroupImpl(Stone s,
Board board,
GroupsImpl g)
s - The Stone which is the new group.| Method Detail |
protected void update(Stone s,
Board board)
s - The Stone to be added to the group.
private void updateLibertiesAndOpponents(Stone s,
Board board)
s - The Stone to be added to the group.
protected void update(SingleGroupImpl sgi,
Board board)
private void updateBounds(Stone s)
public boolean isInSingleGroup(Stone stone)
isInSingleGroup in interface SingleGroupstone - The Stone being checked.
public boolean isLibertyOfSingleGroup(Point pt)
isLibertyOfSingleGroup in interface SingleGrouppt - The Point being checked.
public Stone getAnyStone()
getAnyStone in interface SingleGrouppublic Stone[] getStones()
getStones in interface SingleGrouppublic short getTotalStones()
getTotalStones in interface SingleGrouppublic Point[] getLiberties()
getLiberties in interface SingleGrouppublic short getTotalLiberties()
getTotalLiberties in interface SingleGrouppublic Stone[] getAdjacentOpponentStones()
getAdjacentOpponentStones in interface SingleGrouppublic Color getColor()
getColor in interface SingleGrouppublic void recompute(Board board)
recompute in interface SingleGroupboard - The Board object.public int getMinX()
getMinX in interface SingleGrouppublic int getMaxX()
getMaxX in interface SingleGrouppublic int getMinY()
getMinY in interface SingleGrouppublic int getMaxY()
getMaxY in interface SingleGrouppublic String toString()
toString in class Objectpublic Object clone()
clone in interface SingleGroupclone in class Object
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||