summaryrefslogtreecommitdiff
path: root/src/main/java/bjc/funcdata
diff options
context:
space:
mode:
authorBen Culkin <scorpress@gmail.com>2020-12-03 19:21:38 -0500
committerBen Culkin <scorpress@gmail.com>2020-12-03 19:21:38 -0500
commit0a8f34c27c6ef93c5c94d17728af62c7607e225f (patch)
tree3bbbbb6d62649c7411e7ae3d53a75786255ed84e /src/main/java/bjc/funcdata
parent097a33bc2ecaa64a664550ddd62ccd8de47c51d0 (diff)
Rename types to match Java style
This renames several interfaces that had names like IWhatever, since that isn't a style that Java uses
Diffstat (limited to 'src/main/java/bjc/funcdata')
-rw-r--r--src/main/java/bjc/funcdata/ExtendedMap.java14
-rw-r--r--src/main/java/bjc/funcdata/Freezable.java (renamed from src/main/java/bjc/funcdata/IFreezable.java)2
-rw-r--r--src/main/java/bjc/funcdata/FunctionalList.java50
-rw-r--r--src/main/java/bjc/funcdata/FunctionalMap.java10
-rw-r--r--src/main/java/bjc/funcdata/FunctionalStringTokenizer.java6
-rw-r--r--src/main/java/bjc/funcdata/ListEx.java (renamed from src/main/java/bjc/funcdata/IList.java)22
-rw-r--r--src/main/java/bjc/funcdata/MapEx.java (renamed from src/main/java/bjc/funcdata/IMap.java)20
-rw-r--r--src/main/java/bjc/funcdata/ObjectFrozen.java2
-rw-r--r--src/main/java/bjc/funcdata/TransformedValueMap.java8
-rw-r--r--src/main/java/bjc/funcdata/bst/BinarySearchTree.java10
-rw-r--r--src/main/java/bjc/funcdata/bst/BinarySearchTreeLeaf.java2
-rw-r--r--src/main/java/bjc/funcdata/bst/BinarySearchTreeNode.java8
-rw-r--r--src/main/java/bjc/funcdata/bst/TreePart.java (renamed from src/main/java/bjc/funcdata/bst/ITreePart.java)2
13 files changed, 78 insertions, 78 deletions
diff --git a/src/main/java/bjc/funcdata/ExtendedMap.java b/src/main/java/bjc/funcdata/ExtendedMap.java
index 9638cdc..379ff65 100644
--- a/src/main/java/bjc/funcdata/ExtendedMap.java
+++ b/src/main/java/bjc/funcdata/ExtendedMap.java
@@ -15,11 +15,11 @@ import java.util.function.*;
* @param <ValueType>
* The type of the values of the map.
*/
-class ExtendedMap<KeyType, ValueType> implements IMap<KeyType, ValueType> {
+class ExtendedMap<KeyType, ValueType> implements MapEx<KeyType, ValueType> {
/* The map we delegate lookups to. */
- private final IMap<KeyType, ValueType> delegate;
+ private final MapEx<KeyType, ValueType> delegate;
/* The map we store things in. */
- private final IMap<KeyType, ValueType> store;
+ private final MapEx<KeyType, ValueType> store;
private boolean isFrozen = false;
private boolean thawEnabled = true;
@@ -33,8 +33,8 @@ class ExtendedMap<KeyType, ValueType> implements IMap<KeyType, ValueType> {
* @param store
* The map to store things in.
*/
- public ExtendedMap(final IMap<KeyType, ValueType> delegate,
- final IMap<KeyType, ValueType> store) {
+ public ExtendedMap(final MapEx<KeyType, ValueType> delegate,
+ final MapEx<KeyType, ValueType> store) {
this.delegate = delegate;
this.store = store;
}
@@ -71,8 +71,8 @@ class ExtendedMap<KeyType, ValueType> implements IMap<KeyType, ValueType> {
}
@Override
- public IList<KeyType> keyList() {
- IList<KeyType> ilst = new FunctionalList<>();
+ public ListEx<KeyType> keyList() {
+ ListEx<KeyType> ilst = new FunctionalList<>();
ilst.addAll(store.keyList());
ilst.addAll(delegate.keyList());
diff --git a/src/main/java/bjc/funcdata/IFreezable.java b/src/main/java/bjc/funcdata/Freezable.java
index abc7d6f..e83accb 100644
--- a/src/main/java/bjc/funcdata/IFreezable.java
+++ b/src/main/java/bjc/funcdata/Freezable.java
@@ -12,7 +12,7 @@ package bjc.funcdata;
*
* @author Ben Culkin
*/
-public interface IFreezable {
+public interface Freezable {
/**
* Freezes the internal state of this object, making it immutable.
*
diff --git a/src/main/java/bjc/funcdata/FunctionalList.java b/src/main/java/bjc/funcdata/FunctionalList.java
index 2cdfa27..f9c06a3 100644
--- a/src/main/java/bjc/funcdata/FunctionalList.java
+++ b/src/main/java/bjc/funcdata/FunctionalList.java
@@ -12,10 +12,10 @@ import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Predicate;
-import bjc.data.IHolder;
-import bjc.data.IPair;
-import bjc.data.Identity;
+import bjc.data.Holder;
import bjc.data.Pair;
+import bjc.data.Identity;
+import bjc.data.SimplePair;
/**
* A wrapper over another list that provides eager functional operations over
@@ -29,7 +29,7 @@ import bjc.data.Pair;
* @param <E>
* The type in this list
*/
-public class FunctionalList<E> implements Cloneable, IList<E> {
+public class FunctionalList<E> implements Cloneable, ListEx<E> {
/* The list used as a backing store */
private final List<E> wrapped;
@@ -65,7 +65,7 @@ public class FunctionalList<E> implements Cloneable, IList<E> {
* @return The returned list.
*/
@SafeVarargs
- public static <T> IList<T> listOf(final T... items) {
+ public static <T> ListEx<T> listOf(final T... items) {
return new FunctionalList<>(items);
}
@@ -137,8 +137,8 @@ public class FunctionalList<E> implements Cloneable, IList<E> {
* @return A copy of the list.
*/
@Override
- public IList<E> clone() {
- final IList<E> cloned = new FunctionalList<>();
+ public ListEx<E> clone() {
+ final ListEx<E> cloned = new FunctionalList<>();
for (final E element : wrapped) {
cloned.add(element);
@@ -148,7 +148,7 @@ public class FunctionalList<E> implements Cloneable, IList<E> {
}
@Override
- public <T, F> IList<F> combineWith(final IList<T> rightList,
+ public <T, F> ListEx<F> combineWith(final ListEx<T> rightList,
final BiFunction<E, T, F> itemCombiner) {
if (rightList == null) {
throw new NullPointerException("Target combine list must not be null");
@@ -156,7 +156,7 @@ public class FunctionalList<E> implements Cloneable, IList<E> {
throw new NullPointerException("Combiner must not be null");
}
- final IList<F> returned = new FunctionalList<>();
+ final ListEx<F> returned = new FunctionalList<>();
/* Get the iterator for the other list. */
final Iterator<T> rightIterator = rightList.toIterable().iterator();
@@ -222,14 +222,14 @@ public class FunctionalList<E> implements Cloneable, IList<E> {
}
@Override
- public <T> IList<T> flatMap(final Function<E, IList<T>> expander) {
+ public <T> ListEx<T> flatMap(final Function<E, ListEx<T>> expander) {
if (expander == null)
throw new NullPointerException("Expander must not be null");
- final IList<T> returned = new FunctionalList<>(this.wrapped.size());
+ final ListEx<T> returned = new FunctionalList<>(this.wrapped.size());
forEach(element -> {
- final IList<T> expandedElement = expander.apply(element);
+ final ListEx<T> expandedElement = expander.apply(element);
if (expandedElement == null)
throw new NullPointerException("Expander returned null list");
@@ -257,7 +257,7 @@ public class FunctionalList<E> implements Cloneable, IList<E> {
/*
* This is held b/c ref'd variables must be final/effectively final.
*/
- final IHolder<Integer> currentIndex = new Identity<>(0);
+ final Holder<Integer> currentIndex = new Identity<>(0);
wrapped.forEach(element -> {
/* Call the action with the index and the value. */
@@ -283,11 +283,11 @@ public class FunctionalList<E> implements Cloneable, IList<E> {
}
@Override
- public IList<E> getMatching(final Predicate<E> predicate) {
+ public ListEx<E> getMatching(final Predicate<E> predicate) {
if (predicate == null)
throw new NullPointerException("Predicate must not be null");
- final IList<E> returned = new FunctionalList<>();
+ final ListEx<E> returned = new FunctionalList<>();
wrapped.forEach(element -> {
if (predicate.test(element)) {
@@ -313,17 +313,17 @@ public class FunctionalList<E> implements Cloneable, IList<E> {
/* Check if a partition has room for another item. */
private Boolean isPartitionFull(final int numberPerPartition,
- final IHolder<IList<E>> currentPartition) {
+ final Holder<ListEx<E>> currentPartition) {
return currentPartition
.unwrap(partition -> partition.getSize() >= numberPerPartition);
}
@Override
- public <T> IList<T> map(final Function<E, T> elementTransformer) {
+ public <T> ListEx<T> map(final Function<E, T> elementTransformer) {
if (elementTransformer == null)
throw new NullPointerException("Transformer must be not null");
- final IList<T> returned = new FunctionalList<>(this.wrapped.size());
+ final ListEx<T> returned = new FunctionalList<>(this.wrapped.size());
forEach(element -> {
// Add the transformed item to the result
@@ -334,12 +334,12 @@ public class FunctionalList<E> implements Cloneable, IList<E> {
}
@Override
- public <T> IList<IPair<E, T>> pairWith(final IList<T> rightList) {
- return combineWith(rightList, Pair<E, T>::new);
+ public <T> ListEx<Pair<E, T>> pairWith(final ListEx<T> rightList) {
+ return combineWith(rightList, SimplePair<E, T>::new);
}
@Override
- public IList<IList<E>> partition(final int numberPerPartition) {
+ public ListEx<ListEx<E>> partition(final int numberPerPartition) {
if (numberPerPartition < 1 || numberPerPartition > wrapped.size()) {
final String fmt
= "%s is an invalid partition size. Must be between 1 and %d";
@@ -348,10 +348,10 @@ public class FunctionalList<E> implements Cloneable, IList<E> {
throw new IllegalArgumentException(msg);
}
- final IList<IList<E>> returned = new FunctionalList<>();
+ final ListEx<ListEx<E>> returned = new FunctionalList<>();
/* The current partition being filled. */
- final IHolder<IList<E>> currentPartition = new Identity<>(new FunctionalList<>());
+ final Holder<ListEx<E>> currentPartition = new Identity<>(new FunctionalList<>());
this.forEach(element -> {
if (isPartitionFull(numberPerPartition, currentPartition)) {
@@ -395,7 +395,7 @@ public class FunctionalList<E> implements Cloneable, IList<E> {
}
/* The current collapsed list. */
- final IHolder<T> currentState = new Identity<>(initialValue);
+ final Holder<T> currentState = new Identity<>(initialValue);
wrapped.forEach(element -> {
/* Accumulate a new value into the state. */
@@ -444,7 +444,7 @@ public class FunctionalList<E> implements Cloneable, IList<E> {
}
@Override
- public IList<E> tail() {
+ public ListEx<E> tail() {
return new FunctionalList<>(wrapped.subList(1, getSize()));
}
diff --git a/src/main/java/bjc/funcdata/FunctionalMap.java b/src/main/java/bjc/funcdata/FunctionalMap.java
index 3ab2598..3427a91 100644
--- a/src/main/java/bjc/funcdata/FunctionalMap.java
+++ b/src/main/java/bjc/funcdata/FunctionalMap.java
@@ -6,7 +6,7 @@ import java.util.function.*;
import bjc.data.*;
/**
- * Basic implementation of {@link IMap}
+ * Basic implementation of {@link MapEx}
*
* @author ben
*
@@ -16,7 +16,7 @@ import bjc.data.*;
* @param <ValueType>
* The type of the map's values.
*/
-public class FunctionalMap<KeyType, ValueType> implements IMap<KeyType, ValueType> {
+public class FunctionalMap<KeyType, ValueType> implements MapEx<KeyType, ValueType> {
/* Our backing store. */
private Map<KeyType, ValueType> wrappedMap;
@@ -35,10 +35,10 @@ public class FunctionalMap<KeyType, ValueType> implements IMap<KeyType, ValueTyp
* The entries to put into the map.
*/
@SafeVarargs
- public FunctionalMap(final IPair<KeyType, ValueType>... entries) {
+ public FunctionalMap(final Pair<KeyType, ValueType>... entries) {
this();
- for (final IPair<KeyType, ValueType> entry : entries) {
+ for (final Pair<KeyType, ValueType> entry : entries) {
entry.doWith(wrappedMap::put);
}
}
@@ -89,7 +89,7 @@ public class FunctionalMap<KeyType, ValueType> implements IMap<KeyType, ValueTyp
}
@Override
- public IList<KeyType> keyList() {
+ public ListEx<KeyType> keyList() {
final FunctionalList<KeyType> keys = new FunctionalList<>();
wrappedMap.keySet().forEach(keys::add);
diff --git a/src/main/java/bjc/funcdata/FunctionalStringTokenizer.java b/src/main/java/bjc/funcdata/FunctionalStringTokenizer.java
index 856c153..3344e05 100644
--- a/src/main/java/bjc/funcdata/FunctionalStringTokenizer.java
+++ b/src/main/java/bjc/funcdata/FunctionalStringTokenizer.java
@@ -128,7 +128,7 @@ public class FunctionalStringTokenizer {
*
* @return This tokenizer, converted into a list of strings.
*/
- public IList<String> toList() {
+ public ListEx<String> toList() {
return toList((final String element) -> element);
}
@@ -144,11 +144,11 @@ public class FunctionalStringTokenizer {
*
* @return A list containing all of the converted tokens.
*/
- public <E> IList<E> toList(final Function<String, E> transformer) {
+ public <E> ListEx<E> toList(final Function<String, E> transformer) {
if (transformer == null)
throw new NullPointerException("Transformer must not be null");
- final IList<E> returned = new FunctionalList<>();
+ final ListEx<E> returned = new FunctionalList<>();
/* Add each token to the list after transforming it. */
forEachToken(token -> {
diff --git a/src/main/java/bjc/funcdata/IList.java b/src/main/java/bjc/funcdata/ListEx.java
index 0ff8e30..164a71d 100644
--- a/src/main/java/bjc/funcdata/IList.java
+++ b/src/main/java/bjc/funcdata/ListEx.java
@@ -9,7 +9,7 @@ import java.util.function.Function;
import java.util.function.Predicate;
import java.util.stream.Collector;
-import bjc.data.IPair;
+import bjc.data.Pair;
import bjc.functypes.ID;
/**
@@ -20,7 +20,7 @@ import bjc.functypes.ID;
* @param <ContainedType>
* The type in this list
*/
-public interface IList<ContainedType> extends Iterable<ContainedType> {
+public interface ListEx<ContainedType> extends Iterable<ContainedType> {
/**
* Add an item to this list.
*
@@ -40,7 +40,7 @@ public interface IList<ContainedType> extends Iterable<ContainedType> {
* @return True if every item was successfully added to the list, false
* otherwise.
*/
- default boolean addAll(final IList<ContainedType> items) {
+ default boolean addAll(final ListEx<ContainedType> items) {
return items.map(this::add).anyMatch(bl -> bl == false);
}
@@ -136,7 +136,7 @@ public interface IList<ContainedType> extends Iterable<ContainedType> {
*
* @return A new list containing the merged pairs of lists.
*/
- <OtherType, CombinedType> IList<CombinedType> combineWith(IList<OtherType> list,
+ <OtherType, CombinedType> ListEx<CombinedType> combineWith(ListEx<OtherType> list,
BiFunction<ContainedType, OtherType, CombinedType> combiner);
/**
@@ -191,8 +191,8 @@ public interface IList<ContainedType> extends Iterable<ContainedType> {
* @return A new list containing the flattened results of applying the provided
* function.
*/
- <MappedType> IList<MappedType>
- flatMap(Function<ContainedType, IList<MappedType>> expander);
+ <MappedType> ListEx<MappedType>
+ flatMap(Function<ContainedType, ListEx<MappedType>> expander);
/**
* Apply a given action for each member of the list.
@@ -230,7 +230,7 @@ public interface IList<ContainedType> extends Iterable<ContainedType> {
*
* @return A list containing all elements that match the predicate.
*/
- IList<ContainedType> getMatching(Predicate<ContainedType> predicate);
+ ListEx<ContainedType> getMatching(Predicate<ContainedType> predicate);
/**
* Retrieve the size of the wrapped list.
@@ -259,7 +259,7 @@ public interface IList<ContainedType> extends Iterable<ContainedType> {
*
* @return A new list containing the mapped elements of this list.
*/
- <MappedType> IList<MappedType> map(Function<ContainedType, MappedType> transformer);
+ <MappedType> ListEx<MappedType> map(Function<ContainedType, MappedType> transformer);
/**
* Zip two lists into a list of pairs.
@@ -272,7 +272,7 @@ public interface IList<ContainedType> extends Iterable<ContainedType> {
*
* @return A list containing pairs of this element and the specified list.
*/
- <OtherType> IList<IPair<ContainedType, OtherType>> pairWith(IList<OtherType> list);
+ <OtherType> ListEx<Pair<ContainedType, OtherType>> pairWith(ListEx<OtherType> list);
/**
* Partition this list into a list of sublists.
@@ -285,7 +285,7 @@ public interface IList<ContainedType> extends Iterable<ContainedType> {
* partition may not be completely full if the size of the list is not a
* multiple of partitionSize.
*/
- IList<IList<ContainedType>> partition(int partitionSize);
+ ListEx<ListEx<ContainedType>> partition(int partitionSize);
/**
* Prepend an item to the list.
@@ -429,7 +429,7 @@ public interface IList<ContainedType> extends Iterable<ContainedType> {
*
* @return The list without the first element.
*/
- IList<ContainedType> tail();
+ ListEx<ContainedType> tail();
/**
* Convert this list into an array.
diff --git a/src/main/java/bjc/funcdata/IMap.java b/src/main/java/bjc/funcdata/MapEx.java
index ca9ef11..a7af4c5 100644
--- a/src/main/java/bjc/funcdata/IMap.java
+++ b/src/main/java/bjc/funcdata/MapEx.java
@@ -14,7 +14,7 @@ import java.util.function.*;
* @param <ValueType>
* The type of this map's values.
*/
-public interface IMap<KeyType, ValueType> extends IFreezable {
+public interface MapEx<KeyType, ValueType> extends Freezable {
/**
* Execute an action for each entry in the map.
*
@@ -86,7 +86,7 @@ public interface IMap<KeyType, ValueType> extends IFreezable {
default void clear() {
if (isFrozen()) throw new ObjectFrozen("Can't clear a frozen map");
- keyList().forEach(IMap.this::remove);
+ keyList().forEach(MapEx.this::remove);
}
/**
@@ -116,15 +116,15 @@ public interface IMap<KeyType, ValueType> extends IFreezable {
*
* @return A list of all the keys in this map.
*/
- IList<KeyType> keyList();
+ ListEx<KeyType> keyList();
/**
* Get a list of the values in this map.
*
* @return A list of values in this map.
*/
- default IList<ValueType> valueList() {
- final IList<ValueType> returns = new FunctionalList<>();
+ default ListEx<ValueType> valueList() {
+ final ListEx<ValueType> returns = new FunctionalList<>();
for (final KeyType key : keyList()) {
returns.add(get(key).orElse(null));
@@ -154,7 +154,7 @@ public interface IMap<KeyType, ValueType> extends IFreezable {
*
* @return The map where each value will be transformed after lookup.
*/
- default <V2> IMap<KeyType, V2> transform(final Function<ValueType, V2> transformer) {
+ default <V2> MapEx<KeyType, V2> transform(final Function<ValueType, V2> transformer) {
return new TransformedValueMap<>(this, transformer);
}
@@ -164,7 +164,7 @@ public interface IMap<KeyType, ValueType> extends IFreezable {
*
* @return An extended map.
*/
- default IMap<KeyType, ValueType> extend() {
+ default MapEx<KeyType, ValueType> extend() {
return extend(new FunctionalMap<>());
};
@@ -177,7 +177,7 @@ public interface IMap<KeyType, ValueType> extends IFreezable {
*
* @return An extended map, with the specified backing map.
*/
- default IMap<KeyType, ValueType> extend(IMap<KeyType, ValueType> backer) {
+ default MapEx<KeyType, ValueType> extend(MapEx<KeyType, ValueType> backer) {
return new ExtendedMap<>(this, backer);
};
@@ -200,10 +200,10 @@ public interface IMap<KeyType, ValueType> extends IFreezable {
* @throws IllegalArgumentException If you provide an incomplete pair of arguments.
*/
@SuppressWarnings("unchecked")
- static <KeyType2, ValueType2> IMap<KeyType2, ValueType2> of(Object... args) {
+ static <KeyType2, ValueType2> MapEx<KeyType2, ValueType2> of(Object... args) {
if (args.length % 2 != 0) throw new IllegalArgumentException("Args must be in the form of key-value pairs");
- IMap<KeyType2, ValueType2> map = new FunctionalMap<>();
+ MapEx<KeyType2, ValueType2> map = new FunctionalMap<>();
for (int index = 0; index < args.length; index += 2) {
KeyType2 key = (KeyType2) args[index];
ValueType2 value = (ValueType2) args[index + 1];
diff --git a/src/main/java/bjc/funcdata/ObjectFrozen.java b/src/main/java/bjc/funcdata/ObjectFrozen.java
index 2260a0e..a9f58b8 100644
--- a/src/main/java/bjc/funcdata/ObjectFrozen.java
+++ b/src/main/java/bjc/funcdata/ObjectFrozen.java
@@ -1,7 +1,7 @@
package bjc.funcdata;
/**
- * Exception that implementations of {@link IFreezable} can throw if you attempt
+ * Exception that implementations of {@link Freezable} can throw if you attempt
* to modify a frozen object.
*
* @author Ben Culkin
diff --git a/src/main/java/bjc/funcdata/TransformedValueMap.java b/src/main/java/bjc/funcdata/TransformedValueMap.java
index 1e0ef51..643f610 100644
--- a/src/main/java/bjc/funcdata/TransformedValueMap.java
+++ b/src/main/java/bjc/funcdata/TransformedValueMap.java
@@ -19,9 +19,9 @@ import java.util.function.*;
*
*/
final class TransformedValueMap<OldKey, OldValue, NewValue>
- implements IMap<OldKey, NewValue> {
+ implements MapEx<OldKey, NewValue> {
/* Our backing map. */
- private final IMap<OldKey, OldValue> backing;
+ private final MapEx<OldKey, OldValue> backing;
/* Our transforming function. */
private final Function<OldValue, NewValue> transformer;
@@ -37,7 +37,7 @@ final class TransformedValueMap<OldKey, OldValue, NewValue>
* @param transform
* The function to use for the transform.
*/
- public TransformedValueMap(final IMap<OldKey, OldValue> backingMap,
+ public TransformedValueMap(final MapEx<OldKey, OldValue> backingMap,
final Function<OldValue, NewValue> transform) {
backing = backingMap;
transformer = transform;
@@ -73,7 +73,7 @@ final class TransformedValueMap<OldKey, OldValue, NewValue>
}
@Override
- public IList<OldKey> keyList() {
+ public ListEx<OldKey> keyList() {
return backing.keyList();
}
diff --git a/src/main/java/bjc/funcdata/bst/BinarySearchTree.java b/src/main/java/bjc/funcdata/bst/BinarySearchTree.java
index 2c5b4d8..99b67cd 100644
--- a/src/main/java/bjc/funcdata/bst/BinarySearchTree.java
+++ b/src/main/java/bjc/funcdata/bst/BinarySearchTree.java
@@ -6,7 +6,7 @@ import java.util.List;
import java.util.function.Predicate;
import bjc.funcdata.FunctionalList;
-import bjc.funcdata.IList;
+import bjc.funcdata.ListEx;
/**
* A binary search tree, with some mild support for functional traversal.
@@ -24,7 +24,7 @@ public class BinarySearchTree<T> {
private int elementCount;
/* The root element of the tree */
- private ITreePart<T> root;
+ private TreePart<T> root;
/**
* Create a new tree using the specified way to compare elements.
@@ -66,7 +66,7 @@ public class BinarySearchTree<T> {
*
* @return Whether the adjusted pivot is with the list.
*/
- private boolean adjustedPivotInBounds(final IList<T> elements, final int pivot,
+ private boolean adjustedPivotInBounds(final ListEx<T> elements, final int pivot,
final int pivotAdjustment) {
return ((pivot - pivotAdjustment) >= 0)
&& ((pivot + pivotAdjustment) < elements.getSize());
@@ -78,7 +78,7 @@ public class BinarySearchTree<T> {
* Takes O(N) time, but also O(N) space.
*/
public void balance() {
- final IList<T> elements = new FunctionalList<>();
+ final ListEx<T> elements = new FunctionalList<>();
/* Add each element to the list in sorted order. */
root.forEach(TreeLinearizationMethod.INORDER, element -> elements.add(element));
@@ -135,7 +135,7 @@ public class BinarySearchTree<T> {
*
* @return The root of the tree.
*/
- public ITreePart<T> getRoot() {
+ public TreePart<T> getRoot() {
return root;
}
diff --git a/src/main/java/bjc/funcdata/bst/BinarySearchTreeLeaf.java b/src/main/java/bjc/funcdata/bst/BinarySearchTreeLeaf.java
index 0b99cad..9532555 100644
--- a/src/main/java/bjc/funcdata/bst/BinarySearchTreeLeaf.java
+++ b/src/main/java/bjc/funcdata/bst/BinarySearchTreeLeaf.java
@@ -13,7 +13,7 @@ import java.util.function.Predicate;
* @param <T>
* The data stored in the tree.
*/
-public class BinarySearchTreeLeaf<T> implements ITreePart<T> {
+public class BinarySearchTreeLeaf<T> implements TreePart<T> {
/** The data held in this tree leaf */
protected T data;
diff --git a/src/main/java/bjc/funcdata/bst/BinarySearchTreeNode.java b/src/main/java/bjc/funcdata/bst/BinarySearchTreeNode.java
index a73f81a..0eef92a 100644
--- a/src/main/java/bjc/funcdata/bst/BinarySearchTreeNode.java
+++ b/src/main/java/bjc/funcdata/bst/BinarySearchTreeNode.java
@@ -20,10 +20,10 @@ import java.util.function.Predicate;
*/
public class BinarySearchTreeNode<T> extends BinarySearchTreeLeaf<T> {
/* The left child of this node */
- private ITreePart<T> left;
+ private TreePart<T> left;
/* The right child of this node */
- private ITreePart<T> right;
+ private TreePart<T> right;
/**
* Create a new node with the specified data and children.
@@ -37,8 +37,8 @@ public class BinarySearchTreeNode<T> extends BinarySearchTreeLeaf<T> {
* @param rght
* The right child of this node.
*/
- public BinarySearchTreeNode(final T element, final ITreePart<T> lft,
- final ITreePart<T> rght) {
+ public BinarySearchTreeNode(final T element, final TreePart<T> lft,
+ final TreePart<T> rght) {
super(element);
this.left = lft;
this.right = rght;
diff --git a/src/main/java/bjc/funcdata/bst/ITreePart.java b/src/main/java/bjc/funcdata/bst/TreePart.java
index bac640d..b451463 100644
--- a/src/main/java/bjc/funcdata/bst/ITreePart.java
+++ b/src/main/java/bjc/funcdata/bst/TreePart.java
@@ -13,7 +13,7 @@ import java.util.function.Predicate;
* @param <T>
* The data contained in this part of the tree.
*/
-public interface ITreePart<T> {
+public interface TreePart<T> {
/**
* Add a element below this tree part somewhere.
*