diff options
| author | bculkin2442 <bjculkin@mix.wvu.edu> | 2016-05-10 16:02:45 -0400 |
|---|---|---|
| committer | bculkin2442 <bjculkin@mix.wvu.edu> | 2016-05-10 16:02:45 -0400 |
| commit | 61fd71f69e080790da722e0e03b71ecd7c2538a2 (patch) | |
| tree | e5c1150b27b84d550f807e44ac82688216451f00 /BJC-Utils2/src/main/java/bjc/utils/funcdata | |
| parent | 87ae1dfc8d8cb7b51d7bda4750ce841bbe691cfc (diff) | |
General update
Diffstat (limited to 'BJC-Utils2/src/main/java/bjc/utils/funcdata')
| -rw-r--r-- | BJC-Utils2/src/main/java/bjc/utils/funcdata/ExtendedMap.java | 18 | ||||
| -rw-r--r-- | BJC-Utils2/src/main/java/bjc/utils/funcdata/FunctionalList.java | 42 | ||||
| -rw-r--r-- | BJC-Utils2/src/main/java/bjc/utils/funcdata/FunctionalMap.java | 12 | ||||
| -rw-r--r-- | BJC-Utils2/src/main/java/bjc/utils/funcdata/FunctionalStringTokenizer.java | 6 | ||||
| -rw-r--r-- | BJC-Utils2/src/main/java/bjc/utils/funcdata/IList.java (renamed from BJC-Utils2/src/main/java/bjc/utils/funcdata/IFunctionalList.java) | 22 | ||||
| -rw-r--r-- | BJC-Utils2/src/main/java/bjc/utils/funcdata/IMap.java (renamed from BJC-Utils2/src/main/java/bjc/utils/funcdata/IFunctionalMap.java) | 10 | ||||
| -rw-r--r-- | BJC-Utils2/src/main/java/bjc/utils/funcdata/ITree.java | 2 | ||||
| -rw-r--r-- | BJC-Utils2/src/main/java/bjc/utils/funcdata/PushdownMap.java | 10 | ||||
| -rw-r--r-- | BJC-Utils2/src/main/java/bjc/utils/funcdata/TransformedValueMap.java | 14 | ||||
| -rw-r--r-- | BJC-Utils2/src/main/java/bjc/utils/funcdata/Tree.java | 16 | ||||
| -rw-r--r-- | BJC-Utils2/src/main/java/bjc/utils/funcdata/bst/BinarySearchTree.java | 6 |
11 files changed, 79 insertions, 79 deletions
diff --git a/BJC-Utils2/src/main/java/bjc/utils/funcdata/ExtendedMap.java b/BJC-Utils2/src/main/java/bjc/utils/funcdata/ExtendedMap.java index 9776961..378a4a0 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/funcdata/ExtendedMap.java +++ b/BJC-Utils2/src/main/java/bjc/utils/funcdata/ExtendedMap.java @@ -7,13 +7,13 @@ import java.util.function.Function; import bjc.utils.funcutils.ListUtils; class ExtendedMap<KeyType, ValueType> - implements IFunctionalMap<KeyType, ValueType> { - private IFunctionalMap<KeyType, ValueType> delegate; + implements IMap<KeyType, ValueType> { + private IMap<KeyType, ValueType> delegate; - private IFunctionalMap<KeyType, ValueType> store; + private IMap<KeyType, ValueType> store; - public ExtendedMap(IFunctionalMap<KeyType, ValueType> delegate, - IFunctionalMap<KeyType, ValueType> store) { + public ExtendedMap(IMap<KeyType, ValueType> delegate, + IMap<KeyType, ValueType> store) { this.delegate = delegate; this.store = store; } @@ -28,7 +28,7 @@ class ExtendedMap<KeyType, ValueType> } @Override - public IFunctionalMap<KeyType, ValueType> extend() { + public IMap<KeyType, ValueType> extend() { return new ExtendedMap<>(this, new FunctionalMap<>()); } @@ -68,12 +68,12 @@ class ExtendedMap<KeyType, ValueType> } @Override - public IFunctionalList<KeyType> keyList() { + public IList<KeyType> keyList() { return ListUtils.mergeLists(store.keyList(), delegate.keyList()); } @Override - public <MappedValue> IFunctionalMap<KeyType, MappedValue> mapValues( + public <MappedValue> IMap<KeyType, MappedValue> mapValues( Function<ValueType, MappedValue> transformer) { return new TransformedValueMap<>(this, transformer); } @@ -89,7 +89,7 @@ class ExtendedMap<KeyType, ValueType> } @Override - public IFunctionalList<ValueType> valueList() { + public IList<ValueType> valueList() { return ListUtils.mergeLists(store.valueList(), delegate.valueList()); } diff --git a/BJC-Utils2/src/main/java/bjc/utils/funcdata/FunctionalList.java b/BJC-Utils2/src/main/java/bjc/utils/funcdata/FunctionalList.java index 8579693..638ad7e 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/funcdata/FunctionalList.java +++ b/BJC-Utils2/src/main/java/bjc/utils/funcdata/FunctionalList.java @@ -27,7 +27,7 @@ import bjc.utils.data.Pair; * @param <E> * The type in this list */ -public class FunctionalList<E> implements Cloneable, IFunctionalList<E> { +public class FunctionalList<E> implements Cloneable, IList<E> { /** * The list used as a backing store */ @@ -148,8 +148,8 @@ public class FunctionalList<E> implements Cloneable, IFunctionalList<E> { * @return A list */ @Override - public IFunctionalList<E> clone() { - IFunctionalList<E> clonedList = new FunctionalList<>(); + public IList<E> clone() { + IList<E> clonedList = new FunctionalList<>(); for (E element : wrappedList) { clonedList.add(element); @@ -166,8 +166,8 @@ public class FunctionalList<E> implements Cloneable, IFunctionalList<E> { * IFunctionalList, java.util.function.BiFunction) */ @Override - public <T, F> IFunctionalList<F> combineWith( - IFunctionalList<T> rightList, + public <T, F> IList<F> combineWith( + IList<T> rightList, BiFunction<E, T, F> itemCombiner) { if (rightList == null) { throw new NullPointerException( @@ -176,7 +176,7 @@ public class FunctionalList<E> implements Cloneable, IFunctionalList<E> { throw new NullPointerException("Combiner must not be null"); } - IFunctionalList<F> returnedList = new FunctionalList<>(); + IList<F> returnedList = new FunctionalList<>(); // Get the iterator for the other list Iterator<T> rightIterator = rightList.toIterable().iterator(); @@ -227,17 +227,17 @@ public class FunctionalList<E> implements Cloneable, IFunctionalList<E> { * Function) */ @Override - public <T> IFunctionalList<T> flatMap( - Function<E, IFunctionalList<T>> elementExpander) { + public <T> IList<T> flatMap( + Function<E, IList<T>> elementExpander) { if (elementExpander == null) { throw new NullPointerException("Expander must not be null"); } - IFunctionalList<T> returnedList = new FunctionalList<>( + IList<T> returnedList = new FunctionalList<>( this.wrappedList.size()); forEach(element -> { - IFunctionalList<T> expandedElement = elementExpander + IList<T> expandedElement = elementExpander .apply(element); if (expandedElement == null) { @@ -320,12 +320,12 @@ public class FunctionalList<E> implements Cloneable, IFunctionalList<E> { * Predicate) */ @Override - public IFunctionalList<E> getMatching(Predicate<E> matchPredicate) { + public IList<E> getMatching(Predicate<E> matchPredicate) { if (matchPredicate == null) { throw new NullPointerException("Predicate must not be null"); } - IFunctionalList<E> returnedList = new FunctionalList<>(); + IList<E> returnedList = new FunctionalList<>(); wrappedList.forEach((element) -> { if (matchPredicate.test(element)) { @@ -361,7 +361,7 @@ public class FunctionalList<E> implements Cloneable, IFunctionalList<E> { * Check if a partition has room for another item */ private Boolean isPartitionFull(int numberPerPartition, - IHolder<IFunctionalList<E>> currentPartition) { + IHolder<IList<E>> currentPartition) { return currentPartition.unwrap( (partition) -> partition.getSize() >= numberPerPartition); } @@ -373,12 +373,12 @@ public class FunctionalList<E> implements Cloneable, IFunctionalList<E> { * bjc.utils.funcdata.IFunctionalList#map(java.util.function.Function) */ @Override - public <T> IFunctionalList<T> map(Function<E, T> elementTransformer) { + public <T> IList<T> map(Function<E, T> elementTransformer) { if (elementTransformer == null) { throw new NullPointerException("Transformer must be not null"); } - IFunctionalList<T> returnedList = new FunctionalList<>( + IList<T> returnedList = new FunctionalList<>( this.wrappedList.size()); forEach(element -> { @@ -396,8 +396,8 @@ public class FunctionalList<E> implements Cloneable, IFunctionalList<E> { * IFunctionalList) */ @Override - public <T> IFunctionalList<IPair<E, T>> pairWith( - IFunctionalList<T> rightList) { + public <T> IList<IPair<E, T>> pairWith( + IList<T> rightList) { return combineWith(rightList, Pair<E, T>::new); } @@ -407,7 +407,7 @@ public class FunctionalList<E> implements Cloneable, IFunctionalList<E> { * @see bjc.utils.funcdata.IFunctionalList#partition(int) */ @Override - public IFunctionalList<IFunctionalList<E>> partition( + public IList<IList<E>> partition( int numberPerPartition) { if (numberPerPartition < 1 || numberPerPartition > wrappedList.size()) { @@ -416,10 +416,10 @@ public class FunctionalList<E> implements Cloneable, IFunctionalList<E> { + wrappedList.size()); } - IFunctionalList<IFunctionalList<E>> returnedList = new FunctionalList<>(); + IList<IList<E>> returnedList = new FunctionalList<>(); // The current partition being filled - IHolder<IFunctionalList<E>> currentPartition = new Identity<>( + IHolder<IList<E>> currentPartition = new Identity<>( new FunctionalList<>()); this.forEach((element) -> { @@ -559,7 +559,7 @@ public class FunctionalList<E> implements Cloneable, IFunctionalList<E> { } @Override - public IFunctionalList<E> tail() { + public IList<E> tail() { return new FunctionalList<>(wrappedList.subList(1, getSize())); } diff --git a/BJC-Utils2/src/main/java/bjc/utils/funcdata/FunctionalMap.java b/BJC-Utils2/src/main/java/bjc/utils/funcdata/FunctionalMap.java index fb8bb81..0002a58 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/funcdata/FunctionalMap.java +++ b/BJC-Utils2/src/main/java/bjc/utils/funcdata/FunctionalMap.java @@ -9,7 +9,7 @@ import java.util.function.Function; import bjc.utils.data.IPair; /** - * Basic implementation of {@link IFunctionalMap} + * Basic implementation of {@link IMap} * * @author ben * @@ -19,7 +19,7 @@ import bjc.utils.data.IPair; * The type of the map's values */ public class FunctionalMap<KeyType, ValueType> - implements IFunctionalMap<KeyType, ValueType> { + implements IMap<KeyType, ValueType> { private Map<KeyType, ValueType> wrappedMap; /** @@ -71,7 +71,7 @@ public class FunctionalMap<KeyType, ValueType> } @Override - public IFunctionalMap<KeyType, ValueType> extend() { + public IMap<KeyType, ValueType> extend() { return new ExtendedMap<>(this, new FunctionalMap<>()); } @@ -115,7 +115,7 @@ public class FunctionalMap<KeyType, ValueType> } @Override - public IFunctionalList<KeyType> keyList() { + public IList<KeyType> keyList() { FunctionalList<KeyType> keys = new FunctionalList<>(); wrappedMap.keySet().forEach((key) -> { @@ -132,7 +132,7 @@ public class FunctionalMap<KeyType, ValueType> * Function) */ @Override - public <MappedValue> IFunctionalMap<KeyType, MappedValue> mapValues( + public <MappedValue> IMap<KeyType, MappedValue> mapValues( Function<ValueType, MappedValue> transformer) { if (transformer == null) { throw new NullPointerException("Transformer must not be null"); @@ -166,7 +166,7 @@ public class FunctionalMap<KeyType, ValueType> } @Override - public IFunctionalList<ValueType> valueList() { + public IList<ValueType> valueList() { FunctionalList<ValueType> values = new FunctionalList<>(); wrappedMap.values().forEach((value) -> { diff --git a/BJC-Utils2/src/main/java/bjc/utils/funcdata/FunctionalStringTokenizer.java b/BJC-Utils2/src/main/java/bjc/utils/funcdata/FunctionalStringTokenizer.java index aa6fca3..18617d1 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/funcdata/FunctionalStringTokenizer.java +++ b/BJC-Utils2/src/main/java/bjc/utils/funcdata/FunctionalStringTokenizer.java @@ -140,7 +140,7 @@ public class FunctionalStringTokenizer { * * @return This tokenizer, converted into a list of strings */ - public IFunctionalList<String> toList() { + public IList<String> toList() { return toList((String element) -> element); } @@ -155,13 +155,13 @@ public class FunctionalStringTokenizer { * The function to use to convert tokens. * @return A list containing all of the converted tokens. */ - public <E> IFunctionalList<E> toList( + public <E> IList<E> toList( Function<String, E> tokenTransformer) { if (tokenTransformer == null) { throw new NullPointerException("Transformer must not be null"); } - IFunctionalList<E> returnList = new FunctionalList<>(); + IList<E> returnList = new FunctionalList<>(); // Add each token to the list after transforming it forEachToken(token -> { diff --git a/BJC-Utils2/src/main/java/bjc/utils/funcdata/IFunctionalList.java b/BJC-Utils2/src/main/java/bjc/utils/funcdata/IList.java index 5327dbe..c45551e 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/funcdata/IFunctionalList.java +++ b/BJC-Utils2/src/main/java/bjc/utils/funcdata/IList.java @@ -22,7 +22,7 @@ import bjc.utils.data.IPair; * @param <ContainedType> * The type in this list */ -public interface IFunctionalList<ContainedType> { +public interface IList<ContainedType> { /** * Add an item to this list @@ -87,8 +87,8 @@ public interface IFunctionalList<ContainedType> { * The function to use for combining element pairs. * @return A new list containing the merged pairs of lists. */ - <OtherType, CombinedType> IFunctionalList<CombinedType> combineWith( - IFunctionalList<OtherType> rightList, + <OtherType, CombinedType> IList<CombinedType> combineWith( + IList<OtherType> rightList, BiFunction<ContainedType, OtherType, CombinedType> itemCombiner); /** @@ -126,8 +126,8 @@ public interface IFunctionalList<ContainedType> { * @return A new list containing the flattened results of applying the * provided function. */ - <MappedType> IFunctionalList<MappedType> flatMap( - Function<ContainedType, IFunctionalList<MappedType>> elementExpander); + <MappedType> IList<MappedType> flatMap( + Function<ContainedType, IList<MappedType>> elementExpander); /** * Apply a given action for each member of the list @@ -172,7 +172,7 @@ public interface IFunctionalList<ContainedType> { * The predicate to match by * @return A list containing all elements that match the predicate */ - IFunctionalList<ContainedType> getMatching( + IList<ContainedType> getMatching( Predicate<ContainedType> matchPredicate); /** @@ -200,7 +200,7 @@ public interface IFunctionalList<ContainedType> { * The function to apply to each element in the list * @return A new list containing the mapped elements of this list. */ - <MappedType> IFunctionalList<MappedType> map( + <MappedType> IList<MappedType> map( Function<ContainedType, MappedType> elementTransformer); /** @@ -214,8 +214,8 @@ public interface IFunctionalList<ContainedType> { * @return A list containing pairs of this element and the specified * list */ - <OtherType> IFunctionalList<IPair<ContainedType, OtherType>> pairWith( - IFunctionalList<OtherType> rightList); + <OtherType> IList<IPair<ContainedType, OtherType>> pairWith( + IList<OtherType> rightList); /** * Partition this list into a list of sublists @@ -224,7 +224,7 @@ public interface IFunctionalList<ContainedType> { * The size of elements to put into each one of the sublists * @return A list partitioned into partitions of size nPerPart */ - IFunctionalList<IFunctionalList<ContainedType>> partition( + IList<IList<ContainedType>> partition( int numberPerPartition); /** @@ -330,7 +330,7 @@ public interface IFunctionalList<ContainedType> { * * @return The list without the first element */ - public IFunctionalList<ContainedType> tail(); + public IList<ContainedType> tail(); /** * Convert this list into an array diff --git a/BJC-Utils2/src/main/java/bjc/utils/funcdata/IFunctionalMap.java b/BJC-Utils2/src/main/java/bjc/utils/funcdata/IMap.java index 8a54246..f5f7a26 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/funcdata/IFunctionalMap.java +++ b/BJC-Utils2/src/main/java/bjc/utils/funcdata/IMap.java @@ -15,7 +15,7 @@ import java.util.function.Function; * The type of this map's values * */ -public interface IFunctionalMap<KeyType, ValueType> { +public interface IMap<KeyType, ValueType> { /** * Check if this map contains the specified key @@ -32,7 +32,7 @@ public interface IFunctionalMap<KeyType, ValueType> { * * @return An extended map */ - IFunctionalMap<KeyType, ValueType> extend(); + IMap<KeyType, ValueType> extend(); /** * Execute an action for each entry in the map @@ -81,7 +81,7 @@ public interface IFunctionalMap<KeyType, ValueType> { * * @return A list of all the keys in this map */ - IFunctionalList<KeyType> keyList(); + IList<KeyType> keyList(); /** * Transform the values returned by this map. @@ -96,7 +96,7 @@ public interface IFunctionalMap<KeyType, ValueType> { * The function to use to transform values * @return The map where each value will be transformed after lookup */ - <V2> IFunctionalMap<KeyType, V2> mapValues( + <V2> IMap<KeyType, V2> mapValues( Function<ValueType, V2> transformer); /** @@ -133,5 +133,5 @@ public interface IFunctionalMap<KeyType, ValueType> { * * @return A list of values in this map */ - IFunctionalList<ValueType> valueList(); + IList<ValueType> valueList(); }
\ No newline at end of file diff --git a/BJC-Utils2/src/main/java/bjc/utils/funcdata/ITree.java b/BJC-Utils2/src/main/java/bjc/utils/funcdata/ITree.java index 026f3f8..e0c63e3 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/funcdata/ITree.java +++ b/BJC-Utils2/src/main/java/bjc/utils/funcdata/ITree.java @@ -43,7 +43,7 @@ public interface ITree<ContainedType> { */ public <NewType, ReturnedType> ReturnedType collapse( Function<ContainedType, NewType> leafTransform, - Function<ContainedType, Function<IFunctionalList<NewType>, NewType>> nodeCollapser, + Function<ContainedType, Function<IList<NewType>, NewType>> nodeCollapser, Function<NewType, ReturnedType> resultTransformer); /** diff --git a/BJC-Utils2/src/main/java/bjc/utils/funcdata/PushdownMap.java b/BJC-Utils2/src/main/java/bjc/utils/funcdata/PushdownMap.java index cc31923..ed9aa63 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/funcdata/PushdownMap.java +++ b/BJC-Utils2/src/main/java/bjc/utils/funcdata/PushdownMap.java @@ -13,7 +13,7 @@ import java.util.function.Function; * @param <ValueType> */ public class PushdownMap<KeyType, ValueType> - implements IFunctionalMap<KeyType, ValueType> { + implements IMap<KeyType, ValueType> { @Override public boolean containsKey(KeyType key) { @@ -22,7 +22,7 @@ public class PushdownMap<KeyType, ValueType> } @Override - public IFunctionalMap<KeyType, ValueType> extend() { + public IMap<KeyType, ValueType> extend() { // TODO Auto-generated method stub return null; } @@ -58,13 +58,13 @@ public class PushdownMap<KeyType, ValueType> } @Override - public IFunctionalList<KeyType> keyList() { + public IList<KeyType> keyList() { // TODO Auto-generated method stub return null; } @Override - public <V2> IFunctionalMap<KeyType, V2> mapValues( + public <V2> IMap<KeyType, V2> mapValues( Function<ValueType, V2> transformer) { // TODO Auto-generated method stub return null; @@ -83,7 +83,7 @@ public class PushdownMap<KeyType, ValueType> } @Override - public IFunctionalList<ValueType> valueList() { + public IList<ValueType> valueList() { // TODO Auto-generated method stub return null; } diff --git a/BJC-Utils2/src/main/java/bjc/utils/funcdata/TransformedValueMap.java b/BJC-Utils2/src/main/java/bjc/utils/funcdata/TransformedValueMap.java index 1d52d82..cf54935 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/funcdata/TransformedValueMap.java +++ b/BJC-Utils2/src/main/java/bjc/utils/funcdata/TransformedValueMap.java @@ -17,11 +17,11 @@ import java.util.function.Function; * The type of the transformed values */ final class TransformedValueMap<OldKey, OldValue, NewValue> - implements IFunctionalMap<OldKey, NewValue> { - private IFunctionalMap<OldKey, OldValue> mapToTransform; + implements IMap<OldKey, NewValue> { + private IMap<OldKey, OldValue> mapToTransform; private Function<OldValue, NewValue> transformer; - public TransformedValueMap(IFunctionalMap<OldKey, OldValue> destMap, + public TransformedValueMap(IMap<OldKey, OldValue> destMap, Function<OldValue, NewValue> transform) { mapToTransform = destMap; transformer = transform; @@ -33,7 +33,7 @@ final class TransformedValueMap<OldKey, OldValue, NewValue> } @Override - public IFunctionalMap<OldKey, NewValue> extend() { + public IMap<OldKey, NewValue> extend() { return new ExtendedMap<>(this, new FunctionalMap<>()); } @@ -67,12 +67,12 @@ final class TransformedValueMap<OldKey, OldValue, NewValue> } @Override - public IFunctionalList<OldKey> keyList() { + public IList<OldKey> keyList() { return mapToTransform.keyList(); } @Override - public <MappedValue> IFunctionalMap<OldKey, MappedValue> mapValues( + public <MappedValue> IMap<OldKey, MappedValue> mapValues( Function<NewValue, MappedValue> transform) { return new TransformedValueMap<>(this, transform); } @@ -94,7 +94,7 @@ final class TransformedValueMap<OldKey, OldValue, NewValue> } @Override - public IFunctionalList<NewValue> valueList() { + public IList<NewValue> valueList() { return mapToTransform.valueList().map(transformer); } }
\ No newline at end of file diff --git a/BJC-Utils2/src/main/java/bjc/utils/funcdata/Tree.java b/BJC-Utils2/src/main/java/bjc/utils/funcdata/Tree.java index 4ddcd45..34b70d5 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/funcdata/Tree.java +++ b/BJC-Utils2/src/main/java/bjc/utils/funcdata/Tree.java @@ -17,7 +17,7 @@ import bjc.utils.funcutils.StringUtils; */ public class Tree<ContainedType> implements ITree<ContainedType> { private ContainedType data; - private IFunctionalList<ITree<ContainedType>> children; + private IList<ITree<ContainedType>> children; private boolean hasChildren; @@ -44,7 +44,7 @@ public class Tree<ContainedType> implements ITree<ContainedType> { * A list of children for this node */ public Tree(ContainedType leafToken, - IFunctionalList<ITree<ContainedType>> childrn) { + IList<ITree<ContainedType>> childrn) { data = leafToken; hasChildren = true; @@ -95,7 +95,7 @@ public class Tree<ContainedType> implements ITree<ContainedType> { @Override public <NewType, ReturnedType> ReturnedType collapse( Function<ContainedType, NewType> leafTransform, - Function<ContainedType, Function<IFunctionalList<NewType>, NewType>> nodeCollapser, + Function<ContainedType, Function<IList<NewType>, NewType>> nodeCollapser, Function<NewType, ReturnedType> resultTransformer) { return resultTransformer @@ -129,12 +129,12 @@ public class Tree<ContainedType> implements ITree<ContainedType> { protected <NewType> NewType internalCollapse( Function<ContainedType, NewType> leafTransform, - Function<ContainedType, Function<IFunctionalList<NewType>, NewType>> nodeCollapser) { + Function<ContainedType, Function<IList<NewType>, NewType>> nodeCollapser) { if (hasChildren) { - Function<IFunctionalList<NewType>, NewType> nodeTransformer = nodeCollapser + Function<IList<NewType>, NewType> nodeTransformer = nodeCollapser .apply(data); - IFunctionalList<NewType> collapsedChildren = children + IList<NewType> collapsedChildren = children .map((child) -> { return child.collapse(leafTransform, nodeCollapser, (subTreeVal) -> subTreeVal); @@ -169,7 +169,7 @@ public class Tree<ContainedType> implements ITree<ContainedType> { Function<ContainedType, MappedType> leafTransformer, Function<ContainedType, MappedType> operatorTransformer) { if (hasChildren) { - IFunctionalList<ITree<MappedType>> mappedChildren = children + IList<ITree<MappedType>> mappedChildren = children .map((child) -> { return child.rebuildTree(leafTransformer, operatorTransformer); @@ -279,7 +279,7 @@ public class Tree<ContainedType> implements ITree<ContainedType> { public <MappedType> ITree<MappedType> transformTree( Function<ContainedType, MappedType> transformer) { if (hasChildren) { - IFunctionalList<ITree<MappedType>> transformedChildren = children + IList<ITree<MappedType>> transformedChildren = children .map((child) -> child.transformTree(transformer)); return new Tree<>(transformer.apply(data), diff --git a/BJC-Utils2/src/main/java/bjc/utils/funcdata/bst/BinarySearchTree.java b/BJC-Utils2/src/main/java/bjc/utils/funcdata/bst/BinarySearchTree.java index 712f0e3..9cfc9a4 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/funcdata/bst/BinarySearchTree.java +++ b/BJC-Utils2/src/main/java/bjc/utils/funcdata/bst/BinarySearchTree.java @@ -6,7 +6,7 @@ import java.util.List; import java.util.function.Predicate; import bjc.utils.funcdata.FunctionalList; -import bjc.utils.funcdata.IFunctionalList; +import bjc.utils.funcdata.IList; /** * A binary search tree, with some mild support for functional traversal. @@ -74,7 +74,7 @@ public class BinarySearchTree<T> { * The distance from the pivot * @return Whether the adjusted pivot is with the list */ - private boolean adjustedPivotInBounds(IFunctionalList<T> elements, + private boolean adjustedPivotInBounds(IList<T> elements, int pivot, int pivotAdjustment) { return (pivot - pivotAdjustment) >= 0 && (pivot + pivotAdjustment) < elements.getSize(); @@ -85,7 +85,7 @@ public class BinarySearchTree<T> { * time, but also O(N) space. */ public void balance() { - IFunctionalList<T> elements = new FunctionalList<>(); + IList<T> elements = new FunctionalList<>(); // Add each element to the list in sorted order rootElement.forEach(TreeLinearizationMethod.INORDER, |
