org.grinvin.engine.apengine

Class LimitedTreeGenerator


public class LimitedTreeGenerator
extends TreeGenerator

Tree generator that generates trees with at most the given amount of unary and binary operators.

Nested Class Summary

Nested classes/interfaces inherited from class org.grinvin.engine.apengine.TreeGenerator

TreeGenerator.TreeGeneratorStateStack

Field Summary

Fields inherited from class org.grinvin.engine.apengine.TreeGenerator

completeWorkingTree, currentBinaryOperators, currentUnaryOperators, stateStack, workingTree

Constructor Summary

LimitedTreeGenerator(int maxUnaryOperators, int maxBinaryOperators)

Method Summary

LabeledBinaryTree
nextTree()
Return the next LabeledBinaryTree or null when no more tree is available.
protected void
pushNextOperatorCount()
Push a new depthstate on the stack with the next number of unary and binary operators.

Methods inherited from class org.grinvin.engine.apengine.TreeGenerator

complete, correct, extend, nextTree, pushNextOperatorCount

Constructor Details

LimitedTreeGenerator

public LimitedTreeGenerator(int maxUnaryOperators,
                            int maxBinaryOperators)

Method Details

nextTree

public LabeledBinaryTree nextTree()
Return the next LabeledBinaryTree or null when no more tree is available.
Overrides:
nextTree in interface TreeGenerator

pushNextOperatorCount

protected void pushNextOperatorCount()
Push a new depthstate on the stack with the next number of unary and binary operators. The operators are added as follows:
unary
00
10
01
20
11
30
02
Overrides:
pushNextOperatorCount in interface TreeGenerator