Class TupleComparator

  • All Implemented Interfaces:
    java.util.Comparator<Tuple>

    public class TupleComparator
    extends java.lang.Object
    implements java.util.Comparator<Tuple>
    Compares two tuples according to the values of one or many of their attributes. Such a comparator can be used to sort a list of tuples.
    Author:
    Sylvain Hallé
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.lang.String[] m_sortAttributes
      The attributes over which to perform the comparison
    • Constructor Summary

      Constructors 
      Constructor Description
      TupleComparator​(java.lang.String... attributes)
      Creates a new tuple comparator
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int compare​(Tuple x, Tuple y)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.Comparator

        equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
    • Field Detail

      • m_sortAttributes

        protected java.lang.String[] m_sortAttributes
        The attributes over which to perform the comparison
    • Constructor Detail

      • TupleComparator

        public TupleComparator​(java.lang.String... attributes)
        Creates a new tuple comparator
        Parameters:
        attributes - The attributes over which to perform the comparison
    • Method Detail

      • compare

        public int compare​(Tuple x,
                           Tuple y)
        Specified by:
        compare in interface java.util.Comparator<Tuple>