Package mondrian.util

Class Triple<T0,​T1,​T2>

  • All Implemented Interfaces:
    java.lang.Comparable<Triple<T0,​T1,​T2>>

    public class Triple<T0,​T1,​T2>
    extends java.lang.Object
    implements java.lang.Comparable<Triple<T0,​T1,​T2>>
    Tuple of three values.

    Because a triple implements equals(Object), hashCode() and compareTo(mondrian.util.Triple), it can be used in any kind of Collection.

    Author:
    jhyde
    • Field Summary

      Fields 
      Modifier and Type Field Description
      T0 v0  
      T1 v1  
      T2 v2  
    • Constructor Summary

      Constructors 
      Constructor Description
      Triple​(T0 v0, T1 v1, T2 v2)
      Creates a Triple.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int compareTo​(Triple<T0,​T1,​T2> that)  
      boolean equals​(java.lang.Object obj)  
      int hashCode()  
      static <T0,​T1,​T2>
      java.lang.Iterable<T0>
      iter0​(java.lang.Iterable<Triple<T0,​T1,​T2>> iterable)
      Returns an iterable over the slice #0 of an iterable.
      static <T0,​T1,​T2>
      java.lang.Iterable<T1>
      iter1​(java.lang.Iterable<Triple<T0,​T1,​T2>> iterable)
      Returns an iterable over the slice #1 of an iterable.
      static <T0,​T1,​T2>
      java.lang.Iterable<T2>
      iter2​(java.lang.Iterable<Triple<T0,​T1,​T2>> iterable)
      Returns an iterable over the slice #2 of an iterable.
      static <T0,​T1,​T2>
      Triple<T0,​T1,​T2>
      of​(T0 v0, T1 v1, T2 v2)
      Creates a Triple.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

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

      • v0

        public T0 v0
      • v1

        public T1 v1
      • v2

        public T2 v2
    • Constructor Detail

      • Triple

        public Triple​(T0 v0,
                      T1 v1,
                      T2 v2)
        Creates a Triple.
        Parameters:
        v0 - Value #0
        v1 - Value #1
        v2 - Value #2
    • Method Detail

      • of

        public static <T0,​T1,​T2> Triple<T0,​T1,​T2> of​(T0 v0,
                                                                             T1 v1,
                                                                             T2 v2)
        Creates a Triple.
        Parameters:
        v0 - Value #0
        v1 - Value #1
        v2 - Value #2
        Returns:
        a new Triple
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • compareTo

        public int compareTo​(Triple<T0,​T1,​T2> that)
        Specified by:
        compareTo in interface java.lang.Comparable<T0>
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • iter0

        public static <T0,​T1,​T2> java.lang.Iterable<T0> iter0​(java.lang.Iterable<Triple<T0,​T1,​T2>> iterable)
        Returns an iterable over the slice #0 of an iterable.
        Type Parameters:
        T0 - Type #0
        T1 - Type #1
        T2 - Type #2
        Parameters:
        iterable - Iterable over triples
        Returns:
        Iterable over the 0'th elements of each triple
      • iter1

        public static <T0,​T1,​T2> java.lang.Iterable<T1> iter1​(java.lang.Iterable<Triple<T0,​T1,​T2>> iterable)
        Returns an iterable over the slice #1 of an iterable.
        Type Parameters:
        T0 - Type #0
        T1 - Type #1
        T2 - Type #2
        Parameters:
        iterable - Iterable over triples
        Returns:
        Iterable over the 1'th elements of each triple
      • iter2

        public static <T0,​T1,​T2> java.lang.Iterable<T2> iter2​(java.lang.Iterable<Triple<T0,​T1,​T2>> iterable)
        Returns an iterable over the slice #2 of an iterable.
        Type Parameters:
        T0 - Type #0
        T1 - Type #1
        T2 - Type #2
        Parameters:
        iterable - Iterable over triples
        Returns:
        Iterable over the 2'th elements of each triple