All Packages Class Hierarchy This Package Previous Next Index
Class jdsltools.testers.binarytreetester.BinaryTreeFactory
java.lang.Object
|
+----jdsltools.testers.GenericFactory
|
+----jdsltools.testers.binarytreetester.BinaryTreeFactory
- public class BinaryTreeFactory
- extends GenericFactory
Builds BinaryTree's.
Key followed by Meaning
MT_TREE: Produces an empty tree which has only one external
node.
SAPLING: Produces a tree with three nodes, one internal and two
external
RANDOM: Produces a tree of random shape. Pass in the number of
external nodes the tree is to have instead of a location.
All of the positions will be returned. Uses expandExternal,
isExternal, leftChild, and rightChild
ROOT: represents the Position at the root.
THREE: represents the three positions made in SAPLING
NON_ROOT: represents a non root position.
Uses root(), positions(), and newContainer()
- Version:
- $Revision: 1.3 $, $Date: 1998/07/10 20:07:26 $
- Author:
- Marco da Silva (mds)
-
MT_TREE
- Produces an empty tree which has only one external node.
-
NON_ROOT
- a non root position
-
RANDOM
- Produces a tree of random shape.
-
ROOT
- the root of the tree
-
SAPLING
- Produces a tree with three nodes, one internal and two external.
-
THREE
- represents the three positions made in SAPLING.
-
BinaryTreeFactory(String)
-
-
BinaryTreeFactory(String, String)
-
-
build(Position, int)
- Auxiliary method used to build a random tree that recursively builds
a tree rooted at position p and with n external nodes.
-
generate(int, int)
- Generates a data structure based on the type and position key.
-
init(String)
- call to avoid null pointer exceptions, creates structures that take
parameters.
-
location(int)
- Returns the current container and a new location for that container
-
randomTree(int)
- Uses the random tree generation code found in section 5.5 of
Data Structures and Algorithms in Java.
-
setContainer(Object)
- Sets the current container of the factory, so that the factory can
generate locations like Position and Locator
MT_TREE
public static final int MT_TREE
- Produces an empty tree which has only one external node.
ROOT
public static final int ROOT
- the root of the tree
SAPLING
public static final int SAPLING
- Produces a tree with three nodes, one internal and two external.
THREE
public static final int THREE
- represents the three positions made in SAPLING.
RANDOM
public static final int RANDOM
- Produces a tree of random shape. Pass in the number of
external nodes the tree is to have instead of a location.
All of the positions will be returned. Uses expandExternal,
isExternal, leftChild, and rightChild
NON_ROOT
public static final int NON_ROOT
- a non root position
BinaryTreeFactory
public BinaryTreeFactory(String structToBuild)
BinaryTreeFactory
public BinaryTreeFactory(String structToBuild,
String arguments)
init
public void init(String arguments)
- call to avoid null pointer exceptions, creates structures that take
parameters.
generate
public TestStructure generate(int structure,
int location)
- Generates a data structure based on the type and position key.
- Overrides:
- generate in class GenericFactory
location
public TestStructure location(int location)
- Returns the current container and a new location for that container
- Overrides:
- location in class GenericFactory
setContainer
public void setContainer(Object container)
- Sets the current container of the factory, so that the factory can
generate locations like Position and Locator
- Overrides:
- setContainer in class GenericFactory
randomTree
public BinaryTree randomTree(int externals)
- Uses the random tree generation code found in section 5.5 of
Data Structures and Algorithms in Java.
- Parameters:
- externals - The number of external nodes in the tree.
- Returns:
- a tree
build
protected void build(Position p,
int n)
- Auxiliary method used to build a random tree that recursively builds
a tree rooted at position p and with n external nodes.
- Parameters:
- p - The root position.
- n - The number of externals.
All Packages Class Hierarchy This Package Previous Next Index