Class ShiftOrder

  • All Implemented Interfaces:
    LexicographicalOrder

    public class ShiftOrder
    extends java.lang.Object
    implements LexicographicalOrder
    Version:
    4.7

    It provides a very simple lexicographical order based on the dimension ordering, with the possibility to choose the most significant dimension

    • Constructor Summary

      Constructors 
      Constructor Description
      ShiftOrder​(int dimensions, int mostSignificant)
      It creates a lexicographical order with the possibility to shift the order according to the most significant dimension.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private void adjustOrderingToShift()
      It adjust the ordering to the shift caused by most significant dimension which is no longer positioned at index 0.
      java.lang.String checkInvariants()
      It checks that this order has consistent data structures.
      int compare​(int[] p1, int[] p2)
      It compares two k-dimensional points.
      int dimensionAt​(int precedenceLevel)
      It provides the dimension corresponding to the given precedence level
      int getMostSignificantDimension()
      This is equivalent to the call precedenceOf(0).
      int[] masterOrdering()
      It returns the ordering of dimensions used when no shift is applied (i.e.
      int precedenceOf​(int dimension)
      It provides the precedence level of the given dimension.
      void setMostSignificantDimension​(int dimension)
      It shifts the lexicographical order so that the most significant dimension is set to d.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • mostSignificant

        int mostSignificant
      • noOfDimensions

        final int noOfDimensions
      • masterOrdering

        final int[] masterOrdering
      • orderingWithShiftConsidered

        final int[] orderingWithShiftConsidered
    • Constructor Detail

      • ShiftOrder

        public ShiftOrder​(int dimensions,
                          int mostSignificant)
        It creates a lexicographical order with the possibility to shift the order according to the most significant dimension.
        Parameters:
        dimensions - number of dimensions.
        mostSignificant - the position of the most significant dimension.
    • Method Detail

      • checkInvariants

        public java.lang.String checkInvariants()
        It checks that this order has consistent data structures.
        Returns:
        a string describing the consistency problem with data structures, null if no problem encountered.
      • adjustOrderingToShift

        private void adjustOrderingToShift()
        It adjust the ordering to the shift caused by most significant dimension which is no longer positioned at index 0.
      • compare

        public int compare​(int[] p1,
                           int[] p2)
        Description copied from interface: LexicographicalOrder
        It compares two k-dimensional points.
        Specified by:
        compare in interface LexicographicalOrder
        Parameters:
        p1 - point 1
        p2 - point 2
        Returns:
        comparison result: a negative value if p1 is smaller than p2, 0 if p1 is equal to p2, and a positive value if p1 is larger than p2.
      • dimensionAt

        public int dimensionAt​(int precedenceLevel)
        Description copied from interface: LexicographicalOrder
        It provides the dimension corresponding to the given precedence level
        Specified by:
        dimensionAt in interface LexicographicalOrder
        Parameters:
        precedenceLevel - the given precedence level
        Returns:
        an integer value of the dimension.
      • precedenceOf

        public int precedenceOf​(int dimension)
        Description copied from interface: LexicographicalOrder
        It provides the precedence level of the given dimension. 0 is the most significant.
        Specified by:
        precedenceOf in interface LexicographicalOrder
        Parameters:
        dimension - the given dimension
        Returns:
        integer value of the precedence level.
      • setMostSignificantDimension

        public void setMostSignificantDimension​(int dimension)
        Description copied from interface: LexicographicalOrder
        It shifts the lexicographical order so that the most significant dimension is set to d.
        Specified by:
        setMostSignificantDimension in interface LexicographicalOrder
        Parameters:
        dimension - the dimension to be considered most significant
      • masterOrdering

        public int[] masterOrdering()
        Description copied from interface: LexicographicalOrder
        It returns the ordering of dimensions used when no shift is applied (i.e. when the most significant dimension is not changed)
        Specified by:
        masterOrdering in interface LexicographicalOrder
        Returns:
        the ordering of dimensions without a shift.