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/examples/BinarySearcher.java | 7 ++-- .../bjc/utils/examples/parsing/ShuntTester.java | 4 +-- .../utils/examples/parsing/TreeConstructTest.java | 19 +++++------ .../bjc/utils/examples/rangen/DiabloItemGen.java | 4 +-- .../examples/rangen/RandomStringExamples.java | 6 ++-- .../components/ComponentDescriptionFileParser.java | 13 ++++---- .../components/ComponentDescriptionState.java | 2 +- .../utils/components/FileComponentRepository.java | 36 ++++++++++---------- .../java/bjc/utils/configuration/ConfigFile.java | 2 +- .../main/java/bjc/utils/data/BoundLazyPair.java | 12 +++---- BJC-Utils2/src/main/java/bjc/utils/data/IPair.java | 9 +++-- .../src/main/java/bjc/utils/data/LazyPair.java | 4 +-- BJC-Utils2/src/main/java/bjc/utils/data/Pair.java | 4 +-- .../utils/exceptions/FileNotChosenException.java | 2 +- .../utils/exceptions/PragmaFormatException.java | 6 ++-- .../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 ++--- .../main/java/bjc/utils/funcutils/FuncUtils.java | 15 ++++++--- .../bjc/utils/funcutils/FunctionalFileVisitor.java | 7 ++-- .../bjc/utils/funcutils/GroupPartIteration.java | 6 ++-- .../main/java/bjc/utils/funcutils/ListUtils.java | 33 +++++++++---------- .../main/java/bjc/utils/funcutils/StringUtils.java | 3 +- .../java/bjc/utils/funcutils/TokenDeaffixer.java | 4 +-- .../java/bjc/utils/funcutils/TokenSplitter.java | 10 +++--- .../main/java/bjc/utils/graph/AdjacencyMap.java | 4 +-- .../src/main/java/bjc/utils/graph/Graph.java | 8 ++--- .../java/bjc/utils/gui/ExtensionFileFilter.java | 3 +- .../java/bjc/utils/gui/ListParameterPanel.java | 8 ++--- .../java/bjc/utils/gui/awt/SimpleFileDialog.java | 8 ++--- .../utils/parserutils/RuleBasedConfigReader.java | 4 +-- .../java/bjc/utils/parserutils/ShuntingYard.java | 10 +++--- .../bjc/utils/parserutils/TokenTransformer.java | 9 +++-- .../bjc/utils/parserutils/TreeConstructor.java | 4 +-- 37 files changed, 171 insertions(+), 168 deletions(-) diff --git a/BJC-Utils2/src/examples/java/bjc/utils/examples/BinarySearcher.java b/BJC-Utils2/src/examples/java/bjc/utils/examples/BinarySearcher.java index d3f55f6..f7c15b9 100644 --- a/BJC-Utils2/src/examples/java/bjc/utils/examples/BinarySearcher.java +++ b/BJC-Utils2/src/examples/java/bjc/utils/examples/BinarySearcher.java @@ -25,8 +25,8 @@ public class BinarySearcher { char command = ' '; - BinarySearchTree searchTree = - new BinarySearchTree<>((o1, o2) -> o1 - o2); + BinarySearchTree searchTree = new BinarySearchTree<>( + (o1, o2) -> o1 - o2); while (command != 'e') { System.out.print("Enter a command (m for help): "); @@ -128,8 +128,7 @@ public class BinarySearcher { break; case 'o': - linearizationMethod = - TreeLinearizationMethod.POSTORDER; + linearizationMethod = TreeLinearizationMethod.POSTORDER; break; default: diff --git a/BJC-Utils2/src/examples/java/bjc/utils/examples/parsing/ShuntTester.java b/BJC-Utils2/src/examples/java/bjc/utils/examples/parsing/ShuntTester.java index 6c1374e..9744653 100644 --- a/BJC-Utils2/src/examples/java/bjc/utils/examples/parsing/ShuntTester.java +++ b/BJC-Utils2/src/examples/java/bjc/utils/examples/parsing/ShuntTester.java @@ -27,8 +27,8 @@ public class ShuntTester { ShuntingYard yard = new ShuntingYard<>(true); - IFunctionalList shuntedTokens = - yard.postfix(new FunctionalStringTokenizer(line) + IFunctionalList shuntedTokens = yard + .postfix(new FunctionalStringTokenizer(line) .toList((strang) -> strang), (strang) -> strang); System.out.println(shuntedTokens.toString()); diff --git a/BJC-Utils2/src/examples/java/bjc/utils/examples/parsing/TreeConstructTest.java b/BJC-Utils2/src/examples/java/bjc/utils/examples/parsing/TreeConstructTest.java index 320c4a4..faeb3a6 100644 --- a/BJC-Utils2/src/examples/java/bjc/utils/examples/parsing/TreeConstructTest.java +++ b/BJC-Utils2/src/examples/java/bjc/utils/examples/parsing/TreeConstructTest.java @@ -61,8 +61,8 @@ public class TreeConstructTest { System.out.print("Enter a expression to parse: "); String line = inputSource.nextLine(); - IFunctionalList tokens = - new FunctionalStringTokenizer(line).toList(); + IFunctionalList tokens = new FunctionalStringTokenizer( + line).toList(); ShuntingYard yard = new ShuntingYard<>(true); @@ -75,8 +75,8 @@ public class TreeConstructTest { ops.add(new Pair<>(":=", ":=")); ops.add(new Pair<>("=>", "=>")); - IFunctionalList semiExpandedTokens = - ListUtils.splitTokens(tokens, ops); + IFunctionalList semiExpandedTokens = ListUtils + .splitTokens(tokens, ops); ops = new LinkedList<>(); @@ -85,13 +85,13 @@ public class TreeConstructTest { ops.add(new Pair<>("[", "\\[")); ops.add(new Pair<>("]", "\\]")); - IFunctionalList fullyExpandedTokens = - ListUtils.deAffixTokens(semiExpandedTokens, ops); + IFunctionalList fullyExpandedTokens = ListUtils + .deAffixTokens(semiExpandedTokens, ops); fullyExpandedTokens.removeIf((strang) -> strang.equals("")); - IFunctionalList shuntedTokens = - yard.postfix(fullyExpandedTokens, (token) -> token); + IFunctionalList shuntedTokens = yard + .postfix(fullyExpandedTokens, (token) -> token); System.out.println("Shunted: " + shuntedTokens.toString()); @@ -105,8 +105,7 @@ public class TreeConstructTest { return false; }; - IFunctionalMap>, ITree>> operators = - new FunctionalMap<>(); + IFunctionalMap>, ITree>> operators = new FunctionalMap<>(); operators.put("[", (queuedTrees) -> { return null; diff --git a/BJC-Utils2/src/examples/java/bjc/utils/examples/rangen/DiabloItemGen.java b/BJC-Utils2/src/examples/java/bjc/utils/examples/rangen/DiabloItemGen.java index 4a03a5b..09530ba 100644 --- a/BJC-Utils2/src/examples/java/bjc/utils/examples/rangen/DiabloItemGen.java +++ b/BJC-Utils2/src/examples/java/bjc/utils/examples/rangen/DiabloItemGen.java @@ -83,8 +83,8 @@ public class DiabloItemGen { addInfixRules(); for (int i = 0; i < 100; i++) { - IFunctionalList ls = - rules.generateListValues("", " "); + IFunctionalList ls = rules.generateListValues("", + " "); StringBuilder sb = new StringBuilder(); diff --git a/BJC-Utils2/src/examples/java/bjc/utils/examples/rangen/RandomStringExamples.java b/BJC-Utils2/src/examples/java/bjc/utils/examples/rangen/RandomStringExamples.java index 116e276..0d693d7 100644 --- a/BJC-Utils2/src/examples/java/bjc/utils/examples/rangen/RandomStringExamples.java +++ b/BJC-Utils2/src/examples/java/bjc/utils/examples/rangen/RandomStringExamples.java @@ -45,7 +45,8 @@ public class RandomStringExamples { ""); for (int i = 0; i < 10; i++) { - IFunctionalList ls = rg.generateListValues("", " "); + IFunctionalList ls = rg + .generateListValues("", " "); StringBuilder sb = new StringBuilder(); @@ -56,8 +57,7 @@ public class RandomStringExamples { } private static void addRule(String rule, String... cases) { - IFunctionalList> cses = - new FunctionalList<>(); + IFunctionalList> cses = new FunctionalList<>(); for (String strang : cases) { cses.add(FunctionalStringTokenizer.fromString(strang) 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 - buildStringCollapserPragma(String pragmaName) { + private static BiConsumer 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 implements IComponentRepository { - 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 IHolder isFirstDir = new Identity<>(true); - BiPredicate 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 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 @Override public IPair bind( BiFunction> bindr) { - IHolder> newPair = - new Identity<>(boundPair); + IHolder> newPair = new Identity<>( + boundPair); IHolder newPairMade = new Identity<>(pairBound); Supplier leftSupp = () -> { @@ -90,11 +90,11 @@ class BoundLazyPair } @Override - public MergedType - merge(BiFunction merger) { + public MergedType merge( + BiFunction 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 { } /** - * 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 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 } @Override - public MergedType - merge(BiFunction merger) { + public MergedType merge( + BiFunction 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 } @Override - public MergedType - merge(BiFunction merger) { + public MergedType merge( + BiFunction 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 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 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 The initial type of the function - * @param The intermediate type of the function - * @param The terminal type of the function - * @param func The function to transform - * @return The function transformed into a unary function returning a function + * @param + * The initial type of the function + * @param + * The intermediate type of the function + * @param + * 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 Function> curry2( BiFunction 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 { +final class FunctionalFileVisitor extends SimpleFileVisitor { private BiPredicate traversalPredicate; private BiPredicate 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 * The type of element in the list being partitioned */ -final class GroupPartIteration - implements Consumer { +final class GroupPartIteration implements Consumer { private IFunctionalList> returnedList; private IHolder> currentPartition; private IFunctionalList rejectedItems; @@ -24,8 +23,7 @@ final class GroupPartIteration private int numberPerPartition; private Function elementCounter; - public GroupPartIteration( - IFunctionalList> returned, + public GroupPartIteration(IFunctionalList> returned, IHolder> currPart, IFunctionalList rejects, IHolder numInCurrPart, int nPerPart, Function 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> returnedList = - new FunctionalList<>(); + IFunctionalList> returnedList = new FunctionalList<>(); /* * List that holds current partition */ - IHolder> currentPartition = - new Identity<>(new FunctionalList<>()); + IHolder> 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> returnedList = - new Identity<>(input); + IHolder> 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> returnedList = - new Identity<>(input); + IHolder> returnedList = new Identity<>( + input); operators.forEach((operator) -> returnedList .transform((oldReturn) -> oldReturn.flatMap((token) -> { @@ -236,8 +233,8 @@ public class ListUtils { public static IFunctionalList drawWithReplacement( IFunctionalList list, int numberOfItems, Function rng) { - IFunctionalList selectedItems = - new FunctionalList<>(new ArrayList<>(numberOfItems)); + IFunctionalList 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 IFunctionalList drawWithoutReplacement( IFunctionalList list, int numberOfItems, Function rng) { - IFunctionalList selectedItems = - new FunctionalList<>(new ArrayList<>(numberOfItems)); + IFunctionalList 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 IFunctionalList - mergeLists(IFunctionalList... lists) { + public static IFunctionalList mergeLists( + IFunctionalList... lists) { IFunctionalList returnedList = new FunctionalList<>(); for (IFunctionalList 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 String printDeque(Deque queuedTrees) { + public static String printDeque( + Deque 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> { +final class TokenDeaffixer + implements BiFunction> { 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> { +final class TokenSplitter + implements BiFunction> { 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 { /** * The backing storage of the map */ - private IFunctionalMap> adjacencyMap = - new FunctionalMap<>(); + private IFunctionalMap> 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 { }); // Get the edge with the minimum distance - IHolder> minimumEdge = - new Identity<>(availableEdges.poll()); + IHolder> 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 { * @return A adjacency map representing this graph */ public AdjacencyMap toAdjacencyMap() { - AdjacencyMap adjacencyMap = - new AdjacencyMap<>(backingGraph.keyList()); + AdjacencyMap 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 extends JPanel { if (addAction != null) { addParam = new JButton("Add..."); addParam.addActionListener((event) -> { - DefaultListModel model = - (DefaultListModel) list.getModel(); + DefaultListModel model = (DefaultListModel) list + .getModel(); model.addElement(addAction.get()); }); @@ -111,8 +111,8 @@ public class ListParameterPanel extends JPanel { if (removeAction != null) { removeParam = new JButton("Remove..."); removeParam.addActionListener((event) -> { - DefaultListModel model = - (DefaultListModel) list.getModel(); + DefaultListModel model = (DefaultListModel) 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 { } 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 { /** * 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 { 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 implements Consumer { private final class OperatorHandler @@ -23,15 +22,15 @@ final class TokenTransformer implements Consumer { } @Override - public IPair>, ITree> - apply(IPair>, ITree> pair) { + public IPair>, ITree> apply( + IPair>, ITree> pair) { return pair.bind((queuedASTs, currentAST) -> { return handleOperator(queuedASTs); }); } - private IPair>, ITree> - handleOperator(Deque> queuedASTs) { + private IPair>, ITree> handleOperator( + Deque> queuedASTs) { ITree 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>, ITree>> initialState = - new Identity<>(new Pair<>(new LinkedList<>(), null)); + IHolder>, ITree>> initialState = new Identity<>( + new Pair<>(new LinkedList<>(), null)); tokens.forEach( new TokenTransformer<>(initialState, operatorPredicate, -- cgit v1.2.3