From df94066e3af02ff02d5ab4d033a3d603f743234c Mon Sep 17 00:00:00 2001 From: bjculkin Date: Mon, 12 Feb 2018 22:45:04 -0500 Subject: Formatting pass --- .../java/bjc/utils/data/internals/BoundLazy.java | 24 +++++------ .../bjc/utils/data/internals/BoundLazyPair.java | 49 +++++++++++----------- .../bjc/utils/data/internals/BoundListHolder.java | 15 ++++--- .../utils/data/internals/HalfBoundLazyPair.java | 28 ++++++------- .../java/bjc/utils/data/internals/WrappedLazy.java | 4 +- .../bjc/utils/data/internals/WrappedOption.java | 10 ++--- 6 files changed, 65 insertions(+), 65 deletions(-) (limited to 'base/src/main/java/bjc/utils/data/internals') diff --git a/base/src/main/java/bjc/utils/data/internals/BoundLazy.java b/base/src/main/java/bjc/utils/data/internals/BoundLazy.java index a1c2ea0..f4e8f7e 100644 --- a/base/src/main/java/bjc/utils/data/internals/BoundLazy.java +++ b/base/src/main/java/bjc/utils/data/internals/BoundLazy.java @@ -32,13 +32,13 @@ public class BoundLazy implements IHolder> actions = new FunctionalList<>(); /** - * Create a new bound lazy value. + * Create a new bound lazy value. * * @param supp - * The supplier of the old value. + * The supplier of the old value. * * @param binder - * The function to use to bind the old value to the new one. + * The function to use to bind the old value to the new one. */ public BoundLazy(final Supplier> supp, final Function> binder) { @@ -48,7 +48,7 @@ public class BoundLazy implements IHolder IHolder bind(final Function> bindr) { - if (bindr == null) throw new NullPointerException("Binder must not be null"); + if(bindr == null) throw new NullPointerException("Binder must not be null"); /* Prepare a list of pending actions. */ final IList> pendingActions = new FunctionalList<>(); @@ -59,7 +59,7 @@ public class BoundLazy implements IHolder oldHolder = boundHolder; /* Bind the value if it hasn't been bound before. */ - if (!holderBound) { + if(!holderBound) { oldHolder = oldSupplier.get().unwrap(binder); } @@ -75,7 +75,7 @@ public class BoundLazy implements IHolder Function> lift( final Function func) { - if (func == null) throw new NullPointerException("Function to lift must not be null"); + if(func == null) throw new NullPointerException("Function to lift must not be null"); return (val) -> { return new Lazy<>(func.apply(val)); @@ -84,7 +84,7 @@ public class BoundLazy implements IHolder IHolder map(final Function mapper) { - if (mapper == null) throw new NullPointerException("Mapper must not be null"); + if(mapper == null) throw new NullPointerException("Mapper must not be null"); /* Prepare a list of pending actions. */ final IList> pendingActions = new FunctionalList<>(); @@ -95,7 +95,7 @@ public class BoundLazy implements IHolder oldHolder = boundHolder; /* Bound the value if it hasn't been bound. */ - if (!holderBound) { + if(!holderBound) { oldHolder = oldSupplier.get().unwrap(binder); } @@ -110,14 +110,14 @@ public class BoundLazy implements IHolder transform(final UnaryOperator transformer) { - if (transformer == null) throw new NullPointerException("Transformer must not be null"); + if(transformer == null) throw new NullPointerException("Transformer must not be null"); actions.add(transformer); @@ -126,9 +126,9 @@ public class BoundLazy implements IHolder UnwrappedType unwrap(final Function unwrapper) { - if (unwrapper == null) throw new NullPointerException("Unwrapper must not be null"); + if(unwrapper == null) throw new NullPointerException("Unwrapper must not be null"); - if (!holderBound) { + if(!holderBound) { boundHolder = oldSupplier.get().unwrap(binder::apply); } diff --git a/base/src/main/java/bjc/utils/data/internals/BoundLazyPair.java b/base/src/main/java/bjc/utils/data/internals/BoundLazyPair.java index 401f5d5..2ef0e4c 100644 --- a/base/src/main/java/bjc/utils/data/internals/BoundLazyPair.java +++ b/base/src/main/java/bjc/utils/data/internals/BoundLazyPair.java @@ -34,13 +34,14 @@ public class BoundLazyPair implements IPai * Create a new bound lazy pair. * * @param leftSupp - * The supplier for the left value. + * The supplier for the left value. * * @param rightSupp - * The supplier for the right value. + * The supplier for the right value. * * @param bindr - * The function to use to bind the left and right into a new pair. + * The function to use to bind the left and right into a new + * pair. */ public BoundLazyPair(final Supplier leftSupp, final Supplier rightSupp, final BiFunction> bindr) { @@ -52,13 +53,13 @@ public class BoundLazyPair implements IPai @Override public IPair bind( final BiFunction> bindr) { - if (bindr == null) throw new NullPointerException("Binder must not be null"); + if(bindr == null) throw new NullPointerException("Binder must not be null"); final IHolder> newPair = new Identity<>(boundPair); - final IHolder newPairMade = new Identity<>(pairBound); + final IHolder newPairMade = new Identity<>(pairBound); final Supplier leftSupp = () -> { - if (!newPairMade.getValue()) { + if(!newPairMade.getValue()) { /* * If the pair hasn't been bound before, bind * it. @@ -72,7 +73,7 @@ public class BoundLazyPair implements IPai }; final Supplier rightSupp = () -> { - if (!newPairMade.getValue()) { + if(!newPairMade.getValue()) { /* * If the pair hasn't been bound before, bind * it. @@ -91,12 +92,12 @@ public class BoundLazyPair implements IPai @Override public IPair bindLeft( final Function> leftBinder) { - if (leftBinder == null) throw new NullPointerException("Left binder must not be null"); + if(leftBinder == null) throw new NullPointerException("Left binder must not be null"); final Supplier leftSupp = () -> { IPair newPair = boundPair; - if (!pairBound) { + if(!pairBound) { /* * If the pair hasn't been bound before, bind * it. @@ -113,12 +114,12 @@ public class BoundLazyPair implements IPai @Override public IPair bindRight( final Function> rightBinder) { - if (rightBinder == null) throw new NullPointerException("Right binder must not be null"); + if(rightBinder == null) throw new NullPointerException("Right binder must not be null"); final Supplier rightSupp = () -> { IPair newPair = boundPair; - if (!pairBound) { + if(!pairBound) { /* * If the pair hasn't been bound before, bind * it. @@ -137,17 +138,17 @@ public class BoundLazyPair implements IPai final IPair otherPair, final BiFunction leftCombiner, final BiFunction rightCombiner) { - if (otherPair == null) { + if(otherPair == null) { throw new NullPointerException("Other pair must not be null"); - } else if (leftCombiner == null) { + } else if(leftCombiner == null) { throw new NullPointerException("Left combiner must not be null"); - } else if (rightCombiner == null) { + } else if(rightCombiner == null) { throw new NullPointerException("Right combiner must not be null"); } return otherPair.bind((otherLeft, otherRight) -> { return bind((leftVal, rightVal) -> { - CombinedLeft cLeft = leftCombiner.apply(leftVal, otherLeft); + CombinedLeft cLeft = leftCombiner.apply(leftVal, otherLeft); CombinedRight cRight = rightCombiner.apply(rightVal, otherRight); return new LazyPair<>(cLeft, cRight); @@ -157,10 +158,10 @@ public class BoundLazyPair implements IPai @Override public IPair mapLeft(final Function mapper) { - if (mapper == null) throw new NullPointerException("Mapper must not be null"); + if(mapper == null) throw new NullPointerException("Mapper must not be null"); final Supplier leftSupp = () -> { - if (!pairBound) { + if(!pairBound) { final NewLeft leftVal = binder.apply(leftSupplier.get(), rightSupplier.get()).getLeft(); return mapper.apply(leftVal); @@ -170,7 +171,7 @@ public class BoundLazyPair implements IPai }; final Supplier rightSupp = () -> { - if (!pairBound) return binder.apply(leftSupplier.get(), rightSupplier.get()).getRight(); + if(!pairBound) return binder.apply(leftSupplier.get(), rightSupplier.get()).getRight(); return boundPair.getRight(); }; @@ -180,16 +181,16 @@ public class BoundLazyPair implements IPai @Override public IPair mapRight(final Function mapper) { - if (mapper == null) throw new NullPointerException("Mapper must not be null"); + if(mapper == null) throw new NullPointerException("Mapper must not be null"); final Supplier leftSupp = () -> { - if (!pairBound) return binder.apply(leftSupplier.get(), rightSupplier.get()).getLeft(); + if(!pairBound) return binder.apply(leftSupplier.get(), rightSupplier.get()).getLeft(); return boundPair.getLeft(); }; final Supplier rightSupp = () -> { - if (!pairBound) { + if(!pairBound) { final NewRight rightVal = binder.apply(leftSupplier.get(), rightSupplier.get()) .getRight(); @@ -204,9 +205,9 @@ public class BoundLazyPair implements IPai @Override public MergedType merge(final BiFunction merger) { - if (merger == null) throw new NullPointerException("Merger must not be null"); + if(merger == null) throw new NullPointerException("Merger must not be null"); - if (!pairBound) { + if(!pairBound) { /* * If the pair isn't bound yet, bind it. */ @@ -220,7 +221,7 @@ public class BoundLazyPair implements IPai @Override public String toString() { - if (pairBound) return boundPair.toString(); + if(pairBound) return boundPair.toString(); return "(un-materialized)"; } diff --git a/base/src/main/java/bjc/utils/data/internals/BoundListHolder.java b/base/src/main/java/bjc/utils/data/internals/BoundListHolder.java index 31178da..613f8e9 100644 --- a/base/src/main/java/bjc/utils/data/internals/BoundListHolder.java +++ b/base/src/main/java/bjc/utils/data/internals/BoundListHolder.java @@ -21,7 +21,7 @@ public class BoundListHolder implements IHolder { * Create a new list of holders. * * @param toHold - * The list of holders to, well, hold. + * The list of holders to, well, hold. */ public BoundListHolder(final IList> toHold) { heldHolders = toHold; @@ -29,7 +29,7 @@ public class BoundListHolder implements IHolder { @Override public IHolder bind(final Function> binder) { - if (binder == null) throw new NullPointerException("Binder must not be null"); + if(binder == null) throw new NullPointerException("Binder must not be null"); final IList> boundHolders = heldHolders.map((containedHolder) -> { return containedHolder.bind(binder); @@ -40,7 +40,7 @@ public class BoundListHolder implements IHolder { @Override public Function> lift(final Function func) { - if (func == null) throw new NullPointerException("Function to lift must not be null"); + if(func == null) throw new NullPointerException("Function to lift must not be null"); return (val) -> { return new ListHolder<>(func.apply(val)); @@ -49,7 +49,7 @@ public class BoundListHolder implements IHolder { @Override public IHolder map(final Function mapper) { - if (mapper == null) throw new NullPointerException("Mapper must not be null"); + if(mapper == null) throw new NullPointerException("Mapper must not be null"); final IList> mappedHolders = heldHolders.map((containedHolder) -> { return containedHolder.map(mapper); @@ -60,7 +60,7 @@ public class BoundListHolder implements IHolder { @Override public IHolder transform(final UnaryOperator transformer) { - if (transformer == null) throw new NullPointerException("Transformer must not be null"); + if(transformer == null) throw new NullPointerException("Transformer must not be null"); heldHolders.forEach((containedHolder) -> { containedHolder.transform(transformer); @@ -71,11 +71,10 @@ public class BoundListHolder implements IHolder { @Override public UnwrappedType unwrap(final Function unwrapper) { - if (unwrapper == null) throw new NullPointerException("Unwrapper must not be null"); + if(unwrapper == null) throw new NullPointerException("Unwrapper must not be null"); /* - * @NOTE - * Is there another way we could want to do this? + * @NOTE Is there another way we could want to do this? */ return heldHolders.randItem().unwrap(unwrapper); } diff --git a/base/src/main/java/bjc/utils/data/internals/HalfBoundLazyPair.java b/base/src/main/java/bjc/utils/data/internals/HalfBoundLazyPair.java index 5467255..4803bc2 100644 --- a/base/src/main/java/bjc/utils/data/internals/HalfBoundLazyPair.java +++ b/base/src/main/java/bjc/utils/data/internals/HalfBoundLazyPair.java @@ -31,18 +31,18 @@ public class HalfBoundLazyPair implements IPair> binder; /* The new bound pair. */ - private IPair boundPair; + private IPair boundPair; /* Has the pair been bound yet or not? */ - private boolean pairBound; + private boolean pairBound; /** * Create a new half-bound lazy pair. * * @param oldSupp - * The supplier of the old value. + * The supplier of the old value. * * @param bindr - * The function to use to create the pair from the old value. + * The function to use to create the pair from the old value. */ public HalfBoundLazyPair(final Supplier oldSupp, final Function> bindr) { @@ -57,7 +57,7 @@ public class HalfBoundLazyPair implements IPair newPairMade = new Identity<>(pairBound); final Supplier leftSupp = () -> { - if (!newPairMade.getValue()) { + if(!newPairMade.getValue()) { /* Bind the pair if it hasn't been bound yet. */ newPair.replace(binder.apply(oldSupplier.get())); newPairMade.replace(true); @@ -67,7 +67,7 @@ public class HalfBoundLazyPair implements IPair rightSupp = () -> { - if (!newPairMade.getValue()) { + if(!newPairMade.getValue()) { /* Bind the pair if it hasn't been bound yet. */ newPair.replace(binder.apply(oldSupplier.get())); newPairMade.replace(true); @@ -85,7 +85,7 @@ public class HalfBoundLazyPair implements IPair leftSupp = () -> { IPair newPair = boundPair; - if (!pairBound) { + if(!pairBound) { newPair = binder.apply(oldSupplier.get()); } @@ -101,7 +101,7 @@ public class HalfBoundLazyPair implements IPair rightSupp = () -> { IPair newPair = boundPair; - if (!pairBound) { + if(!pairBound) { newPair = binder.apply(oldSupplier.get()); } @@ -118,7 +118,7 @@ public class HalfBoundLazyPair implements IPair rightCombiner) { return otherPair.bind((otherLeft, otherRight) -> { return bind((leftVal, rightVal) -> { - CombinedLeft cLeft = leftCombiner.apply(leftVal, otherLeft); + CombinedLeft cLeft = leftCombiner.apply(leftVal, otherLeft); CombinedRight cRight = rightCombiner.apply(rightVal, otherRight); return new LazyPair<>(cLeft, cRight); @@ -129,7 +129,7 @@ public class HalfBoundLazyPair implements IPair IPair mapLeft(final Function mapper) { final Supplier leftSupp = () -> { - if (pairBound) return mapper.apply(boundPair.getLeft()); + if(pairBound) return mapper.apply(boundPair.getLeft()); final NewLeft leftVal = binder.apply(oldSupplier.get()).getLeft(); @@ -137,7 +137,7 @@ public class HalfBoundLazyPair implements IPair rightSupp = () -> { - if (pairBound) return boundPair.getRight(); + if(pairBound) return boundPair.getRight(); return binder.apply(oldSupplier.get()).getRight(); }; @@ -148,13 +148,13 @@ public class HalfBoundLazyPair implements IPair IPair mapRight(final Function mapper) { final Supplier leftSupp = () -> { - if (pairBound) return boundPair.getLeft(); + if(pairBound) return boundPair.getLeft(); return binder.apply(oldSupplier.get()).getLeft(); }; final Supplier rightSupp = () -> { - if (pairBound) return mapper.apply(boundPair.getRight()); + if(pairBound) return mapper.apply(boundPair.getRight()); final NewRight rightVal = binder.apply(oldSupplier.get()).getRight(); @@ -166,7 +166,7 @@ public class HalfBoundLazyPair implements IPair MergedType merge(final BiFunction merger) { - if (!pairBound) { + if(!pairBound) { boundPair = binder.apply(oldSupplier.get()); pairBound = true; diff --git a/base/src/main/java/bjc/utils/data/internals/WrappedLazy.java b/base/src/main/java/bjc/utils/data/internals/WrappedLazy.java index a5c8130..57f9302 100644 --- a/base/src/main/java/bjc/utils/data/internals/WrappedLazy.java +++ b/base/src/main/java/bjc/utils/data/internals/WrappedLazy.java @@ -19,13 +19,13 @@ public class WrappedLazy implements IHolder { * Create a new wrapped lazy value. * * @param wrappedHolder - * The holder to make lazy. + * The holder to make lazy. */ public WrappedLazy(final IHolder wrappedHolder) { held = new Lazy<>(wrappedHolder); } - /* + /* * This has an extra parameter, because otherwise it erases to the same * as the public one. * diff --git a/base/src/main/java/bjc/utils/data/internals/WrappedOption.java b/base/src/main/java/bjc/utils/data/internals/WrappedOption.java index 872295f..6260ce4 100644 --- a/base/src/main/java/bjc/utils/data/internals/WrappedOption.java +++ b/base/src/main/java/bjc/utils/data/internals/WrappedOption.java @@ -19,7 +19,7 @@ public class WrappedOption implements IHolder { * Create a new wrapped option. * * @param seedValue - * The value to wrap. + * The value to wrap. */ public WrappedOption(final IHolder seedValue) { held = new Option<>(seedValue); @@ -38,7 +38,7 @@ public class WrappedOption implements IHolder { public IHolder bind(final Function> binder) { final IHolder> newHolder = held.map((containedHolder) -> { return containedHolder.bind((containedValue) -> { - if (containedValue == null) return new Option<>(null); + if(containedValue == null) return new Option<>(null); return binder.apply(containedValue); }); @@ -58,7 +58,7 @@ public class WrappedOption implements IHolder { public IHolder map(final Function mapper) { final IHolder> newHolder = held.map((containedHolder) -> { return containedHolder.map((containedValue) -> { - if (containedValue == null) return null; + if(containedValue == null) return null; return mapper.apply(containedValue); }); @@ -71,7 +71,7 @@ public class WrappedOption implements IHolder { public IHolder transform(final UnaryOperator transformer) { held.transform((containedHolder) -> { return containedHolder.transform((containedValue) -> { - if (containedValue == null) return null; + if(containedValue == null) return null; return transformer.apply(containedValue); }); @@ -84,7 +84,7 @@ public class WrappedOption implements IHolder { public UnwrappedType unwrap(final Function unwrapper) { return held.unwrap((containedHolder) -> { return containedHolder.unwrap((containedValue) -> { - if (containedValue == null) return null; + if(containedValue == null) return null; return unwrapper.apply(containedValue); }); -- cgit v1.2.3