klaus.chess.party
Class PartyNode

java.lang.Object
  extended by klaus.chess.party.PartyNode

public class PartyNode
extends Object

Represents a node in a Party tree

Since:
2009-04-04 alpha3
Author:
Stephan Hillebrand

Field Summary
private  String comment
          A comment
private  int id
          A unique, auto-generated ID
static int LAST_ID
           
private  Move lastMove
           
private  Vector<PartyNode> nextMoves
          A vector containing all possible next moves ( that is, all variants including the pv)
private  int pv
          The PV's (=principal variation's) index in nextMoves
 
Constructor Summary
PartyNode()
          Create a new PartyNode for a new game (= root node)
PartyNode(Move lastMove)
          Create a new Party node within a game (= normal node)
 
Method Summary
 void addPV(PartyNode next)
          Adds a new variant and makes it PV
 void addVariant(PartyNode next)
          Add a new variant
 String getComment()
          Get the comment after this move.
 int getId()
           
 Move getMove()
           
 PartyNode getPV()
           
 boolean hasPV()
           
 void setComment(String comment)
          Set the comment after the move
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LAST_ID

public static int LAST_ID

id

private int id
A unique, auto-generated ID


lastMove

private Move lastMove

nextMoves

private Vector<PartyNode> nextMoves
A vector containing all possible next moves ( that is, all variants including the pv)


pv

private int pv
The PV's (=principal variation's) index in nextMoves


comment

private String comment
A comment

Constructor Detail

PartyNode

public PartyNode()
Create a new PartyNode for a new game (= root node)


PartyNode

public PartyNode(Move lastMove)
Create a new Party node within a game (= normal node)

Parameters:
lastMove - the move transforming the parent node's position to this node's position
Method Detail

addVariant

public void addVariant(PartyNode next)
Add a new variant

Parameters:
next - the node after the next variant

addPV

public void addPV(PartyNode next)
Adds a new variant and makes it PV

Parameters:
next -

hasPV

public boolean hasPV()

getPV

public PartyNode getPV()

getMove

public Move getMove()

getId

public int getId()

getComment

public String getComment()
Get the comment after this move. By default, null means no comment at all is displayed, while "" or any blank string will mean an empty line might be displayed depending on how notation is handled.

Returns:
the comment string if any or null if no comment is given

setComment

public void setComment(String comment)
Set the comment after the move

Parameters:
comment - the comment if any or null in order to erase an existing comment.