public final class StrategyWalk extends Object
Modifier and Type | Method and Description |
---|---|
static Node |
getAt(Node node,
int index,
Predicate<Node> treeWalkerStrategy)
Returns a
Node from the tree structure represented by the given Node that matches the specified predicate. |
static int |
getNodeCount(Node node,
Predicate<Node> 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 node,
int index,
Function<Node,Node> replacement,
Predicate<Node> treeWalkerStrategy)
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 node, Predicate<Node> 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 node, int index, Predicate<Node> treeWalkerStrategy)
Node
from the tree structure represented by the given Node
that matches the specified predicate.public static Node replaceAt(Node node, int index, Function<Node,Node> replacement, Predicate<Node> treeWalkerStrategy)
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 replacement
OakGP Genetic Programming Framework