Class IntPreOrder


  • public class IntPreOrder
    extends Object
    This class represents a total pre-orders of {1,..n}, which are identified by a list of their equivalence classes.

    This domain has a canonical lattice structure induced by the "granularity" - a total pre-order refines another if it induces smaller equivalence classes. The top element is the most granular pre-order, whose only equivalence class is the full domain. The bottom elements are all total orders (i.e. they also are antisymmetric).

    The class provides two operations:

    This class is imported from https://github.com/incaseoftrouble/naturals-util

    • Field Detail

      • array

        protected final int[][] array
      • size

        protected final int size
    • Method Detail

      • coarsest

        public static IntPreOrder coarsest​(int n)
        Returns the coarsest pre-order over the {1,..,n} domain, i.e. [{1,..,n}].
        Parameters:
        n - The size of the domain
        Returns:
        The coarsest record over the domain
      • empty

        public static IntPreOrder empty()
        Returns the empty pre-order.
      • finest

        public static IntPreOrder finest​(int n)
        Returns a finest pre-order over the {1,..,n} domain, i.e. a record of the form [{1},{2},..,{n}].
      • classes

        public int classes()
        Returns the number of classes.
      • equivalenceClass

        public int[] equivalenceClass​(int index)
        Returns the class with the given index.

        Warning: For performance reasons, the internal array is returned (instead of a copy). This array must not be modified.

      • generation

        public IntPreOrder generation​(Set<Integer> newborn)
        Computes the pre-order obtained by declaring newborn as the smallest elements.
        Parameters:
        newborn - The new smallest elements.
        Returns:
        The pre-order with newborn as new smallest elements.
      • hashCode

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

        public boolean refines​(IntPreOrder other)
        Determines whether the pre-order defined by this object strictly refines the other.
      • size

        public int size()
        Returns the domain size.