public final class DepthWalk extends Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
DepthWalk.DepthWalkReplacement
Defines a strategy for determining a replacement for a node encountered when walking a tree structure.
|
static interface |
DepthWalk.DepthWalkStrategy
Defines a strategy for determining which nodes should be considered when walking a tree structure.
|
| Modifier and Type | Method and Description |
|---|---|
static Node |
getAt(Node current,
int index,
DepthWalk.DepthWalkStrategy treeWalkerStrategy)
Returns a
Node from the tree structure represented by the given Node that matches the specified predicate. |
static int |
getNodeCount(Node tree,
DepthWalk.DepthWalkStrategy treeWalkerStrategy)
Returns the total number of nodes contained in the tree-structure represented by the given
Node that match the specified predicate. |
static Node |
replaceAt(Node current,
int index,
DepthWalk.DepthWalkReplacement replacement)
Returns a new
Node resulting from replacing the Node at position index of the given Node with the result of
replacement. |
public static int getNodeCount(Node tree, DepthWalk.DepthWalkStrategy treeWalkerStrategy)
Node that match the specified predicate.treeWalkerStrategy - the predicate used to determine if a Node should be included in the countpublic static Node getAt(Node current, int index, DepthWalk.DepthWalkStrategy treeWalkerStrategy)
Node from the tree structure represented by the given Node that matches the specified predicate.public static Node replaceAt(Node current, int index, DepthWalk.DepthWalkReplacement replacement)
Node resulting from replacing the Node at position index of the given Node with the result of
replacement.index - the index of the Node, in the tree structure represented by this object, that needs to be replacedreplacement - the function to apply to the Node at index to determine the Node that should replace itNode derived from replacing the Node at index with the result of replacementOakGP Genetic Programming Framework