From 27bf571d6413c3cc6a5d664b5bddd38d21d7b1cd Mon Sep 17 00:00:00 2001 From: EVE Date: Mon, 13 Mar 2017 16:42:21 -0400 Subject: Formatting --- .../src/main/java/bjc/utils/data/LazyPair.java | 56 ++++++++++------------ 1 file changed, 24 insertions(+), 32 deletions(-) (limited to 'BJC-Utils2/src/main/java/bjc/utils/data/LazyPair.java') 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 e03b46e..29e37ac 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/data/LazyPair.java +++ b/BJC-Utils2/src/main/java/bjc/utils/data/LazyPair.java @@ -13,29 +13,28 @@ import bjc.utils.data.internals.HalfBoundLazyPair; * @author ben * * @param - * The type on the left side of the pair + * The type on the left side of the pair * @param - * The type on the right side of the pair + * The type on the right side of the pair * */ -public class LazyPair - implements IPair { - private LeftType leftValue; - private RightType rightValue; +public class LazyPair implements IPair { + private LeftType leftValue; + private RightType rightValue; - private Supplier leftSupplier; - private Supplier rightSupplier; + private Supplier leftSupplier; + private Supplier rightSupplier; - private boolean leftMaterialized; - private boolean rightMaterialized; + private boolean leftMaterialized; + private boolean rightMaterialized; /** * Create a new lazy pair, using the set values * * @param leftVal - * The value for the left side of the pair + * The value for the left side of the pair * @param rightVal - * The value for the right side of the pair + * The value for the right side of the pair */ public LazyPair(LeftType leftVal, RightType rightVal) { leftValue = leftVal; @@ -49,12 +48,11 @@ public class LazyPair * Create a new lazy pair from the given value sources * * @param leftSupp - * The source for a value on the left side of the pair + * The source for a value on the left side of the pair * @param rightSupp - * The source for a value on the right side of the pair + * The source for a value on the right side of the pair */ - public LazyPair(Supplier leftSupp, - Supplier rightSupp) { + public LazyPair(Supplier leftSupp, Supplier rightSupp) { // Use single suppliers to catch double-instantiation bugs leftSupplier = new SingleSupplier<>(leftSupp); rightSupplier = new SingleSupplier<>(rightSupp); @@ -70,7 +68,8 @@ public class LazyPair } @Override - public IPair bindLeft(Function> leftBinder) { + public IPair bindLeft( + Function> leftBinder) { Supplier leftSupp = () -> { if (leftMaterialized) { return leftValue; @@ -97,17 +96,13 @@ public class LazyPair } @Override - public IPair combine( - IPair otherPair, - BiFunction leftCombiner, - BiFunction rightCombiner) { + public IPair combine( + IPair otherPair, + BiFunction leftCombiner, + BiFunction rightCombiner) { return otherPair.bind((otherLeft, otherRight) -> { return bind((leftVal, rightVal) -> { - return new LazyPair<>( - leftCombiner.apply(leftVal, otherLeft), + return new LazyPair<>(leftCombiner.apply(leftVal, otherLeft), rightCombiner.apply(rightVal, otherRight)); }); }); @@ -136,8 +131,7 @@ public class LazyPair } @Override - public IPair mapLeft( - Function mapper) { + public IPair mapLeft(Function mapper) { Supplier leftSupp = () -> { if (leftMaterialized) { return mapper.apply(leftValue); @@ -158,8 +152,7 @@ public class LazyPair } @Override - public IPair mapRight( - Function mapper) { + public IPair mapRight(Function mapper) { Supplier leftSupp = () -> { if (leftMaterialized) { return leftValue; @@ -180,8 +173,7 @@ public class LazyPair } @Override - public MergedType merge( - BiFunction merger) { + public MergedType merge(BiFunction merger) { if (!leftMaterialized) { leftValue = leftSupplier.get(); -- cgit v1.2.3