Class NTuple2<T1 extends Comparable<T1>,T2 extends Comparable<T2>>

java.lang.Object
de.powerstat.validation.containers.NTuple2<T1,T2>
Type Parameters:
T1 - Type 1
T2 - Type 2
All Implemented Interfaces:
Comparable<NTuple2<T1,T2>>

public final class NTuple2<T1 extends Comparable<T1>,T2 extends Comparable<T2>> extends Object implements Comparable<NTuple2<T1,T2>>
N-Tuple 2.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final T1
    Object1 of type T1.
    private final T2
    Object2 of type T2.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
    NTuple2(T1 obj1, T2 obj2)
    Private constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Compare with another object.
    boolean
    Is equal with another object.
    int
    Calculate hash code.
    static <T1 extends Comparable<T1>, T2 extends Comparable<T2>>
    NTuple2<T1,T2>
    of(T1 obj1, T2 obj2)
    NTuple2 factory.
    Returns the first value of this NTuple2 as a T1.
    Returns the second value of this NTuple2 as a T2.
    Returns the string representation of this NTuple2.

    Methods inherited from class java.lang.Object

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

    • object1

      private final T1 extends Comparable<T1> object1
      Object1 of type T1.
    • object2

      private final T2 extends Comparable<T2> object2
      Object2 of type T2.
  • Constructor Details

    • NTuple2

      private NTuple2(T1 obj1, T2 obj2)
      Private constructor.
      Parameters:
      obj1 - Object 1 of type T1
      obj2 - Object 2 of Type T2
  • Method Details

    • of

      public static <T1 extends Comparable<T1>, T2 extends Comparable<T2>> NTuple2<T1,T2> of(T1 obj1, T2 obj2)
      NTuple2 factory.
      Type Parameters:
      T1 - Type 1
      T2 - Type 2
      Parameters:
      obj1 - Object 1 of type T1
      obj2 - Object 2 of Type T2
      Returns:
      NTuple2 object
    • t1Value

      public T1 t1Value()
      Returns the first value of this NTuple2 as a T1.
      Returns:
      The T1 value represented by this object.
    • t2Value

      public T2 t2Value()
      Returns the second value of this NTuple2 as a T2.
      Returns:
      The T2 value represented by this object.
    • hashCode

      public int hashCode()
      Calculate hash code.
      Overrides:
      hashCode in class Object
      Returns:
      Hash
      See Also:
    • equals

      public boolean equals(Object obj)
      Is equal with another object.
      Overrides:
      equals in class Object
      Parameters:
      obj - Object
      Returns:
      true when equal, false otherwise
      See Also:
    • toString

      public String toString()
      Returns the string representation of this NTuple2. The exact details of this representation are unspecified and subject to change, but the following may be regarded as typical: "NTuple2[object1=..., object2=...]"
      Overrides:
      toString in class Object
      Returns:
      String representation of this NTuple2
      See Also:
    • compareTo

      public int compareTo(NTuple2<T1,T2> obj)
      Compare with another object.
      Specified by:
      compareTo in interface Comparable<T1 extends Comparable<T1>>
      Parameters:
      obj - Object to compare with
      Returns:
      0: equal; 1: greater; -1: smaller
      See Also: