From b65b705c391bb772bc41269bce5243c1cc88969d Mon Sep 17 00:00:00 2001 From: bculkin2442 Date: Fri, 22 Apr 2016 14:29:05 -0400 Subject: Formatting changes --- .../java/bjc/utils/funcdata/FunctionalList.java | 38 ++++++++++------------ .../java/bjc/utils/funcdata/IFunctionalList.java | 16 ++++----- .../src/main/java/bjc/utils/funcdata/ITree.java | 4 +-- .../bjc/utils/funcdata/bst/BinarySearchTree.java | 2 +- .../utils/funcdata/bst/BinarySearchTreeNode.java | 5 ++- .../funcdata/bst/TreeLinearizationMethod.java | 8 ++--- 6 files changed, 37 insertions(+), 36 deletions(-) (limited to 'BJC-Utils2/src/main/java/bjc/utils/funcdata') 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 735c664..c8f2269 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/funcdata/FunctionalList.java +++ b/BJC-Utils2/src/main/java/bjc/utils/funcdata/FunctionalList.java @@ -1,5 +1,6 @@ package bjc.utils.funcdata; +import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.Iterator; @@ -16,8 +17,6 @@ import bjc.utils.data.IPair; import bjc.utils.data.Identity; import bjc.utils.data.Pair; -import java.util.ArrayList; - /** * A wrapper over another list that provides eager functional operations * over it. Differs from a stream in every way except for the fact that @@ -182,8 +181,8 @@ public class FunctionalList implements Cloneable, IFunctionalList { // Get the iterator for the other list Iterator rightIterator = rightList.toIterable().iterator(); - for (Iterator leftIterator = - wrappedList.iterator(); leftIterator.hasNext() + for (Iterator leftIterator = wrappedList + .iterator(); leftIterator.hasNext() && rightIterator.hasNext();) { // Add the transformed items to the result list E leftVal = leftIterator.next(); @@ -228,18 +227,18 @@ public class FunctionalList implements Cloneable, IFunctionalList { * Function) */ @Override - public IFunctionalList - flatMap(Function> elementExpander) { + public IFunctionalList flatMap( + Function> elementExpander) { if (elementExpander == null) { throw new NullPointerException("Expander must not be null"); } - IFunctionalList returnedList = - new FunctionalList<>(this.wrappedList.size()); + IFunctionalList returnedList = new FunctionalList<>( + this.wrappedList.size()); forEach(element -> { - IFunctionalList expandedElement = - elementExpander.apply(element); + IFunctionalList expandedElement = elementExpander + .apply(element); if (expandedElement == null) { throw new NullPointerException( @@ -370,8 +369,8 @@ public class FunctionalList implements Cloneable, IFunctionalList { throw new NullPointerException("Transformer must be not null"); } - IFunctionalList returnedList = - new FunctionalList<>(this.wrappedList.size()); + IFunctionalList returnedList = new FunctionalList<>( + this.wrappedList.size()); forEach(element -> { // Add the transformed item to the result @@ -388,8 +387,8 @@ public class FunctionalList implements Cloneable, IFunctionalList { * IFunctionalList) */ @Override - public IFunctionalList> - pairWith(IFunctionalList rightList) { + public IFunctionalList> pairWith( + IFunctionalList rightList) { return combineWith(rightList, Pair::new); } @@ -399,8 +398,8 @@ public class FunctionalList implements Cloneable, IFunctionalList { * @see bjc.utils.funcdata.IFunctionalList#partition(int) */ @Override - public IFunctionalList> - partition(int numberPerPartition) { + public IFunctionalList> partition( + int numberPerPartition) { if (numberPerPartition < 1 || numberPerPartition > wrappedList.size()) { throw new IllegalArgumentException("" + numberPerPartition @@ -408,12 +407,11 @@ public class FunctionalList implements Cloneable, IFunctionalList { + wrappedList.size()); } - IFunctionalList> returnedList = - new FunctionalList<>(); + IFunctionalList> returnedList = new FunctionalList<>(); // The current partition being filled - IHolder> currentPartition = - new Identity<>(new FunctionalList<>()); + IHolder> currentPartition = new Identity<>( + new FunctionalList<>()); this.forEach((element) -> { if (isPartitionFull(numberPerPartition, currentPartition)) { diff --git a/BJC-Utils2/src/main/java/bjc/utils/funcdata/IFunctionalList.java b/BJC-Utils2/src/main/java/bjc/utils/funcdata/IFunctionalList.java index 2c5d2ae..3358da0 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/funcdata/IFunctionalList.java +++ b/BJC-Utils2/src/main/java/bjc/utils/funcdata/IFunctionalList.java @@ -172,8 +172,8 @@ public interface IFunctionalList { * The predicate to match by * @return A list containing all elements that match the predicate */ - IFunctionalList - getMatching(Predicate matchPredicate); + IFunctionalList getMatching( + Predicate matchPredicate); /** * Retrieve the size of the wrapped list @@ -200,8 +200,8 @@ public interface IFunctionalList { * The function to apply to each element in the list * @return A new list containing the mapped elements of this list. */ - IFunctionalList - map(Function elementTransformer); + IFunctionalList map( + Function elementTransformer); /** * Zip two lists into a list of pairs @@ -214,8 +214,8 @@ public interface IFunctionalList { * @return A list containing pairs of this element and the specified * list */ - IFunctionalList> - pairWith(IFunctionalList rightList); + IFunctionalList> pairWith( + IFunctionalList rightList); /** * Partition this list into a list of sublists @@ -224,8 +224,8 @@ public interface IFunctionalList { * The size of elements to put into each one of the sublists * @return A list partitioned into partitions of size nPerPart */ - IFunctionalList> - partition(int numberPerPartition); + IFunctionalList> partition( + int numberPerPartition); /** * Prepend an item to the list 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 866471c..026f3f8 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/funcdata/ITree.java +++ b/BJC-Utils2/src/main/java/bjc/utils/funcdata/ITree.java @@ -170,8 +170,8 @@ public interface ITree { * The function to use to transform tokens * @return A tree with the token types transformed */ - public ITree - transformTree(Function transformer); + public ITree transformTree( + Function transformer); /** * Perform an action on each part of the tree 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 6e9d14e..c147646 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 @@ -179,7 +179,7 @@ public class BinarySearchTree { } else if (traversalPredicate == null) { throw new NullPointerException("Predicate must not be nulls"); } - + rootElement.forEach(linearizationMethod, traversalPredicate); } diff --git a/BJC-Utils2/src/main/java/bjc/utils/funcdata/bst/BinarySearchTreeNode.java b/BJC-Utils2/src/main/java/bjc/utils/funcdata/bst/BinarySearchTreeNode.java index 58e07f7..371abd4 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/funcdata/bst/BinarySearchTreeNode.java +++ b/BJC-Utils2/src/main/java/bjc/utils/funcdata/bst/BinarySearchTreeNode.java @@ -1,6 +1,9 @@ package bjc.utils.funcdata.bst; -import static bjc.utils.funcdata.bst.DirectedWalkFunction.DirectedWalkResult.*; +import static bjc.utils.funcdata.bst.DirectedWalkFunction.DirectedWalkResult.FAILURE; +import static bjc.utils.funcdata.bst.DirectedWalkFunction.DirectedWalkResult.LEFT; +import static bjc.utils.funcdata.bst.DirectedWalkFunction.DirectedWalkResult.RIGHT; +import static bjc.utils.funcdata.bst.DirectedWalkFunction.DirectedWalkResult.SUCCESS; import java.util.Comparator; import java.util.function.BiFunction; diff --git a/BJC-Utils2/src/main/java/bjc/utils/funcdata/bst/TreeLinearizationMethod.java b/BJC-Utils2/src/main/java/bjc/utils/funcdata/bst/TreeLinearizationMethod.java index 6c15284..eedb189 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/funcdata/bst/TreeLinearizationMethod.java +++ b/BJC-Utils2/src/main/java/bjc/utils/funcdata/bst/TreeLinearizationMethod.java @@ -13,13 +13,13 @@ public enum TreeLinearizationMethod { */ INORDER, /** - * Visit the left side of this tree part, the right side, and then - * the tree part itself. + * Visit the left side of this tree part, the right side, and then the + * tree part itself. */ POSTORDER, /** - * Visit the tree part itself, then the left side of tthis tree - * part and then the right part. + * Visit the tree part itself, then the left side of tthis tree part + * and then the right part. */ PREORDER } \ No newline at end of file -- cgit v1.2.3