org.grinvin.engine.apengine

Class TreeGenerator.TreeGeneratorStateStack

Enclosing Class:
TreeGenerator

protected class TreeGenerator.TreeGeneratorStateStack
extends StateStack<E>

Private class to represent the stack of the TreeGenerator. Handling this manually improves computation speed.

Field Summary

Fields inherited from class org.grinvin.engine.apengine.StateStack<E>

size, top

Method Summary

org.grinvin.engine.apengine.TreeGenerator.TreeGeneratorState[]
createArray(int size)
org.grinvin.engine.apengine.TreeGenerator.TreeGeneratorState
emptyState()
void
pushNewDepthState(int unaryCount, int binaryCount)
Push a new state that upon execution will start working with new unary and binary count.
void
pushRecurseState(int depth, int pos, int endpos)
void
pushRemoveState(int depth, int leftrightpos, int parent)
Push a new state that upon execution will remove the node with the given coordinates.

Methods inherited from class org.grinvin.engine.apengine.StateStack<E>

createArray, empty, emptyState, extend, peek, pop

Method Details

createArray

public org.grinvin.engine.apengine.TreeGenerator.TreeGeneratorState[] createArray(int size)
Overrides:
createArray in interface StateStack<E>

emptyState

public org.grinvin.engine.apengine.TreeGenerator.TreeGeneratorState emptyState()
Overrides:
emptyState in interface StateStack<E>

pushNewDepthState

public void pushNewDepthState(int unaryCount,
                              int binaryCount)
Push a new state that upon execution will start working with new unary and binary count.

pushRecurseState

public void pushRecurseState(int depth,
                             int pos,
                             int endpos)

pushRemoveState

public final void pushRemoveState(int depth,
                                  int leftrightpos,
                                  int parent)
Push a new state that upon execution will remove the node with the given coordinates.
Parameters:
depth - depth in the tree
leftrightpos - position relative to the parent: 0 for left, 1 for right
parent - parent of the node to be removed