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 int
classes()
Returns the number of classes.static IntPreOrder
coarsest(int n)
Returns the coarsest pre-order over the{1,..,n}
domain, i.e.static IntPreOrder
empty()
Returns the empty pre-order.boolean
equals(Object o)
int[]
equivalenceClass(int index)
Returns the class with the givenindex
.static IntPreOrder
finest(int n)
Returns a finest pre-order over the{1,..,n}
domain, i.e.IntPreOrder
generation(Set<Integer> newborn)
Computes the pre-order obtained by declaringnewborn
as the smallest elements.int
hashCode()
boolean
refines(IntPreOrder other)
Determines whether the pre-order defined by this object strictly refines theother
.int
size()
Returns the domain size.String
toString()
-
-
-
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 declaringnewborn
as the smallest elements.- Parameters:
newborn
- The new smallest elements.- Returns:
- The pre-order with
newborn
as 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.
-
-