From 0a8f34c27c6ef93c5c94d17728af62c7607e225f Mon Sep 17 00:00:00 2001 From: Ben Culkin Date: Thu, 3 Dec 2020 19:21:38 -0500 Subject: Rename types to match Java style This renames several interfaces that had names like IWhatever, since that isn't a style that Java uses --- src/main/java/bjc/data/internals/BoundLazy.java | 38 ++++++++++---------- .../java/bjc/data/internals/BoundLazyPair.java | 40 +++++++++++----------- .../java/bjc/data/internals/BoundListHolder.java | 24 ++++++------- .../java/bjc/data/internals/HalfBoundLazyPair.java | 40 +++++++++++----------- src/main/java/bjc/data/internals/WrappedLazy.java | 24 ++++++------- .../java/bjc/data/internals/WrappedOption.java | 24 ++++++------- 6 files changed, 95 insertions(+), 95 deletions(-) (limited to 'src/main/java/bjc/data/internals') diff --git a/src/main/java/bjc/data/internals/BoundLazy.java b/src/main/java/bjc/data/internals/BoundLazy.java index a350a2b..0e0e95c 100644 --- a/src/main/java/bjc/data/internals/BoundLazy.java +++ b/src/main/java/bjc/data/internals/BoundLazy.java @@ -4,10 +4,10 @@ import java.util.function.Function; import java.util.function.Supplier; import java.util.function.UnaryOperator; -import bjc.data.IHolder; +import bjc.data.Holder; import bjc.data.Lazy; import bjc.funcdata.FunctionalList; -import bjc.funcdata.IList; +import bjc.funcdata.ListEx; /** * Implements a lazy holder that has been bound. @@ -19,21 +19,21 @@ import bjc.funcdata.IList; * The type of the new bound value. */ public class BoundLazy - implements IHolder { + implements Holder { /* The old value. */ - private final Supplier> oldSupplier; + private final Supplier> oldSupplier; /* The function to use to transform the old value into a new value. */ - private final Function> binder; + private final Function> binder; /* The bound value being held. */ - private IHolder boundHolder; + private Holder boundHolder; /* Whether the bound value has been actualized or not. */ private boolean holderBound; /* Transformations currently pending on the bound value. */ - private final IList> actions + private final ListEx> actions = new FunctionalList<>(); /** @@ -45,20 +45,20 @@ public class BoundLazy * @param binder * The function to use to bind the old value to the new one. */ - public BoundLazy(final Supplier> supp, - final Function> binder) { + public BoundLazy(final Supplier> supp, + final Function> binder) { oldSupplier = supp; this.binder = binder; } @Override - public IHolder - bind(final Function> bindr) { + public Holder + bind(final Function> bindr) { if (bindr == null) throw new NullPointerException("Binder must not be null"); /* Prepare a list of pending actions. */ - final IList> pendingActions + final ListEx> pendingActions = new FunctionalList<>(); for (UnaryOperator pendAct : actions) { @@ -66,8 +66,8 @@ public class BoundLazy } /* Create the new supplier of a value. */ - final Supplier> typeSupplier = () -> { - IHolder oldHolder = boundHolder; + final Supplier> typeSupplier = () -> { + Holder oldHolder = boundHolder; /* Bind the value if it hasn't been bound before. */ if (!holderBound) { @@ -83,7 +83,7 @@ public class BoundLazy } @Override - public Function> + public Function> lift(final Function func) { if (func == null) throw new NullPointerException("Function to lift must not be null"); @@ -94,13 +94,13 @@ public class BoundLazy } @Override - public IHolder + public Holder map(final Function mapper) { if (mapper == null) throw new NullPointerException("Mapper must not be null"); /* Prepare a list of pending actions. */ - final IList> pendingActions + final ListEx> pendingActions = new FunctionalList<>(); for (UnaryOperator pendAct : actions) { @@ -109,7 +109,7 @@ public class BoundLazy /* Prepare the new supplier. */ final Supplier typeSupplier = () -> { - IHolder oldHolder = boundHolder; + Holder oldHolder = boundHolder; /* Bound the value if it hasn't been bound. */ if (!holderBound) { @@ -133,7 +133,7 @@ public class BoundLazy } @Override - public IHolder + public Holder transform(final UnaryOperator transformer) { if (transformer == null) throw new NullPointerException("Transformer must not be null"); diff --git a/src/main/java/bjc/data/internals/BoundLazyPair.java b/src/main/java/bjc/data/internals/BoundLazyPair.java index e081c04..91981de 100644 --- a/src/main/java/bjc/data/internals/BoundLazyPair.java +++ b/src/main/java/bjc/data/internals/BoundLazyPair.java @@ -4,8 +4,8 @@ import java.util.function.BiFunction; import java.util.function.Function; import java.util.function.Supplier; -import bjc.data.IHolder; -import bjc.data.IPair; +import bjc.data.Holder; +import bjc.data.Pair; import bjc.data.Identity; import bjc.data.LazyPair; @@ -16,17 +16,17 @@ import bjc.data.LazyPair; */ @SuppressWarnings("javadoc") public class BoundLazyPair - implements IPair { + implements Pair { /* The supplier of the left value. */ private final Supplier leftSupplier; /* The supplier of the right value. */ private final Supplier rightSupplier; /* The binder to transform values. */ - private final BiFunction> binder; + private final BiFunction> binder; /* The bound pair. */ - private IPair boundPair; + private Pair boundPair; /* Whether the pair has been bound yet. */ private boolean pairBound; @@ -46,20 +46,20 @@ public class BoundLazyPair */ public BoundLazyPair(final Supplier leftSupp, final Supplier rightSupp, - final BiFunction> bindr) { + final BiFunction> bindr) { leftSupplier = leftSupp; rightSupplier = rightSupp; binder = bindr; } @Override - public IPair bind( - final BiFunction> bindr) { + public Pair bind( + final BiFunction> bindr) { if (bindr == null) throw new NullPointerException("Binder must not be null"); - final IHolder> newPair = new Identity<>(boundPair); - final IHolder newPairMade = new Identity<>(pairBound); + final Holder> newPair = new Identity<>(boundPair); + final Holder newPairMade = new Identity<>(pairBound); final Supplier leftSupp = () -> { if (!newPairMade.getValue()) { @@ -91,13 +91,13 @@ public class BoundLazyPair } @Override - public IPair - bindLeft(final Function> leftBinder) { + public Pair + bindLeft(final Function> leftBinder) { if (leftBinder == null) throw new NullPointerException("Left binder must not be null"); final Supplier leftSupp = () -> { - IPair newPair = boundPair; + Pair newPair = boundPair; if (!pairBound) { /* @@ -113,13 +113,13 @@ public class BoundLazyPair } @Override - public IPair - bindRight(final Function> rightBinder) { + public Pair + bindRight(final Function> rightBinder) { if (rightBinder == null) throw new NullPointerException("Right binder must not be null"); final Supplier rightSupp = () -> { - IPair newPair = boundPair; + Pair newPair = boundPair; if (!pairBound) { /* @@ -136,8 +136,8 @@ public class BoundLazyPair @Override public - IPair - combine(final IPair otherPair, + Pair + combine(final Pair otherPair, final BiFunction leftCombiner, final BiFunction rightCombiner) { if (otherPair == null) { @@ -157,7 +157,7 @@ public class BoundLazyPair } @Override - public IPair + public Pair mapLeft(final Function mapper) { if (mapper == null) throw new NullPointerException("Mapper must not be null"); @@ -184,7 +184,7 @@ public class BoundLazyPair } @Override - public IPair + public Pair mapRight(final Function mapper) { if (mapper == null) throw new NullPointerException("Mapper must not be null"); diff --git a/src/main/java/bjc/data/internals/BoundListHolder.java b/src/main/java/bjc/data/internals/BoundListHolder.java index 1193c8d..c944252 100644 --- a/src/main/java/bjc/data/internals/BoundListHolder.java +++ b/src/main/java/bjc/data/internals/BoundListHolder.java @@ -3,9 +3,9 @@ package bjc.data.internals; import java.util.function.Function; import java.util.function.UnaryOperator; -import bjc.data.IHolder; +import bjc.data.Holder; import bjc.data.ListHolder; -import bjc.funcdata.IList; +import bjc.funcdata.ListEx; /** * Holds a list, converted into a holder. @@ -13,9 +13,9 @@ import bjc.funcdata.IList; * @author Ben Culkin */ @SuppressWarnings("javadoc") -public class BoundListHolder implements IHolder { +public class BoundListHolder implements Holder { /* The list of contained holders. */ - private final IList> heldHolders; + private final ListEx> heldHolders; /** * Create a new list of holders. @@ -23,17 +23,17 @@ public class BoundListHolder implements IHolder { * @param toHold * The list of holders to, well, hold. */ - public BoundListHolder(final IList> toHold) { + public BoundListHolder(final ListEx> toHold) { heldHolders = toHold; } @Override - public IHolder - bind(final Function> binder) { + public Holder + bind(final Function> binder) { if (binder == null) throw new NullPointerException("Binder must not be null"); - final IList> boundHolders + final ListEx> boundHolders = heldHolders.map(containedHolder -> { return containedHolder.bind(binder); }); @@ -42,7 +42,7 @@ public class BoundListHolder implements IHolder { } @Override - public Function> + public Function> lift(final Function func) { if (func == null) throw new NullPointerException("Function to lift must not be null"); @@ -53,12 +53,12 @@ public class BoundListHolder implements IHolder { } @Override - public IHolder + public Holder map(final Function mapper) { if (mapper == null) throw new NullPointerException("Mapper must not be null"); - final IList> mappedHolders + final ListEx> mappedHolders = heldHolders.map(containedHolder -> { return containedHolder.map(mapper); }); @@ -67,7 +67,7 @@ public class BoundListHolder implements IHolder { } @Override - public IHolder + public Holder transform(final UnaryOperator transformer) { if (transformer == null) throw new NullPointerException("Transformer must not be null"); diff --git a/src/main/java/bjc/data/internals/HalfBoundLazyPair.java b/src/main/java/bjc/data/internals/HalfBoundLazyPair.java index 6bcb6ae..849b973 100644 --- a/src/main/java/bjc/data/internals/HalfBoundLazyPair.java +++ b/src/main/java/bjc/data/internals/HalfBoundLazyPair.java @@ -4,8 +4,8 @@ import java.util.function.BiFunction; import java.util.function.Function; import java.util.function.Supplier; -import bjc.data.IHolder; -import bjc.data.IPair; +import bjc.data.Holder; +import bjc.data.Pair; import bjc.data.Identity; import bjc.data.LazyPair; @@ -24,15 +24,15 @@ import bjc.data.LazyPair; */ @SuppressWarnings("javadoc") public class HalfBoundLazyPair - implements IPair { + implements Pair { /* The supplier of the old value. */ private final Supplier oldSupplier; /* The function to transform the old value into a new pair. */ - private final Function> binder; + private final Function> binder; /* The new bound pair. */ - private IPair boundPair; + private Pair boundPair; /* Has the pair been bound yet or not? */ private boolean pairBound; @@ -46,16 +46,16 @@ public class HalfBoundLazyPair * The function to use to create the pair from the old value. */ public HalfBoundLazyPair(final Supplier oldSupp, - final Function> bindr) { + final Function> bindr) { oldSupplier = oldSupp; binder = bindr; } @Override - public IPair bind( - final BiFunction> bindr) { - final IHolder> newPair = new Identity<>(boundPair); - final IHolder newPairMade = new Identity<>(pairBound); + public Pair bind( + final BiFunction> bindr) { + final Holder> newPair = new Identity<>(boundPair); + final Holder newPairMade = new Identity<>(pairBound); final Supplier leftSupp = () -> { if (!newPairMade.getValue()) { @@ -81,10 +81,10 @@ public class HalfBoundLazyPair } @Override - public IPair - bindLeft(final Function> leftBinder) { + public Pair + bindLeft(final Function> leftBinder) { final Supplier leftSupp = () -> { - IPair newPair = boundPair; + Pair newPair = boundPair; if (!pairBound) { newPair = binder.apply(oldSupplier.get()); @@ -97,10 +97,10 @@ public class HalfBoundLazyPair } @Override - public IPair - bindRight(final Function> rightBinder) { + public Pair + bindRight(final Function> rightBinder) { final Supplier rightSupp = () -> { - IPair newPair = boundPair; + Pair newPair = boundPair; if (!pairBound) { newPair = binder.apply(oldSupplier.get()); @@ -114,8 +114,8 @@ public class HalfBoundLazyPair @Override public - IPair - combine(final IPair otherPair, + Pair + combine(final Pair otherPair, final BiFunction leftCombiner, final BiFunction rightCombiner) { return otherPair.bind((otherLeft, otherRight) -> bind((leftVal, rightVal) -> { @@ -127,7 +127,7 @@ public class HalfBoundLazyPair } @Override - public IPair + public Pair mapLeft(final Function mapper) { final Supplier leftSupp = () -> { if (pairBound) @@ -149,7 +149,7 @@ public class HalfBoundLazyPair } @Override - public IPair + public Pair mapRight(final Function mapper) { final Supplier leftSupp = () -> { if (pairBound) diff --git a/src/main/java/bjc/data/internals/WrappedLazy.java b/src/main/java/bjc/data/internals/WrappedLazy.java index cda86fd..624fb1b 100644 --- a/src/main/java/bjc/data/internals/WrappedLazy.java +++ b/src/main/java/bjc/data/internals/WrappedLazy.java @@ -3,7 +3,7 @@ package bjc.data.internals; import java.util.function.Function; import java.util.function.UnaryOperator; -import bjc.data.IHolder; +import bjc.data.Holder; import bjc.data.Lazy; /** @@ -13,9 +13,9 @@ import bjc.data.Lazy; * @param * The type of the wrapped value. */ -public class WrappedLazy implements IHolder { +public class WrappedLazy implements Holder { /* Held value. */ - private final IHolder> held; + private final Holder> held; /** * Create a new wrapped lazy value. @@ -23,7 +23,7 @@ public class WrappedLazy implements IHolder { * @param wrappedHolder * The holder to make lazy. */ - public WrappedLazy(final IHolder wrappedHolder) { + public WrappedLazy(final Holder wrappedHolder) { held = new Lazy<>(wrappedHolder); } @@ -34,15 +34,15 @@ public class WrappedLazy implements IHolder { * This is a case where reified generics would be useful, because then the * compiler could know which one we meant without the dummy parameter. */ - private WrappedLazy(final IHolder> wrappedHolder, + private WrappedLazy(final Holder> wrappedHolder, @SuppressWarnings("unused") final boolean dummy) { held = wrappedHolder; } @Override - public IHolder - bind(final Function> binder) { - final IHolder> newHolder = held.map(containedHolder -> { + public Holder + bind(final Function> binder) { + final Holder> newHolder = held.map(containedHolder -> { return containedHolder.bind(binder); }); @@ -50,7 +50,7 @@ public class WrappedLazy implements IHolder { } @Override - public Function> + public Function> lift(final Function func) { return val -> { return new Lazy<>(func.apply(val)); @@ -58,9 +58,9 @@ public class WrappedLazy implements IHolder { } @Override - public IHolder + public Holder map(final Function mapper) { - final IHolder> newHolder = held.map(containedHolder -> { + final Holder> newHolder = held.map(containedHolder -> { return containedHolder.map(mapper); }); @@ -68,7 +68,7 @@ public class WrappedLazy implements IHolder { } @Override - public IHolder + public Holder transform(final UnaryOperator transformer) { held.transform(containedHolder -> { return containedHolder.transform(transformer); diff --git a/src/main/java/bjc/data/internals/WrappedOption.java b/src/main/java/bjc/data/internals/WrappedOption.java index 6becc16..f46d501 100644 --- a/src/main/java/bjc/data/internals/WrappedOption.java +++ b/src/main/java/bjc/data/internals/WrappedOption.java @@ -3,7 +3,7 @@ package bjc.data.internals; import java.util.function.Function; import java.util.function.UnaryOperator; -import bjc.data.IHolder; +import bjc.data.Holder; import bjc.data.Option; /** @@ -13,9 +13,9 @@ import bjc.data.Option; * @param * The wrapped type. */ -public class WrappedOption implements IHolder { +public class WrappedOption implements Holder { /* The held value. */ - private final IHolder> held; + private final Holder> held; /** * Create a new wrapped option. @@ -23,7 +23,7 @@ public class WrappedOption implements IHolder { * @param seedValue * The value to wrap. */ - public WrappedOption(final IHolder seedValue) { + public WrappedOption(final Holder seedValue) { held = new Option<>(seedValue); } @@ -31,15 +31,15 @@ public class WrappedOption implements IHolder { * The dummy parameter is to ensure the compiler can pick the right method, * because without this method erases to the same type as the public one. */ - private WrappedOption(final IHolder> toHold, + private WrappedOption(final Holder> toHold, @SuppressWarnings("unused") final boolean dummy) { held = toHold; } @Override - public IHolder - bind(final Function> binder) { - final IHolder> newHolder = held.map(containedHolder -> { + public Holder + bind(final Function> binder) { + final Holder> newHolder = held.map(containedHolder -> { return containedHolder.bind((containedValue) -> { if (containedValue == null) return new Option<>(null); @@ -52,7 +52,7 @@ public class WrappedOption implements IHolder { } @Override - public Function> + public Function> lift(final Function func) { return val -> { return new Option<>(func.apply(val)); @@ -60,9 +60,9 @@ public class WrappedOption implements IHolder { } @Override - public IHolder + public Holder map(final Function mapper) { - final IHolder> newHolder = held.map(containedHolder -> { + final Holder> newHolder = held.map(containedHolder -> { return containedHolder.map((containedValue) -> { if (containedValue == null) return null; @@ -75,7 +75,7 @@ public class WrappedOption implements IHolder { } @Override - public IHolder + public Holder transform(final UnaryOperator transformer) { held.transform(containedHolder -> { return containedHolder.transform((containedValue) -> { -- cgit v1.2.3