Class UncheckedCoPair<L,R>

java.lang.Object
eu.bandm.tools.umod.runtime.UncheckedCoPair<L,R>
Type Parameters:
L - the type of the left alternatives
R - the type of the right alternatives
All Implemented Interfaces:
CoPair<L,R>, Serializable
Direct Known Subclasses:
CheckedCoPair_L, CheckedCoPair_R

public class UncheckedCoPair<L,R> extends Object implements CoPair<L,R>
Implements "CoPair" operations, not guaranteeing any strictness.
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    (package private) boolean
    Flag whether the left variant is realized.
    (package private) L
    The value, in case the left variant is realized.
    (package private) R
    The value, in case the right variant is realized.
  • Constructor Summary

    Constructors
    Constructor
    Description
    UncheckedCoPair(boolean b, R right)
    Create a copair of the "right" alternative.
    Create a copair with the same values as the prototype.
    Create a copair of the "left" alternative.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    As usual.+/ static final long serialVersionUID = -6377989869262315836L; /** Return the stored value, if this instance realizes the left variant.
    Return the stored value, if this instance realizes the right variant.
    int
     
    boolean
    Return whether this instance realizes the left variant.
    void
    Set this instance to realizes the left variant and set its value.
    void
    Set this instance to realizes the right variant and set its value.
     
    protected boolean
    Auxiliary method for comparison.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • left

      L left
      The value, in case the left variant is realized.
    • isLeft

      boolean isLeft
      Flag whether the left variant is realized.
  • Constructor Details

    • UncheckedCoPair

      public UncheckedCoPair(@Opt L left)
      Create a copair of the "left" alternative.
      Parameters:
      left - the value stored in this copair.
    • UncheckedCoPair

      public UncheckedCoPair(boolean b, @Opt R right)
      Create a copair of the "right" alternative.
      Parameters:
      b - a marker parameter which chooses the right alternative. Can have arbitrary value.
      right - the value stored in this copair.
    • UncheckedCoPair

      public UncheckedCoPair(CoPair<L,R> p)
      Create a copair with the same values as the prototype.
      Parameters:
      p - the prototype
  • Method Details

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • isLeft

      public boolean isLeft()
      Description copied from interface: CoPair
      Return whether this instance realizes the left variant.
      Specified by:
      isLeft in interface CoPair<L,R>
      Returns:
      whether this instance realizes the left variant.
    • get_left

      public L get_left()
      Description copied from interface: CoPair
      As usual.+/ static final long serialVersionUID = -6377989869262315836L; /** Return the stored value, if this instance realizes the left variant.
      Specified by:
      get_left in interface CoPair<L,R>
      Returns:
      the stored value, if this instance realizes the left variant.
    • get_right

      public R get_right()
      Description copied from interface: CoPair
      Return the stored value, if this instance realizes the right variant.
      Specified by:
      get_right in interface CoPair<L,R>
      Returns:
      the stored value, if this instance realizes the right variant.
    • set_left

      public void set_left(L l)
      Description copied from interface: CoPair
      Set this instance to realizes the left variant and set its value.
      Specified by:
      set_left in interface CoPair<L,R>
      Parameters:
      l - the value to be stored.
    • set_right

      public void set_right(R r)
      Description copied from interface: CoPair
      Set this instance to realizes the right variant and set its value.
      Specified by:
      set_right in interface CoPair<L,R>
      Parameters:
      r - the value to be stored.
    • xEquals

      protected boolean xEquals(UncheckedCoPair<?,?> o)
      Auxiliary method for comparison.
      Parameters:
      o - the object to compare with.
      Returns:
      whether this and the argument are equal.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object