org.eclipse.palamedes.gdl.core.model
Interface IGameNode

All Known Implementing Classes:
GameNode

public interface IGameNode

A game node is a unique instance of a game state within a game node tree. Usually this interface is only implemented if you provide an own game tree implementation.


Method Summary
 int getDepth()
          Returns the depth of the node in the game tree where 0 is the initial state.
 IMove[] getMoves()
          Returns the moves that have lead to this game node.
 IGameNode getParent()
          Returns the parent node or null if none exist.
 IGameState getState()
          Returns the associated game state if it is still in memory.
 boolean isPreserved()
          Returns if this game nodes content should be preserved even in the case of compacting the game tree.
 boolean isTerminal()
          Returns whether this node is a terminal node or not.
 void setPreserve(boolean preserve)
          Sets whether this game nodes content should be preserved even in the case of compacting the game tree.
 void setState(IGameState state)
          Sets the associated game state
 

Method Detail

getParent

IGameNode getParent()
Returns the parent node or null if none exist.


getState

IGameState getState()
Returns the associated game state if it is still in memory. getState() may return null after compacting the game tree (which happens automatically) unless the nodes isPreserved() method returns true. IGame.regenerateNode(node) will restore the state in this case.

See Also:
isPreserved(), setPreserve(boolean preserve), IGame.regenerateNode(IGameNode node)

setState

void setState(IGameState state)
Sets the associated game state


getDepth

int getDepth()
Returns the depth of the node in the game tree where 0 is the initial state.


getMoves

IMove[] getMoves()
Returns the moves that have lead to this game node.


isPreserved

boolean isPreserved()
Returns if this game nodes content should be preserved even in the case of compacting the game tree.


setPreserve

void setPreserve(boolean preserve)
Sets whether this game nodes content should be preserved even in the case of compacting the game tree.


isTerminal

boolean isTerminal()
Returns whether this node is a terminal node or not.