|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
|
+--org.moyoman.module.Module
|
+--org.moyoman.module.groups.groupsimpl.GroupsImpl
This module implements the Groups interface. It is responsible for maintaining the relation between the different SingleGroup objects.
| Field Summary | |
private ArrayList |
capturedGroups
Each element is a SingleGroupImpl object which was captured by the last move. |
private ArrayList |
combinedGroups
Each element is a SingleGroupImpl object that was combined with other groups by the last move. |
private static DebugType[] |
dt
The debug types that this module returns. |
private ArrayList |
groups
Each element is a SingleGroupImpl object representing a group on the board. |
private Stone[] |
lastPrisoners
The prisoners from the last move. |
private Stone |
lastStone
The last stone placed on the board. |
private ModuleType[] |
mt
The module types that this module requires. |
private static RatedMove[] |
rm
The ratings of moves by this module. |
private short |
statusVal
One of the constants: Groups.ADD, Groups.UPDATE, Groups.COMBINE. |
| Fields inherited from class org.moyoman.module.Module |
|
| Fields inherited from interface org.moyoman.module.groups.Groups |
ADD, COMBINE, SUICIDE, UPDATE |
| Constructor Summary | |
GroupsImpl(GameId id,
ModuleName name)
Create a new GroupsImpl object. |
|
| Method Summary | |
private boolean |
adjacentHorizontal(SingleGroup sg1,
SingleGroup sg2)
Determine if the two groups overlap or are adjacent horizontally. |
private boolean |
adjacentPoints(Point pt1,
Point pt2)
Determine if two points are adjacent. |
private boolean |
adjacentVertical(SingleGroup sg1,
SingleGroup sg2)
Determine if the two groups overlap or are adjacent vertically. |
boolean |
areGroupsAdjacent(SingleGroup sg1,
SingleGroup sg2)
Return true if the two single groups have at least one stone touching. |
Object |
clone()
Override the Object.clone() method. |
protected void |
error(Exception e)
Provide an error method which SingleGroupImpl can also call. |
void |
generateMove(Module[] modules)
Generate the rated moves. |
SingleGroup[] |
getAdjacentSingleGroupsOfOppositeColors(SingleGroup sg)
Get all groups that are adjacent to this group of the opposing color. |
SingleGroup[] |
getCapturedSingleGroups()
Get the groups that were captured by the last stone. |
SingleGroup[] |
getCombinedSingleGroups()
Get the SingleGroups which were combined into a single group by the last stone played. |
Debug[] |
getDebugInformation(DebugType[] types)
Return the debug information for this module. |
DebugType[] |
getDebugTypes()
Get the debug types which this module supports. |
RatedMove[] |
getMoves()
Get the rated moves. |
SingleGroup |
getNewSingleGroup()
Get the SingleGroup which contains the last stone played. |
ModuleType[] |
getRequiredModuleList()
Return the modules that this module requires. |
SingleGroup |
getSingleGroup(Stone stone)
Get the SingleGroup object which contains the stone. |
SingleGroup[] |
getSingleGroups()
Get all of the SingleGroup objects. |
SingleGroup[] |
getSuicidedSingleGroups()
Get the SingleGroup objects which died as a result of suicide on the last move. |
short |
getTotalSingleGroups()
Return the total number of groups. |
SingleGroup |
getUpdatedSingleGroup()
Get the SingleGroup which contains the last stone played. |
void |
makeMove(Move move,
Module[] modules)
Update this module with the last move. |
private boolean |
overlapHorizontal(SingleGroup sg1,
SingleGroup sg2)
Determine if the two groups overlap horizontally. |
private boolean |
overlapVertical(SingleGroup sg1,
SingleGroup sg2)
Determine if the two groups overlap vertically. |
short |
status()
Get the status of the last move that was a stone. |
String |
toString()
Return a String representation of this object. |
boolean |
wereGroupsCaptured()
Determine if the last stone played captured any prisoners. |
| Methods inherited from class org.moyoman.module.Module |
checkTime, create, createHelper, debug, error, fatal, fatal, getAllHelpers, getHelper, getId, getKomi, getModule, getModuleName, getScheduler, information, setTime, warning, warning |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.moyoman.module.ModuleInterface |
getScheduler |
| Field Detail |
private static DebugType[] dt
private ModuleType[] mt
private static RatedMove[] rm
private ArrayList groups
private ArrayList combinedGroups
private Stone lastStone
private Stone[] lastPrisoners
private ArrayList capturedGroups
private short statusVal
| Constructor Detail |
public GroupsImpl(GameId id,
ModuleName name)
throws InternalErrorException
id - The id of the game.name - The module name.
InternalErrorException - Thrown if the operation fails for any reason.| Method Detail |
public short status()
status in interface Groupspublic boolean wereGroupsCaptured()
wereGroupsCaptured in interface Groupspublic SingleGroup[] getSingleGroups()
getSingleGroups in interface Groups
public SingleGroup getSingleGroup(Stone stone)
throws NoSuchDataException
getSingleGroup in interface Groupsstone - The stone in question.
NoSuchDataException - Thrown if the stone is not in any groups.
public SingleGroup getNewSingleGroup()
throws NoSuchDataException
getNewSingleGroup in interface GroupsNoSuchDataException - Thrown if status() does not return Groups.ADD.
public SingleGroup getUpdatedSingleGroup()
throws NoSuchDataException
getUpdatedSingleGroup in interface GroupsNoSuchDataException - Thrown if status() does not return Groups.UPDATE.
public SingleGroup[] getCombinedSingleGroups()
throws NoSuchDataException
getCombinedSingleGroups in interface GroupsNoSuchDataException - Thrown if status() does not return Groups.COMBINE.
public SingleGroup[] getSuicidedSingleGroups()
throws NoSuchDataException
getSuicidedSingleGroups in interface GroupsNoSuchDataException - Thrown if Board.didSuicideOccur() returns false.public short getTotalSingleGroups()
getTotalSingleGroups in interface Groupspublic void generateMove(Module[] modules)
generateMove in class Modulemodules - The modules which this module uses.public Debug[] getDebugInformation(DebugType[] types)
getDebugInformation in class Moduletypes - The types of debug information requested.
public DebugType[] getDebugTypes()
getDebugTypes in class Modulepublic RatedMove[] getMoves()
getMoves in interface ModuleInterfacegetMoves in class Modulepublic ModuleType[] getRequiredModuleList()
getRequiredModuleList in class Module
public void makeMove(Move move,
Module[] modules)
throws IllegalMoveException,
InternalErrorException
makeMove in class Modulemove - The last move.modules - The modules that this module needs.
IllegalMoveException
InternalErrorExceptionpublic SingleGroup[] getAdjacentSingleGroupsOfOppositeColors(SingleGroup sg)
sg - The single group.
public SingleGroup[] getCapturedSingleGroups()
getCapturedSingleGroups in interface Groups
public boolean areGroupsAdjacent(SingleGroup sg1,
SingleGroup sg2)
sg1 - A single group
private boolean adjacentPoints(Point pt1,
Point pt2)
pt1 - One of the points.pt2 - The other point.
private boolean overlapHorizontal(SingleGroup sg1,
SingleGroup sg2)
sg1 - One of the groups.sg2 - The other group.
private boolean adjacentHorizontal(SingleGroup sg1,
SingleGroup sg2)
sg1 - One of the groups.sg2 - The other group.
private boolean overlapVertical(SingleGroup sg1,
SingleGroup sg2)
sg1 - One of the groups.sg2 - The other group.
private boolean adjacentVertical(SingleGroup sg1,
SingleGroup sg2)
sg1 - One of the groups.sg2 - The other group.
public String toString()
toString in class Objectprotected void error(Exception e)
error in class Modulee - The exception to be logged.public Object clone()
clone in interface ModuleInterfaceclone in class Module
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||