|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.moyoman.util.MoveDescriptorForest
This class is used to represent a forest of MoveDescriptor objects.
This would be used in describing sequences of moves. There is an
initial set of moves that can be made. For each of those moves,
there is some set of moves that can be made. Each of these moves is
represented as MoveDescriptor object.
This class could be used for representing things like josekis, or
sequences of moves in a life and death problem.
Each move in a sequence should be the opposite color from the previous
move. By convention, if one side makes two moves in a row, for example
if one side makes a move in the corner, the other side plays elsewhere
and then the first side makes a second move, in between the two moves
should be a move by the second side which is a pass. This can be used
both to show that the two moves in a row is not a mistake, and also to
indicate that a position is non-urgent and that the second side does
not necessarily need to resopnd.
Field Summary | |
private HashMap |
forest
The key is a MoveDescriptor, and the value is a HashMap contains MoveDescriptor objects. |
private HashSet |
initial
Each element is a MoveDescriptor, which is also a key in forest. |
Constructor Summary | |
MoveDescriptorForest()
|
Method Summary | |
void |
addInitialMoveDescriptor(MoveDescriptor md)
Add an initial move to the list. |
void |
addInitialMoveDescriptors(MoveDescriptor[] md)
Add initial moves to the list. |
void |
addMoveDescriptor(MoveDescriptor parent,
MoveDescriptor subsequent)
Add a follow up move to a move which was already added. |
void |
addMoveDescriptors(MoveDescriptor parent,
MoveDescriptor[] subsequent)
Add follow up moves to a move which was already added. |
void |
clear()
Remove all entries. |
Object |
clone()
Override the Object.clone() method. |
private void |
cloneTree(HashMap newHM,
MoveDescriptor md,
HashMap oldForest,
HashMap oldNew)
|
MoveDescriptor[] |
getInitialMoveDescriptors()
Return the possible initial moves. |
MoveDescriptor[] |
getSubsequentMoveDescriptors(MoveDescriptor parent)
Return all of the follow up moves for the specified move. |
static void |
main(String[] args)
|
private String |
moveString(Move move)
|
private String |
nextString(MoveDescriptor md,
int index)
|
String |
toString()
|
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private HashMap forest
private HashSet initial
Constructor Detail |
public MoveDescriptorForest()
Method Detail |
public static void main(String[] args)
public MoveDescriptor[] getInitialMoveDescriptors()
public MoveDescriptor[] getSubsequentMoveDescriptors(MoveDescriptor parent) throws NoSuchDataException
parent
- - The move for which the follow up moves are being retrieved.
NoSuchDataException
- Thrown if the parent is not found.public void addInitialMoveDescriptor(MoveDescriptor md)
md
- - The initial move to be added.public void addInitialMoveDescriptors(MoveDescriptor[] md)
md
- - The initial moves to be added.public void addMoveDescriptor(MoveDescriptor parent, MoveDescriptor subsequent) throws NoSuchDataException
parent
- - The move which has already been added.subsequent
- - A follow up move to the parent.
NoSuchDataException
- Thrown if the parent is not found.public void addMoveDescriptors(MoveDescriptor parent, MoveDescriptor[] subsequent) throws NoSuchDataException
parent
- - The move which has already been added.subsequent
- - Follow up moves to the parent.
NoSuchDataException
- Thrown if the parent is not found.public void clear()
public String toString()
toString
in class Object
private String moveString(Move move)
private String nextString(MoveDescriptor md, int index)
public Object clone()
clone
in class Object
private void cloneTree(HashMap newHM, MoveDescriptor md, HashMap oldForest, HashMap oldNew)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |