Class AbstractTreeGenerator<T>
- java.lang.Object
-
- de.cuioss.test.generator.internal.net.java.quickcheck.generator.support.AbstractTreeGenerator<T>
-
- Type Parameters:
T- type of tree node
- All Implemented Interfaces:
Generator<T>
public abstract class AbstractTreeGenerator<T> extends Object implements Generator<T>
Base class for tree generators.The callback order is:
createNode(): create current nodegetChildCount(int, int): calculate number of child nodes- (create child nodes)
addChildren(Object, List): add child nodes to node
-
-
Field Summary
Fields Modifier and Type Field Description static intMAX_TREE_DEPTH
-
Constructor Summary
Constructors Constructor Description AbstractTreeGenerator()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract voidaddChildren(T node, List<T> children)Add the created children to the parent node.protected abstract TcreateNode()Create a node of type T.protected abstract intgetChildCount(int level, int numberOfSiblings)Get the number of children for the current level.Tnext()Generates the next instance.
-
-
-
Field Detail
-
MAX_TREE_DEPTH
public static final int MAX_TREE_DEPTH
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AbstractTreeGenerator
public AbstractTreeGenerator()
-
-
Method Detail
-
createNode
protected abstract T createNode()
Create a node of type T.
-
addChildren
protected abstract void addChildren(T node, List<T> children)
Add the created children to the parent node.
-
getChildCount
protected abstract int getChildCount(int level, int numberOfSiblings)
Get the number of children for the current level.- Parameters:
level- current level starting with 0 for the root levelnumberOfSiblings- number of siblings (number of siblings is 1 for the root node.)
-
-