Class CheckedPair_LR<L,R>

java.lang.Object
eu.bandm.tools.umod.runtime.UncheckedPair<L,R>
eu.bandm.tools.umod.runtime.CheckedPair_LR<L,R>
Type Parameters:
L - the type of the left components
R - the type of the right components
All Implemented Interfaces:
Nullfree, Pair<L,R>, Pair_checkedLeft<L,R>, Pair_checkedRight<L,R>, Serializable

public class CheckedPair_LR<L,R> extends UncheckedPair<L,R> implements Pair_checkedRight<L,R>, Pair_checkedLeft<L,R>, Nullfree
Implements "Pair" operations and guarantees stricness of both components.
ATTENTION "extends CheckedPair_L<L,R>" not possible because "fromIterables()" would have incompatible return type.
See Also:
  • Constructor Details

    • CheckedPair_LR

      public CheckedPair_LR(L left, R right)
      Create an instance with the given left and right values.
      Parameters:
      left - the left value
      right - the right value
      Throws:
      NullPointerException - if a value is null
  • Method Details

    • set_left

      public void set_left(L l)
      Change the left value of this instance.
      Specified by:
      set_left in interface Pair<L,R>
      Overrides:
      set_left in class UncheckedPair<L,R>
      Parameters:
      l - the new left value.
      Throws:
      NullPointerException - if the value is null
    • set_right

      public void set_right(R r)
      Change the right value of this instance.
      Specified by:
      set_right in interface Pair<L,R>
      Overrides:
      set_right in class UncheckedPair<L,R>
      Parameters:
      r - the new right value.
      Throws:
      NullPointerException - if the value is null
    • with_left

      public CheckedPair_LR<L,R> with_left(L l)
      Deliver a new instance with the given left value and the right value of this instance.
      Specified by:
      with_left in interface Pair<L,R>
      Overrides:
      with_left in class UncheckedPair<L,R>
      Parameters:
      l - the new left value.
      Returns:
      a new instance.
      Throws:
      NullPointerException - if the value is null
    • with_right

      public CheckedPair_LR<L,R> with_right(R r)
      Deliver a new instance with the given right value and the left value of this instance.
      Specified by:
      with_right in interface Pair<L,R>
      Overrides:
      with_right in class UncheckedPair<L,R>
      Parameters:
      r - the new right value.
      Returns:
      a new instance.
      Throws:
      NullPointerException - if the value is null
    • fromIterables

      public static <A, B> List<CheckedPair_LR<A,B>> fromIterables(Iterable<A> left, Iterable<B> right, Class<A> lclass, Class<B> rclass)
      Create a list of instances which contains all possible combinations of the given values.
      Type Parameters:
      A - the type of the left values
      B - the type of the left values
      Parameters:
      left - the left values
      right - the right values
      lclass - the type of the left values
      rclass - the type of the left values
      Returns:
      the list of all combinations
      Throws:
      NullPointerException - if one of the values is null
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class UncheckedPair<L,R>