|
Internet Chess ToolKit v0.2.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectictk.boardgame.ContinuationArrayList
ContinuationArrayList uses arrays internally to represent the banching structure. Arrays are compacted when null items are created.
Constructor Summary | |
ContinuationArrayList()
|
|
ContinuationArrayList(Move m)
|
Method Summary | |
void |
add(Move m)
This adds the move to the continuation list. |
void |
add(Move m,
boolean isMain)
adds a move to the continuation list. |
int |
demote(Move move,
int num)
demotes the variation moving it down the variation list. |
void |
dispose()
reclaims all resources and recursively deletes all branch moves. |
java.lang.String |
dump()
for debugging |
boolean |
exists(int variation)
this does not throw ArrayOutOfBoundsException if your ask an index out of range, you just get false returned. |
boolean |
exists(Move move)
determines if the move is in the current list of continuations |
Move[] |
find(Move m)
searches the continuation list for moves that are equal to the move submitted. |
int[] |
findIndex(Move m)
searches the continuation list for moves that are equal to the move submitted. |
Move |
get(int i)
|
Move |
getDepartureMove()
gets the departure move, that is the move that comes before all of these variations. |
int |
getIndex(Move m)
gets the index of this Move object in the variation branches. |
Move |
getMainLine()
get the next move in the game history. |
boolean |
hasMainLine()
calls exists(0). |
boolean |
hasVariations()
|
boolean |
isTerminal()
no main line and no variations exist. |
int |
promote(Move move,
int num)
promotes the move up the list of continuations. |
void |
remove(int i)
removes a variation from the continuation list. |
void |
remove(Move m)
removes the move from the continuation list. |
void |
removeAll()
makes this move a terminal node. |
void |
removeAllVariations()
All variations are destroyed as Move.dispose() is called recusively down the line for each variation. |
boolean |
setMainLineTerminal()
set the mainline to null. |
int |
size()
gets the number of continuation (variations + the main-line) that exist after this move. |
int |
sizeOfVariations()
much more useful than size(), this function returns the number of variations (continuations minus the main-line). |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ContinuationArrayList(Move m)
public ContinuationArrayList()
Method Detail |
public Move getDepartureMove()
ContinuationList
getDepartureMove
in interface ContinuationList
public boolean isTerminal()
ContinuationList
isTerminal
in interface ContinuationList
public boolean setMainLineTerminal()
ContinuationList
setMainLineTerminal
in interface ContinuationList
public boolean exists(int variation)
ContinuationList
exists
in interface ContinuationList
variation
- which branch to look at (0) is the main line
public boolean exists(Move move)
ContinuationList
exists
in interface ContinuationList
move
- is this move in the list of continuationpublic boolean hasMainLine()
ContinuationList
hasMainLine
in interface ContinuationList
public Move getMainLine()
ContinuationList
getMainLine
in interface ContinuationList
public boolean hasVariations()
hasVariations
in interface ContinuationList
public Move get(int i)
get
in interface ContinuationList
public int size()
ContinuationList
size
in interface ContinuationList
public int sizeOfVariations()
ContinuationList
sizeOfVariations
in interface ContinuationList
public void add(Move m, boolean isMain)
ContinuationList
add
in interface ContinuationList
isMain
- If true then the move added will be the first
continuation. All other moves will be bumped down (if the
mainline wasn't null to begin with). LIFO
if isMake is not true then the move will be the last branch,
in otherwords, appended to the list. FIFOpublic void add(Move m)
ContinuationList
add
in interface ContinuationList
public int getIndex(Move m)
ContinuationList
getIndex
in interface ContinuationList
public Move[] find(Move m)
ContinuationList
find
in interface ContinuationList
public int[] findIndex(Move m)
ContinuationList
findIndex
in interface ContinuationList
public void remove(int i)
ContinuationList
remove
in interface ContinuationList
public void remove(Move m)
ContinuationList
remove
in interface ContinuationList
public void removeAll()
ContinuationList
removeAll
in interface ContinuationList
public void removeAllVariations()
ContinuationList
removeAllVariations
in interface ContinuationList
public void dispose()
dispose
in interface ContinuationList
public int promote(Move move, int num)
ContinuationList
promote
in interface ContinuationList
num
- how many places to displace the variations.
If 0 the variation will be promoted to the main line.
public int demote(Move move, int num)
ContinuationList
demote
in interface ContinuationList
num
- how many places to displace the variations.
If 0 the variation will be demoted to last variation
public java.lang.String dump()
dump
in interface ContinuationList
|
Submit a bug or feature Visit the Website Internet Chess ToolKit is licensed under the GPL v2 . |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |