summaryrefslogtreecommitdiff
path: root/BJC-Utils2/src/main/java/bjc/utils/data/internals/HalfBoundLazyPair.java
diff options
context:
space:
mode:
authorEVE <EVE@EVE-PC>2017-03-13 16:42:21 -0400
committerEVE <EVE@EVE-PC>2017-03-13 16:42:21 -0400
commit27bf571d6413c3cc6a5d664b5bddd38d21d7b1cd (patch)
tree847fb52acb091c1c613d37b8477094d5762c6988 /BJC-Utils2/src/main/java/bjc/utils/data/internals/HalfBoundLazyPair.java
parentaa807a96cae2c47259fb38f710640883060339e9 (diff)
Formatting
Diffstat (limited to 'BJC-Utils2/src/main/java/bjc/utils/data/internals/HalfBoundLazyPair.java')
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/data/internals/HalfBoundLazyPair.java29
1 files changed, 11 insertions, 18 deletions
diff --git a/BJC-Utils2/src/main/java/bjc/utils/data/internals/HalfBoundLazyPair.java b/BJC-Utils2/src/main/java/bjc/utils/data/internals/HalfBoundLazyPair.java
index 1e8d109..a8bdb6a 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/data/internals/HalfBoundLazyPair.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/data/internals/HalfBoundLazyPair.java
@@ -12,17 +12,15 @@ import bjc.utils.data.LazyPair;
/*
* A lazy pair, with only one side bound
*/
-public class HalfBoundLazyPair<OldType, NewLeft, NewRight>
- implements IPair<NewLeft, NewRight> {
- private Supplier<OldType> oldSupplier;
+public class HalfBoundLazyPair<OldType, NewLeft, NewRight> implements IPair<NewLeft, NewRight> {
+ private Supplier<OldType> oldSupplier;
- private Function<OldType, IPair<NewLeft, NewRight>> binder;
+ private Function<OldType, IPair<NewLeft, NewRight>> binder;
- private IPair<NewLeft, NewRight> boundPair;
- private boolean pairBound;
+ private IPair<NewLeft, NewRight> boundPair;
+ private boolean pairBound;
- public HalfBoundLazyPair(Supplier<OldType> oldSupp,
- Function<OldType, IPair<NewLeft, NewRight>> bindr) {
+ public HalfBoundLazyPair(Supplier<OldType> oldSupp, Function<OldType, IPair<NewLeft, NewRight>> bindr) {
oldSupplier = oldSupp;
binder = bindr;
}
@@ -30,8 +28,7 @@ public class HalfBoundLazyPair<OldType, 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 = () -> {
@@ -94,16 +91,14 @@ public class HalfBoundLazyPair<OldType, NewLeft, NewRight>
BiFunction<NewRight, OtherRight, CombinedRight> 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));
});
});
}
@Override
- public <NewLeftType> IPair<NewLeftType, NewRight> mapLeft(
- Function<NewLeft, NewLeftType> mapper) {
+ public <NewLeftType> IPair<NewLeftType, NewRight> mapLeft(Function<NewLeft, NewLeftType> mapper) {
Supplier<NewLeftType> leftSupp = () -> {
if (pairBound) {
return mapper.apply(boundPair.getLeft());
@@ -126,8 +121,7 @@ public class HalfBoundLazyPair<OldType, NewLeft, NewRight>
}
@Override
- public <NewRightType> IPair<NewLeft, NewRightType> mapRight(
- Function<NewRight, NewRightType> mapper) {
+ public <NewRightType> IPair<NewLeft, NewRightType> mapRight(Function<NewRight, NewRightType> mapper) {
Supplier<NewLeft> leftSupp = () -> {
if (pairBound) {
return boundPair.getLeft();
@@ -150,8 +144,7 @@ public class HalfBoundLazyPair<OldType, 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(oldSupplier.get());