Package owl.collections
Class IntPreOrder
- java.lang.Object
-
- owl.collections.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:
generation(java.util.Set<java.lang.Integer>): Computes the record obtained by "rebirth" of the given elements, i.e. they are defined as the new first equivalence class.refines(IntPreOrder): Determines whether this record is strict refinement of the other record.
This class is imported from https://github.com/incaseoftrouble/naturals-util
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intclasses()Returns the number of classes.static IntPreOrdercoarsest(int n)Returns the coarsest pre-order over the{1,..,n}domain, i.e.static IntPreOrderempty()Returns the empty pre-order.booleanequals(Object o)int[]equivalenceClass(int index)Returns the class with the givenindex.static IntPreOrderfinest(int n)Returns a finest pre-order over the{1,..,n}domain, i.e.IntPreOrdergeneration(Set<Integer> newborn)Computes the pre-order obtained by declaringnewbornas the smallest elements.inthashCode()booleanrefines(IntPreOrder other)Determines whether the pre-order defined by this object strictly refines theother.intsize()Returns the domain size.StringtoString()
-
-
-
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 givenindex.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 declaringnewbornas the smallest elements.- Parameters:
newborn- The new smallest elements.- Returns:
- The pre-order with
newbornas new smallest elements.
-
refines
public boolean refines(IntPreOrder other)
Determines whether the pre-order defined by this object strictly refines theother.
-
size
public int size()
Returns the domain size.
-
-