Mapper
Class DerivationTree

java.lang.Object
  extended by Util.Structures.NimbleTree<Symbol>
      extended by Mapper.DerivationTree
All Implemented Interfaces:
Derivation
Direct Known Subclasses:
ContextualDerivationTree

public class DerivationTree
extends NimbleTree<Symbol>
implements Derivation

This class is used in the mapping from genotype to phenotype in GE.

Author:
EHemberg

Field Summary
protected  int currentCodonValue
           
protected  int geneCnt
           
protected  IntIterator genIter
           
protected  GEChromosome genny
           
protected  GEGrammar grammy
           
protected  int wrapCount
           
 
Constructor Summary
DerivationTree(DerivationTree copy)
          Copy Constructor
DerivationTree(GEGrammar gram, GEChromosome gen)
          Create new Derivation Tree
 
Method Summary
 boolean buildDerivationTree()
          Build a derivation tree.
 boolean derive()
           
protected  java.lang.String getGECodonValue(java.lang.String s, int codon)
          Extract range for value from non-terminal specification, where specification is in the format (set-mode) or (range-mode -- range can be open, closed, or half-open).
 int getGeneCnt()
          Get the input used, called genes
 int getWrapCount()
          Get the number of wraps used
protected  boolean growNode(DerivationNode t)
          Grows the nodes of the tree in a recursive procedure.
protected  TreeNode<Symbol> newNode()
           
 void setWrapCount(int wrapCount)
          Set the number of wraps used
 
Methods inherited from class Util.Structures.NimbleTree
addChild, depthFirstTraversal, getAncestorChain, getAncestorChains, getBranchLengths, getBranchLengths, getCurrentLevel, getCurrentNode, getDepth, getMaxStackSize, getNodeCount, getRoot, getRootToLeafPaths, makeTreeOverStringFromSExpression, populateStack, setCurrentLevel, setCurrentNode, setDepth, setMaxStackSize, setNodeCount, setRoot, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

grammy

protected final GEGrammar grammy

genny

protected final GEChromosome genny

wrapCount

protected int wrapCount

genIter

protected IntIterator genIter

geneCnt

protected int geneCnt

currentCodonValue

protected int currentCodonValue
Constructor Detail

DerivationTree

public DerivationTree(GEGrammar gram,
                      GEChromosome gen)
Create new Derivation Tree

Parameters:
gram - mapper
gen - input

DerivationTree

public DerivationTree(DerivationTree copy)
Copy Constructor

Parameters:
copy - Derivation Tree to copy
Method Detail

newNode

protected TreeNode<Symbol> newNode()
Overrides:
newNode in class NimbleTree<Symbol>

buildDerivationTree

public boolean buildDerivationTree()
Build a derivation tree. Using the grammar as a mapper and the input is the genotype.

Returns:
boolean Did the tree map completely

getGECodonValue

protected java.lang.String getGECodonValue(java.lang.String s,
                                           int codon)
                                    throws MalformedGrammarException
Extract range for value from non-terminal specification, where specification is in the format (set-mode) or (range-mode -- range can be open, closed, or half-open).

Parameters:
s - symbol string
codon - codon value
Returns:
string value
Throws:
MalformedGrammarException - The specification s is malformed

growNode

protected boolean growNode(DerivationNode t)
Grows the nodes of the tree in a recursive procedure.

Parameters:
t - start node
Returns:
validity of growth

getWrapCount

public int getWrapCount()
Get the number of wraps used

Returns:
int The number of wraps used

setWrapCount

public void setWrapCount(int wrapCount)
Set the number of wraps used

Parameters:
wrapCount - The number of wraps used

getGeneCnt

public int getGeneCnt()
Get the input used, called genes

Returns:
int The number of inputs used

derive

public boolean derive()
Specified by:
derive in interface Derivation