org.eclipse.palamedes.gdl.core.model.utils
Class GameNodeTree

java.lang.Object
  extended by org.eclipse.palamedes.gdl.core.model.utils.GameNodeTree
All Implemented Interfaces:
IGameTree

public class GameNodeTree
extends java.lang.Object
implements IGameTree

The GameStateTree contains the tree of already resolved game nodes.

Author:
Ingo Keller

Field Summary
 java.util.HashMap<java.lang.Integer,java.util.List<java.lang.Integer>> gsHash2Nodes
          Mapping: GameState.hashCode -> [GameNode.hashCode]+
 java.util.HashMap<java.lang.Integer,IGameNode> hash2Node
          Mapping: GameNode.hashCode -> GameNode
static boolean jumpNode
           
 java.util.HashMap<IGameNode,java.util.List<IGameNode>> structure
          Mapping ParentNode -> [ChildNode]*
 
Constructor Summary
GameNodeTree()
          This constructor creates an empty game state tree.
 
Method Summary
 IGameNode addChild(IGameNode parent, IGameState child, IMove[] moves)
          This method adds a child to a parent.
protected  void getBranchingInfo()
           
 IGameNode getNextNode(IGameNode parent, IMove[] moves)
          Returns the child game node of a parent which was derived through moves.
protected  int getNumberOfStates()
           
 IGameNode getRootNode()
          Returns the root node of the game tree.
 void removeAllSiblingTrees(IGameNode node)
           
 void setRoot(IGameState state)
           
 void setTerminal(IGameState terminalState)
          Announces a terminal state.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

structure

public final java.util.HashMap<IGameNode,java.util.List<IGameNode>> structure
Mapping ParentNode -> [ChildNode]*


gsHash2Nodes

public final java.util.HashMap<java.lang.Integer,java.util.List<java.lang.Integer>> gsHash2Nodes
Mapping: GameState.hashCode -> [GameNode.hashCode]+


hash2Node

public final java.util.HashMap<java.lang.Integer,IGameNode> hash2Node
Mapping: GameNode.hashCode -> GameNode


jumpNode

public static boolean jumpNode
Constructor Detail

GameNodeTree

public GameNodeTree()
This constructor creates an empty game state tree.

Method Detail

setRoot

public void setRoot(IGameState state)

addChild

public IGameNode addChild(IGameNode parent,
                          IGameState child,
                          IMove[] moves)
This method adds a child to a parent.

Specified by:
addChild in interface IGameTree
Parameters:
parent -
child -

getBranchingInfo

protected void getBranchingInfo()

getNumberOfStates

protected final int getNumberOfStates()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getNextNode

public IGameNode getNextNode(IGameNode parent,
                             IMove[] moves)
Description copied from interface: IGameTree
Returns the child game node of a parent which was derived through moves. If no such node exists the method should return null.

Specified by:
getNextNode in interface IGameTree

getRootNode

public IGameNode getRootNode()
Description copied from interface: IGameTree
Returns the root node of the game tree. For each game tree a root node should exist.

Specified by:
getRootNode in interface IGameTree

setTerminal

public void setTerminal(IGameState terminalState)
Description copied from interface: IGameTree
Announces a terminal state.

Specified by:
setTerminal in interface IGameTree

removeAllSiblingTrees

public void removeAllSiblingTrees(IGameNode node)