From df94066e3af02ff02d5ab4d033a3d603f743234c Mon Sep 17 00:00:00 2001 From: bjculkin Date: Mon, 12 Feb 2018 22:45:04 -0500 Subject: Formatting pass --- .../bjc/utils/data/internals/BoundLazyPair.java | 49 +++++++++++----------- 1 file changed, 25 insertions(+), 24 deletions(-) (limited to 'base/src/main/java/bjc/utils/data/internals/BoundLazyPair.java') 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)"; } -- cgit v1.2.3