From 27bf571d6413c3cc6a5d664b5bddd38d21d7b1cd Mon Sep 17 00:00:00 2001 From: EVE Date: Mon, 13 Mar 2017 16:42:21 -0400 Subject: Formatting --- BJC-Utils2/src/main/java/bjc/utils/data/IPair.java | 106 +++++++++------------ 1 file changed, 45 insertions(+), 61 deletions(-) (limited to 'BJC-Utils2/src/main/java/bjc/utils/data/IPair.java') diff --git a/BJC-Utils2/src/main/java/bjc/utils/data/IPair.java b/BJC-Utils2/src/main/java/bjc/utils/data/IPair.java index c82cc8e..1405d75 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/data/IPair.java +++ b/BJC-Utils2/src/main/java/bjc/utils/data/IPair.java @@ -11,35 +11,33 @@ import bjc.utils.funcdata.theory.Bifunctor; * * @author ben * @param - * The type of the left side of the pair + * The type of the left side of the pair * @param - * The type of the right side of the pair + * The type of the right side of the pair * */ -public interface IPair - extends Bifunctor { +public interface IPair extends Bifunctor { /** * Bind a function across the values in this pair * * @param - * The type of the bound left + * The type of the bound left * @param - * The type of the bound right + * The type of the bound right * @param binder - * The function to bind with + * The function to bind with * @return The bound pair */ public IPair bind( - BiFunction> binder); + BiFunction> binder); /** * Bind a function to the left value in this pair * * @param - * The type of the bound value + * The type of the bound value * @param leftBinder - * The function to use to bind + * The function to use to bind * @return A pair with the left type bound */ public IPair bindLeft( @@ -49,9 +47,9 @@ public interface IPair * Bind a function to the right value in this pair * * @param - * The type of the bound value + * The type of the bound value * @param rightBinder - * The function to use to bind + * The function to use to bind * @return A pair with the right type bound */ public IPair bindRight( @@ -61,19 +59,16 @@ public interface IPair * Pairwise combine two pairs together * * @param - * The left type of the other pair + * The left type of the other pair * @param - * The right type of the other pair + * The right type of the other pair * @param otherPair - * The pair to combine with + * The pair to combine with * @return The pairs, pairwise combined together */ - public default IPair, - IPair> combine( - IPair otherPair) { - return combine(otherPair, - (left, otherLeft) -> new Pair<>(left, otherLeft), + public default IPair, IPair> combine( + IPair otherPair) { + return combine(otherPair, (left, otherLeft) -> new Pair<>(left, otherLeft), (right, otherRight) -> new Pair<>(right, otherRight)); } @@ -81,33 +76,30 @@ public interface IPair * Combine the contents of two pairs together * * @param - * The type of the left value of the other pair + * The type of the left value of the other pair * @param - * The type of the right value of the other pair + * The type of the right value of the other pair * @param - * The type of the left value of the combined pair + * The type of the left value of the combined pair * @param - * The type of the right value of the combined pair + * The type of the right value of the combined pair * @param otherPair - * The other pair to combine with + * The other pair to combine with * @param leftCombiner * @param rightCombiner * @return A pair with its values combined */ - public IPair combine( - IPair otherPair, - BiFunction leftCombiner, - BiFunction rightCombiner); + public IPair combine( + IPair otherPair, + BiFunction leftCombiner, + BiFunction rightCombiner); /** * Immediately perfom the specified action with the contents of this * pair * * @param consumer - * The action to perform on the pair + * The action to perform on the pair */ public default void doWith(BiConsumer consumer) { merge((leftValue, rightValue) -> { @@ -118,26 +110,22 @@ public interface IPair } @Override - default Function, - Bifunctor> fmapLeft( - Function func) { + default Function, Bifunctor> fmapLeft( + Function func) { return (argumentPair) -> { if (!(argumentPair instanceof IPair)) { throw new IllegalArgumentException( "This function can only be applied to instances of IPair"); } - IPair argPair = (IPair) argumentPair; + IPair argPair = (IPair) argumentPair; return argPair.mapLeft(func); }; } @Override - default Function< - Bifunctor, Bifunctor> + default Function, Bifunctor> fmapRight(Function func) { return (argumentPair) -> { @@ -146,8 +134,7 @@ public interface IPair "This function can only be applied to instances of IPair"); } - IPair argPair = (IPair) argumentPair; + IPair argPair = (IPair) argumentPair; return argPair.mapRight(func); }; @@ -178,38 +165,35 @@ public interface IPair * pair * * @param - * The new type of the left part of the pair + * The new type of the left part of the pair * @param mapper - * The function to use to transform the left part of the - * pair + * The function to use to transform the left part of the + * pair * @return The pair, with its left part transformed */ - public IPair mapLeft( - Function mapper); + public IPair mapLeft(Function mapper); /** - * Transform the value on the right side of the pair. Doesn't modify - * the pair + * Transform the value on the right side of the pair. Doesn't modify the + * pair * * @param - * The new type of the right part of the pair + * The new type of the right part of the pair * @param mapper - * The function to use to transform the right part of the - * pair + * The function to use to transform the right part of the + * pair * @return The pair, with its right part transformed */ - public IPair mapRight( - Function mapper); + public IPair mapRight(Function mapper); /** * Merge the two values in this pair into a single value * * @param - * The type of the single value + * The type of the single value * @param merger - * The function to use for merging + * The function to use for merging * @return The pair, merged into a single value */ - public MergedType merge( - BiFunction merger); + public MergedType merge(BiFunction merger); } -- cgit v1.2.3