Class Ordering

  • All Implemented Interfaces:
    Cloneable

    @Internal
    public class Ordering
    extends Object
    implements Cloneable
    This class represents an ordering on a set of fields. It specifies the fields and order direction (ascending, descending).
    • Constructor Detail

      • Ordering

        public Ordering()
        Creates an empty ordering.
      • Ordering

        public Ordering​(int index,
                        Class<? extends Comparable<?>> type,
                        Order order)
        Parameters:
        index -
        type -
        order -
    • Method Detail

      • appendOrdering

        public Ordering appendOrdering​(Integer index,
                                       Class<? extends Comparable<?>> type,
                                       Order order)
        Extends this ordering by appending an additional order requirement. If the index has been previously appended then the unmodified Ordering is returned.
        Parameters:
        index - Field index of the appended order requirement.
        type - Type of the appended order requirement.
        order - Order of the appended order requirement.
        Returns:
        This ordering with an additional appended order requirement.
      • getNumberOfFields

        public int getNumberOfFields()
      • getInvolvedIndexes

        public FieldList getInvolvedIndexes()
      • getFieldNumber

        public Integer getFieldNumber​(int index)
      • getOrder

        public Order getOrder​(int index)
      • getFieldPositions

        public int[] getFieldPositions()
      • getFieldOrders

        public Order[] getFieldOrders()
      • getFieldSortDirections

        public boolean[] getFieldSortDirections()
      • isMetBy

        public boolean isMetBy​(Ordering otherOrdering)
      • isOrderEqualOnFirstNFields

        public boolean isOrderEqualOnFirstNFields​(Ordering other,
                                                  int n)
      • createNewOrderingUpToIndex

        public Ordering createNewOrderingUpToIndex​(int exclusiveIndex)
        Creates a new ordering the represents an ordering on a prefix of the fields. If the exclusive index up to which to create the ordering is 0, then there is no resulting ordering and this method return null.
        Parameters:
        exclusiveIndex - The index (exclusive) up to which to create the ordering.
        Returns:
        The new ordering on the prefix of the fields, or null, if the prefix is empty.
      • groupsFields

        public boolean groupsFields​(FieldSet fields)
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object