public final class Node extends java.lang.Object implements ConstNode
Constructor and Description |
---|
Node()
Construct empty node.
|
Node(Move move)
Construct node containing a move.
|
Modifier and Type | Method and Description |
---|---|
void |
addMarked(GoPoint point,
MarkType type)
Add a markup.
|
void |
addSgfProperty(java.lang.String label,
java.util.ArrayList<java.lang.String> values)
Add other unspecified SGF property.
|
void |
addSgfProperty(java.lang.String label,
java.lang.String value) |
void |
addStone(GoColor c,
GoPoint p)
Add or remove a setup stone.
|
void |
addStones(GoColor c,
ConstPointList list)
Add or remove a list of setup stones.
|
void |
append(Node node)
Append a node as a child to this node.
|
GameInfo |
createGameInfo()
Create game information or return it if already existing.
|
Node |
getChild()
Child of main variation or null if no child.
|
Node |
getChild(int i)
Get child node.
|
ConstNode |
getChildConst()
Child of main variation or null if no child (const).
|
ConstNode |
getChildConst(int i)
Get child node (const).
|
int |
getChildIndex(ConstNode child)
Get index of child node.
|
java.lang.String |
getComment()
Get comment.
|
Node |
getFather()
Get father node.
|
ConstNode |
getFatherConst()
Get father node (const).
|
GameInfo |
getGameInfo() |
ConstGameInfo |
getGameInfoConst() |
java.lang.String |
getLabel(GoPoint point)
Get label for a location on the board.
|
java.util.Map<GoPoint,java.lang.String> |
getLabels()
Get all labels on the board.
|
java.util.Map<GoPoint,java.lang.String> |
getLabelsUnmodifiable()
Get all labels on the board (unmodifiable).
|
PointList |
getMarked(MarkType type)
Get all markups of a type.
|
ConstPointList |
getMarkedConst(MarkType type)
Get all markups of a type (const).
|
Move |
getMove()
Get move contained in this node.
|
int |
getMovesLeft(GoColor c)
Moves left in byoyomi.
|
int |
getNumberChildren()
Get number of children.
|
GoColor |
getPlayer()
Color to play if explicitely set.
|
ConstPointList |
getSetup(GoColor c)
Get setup stones.
|
SgfProperties |
getSgfProperties()
Get other unspecified SGF properties.
|
ConstSgfProperties |
getSgfPropertiesConst()
Get other unspecified SGF properties (const).
|
double |
getTimeLeft(GoColor c)
Time left for color after move was made.
|
GoColor |
getToMove()
Get color to move.
|
float |
getValue()
Return a value for the node.
|
boolean |
hasChildren() |
boolean |
hasComment()
Check if node contains a comment.
|
boolean |
hasFather() |
boolean |
hasSetup()
Check if node has setup or delete stones.
|
boolean |
isChildOf(Node node)
Check if node is child of this node.
|
boolean |
isEmpty()
Return true, if node stores no information.
|
void |
makeFirstChild(Node child)
Make child the first child of this node.
|
void |
removeChild(Node child)
Remove child of this node.
|
void |
removeMarked(GoPoint point,
MarkType type)
Remove markup.
|
void |
removeSetup(GoPoint p)
Remove setup at point.
|
void |
removeVariations()
Remove all children but the first.
|
void |
setComment(java.lang.String comment)
Store comment in this node.
|
void |
setFather(Node father)
Set father of this node.
|
void |
setLabel(GoPoint point,
java.lang.String label)
Add label at a location on the board.
|
void |
setMove(Move move)
Set move stored in this node.
|
void |
setMovesLeft(GoColor c,
int n)
Set byoyomi moves left.
|
void |
setPlayer(GoColor color)
Explicitely set color to play.
|
void |
setTimeLeft(GoColor c,
double seconds)
Set byoyomi time left.
|
void |
setValue(float value)
Set value for this node.
|
void |
sortSetup()
Sort the lists of setup stones (add stones and remove stones.
|
ConstNode |
variationAfter(ConstNode child)
Return next child after a given child.
|
ConstNode |
variationBefore(ConstNode child)
Return previous child before a given child.
|
public Node()
public Node(Move move)
move
- The move to store in this node.public void append(Node node)
node
- The node to append.public void addMarked(GoPoint point, MarkType type)
point
- The location that should be marked.type
- The type of the markup from Node.MARK_TYPES.public void addSgfProperty(java.lang.String label, java.util.ArrayList<java.lang.String> values)
label
- The name of the propertyvalues
- The values of the propertypublic void addSgfProperty(java.lang.String label, java.lang.String value)
public void addStone(GoColor c, GoPoint p)
c
- The color of the stone (Black or White; Empty for removal).p
- The location of the setup stone.public void addStones(GoColor c, ConstPointList list)
c
- The color of the stone (Black or White; Empty for removal).list
- The locations of the setup stones.public GameInfo createGameInfo()
public Node getChild()
public ConstNode getChildConst()
getChildConst
in interface ConstNode
public Node getChild(int i)
i
- Index of the child in [0...getNumberChildren() - 1]public ConstNode getChildConst(int i)
getChildConst
in interface ConstNode
i
- Index of the child in [0...getNumberChildren() - 1]public int getChildIndex(ConstNode child)
getChildIndex
in interface ConstNode
child
- The child.public java.lang.String getComment()
getComment
in interface ConstNode
public Node getFather()
public ConstNode getFatherConst()
getFatherConst
in interface ConstNode
public GameInfo getGameInfo()
public ConstGameInfo getGameInfoConst()
getGameInfoConst
in interface ConstNode
public java.lang.String getLabel(GoPoint point)
public java.util.Map<GoPoint,java.lang.String> getLabels()
public java.util.Map<GoPoint,java.lang.String> getLabelsUnmodifiable()
getLabelsUnmodifiable
in interface ConstNode
public PointList getMarked(MarkType type)
type
- Markup type from Node.MARK_TYPES.public ConstPointList getMarkedConst(MarkType type)
getMarkedConst
in interface ConstNode
type
- Markup type from Node.MARK_TYPES.public Move getMove()
public int getMovesLeft(GoColor c)
getMovesLeft
in interface ConstNode
c
- The color.public int getNumberChildren()
getNumberChildren
in interface ConstNode
public GoColor getPlayer()
getPlayer
in interface ConstNode
for getting the color to play.
public ConstPointList getSetup(GoColor c)
public SgfProperties getSgfProperties()
addSgfProperty(java.lang.String, java.util.ArrayList<java.lang.String>)
public ConstSgfProperties getSgfPropertiesConst()
getSgfPropertiesConst
in interface ConstNode
addSgfProperty(java.lang.String, java.util.ArrayList<java.lang.String>)
public double getTimeLeft(GoColor c)
getTimeLeft
in interface ConstNode
c
- The colorpublic GoColor getToMove()
public float getValue()
public boolean hasChildren()
hasChildren
in interface ConstNode
public boolean hasComment()
hasComment
in interface ConstNode
public boolean hasSetup()
public boolean isChildOf(Node node)
node
- The node to check.public boolean isEmpty()
public void makeFirstChild(Node child)
child
- One of the child nodes of this node.public void removeChild(Node child)
child
- Child to remove.public void removeMarked(GoPoint point, MarkType type)
point
- Location of the markup.type
- Type of the markup from Node.MARK_TYPES.public void removeSetup(GoPoint p)
p
- Location of the setup.public void removeVariations()
public void setComment(java.lang.String comment)
comment
- The comment. If the parameter is null, empty or
contains only whitespaces, then the comment will be deleted from this
node.public void setFather(Node father)
father
- The new father.public void setLabel(GoPoint point, java.lang.String label)
point
- The location.label
- The text of the label; empty string or null to delete
the label.public void setMove(Move move)
move
- The move or null, if no move.public void setMovesLeft(GoColor c, int n)
c
- The player.n
- Number of moves left.public void setTimeLeft(GoColor c, double seconds)
c
- The player.seconds
- Time left in seconds.public void setPlayer(GoColor color)
color
- Color to play.public void setValue(float value)
value
- The valuegetValue()
public void sortSetup()
public ConstNode variationAfter(ConstNode child)
variationAfter
in interface ConstNode
child
- The childpublic ConstNode variationBefore(ConstNode child)
variationBefore
in interface ConstNode
child
- The child