summaryrefslogtreecommitdiff
path: root/base/src/main/java/bjc/utils/funcutils/TreeUtils.java
diff options
context:
space:
mode:
authorBen Culkin <scorpress@gmail.com>2020-12-03 19:22:35 -0500
committerBen Culkin <scorpress@gmail.com>2020-12-03 19:22:35 -0500
commita2c7425458f645802a352abc4783e0afc73dba13 (patch)
tree92fe887eb09674ddc61c251626989c06aff88a22 /base/src/main/java/bjc/utils/funcutils/TreeUtils.java
parentbcda03dd2ba95a93a93df7f139b3607491750b74 (diff)
Adapt to esodata changes
Diffstat (limited to 'base/src/main/java/bjc/utils/funcutils/TreeUtils.java')
-rw-r--r--base/src/main/java/bjc/utils/funcutils/TreeUtils.java22
1 files changed, 11 insertions, 11 deletions
diff --git a/base/src/main/java/bjc/utils/funcutils/TreeUtils.java b/base/src/main/java/bjc/utils/funcutils/TreeUtils.java
index 59f60a2..41a01d8 100644
--- a/base/src/main/java/bjc/utils/funcutils/TreeUtils.java
+++ b/base/src/main/java/bjc/utils/funcutils/TreeUtils.java
@@ -21,8 +21,8 @@ public class TreeUtils {
* The path to mark nodes with.
* @return The list of marked paths.
*/
- public static <T> IList<IList<T>> outlineTree(ITree<T> tre, Predicate<T> leafMarker) {
- IList<IList<T>> paths = new FunctionalList<>();
+ public static <T> ListEx<ListEx<T>> outlineTree(Tree<T> tre, Predicate<T> leafMarker) {
+ ListEx<ListEx<T>> paths = new FunctionalList<>();
LinkedList<T> path = new LinkedList<>();
path.add(tre.getHead());
@@ -33,11 +33,11 @@ public class TreeUtils {
}
/* Find a path in a tree. */
- private static <T> void findPath(ITree<T> subtree, LinkedList<T> path,
- Predicate<T> leafMarker, IList<IList<T>> paths) {
+ private static <T> void findPath(Tree<T> subtree, LinkedList<T> path,
+ Predicate<T> leafMarker, ListEx<ListEx<T>> paths) {
if (subtree.getChildrenCount() == 0 && leafMarker.test(subtree.getHead())) {
/* We're at a matching leaf node. Add it. */
- IList<T> finalPath = new FunctionalList<>();
+ ListEx<T> finalPath = new FunctionalList<>();
for (T ePath : path) finalPath.add(ePath);
@@ -63,10 +63,10 @@ public class TreeUtils {
* @param expander The function to expand nodes.
* @return A transformed copy of the tree.
*/
- public static <ContainedType> ITree<ContainedType> substitute(
- ITree<ContainedType> tree,
+ public static <ContainedType> Tree<ContainedType> substitute(
+ Tree<ContainedType> tree,
Predicate<ContainedType> marker,
- Function<ContainedType, ITree<ContainedType>> expander) {
+ Function<ContainedType, Tree<ContainedType>> expander) {
tree.topDownTransform((contents) -> {
if (marker.test(contents)) return TopDownTransformResult.TRANSFORM;
else return TopDownTransformResult.PASSTHROUGH;
@@ -84,9 +84,9 @@ public class TreeUtils {
* @param environment A map which contains the variables to substitute.
* @return A transformed copy of the tree.
*/
- public static <ContainedType> ITree<ContainedType> substitute(
- ITree<ContainedType> tree,
- IMap<ContainedType, ITree<ContainedType>> environment) {
+ public static <ContainedType> Tree<ContainedType> substitute(
+ Tree<ContainedType> tree,
+ MapEx<ContainedType, Tree<ContainedType>> environment) {
return substitute(
tree,
environment::containsKey,