gpalta.core
Class NodeFactory

java.lang.Object
  extended by gpalta.core.NodeFactory

public class NodeFactory
extends java.lang.Object

Holds information for the Nodes available and provides methods for random Node creation


Field Summary
 NodeSet treeRoot
           
 
Constructor Summary
NodeFactory(Config config, ProblemData problemData)
          Read Node config from file config.nodeConfigFileName, including available nodes and their possible connections
 
Method Summary
 Node newNode(java.lang.String name, int currentGlobalDepth)
          Obtain a new Node from a type that matches the given string.
 Node newRandomNode(java.util.List<Node> l, int currentGlobalDepth)
          Obtain a new Node randomly chosen from the given list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

treeRoot

public NodeSet treeRoot
Constructor Detail

NodeFactory

public NodeFactory(Config config,
                   ProblemData problemData)
Read Node config from file config.nodeConfigFileName, including available nodes and their possible connections

Method Detail

newRandomNode

public Node newRandomNode(java.util.List<Node> l,
                          int currentGlobalDepth)
Obtain a new Node randomly chosen from the given list. The Node is cloned and initialized, so it can be used separatedly

Parameters:
l - The list of Nodes from which to choose
currentGlobalDepth - The depth of the requested Node in the Tree

newNode

public Node newNode(java.lang.String name,
                    int currentGlobalDepth)
Obtain a new Node from a type that matches the given string. It will try to correctly detect RealVar and constant nodes. The Node is cloned and initialized, so it can be used separatedly

Parameters:
name - The type of the requested Node. It must coincide with one of the class names of available Nodes, unless it represents a variable or constant terminal
currentGlobalDepth - The depth of the requested Node in the Tree