Class CachedTriple<T1,T2,T3>

java.lang.Object
org.tribuo.util.infotheory.impl.CachedTriple<T1,T2,T3>
Type Parameters:
T1 - The type of the first object.
T2 - The type of the second object.
T3 - The type of the third object.
All Implemented Interfaces:
Serializable

public class CachedTriple<T1,T2,T3> extends Object implements Serializable
A triple of things. The inner pairs are cached, as is the hashcode.

The cache is calculated on construction, and the objects inside the triple are thus expected to be immutable. If they aren't then the behaviour is undefined (and you shouldn't use this class).

See Also:
  • Field Details

    • a

      protected final T1 a
      The first element.
    • b

      protected final T2 b
      The second element.
    • c

      protected final T3 c
      The third element.
  • Constructor Details

    • CachedTriple

      public CachedTriple(T1 a, T2 b, T3 c)
      Constructs a CachedTriple.
      Parameters:
      a - The first element.
      b - The second element.
      c - The third element.
  • Method Details

    • getA

      public T1 getA()
      Gets the first element.
      Returns:
      The first element.
    • getB

      public T2 getB()
      Gets the second element.
      Returns:
      The second element.
    • getC

      public T3 getC()
      Gets the third element.
      Returns:
      The third element.
    • getAB

      public CachedPair<T1,T2> getAB()
      Gets the pair of the first and second elements.
      Returns:
      A pair of the first and second elements.
    • getAC

      public CachedPair<T1,T3> getAC()
      Gets the pair of the first and third elements.
      Returns:
      A pair of the first and third elements.
    • getBC

      public CachedPair<T2,T3> getBC()
      Gets the pair of the second and third elements.
      Returns:
      A pair of the second and third elements.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • calculateHashCode

      public int calculateHashCode()
      Overridden hashcode. Checks to see if the types are ints or longs, and runs them through the mixing function if they are. Then XORs the two hashcodes together.
      Returns:
      A 32-bit integer.
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object