summaryrefslogtreecommitdiff
path: root/BJC-Utils2/src/main/java/bjc
diff options
context:
space:
mode:
authorbculkin2442 <bjculkin@mix.wvu.edu>2016-04-22 14:29:05 -0400
committerbculkin2442 <bjculkin@mix.wvu.edu>2016-04-22 14:29:05 -0400
commitb65b705c391bb772bc41269bce5243c1cc88969d (patch)
tree504ab01aa5faff923a3b278843c41059a4ca2a95 /BJC-Utils2/src/main/java/bjc
parente5c81a00b31a12933cf06aaeb94877dceb3ef8dd (diff)
Formatting changes
Diffstat (limited to 'BJC-Utils2/src/main/java/bjc')
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/components/ComponentDescriptionFileParser.java13
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/components/ComponentDescriptionState.java2
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/components/FileComponentRepository.java36
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/configuration/ConfigFile.java2
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/data/BoundLazyPair.java12
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/data/IPair.java9
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/data/LazyPair.java4
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/data/Pair.java4
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/exceptions/FileNotChosenException.java2
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/exceptions/PragmaFormatException.java6
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/funcdata/FunctionalList.java38
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/funcdata/IFunctionalList.java16
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/funcdata/ITree.java4
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/funcdata/bst/BinarySearchTree.java2
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/funcdata/bst/BinarySearchTreeNode.java5
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/funcdata/bst/TreeLinearizationMethod.java8
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/funcutils/FuncUtils.java15
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/funcutils/FunctionalFileVisitor.java7
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/funcutils/GroupPartIteration.java6
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/funcutils/ListUtils.java33
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/funcutils/StringUtils.java3
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/funcutils/TokenDeaffixer.java4
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/funcutils/TokenSplitter.java10
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/graph/AdjacencyMap.java4
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/graph/Graph.java8
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/gui/ExtensionFileFilter.java3
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/gui/ListParameterPanel.java8
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/gui/awt/SimpleFileDialog.java8
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/parserutils/RuleBasedConfigReader.java4
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/parserutils/ShuntingYard.java10
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/parserutils/TokenTransformer.java9
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/parserutils/TreeConstructor.java4
32 files changed, 152 insertions, 147 deletions
diff --git a/BJC-Utils2/src/main/java/bjc/utils/components/ComponentDescriptionFileParser.java b/BJC-Utils2/src/main/java/bjc/utils/components/ComponentDescriptionFileParser.java
index eec3fa8..52ab0b3 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/components/ComponentDescriptionFileParser.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/components/ComponentDescriptionFileParser.java
@@ -50,8 +50,8 @@ public class ComponentDescriptionFileParser {
try {
state.setVersion(Integer.parseInt(token));
} catch (NumberFormatException nfex) {
- PragmaFormatException pfex =
- new PragmaFormatException("Argument " + token
+ PragmaFormatException pfex = new PragmaFormatException(
+ "Argument " + token
+ " to version pragma isn't a valid integer. "
+ "This pragma requires a integer argument");
@@ -62,9 +62,8 @@ public class ComponentDescriptionFileParser {
});
}
- private static
- BiConsumer<FunctionalStringTokenizer, ComponentDescriptionState>
- buildStringCollapserPragma(String pragmaName) {
+ private static BiConsumer<FunctionalStringTokenizer, ComponentDescriptionState> buildStringCollapserPragma(
+ String pragmaName) {
return (tokenizer, state) -> {
if (!tokenizer.hasMoreTokens()) {
throw new PragmaFormatException("Pragma " + pragmaName
@@ -83,8 +82,8 @@ public class ComponentDescriptionFileParser {
* The stream to parse from
* @return The description parsed from the stream
*/
- public static ComponentDescription
- fromStream(InputStream inputSource) {
+ public static ComponentDescription fromStream(
+ InputStream inputSource) {
ComponentDescriptionState readState = reader
.fromStream(inputSource, new ComponentDescriptionState());
diff --git a/BJC-Utils2/src/main/java/bjc/utils/components/ComponentDescriptionState.java b/BJC-Utils2/src/main/java/bjc/utils/components/ComponentDescriptionState.java
index 52a1999..7d91c84 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/components/ComponentDescriptionState.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/components/ComponentDescriptionState.java
@@ -8,7 +8,7 @@ package bjc.utils.components;
*/
public class ComponentDescriptionState {
private String name;
-
+
private String description;
private String author;
diff --git a/BJC-Utils2/src/main/java/bjc/utils/components/FileComponentRepository.java b/BJC-Utils2/src/main/java/bjc/utils/components/FileComponentRepository.java
index 53219fb..8b0d303 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/components/FileComponentRepository.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/components/FileComponentRepository.java
@@ -7,9 +7,6 @@ import java.nio.file.attribute.BasicFileAttributes;
import java.util.function.BiPredicate;
import java.util.function.Function;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
import bjc.utils.data.IHolder;
import bjc.utils.data.Identity;
import bjc.utils.funcdata.FunctionalList;
@@ -18,6 +15,9 @@ import bjc.utils.funcdata.IFunctionalList;
import bjc.utils.funcdata.IFunctionalMap;
import bjc.utils.funcutils.FileUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
/**
* A component repository that loads its components from files in a
* directory
@@ -30,8 +30,8 @@ import bjc.utils.funcutils.FileUtils;
public class FileComponentRepository<E extends IDescribedComponent>
implements IComponentRepository<E> {
- private static final Logger CLASS_LOGGER =
- LoggerFactory.getLogger(FileComponentRepository.class);
+ private static final Logger CLASS_LOGGER = LoggerFactory
+ .getLogger(FileComponentRepository.class);
/**
* The internal storage of components
@@ -70,19 +70,19 @@ public class FileComponentRepository<E extends IDescribedComponent>
IHolder<Boolean> isFirstDir = new Identity<>(true);
- BiPredicate<Path, BasicFileAttributes> firstLevelTraverser =
- (pth, attr) -> {
- if (attr.isDirectory() && !isFirstDir.getValue()) {
- // Don't skip the first directory, that's the
- // parent
- isFirstDir.replace(false);
- // Skip directories, they probably have
- // component
- return false;
- }
-
- return true;
- };
+ BiPredicate<Path, BasicFileAttributes> firstLevelTraverser = (pth,
+ attr) -> {
+ if (attr.isDirectory() && !isFirstDir.getValue()) {
+ // Don't skip the first directory, that's the
+ // parent
+ isFirstDir.replace(false);
+ // Skip directories, they probably have
+ // component
+ return false;
+ }
+
+ return true;
+ };
try {
FileUtils.traverseDirectory(sourceDirectory,
diff --git a/BJC-Utils2/src/main/java/bjc/utils/configuration/ConfigFile.java b/BJC-Utils2/src/main/java/bjc/utils/configuration/ConfigFile.java
index 9358419..6533023 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/configuration/ConfigFile.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/configuration/ConfigFile.java
@@ -79,7 +79,7 @@ public class ConfigFile {
}
scn.close();
-
+
return returnedFile;
}
diff --git a/BJC-Utils2/src/main/java/bjc/utils/data/BoundLazyPair.java b/BJC-Utils2/src/main/java/bjc/utils/data/BoundLazyPair.java
index 40c502c..634f2bd 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/data/BoundLazyPair.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/data/BoundLazyPair.java
@@ -60,8 +60,8 @@ class BoundLazyPair<OldLeft, OldRight, NewLeft, NewRight>
@Override
public <BoundLeft, BoundRight> IPair<BoundLeft, BoundRight> bind(
BiFunction<NewLeft, NewRight, IPair<BoundLeft, BoundRight>> bindr) {
- IHolder<IPair<NewLeft, NewRight>> newPair =
- new Identity<>(boundPair);
+ IHolder<IPair<NewLeft, NewRight>> newPair = new Identity<>(
+ boundPair);
IHolder<Boolean> newPairMade = new Identity<>(pairBound);
Supplier<NewLeft> leftSupp = () -> {
@@ -90,11 +90,11 @@ class BoundLazyPair<OldLeft, OldRight, NewLeft, NewRight>
}
@Override
- public <MergedType> MergedType
- merge(BiFunction<NewLeft, NewRight, MergedType> merger) {
+ public <MergedType> MergedType merge(
+ BiFunction<NewLeft, NewRight, MergedType> merger) {
if (!pairBound) {
- boundPair =
- binder.apply(leftSupplier.get(), rightSupplier.get());
+ boundPair = binder.apply(leftSupplier.get(),
+ rightSupplier.get());
pairBound = true;
}
diff --git a/BJC-Utils2/src/main/java/bjc/utils/data/IPair.java b/BJC-Utils2/src/main/java/bjc/utils/data/IPair.java
index 3d4998c..ce38d60 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/data/IPair.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/data/IPair.java
@@ -84,13 +84,16 @@ public interface IPair<LeftType, RightType> {
}
/**
- * Immediately perfom the specified action with the contents of this pair
- * @param consumer The action to perform on the pair
+ * Immediately perfom the specified action with the contents of this
+ * pair
+ *
+ * @param consumer
+ * The action to perform on the pair
*/
public default void doWith(BiConsumer<LeftType, RightType> consumer) {
merge((leftValue, rightValue) -> {
consumer.accept(leftValue, rightValue);
-
+
return null;
});
}
diff --git a/BJC-Utils2/src/main/java/bjc/utils/data/LazyPair.java b/BJC-Utils2/src/main/java/bjc/utils/data/LazyPair.java
index 7ae5e96..d69a7bb 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/data/LazyPair.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/data/LazyPair.java
@@ -93,8 +93,8 @@ public class LazyPair<LeftType, RightType>
}
@Override
- public <MergedType> MergedType
- merge(BiFunction<LeftType, RightType, MergedType> merger) {
+ public <MergedType> MergedType merge(
+ BiFunction<LeftType, RightType, MergedType> merger) {
if (!leftMaterialized) {
leftValue = leftSupplier.get();
diff --git a/BJC-Utils2/src/main/java/bjc/utils/data/Pair.java b/BJC-Utils2/src/main/java/bjc/utils/data/Pair.java
index 94affd0..66c50de 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/data/Pair.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/data/Pair.java
@@ -56,8 +56,8 @@ public class Pair<LeftType, RightType>
}
@Override
- public <MergedType> MergedType
- merge(BiFunction<LeftType, RightType, MergedType> merger) {
+ public <MergedType> MergedType merge(
+ BiFunction<LeftType, RightType, MergedType> merger) {
return merger.apply(leftValue, rightValue);
}
diff --git a/BJC-Utils2/src/main/java/bjc/utils/exceptions/FileNotChosenException.java b/BJC-Utils2/src/main/java/bjc/utils/exceptions/FileNotChosenException.java
index 50a2e60..1fb3dc4 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/exceptions/FileNotChosenException.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/exceptions/FileNotChosenException.java
@@ -9,7 +9,7 @@ import java.io.IOException;
*
*/
public class FileNotChosenException extends IOException {
- // Version ID for serialization
+ // Version ID for serialization
private static final long serialVersionUID = -8753348705210831096L;
/**
diff --git a/BJC-Utils2/src/main/java/bjc/utils/exceptions/PragmaFormatException.java b/BJC-Utils2/src/main/java/bjc/utils/exceptions/PragmaFormatException.java
index 3d7187e..93225e1 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/exceptions/PragmaFormatException.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/exceptions/PragmaFormatException.java
@@ -14,12 +14,14 @@ public class PragmaFormatException extends InputMismatchException {
/**
* Create a new exception with the given message
- * @param message The message to explain why the exception was thrown
+ *
+ * @param message
+ * The message to explain why the exception was thrown
*/
public PragmaFormatException(String message) {
super(message);
}
-
+
/**
* Create a new exception
*/
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<E> implements Cloneable, IFunctionalList<E> {
// Get the iterator for the other list
Iterator<T> rightIterator = rightList.toIterable().iterator();
- for (Iterator<E> leftIterator =
- wrappedList.iterator(); leftIterator.hasNext()
+ for (Iterator<E> 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<E> implements Cloneable, IFunctionalList<E> {
* Function)
*/
@Override
- public <T> IFunctionalList<T>
- flatMap(Function<E, IFunctionalList<T>> elementExpander) {
+ public <T> IFunctionalList<T> flatMap(
+ Function<E, IFunctionalList<T>> elementExpander) {
if (elementExpander == null) {
throw new NullPointerException("Expander must not be null");
}
- IFunctionalList<T> returnedList =
- new FunctionalList<>(this.wrappedList.size());
+ IFunctionalList<T> returnedList = new FunctionalList<>(
+ this.wrappedList.size());
forEach(element -> {
- IFunctionalList<T> expandedElement =
- elementExpander.apply(element);
+ IFunctionalList<T> expandedElement = elementExpander
+ .apply(element);
if (expandedElement == null) {
throw new NullPointerException(
@@ -370,8 +369,8 @@ public class FunctionalList<E> implements Cloneable, IFunctionalList<E> {
throw new NullPointerException("Transformer must be not null");
}
- IFunctionalList<T> returnedList =
- new FunctionalList<>(this.wrappedList.size());
+ IFunctionalList<T> returnedList = new FunctionalList<>(
+ this.wrappedList.size());
forEach(element -> {
// Add the transformed item to the result
@@ -388,8 +387,8 @@ public class FunctionalList<E> implements Cloneable, IFunctionalList<E> {
* IFunctionalList)
*/
@Override
- public <T> IFunctionalList<IPair<E, T>>
- pairWith(IFunctionalList<T> rightList) {
+ public <T> IFunctionalList<IPair<E, T>> pairWith(
+ IFunctionalList<T> rightList) {
return combineWith(rightList, Pair<E, T>::new);
}
@@ -399,8 +398,8 @@ public class FunctionalList<E> implements Cloneable, IFunctionalList<E> {
* @see bjc.utils.funcdata.IFunctionalList#partition(int)
*/
@Override
- public IFunctionalList<IFunctionalList<E>>
- partition(int numberPerPartition) {
+ public IFunctionalList<IFunctionalList<E>> partition(
+ int numberPerPartition) {
if (numberPerPartition < 1
|| numberPerPartition > wrappedList.size()) {
throw new IllegalArgumentException("" + numberPerPartition
@@ -408,12 +407,11 @@ public class FunctionalList<E> implements Cloneable, IFunctionalList<E> {
+ wrappedList.size());
}
- IFunctionalList<IFunctionalList<E>> returnedList =
- new FunctionalList<>();
+ IFunctionalList<IFunctionalList<E>> returnedList = new FunctionalList<>();
// The current partition being filled
- IHolder<IFunctionalList<E>> currentPartition =
- new Identity<>(new FunctionalList<>());
+ IHolder<IFunctionalList<E>> 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<ContainedType> {
* The predicate to match by
* @return A list containing all elements that match the predicate
*/
- IFunctionalList<ContainedType>
- getMatching(Predicate<ContainedType> matchPredicate);
+ IFunctionalList<ContainedType> getMatching(
+ Predicate<ContainedType> matchPredicate);
/**
* Retrieve the size of the wrapped list
@@ -200,8 +200,8 @@ 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(Function<ContainedType, MappedType> elementTransformer);
+ <MappedType> IFunctionalList<MappedType> map(
+ Function<ContainedType, MappedType> elementTransformer);
/**
* Zip two lists into a list of pairs
@@ -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> IFunctionalList<IPair<ContainedType, OtherType>> pairWith(
+ IFunctionalList<OtherType> rightList);
/**
* Partition this list into a list of sublists
@@ -224,8 +224,8 @@ 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(int numberPerPartition);
+ IFunctionalList<IFunctionalList<ContainedType>> 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<ContainedType> {
* The function to use to transform tokens
* @return A tree with the token types transformed
*/
- public <MappedType> ITree<MappedType>
- transformTree(Function<ContainedType, MappedType> transformer);
+ public <MappedType> ITree<MappedType> transformTree(
+ Function<ContainedType, MappedType> 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<T> {
} 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
diff --git a/BJC-Utils2/src/main/java/bjc/utils/funcutils/FuncUtils.java b/BJC-Utils2/src/main/java/bjc/utils/funcutils/FuncUtils.java
index d89b7da..2119ed7 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/funcutils/FuncUtils.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/funcutils/FuncUtils.java
@@ -29,11 +29,16 @@ public class FuncUtils {
* Convert a binary function into a unary function that returns a
* function
*
- * @param <A> The initial type of the function
- * @param <B> The intermediate type of the function
- * @param <C> The terminal type of the function
- * @param func The function to transform
- * @return The function transformed into a unary function returning a function
+ * @param <A>
+ * The initial type of the function
+ * @param <B>
+ * The intermediate type of the function
+ * @param <C>
+ * The terminal type of the function
+ * @param func
+ * The function to transform
+ * @return The function transformed into a unary function returning a
+ * function
*/
public static <A, B, C> Function<A, Function<B, C>> curry2(
BiFunction<A, B, C> func) {
diff --git a/BJC-Utils2/src/main/java/bjc/utils/funcutils/FunctionalFileVisitor.java b/BJC-Utils2/src/main/java/bjc/utils/funcutils/FunctionalFileVisitor.java
index 6d3336a..2308d7c 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/funcutils/FunctionalFileVisitor.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/funcutils/FunctionalFileVisitor.java
@@ -7,8 +7,7 @@ import java.nio.file.SimpleFileVisitor;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.function.BiPredicate;
-final class FunctionalFileVisitor
- extends SimpleFileVisitor<Path> {
+final class FunctionalFileVisitor extends SimpleFileVisitor<Path> {
private BiPredicate<Path, BasicFileAttributes> traversalPredicate;
private BiPredicate<Path, BasicFileAttributes> traversalAction;
@@ -30,8 +29,8 @@ final class FunctionalFileVisitor
}
@Override
- public FileVisitResult visitFile(Path file,
- BasicFileAttributes attrs) throws IOException {
+ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs)
+ throws IOException {
if (traversalAction.test(file, attrs)) {
return FileVisitResult.CONTINUE;
}
diff --git a/BJC-Utils2/src/main/java/bjc/utils/funcutils/GroupPartIteration.java b/BJC-Utils2/src/main/java/bjc/utils/funcutils/GroupPartIteration.java
index 3837858..67cf4b1 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/funcutils/GroupPartIteration.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/funcutils/GroupPartIteration.java
@@ -15,8 +15,7 @@ import bjc.utils.funcdata.IFunctionalList;
* @param <E>
* The type of element in the list being partitioned
*/
-final class GroupPartIteration<E>
- implements Consumer<E> {
+final class GroupPartIteration<E> implements Consumer<E> {
private IFunctionalList<IFunctionalList<E>> returnedList;
private IHolder<IFunctionalList<E>> currentPartition;
private IFunctionalList<E> rejectedItems;
@@ -24,8 +23,7 @@ final class GroupPartIteration<E>
private int numberPerPartition;
private Function<E, Integer> elementCounter;
- public GroupPartIteration(
- IFunctionalList<IFunctionalList<E>> returned,
+ public GroupPartIteration(IFunctionalList<IFunctionalList<E>> returned,
IHolder<IFunctionalList<E>> currPart,
IFunctionalList<E> rejects, IHolder<Integer> numInCurrPart,
int nPerPart, Function<E, Integer> eleCount) {
diff --git a/BJC-Utils2/src/main/java/bjc/utils/funcutils/ListUtils.java b/BJC-Utils2/src/main/java/bjc/utils/funcutils/ListUtils.java
index 828f4c3..b0c30b3 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/funcutils/ListUtils.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/funcutils/ListUtils.java
@@ -53,14 +53,13 @@ public class ListUtils {
/*
* List that holds our results
*/
- IFunctionalList<IFunctionalList<E>> returnedList =
- new FunctionalList<>();
+ IFunctionalList<IFunctionalList<E>> returnedList = new FunctionalList<>();
/*
* List that holds current partition
*/
- IHolder<IFunctionalList<E>> currentPartition =
- new Identity<>(new FunctionalList<>());
+ IHolder<IFunctionalList<E>> currentPartition = new Identity<>(
+ new FunctionalList<>());
/*
* List that holds elements rejected during current pass
*/
@@ -74,10 +73,8 @@ public class ListUtils {
/*
* Run up to a certain number of passes
*/
- for (int numberOfIterations =
- 0; numberOfIterations < MAX_NTRIESPART
- && !rejectedElements
- .isEmpty(); numberOfIterations++) {
+ for (int numberOfIterations = 0; numberOfIterations < MAX_NTRIESPART
+ && !rejectedElements.isEmpty(); numberOfIterations++) {
input.forEach(new GroupPartIteration<>(returnedList,
currentPartition, rejectedElements,
numberInCurrentPartition, numberPerPartition,
@@ -125,8 +122,8 @@ public class ListUtils {
"Set of operators must not be null");
}
- IHolder<IFunctionalList<String>> returnedList =
- new Identity<>(input);
+ IHolder<IFunctionalList<String>> returnedList = new Identity<>(
+ input);
operators.forEach((operator) -> {
returnedList.transform((oldReturn) -> {
@@ -159,8 +156,8 @@ public class ListUtils {
"Set of operators must not be null");
}
- IHolder<IFunctionalList<String>> returnedList =
- new Identity<>(input);
+ IHolder<IFunctionalList<String>> returnedList = new Identity<>(
+ input);
operators.forEach((operator) -> returnedList
.transform((oldReturn) -> oldReturn.flatMap((token) -> {
@@ -236,8 +233,8 @@ public class ListUtils {
public static <E> IFunctionalList<E> drawWithReplacement(
IFunctionalList<E> list, int numberOfItems,
Function<Integer, Integer> rng) {
- IFunctionalList<E> selectedItems =
- new FunctionalList<>(new ArrayList<>(numberOfItems));
+ IFunctionalList<E> selectedItems = new FunctionalList<>(
+ new ArrayList<>(numberOfItems));
for (int i = 0; i < numberOfItems; i++) {
selectedItems.add(list.randItem(rng));
@@ -265,8 +262,8 @@ public class ListUtils {
public static <E> IFunctionalList<E> drawWithoutReplacement(
IFunctionalList<E> list, int numberOfItems,
Function<Integer, Integer> rng) {
- IFunctionalList<E> selectedItems =
- new FunctionalList<>(new ArrayList<>(numberOfItems));
+ IFunctionalList<E> selectedItems = new FunctionalList<>(
+ new ArrayList<>(numberOfItems));
int totalItems = list.getSize();
@@ -295,8 +292,8 @@ public class ListUtils {
* @return A list containing all the elements of the lists
*/
@SafeVarargs
- public static <E> IFunctionalList<E>
- mergeLists(IFunctionalList<E>... lists) {
+ public static <E> IFunctionalList<E> mergeLists(
+ IFunctionalList<E>... lists) {
IFunctionalList<E> returnedList = new FunctionalList<>();
for (IFunctionalList<E> list : lists) {
diff --git a/BJC-Utils2/src/main/java/bjc/utils/funcutils/StringUtils.java b/BJC-Utils2/src/main/java/bjc/utils/funcutils/StringUtils.java
index 1d1838e..728968e 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/funcutils/StringUtils.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/funcutils/StringUtils.java
@@ -74,7 +74,8 @@ public class StringUtils {
}
}
- public static <ContainedType> String printDeque(Deque<ContainedType> queuedTrees) {
+ public static <ContainedType> String printDeque(
+ Deque<ContainedType> queuedTrees) {
return queuedTrees.isEmpty() ? "(none)" : queuedTrees.toString();
}
}
diff --git a/BJC-Utils2/src/main/java/bjc/utils/funcutils/TokenDeaffixer.java b/BJC-Utils2/src/main/java/bjc/utils/funcutils/TokenDeaffixer.java
index 1cf5d44..9ea3596 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/funcutils/TokenDeaffixer.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/funcutils/TokenDeaffixer.java
@@ -5,8 +5,8 @@ import java.util.function.BiFunction;
import bjc.utils.funcdata.FunctionalList;
import bjc.utils.funcdata.IFunctionalList;
-final class TokenDeaffixer implements
- BiFunction<String, String, IFunctionalList<String>> {
+final class TokenDeaffixer
+ implements BiFunction<String, String, IFunctionalList<String>> {
private String token;
public TokenDeaffixer(String tok) {
diff --git a/BJC-Utils2/src/main/java/bjc/utils/funcutils/TokenSplitter.java b/BJC-Utils2/src/main/java/bjc/utils/funcutils/TokenSplitter.java
index 0da9f7d..68dde25 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/funcutils/TokenSplitter.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/funcutils/TokenSplitter.java
@@ -5,8 +5,8 @@ import java.util.function.BiFunction;
import bjc.utils.funcdata.FunctionalList;
import bjc.utils.funcdata.IFunctionalList;
-final class TokenSplitter implements
- BiFunction<String, String, IFunctionalList<String>> {
+final class TokenSplitter
+ implements BiFunction<String, String, IFunctionalList<String>> {
private String tokenToSplit;
public TokenSplitter(String tok) {
@@ -25,8 +25,7 @@ final class TokenSplitter implements
}
if (tokenToSplit.contains(operatorName)) {
- if (StringUtils.containsOnly(tokenToSplit,
- operatorRegex)) {
+ if (StringUtils.containsOnly(tokenToSplit, operatorRegex)) {
return new FunctionalList<>(tokenToSplit);
}
@@ -39,8 +38,7 @@ final class TokenSplitter implements
splitTokens.forEachIndexed((tokenIndex, token) -> {
- if (tokenIndex != tokenExpansionSize
- && tokenIndex != 0) {
+ if (tokenIndex != tokenExpansionSize && tokenIndex != 0) {
result.add(operatorName);
result.add(token);
} else {
diff --git a/BJC-Utils2/src/main/java/bjc/utils/graph/AdjacencyMap.java b/BJC-Utils2/src/main/java/bjc/utils/graph/AdjacencyMap.java
index 8386474..32d3b34 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/graph/AdjacencyMap.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/graph/AdjacencyMap.java
@@ -5,6 +5,7 @@ import java.io.OutputStream;
import java.io.PrintStream;
import java.util.InputMismatchException;
import java.util.Scanner;
+
import bjc.utils.data.IHolder;
import bjc.utils.data.Identity;
import bjc.utils.funcdata.FunctionalList;
@@ -118,8 +119,7 @@ public class AdjacencyMap<T> {
/**
* The backing storage of the map
*/
- private IFunctionalMap<T, IFunctionalMap<T, Integer>> adjacencyMap =
- new FunctionalMap<>();
+ private IFunctionalMap<T, IFunctionalMap<T, Integer>> adjacencyMap = new FunctionalMap<>();
/**
* Create a new map from a set of vertices
diff --git a/BJC-Utils2/src/main/java/bjc/utils/graph/Graph.java b/BJC-Utils2/src/main/java/bjc/utils/graph/Graph.java
index d08c3f9..fbaf3f6 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/graph/Graph.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/graph/Graph.java
@@ -172,8 +172,8 @@ public class Graph<T> {
});
// Get the edge with the minimum distance
- IHolder<Edge<T>> minimumEdge =
- new Identity<>(availableEdges.poll());
+ IHolder<Edge<T>> minimumEdge = new Identity<>(
+ availableEdges.poll());
// Only consider edges where we haven't visited the target of
// the edge
@@ -254,8 +254,8 @@ public class Graph<T> {
* @return A adjacency map representing this graph
*/
public AdjacencyMap<T> toAdjacencyMap() {
- AdjacencyMap<T> adjacencyMap =
- new AdjacencyMap<>(backingGraph.keyList());
+ AdjacencyMap<T> adjacencyMap = new AdjacencyMap<>(
+ backingGraph.keyList());
backingGraph.forEach((key, value) -> {
value.forEach((targetKey, targetValue) -> {
diff --git a/BJC-Utils2/src/main/java/bjc/utils/gui/ExtensionFileFilter.java b/BJC-Utils2/src/main/java/bjc/utils/gui/ExtensionFileFilter.java
index 766b241..c020bac 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/gui/ExtensionFileFilter.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/gui/ExtensionFileFilter.java
@@ -1,9 +1,10 @@
package bjc.utils.gui;
import java.io.File;
-import javax.swing.filechooser.FileFilter;
import java.util.List;
+import javax.swing.filechooser.FileFilter;
+
import bjc.utils.funcdata.FunctionalList;
import bjc.utils.funcdata.IFunctionalList;
diff --git a/BJC-Utils2/src/main/java/bjc/utils/gui/ListParameterPanel.java b/BJC-Utils2/src/main/java/bjc/utils/gui/ListParameterPanel.java
index 956c535..b22f8f4 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/gui/ListParameterPanel.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/gui/ListParameterPanel.java
@@ -90,8 +90,8 @@ public class ListParameterPanel<E> extends JPanel {
if (addAction != null) {
addParam = new JButton("Add...");
addParam.addActionListener((event) -> {
- DefaultListModel<E> model =
- (DefaultListModel<E>) list.getModel();
+ DefaultListModel<E> model = (DefaultListModel<E>) list
+ .getModel();
model.addElement(addAction.get());
});
@@ -111,8 +111,8 @@ public class ListParameterPanel<E> extends JPanel {
if (removeAction != null) {
removeParam = new JButton("Remove...");
removeParam.addActionListener((event) -> {
- DefaultListModel<E> model =
- (DefaultListModel<E>) list.getModel();
+ DefaultListModel<E> model = (DefaultListModel<E>) list
+ .getModel();
removeAction.accept(model.remove(list.getSelectedIndex()));
});
diff --git a/BJC-Utils2/src/main/java/bjc/utils/gui/awt/SimpleFileDialog.java b/BJC-Utils2/src/main/java/bjc/utils/gui/awt/SimpleFileDialog.java
index 7617199..4e887f4 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/gui/awt/SimpleFileDialog.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/gui/awt/SimpleFileDialog.java
@@ -48,8 +48,8 @@ public class SimpleFileDialog {
throw new NullPointerException("Title must not be null");
}
- FileDialog fileDialog =
- new FileDialog(parent, title, FileDialog.LOAD);
+ FileDialog fileDialog = new FileDialog(parent, title,
+ FileDialog.LOAD);
if (extensions != null) {
FilenameFilter filter = new ExtensionFileFilter(extensions);
@@ -99,8 +99,8 @@ public class SimpleFileDialog {
throw new NullPointerException("Title must not be null");
}
- FileDialog fileDialog =
- new FileDialog(parent, title, FileDialog.SAVE);
+ FileDialog fileDialog = new FileDialog(parent, title,
+ FileDialog.SAVE);
if (extensions != null) {
FilenameFilter filter = new ExtensionFileFilter(extensions);
diff --git a/BJC-Utils2/src/main/java/bjc/utils/parserutils/RuleBasedConfigReader.java b/BJC-Utils2/src/main/java/bjc/utils/parserutils/RuleBasedConfigReader.java
index c31066c..a2fc34b 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/parserutils/RuleBasedConfigReader.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/parserutils/RuleBasedConfigReader.java
@@ -115,8 +115,8 @@ public class RuleBasedConfigReader<E> {
}
private boolean startRule(E state, boolean ruleOpen, String line) {
- FunctionalStringTokenizer tokenizer =
- new FunctionalStringTokenizer(line, " ");
+ FunctionalStringTokenizer tokenizer = new FunctionalStringTokenizer(
+ line, " ");
String nextToken = tokenizer.nextToken();
diff --git a/BJC-Utils2/src/main/java/bjc/utils/parserutils/ShuntingYard.java b/BJC-Utils2/src/main/java/bjc/utils/parserutils/ShuntingYard.java
index 0e34b97..636bf31 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/parserutils/ShuntingYard.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/parserutils/ShuntingYard.java
@@ -107,7 +107,9 @@ public class ShuntingYard<E> {
/**
* Create a new shunting yard with a default set of operators
- * @param configureBasics Whether or not basic math operators should be provided
+ *
+ * @param configureBasics
+ * Whether or not basic math operators should be provided
*/
public ShuntingYard(boolean configureBasics) {
operators = new FunctionalMap<>();
@@ -157,9 +159,9 @@ public class ShuntingYard<E> {
return false;
}
- boolean hasHigherPrecedence =
- operators.get(rightOperator).getPrecedence() >= operators
- .get(leftOperator).getPrecedence();
+ boolean hasHigherPrecedence = operators.get(rightOperator)
+ .getPrecedence() >= operators.get(leftOperator)
+ .getPrecedence();
return hasHigherPrecedence;
}
diff --git a/BJC-Utils2/src/main/java/bjc/utils/parserutils/TokenTransformer.java b/BJC-Utils2/src/main/java/bjc/utils/parserutils/TokenTransformer.java
index c88763f..4727124 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/parserutils/TokenTransformer.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/parserutils/TokenTransformer.java
@@ -11,7 +11,6 @@ import bjc.utils.data.IPair;
import bjc.utils.data.Pair;
import bjc.utils.funcdata.ITree;
import bjc.utils.funcdata.Tree;
-import bjc.utils.funcutils.StringUtils;
final class TokenTransformer<T> implements Consumer<T> {
private final class OperatorHandler
@@ -23,15 +22,15 @@ final class TokenTransformer<T> implements Consumer<T> {
}
@Override
- public IPair<Deque<ITree<T>>, ITree<T>>
- apply(IPair<Deque<ITree<T>>, ITree<T>> pair) {
+ public IPair<Deque<ITree<T>>, ITree<T>> apply(
+ IPair<Deque<ITree<T>>, ITree<T>> pair) {
return pair.bind((queuedASTs, currentAST) -> {
return handleOperator(queuedASTs);
});
}
- private IPair<Deque<ITree<T>>, ITree<T>>
- handleOperator(Deque<ITree<T>> queuedASTs) {
+ private IPair<Deque<ITree<T>>, ITree<T>> handleOperator(
+ Deque<ITree<T>> queuedASTs) {
ITree<T> newAST;
if (isSpecialOperator.test(element)) {
diff --git a/BJC-Utils2/src/main/java/bjc/utils/parserutils/TreeConstructor.java b/BJC-Utils2/src/main/java/bjc/utils/parserutils/TreeConstructor.java
index 152d4d9..2d2a69e 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/parserutils/TreeConstructor.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/parserutils/TreeConstructor.java
@@ -76,8 +76,8 @@ public class TreeConstructor {
"Special operator determiner must not be null");
}
- IHolder<IPair<Deque<ITree<T>>, ITree<T>>> initialState =
- new Identity<>(new Pair<>(new LinkedList<>(), null));
+ IHolder<IPair<Deque<ITree<T>>, ITree<T>>> initialState = new Identity<>(
+ new Pair<>(new LinkedList<>(), null));
tokens.forEach(
new TokenTransformer<>(initialState, operatorPredicate,