Class Chain
- All Implemented Interfaces:
Lattice
public class Chain extends AbstractDistributiveLattice
Elements of a chain with n elements are numbered from 0 to n −
1, causing an unfortunate clash between one()
, which can be obtained as
valueOf("1")
, and the second element (starting from zero()
)
of the chain, which can be obtained as valueOf(1)
.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and Type Method Description boolean
comp(Element x, Element y)
Check whether two elements are comparable usingLattice.meet(Element[])
.Collection<Element>
elements()
Generate iteratively all elements of this lattice.Collection<Element>
generators()
Return a collection of generators for the lattice.Element
join(Element... element)
Return the join of the provided elements.boolean
leq(Element x, Element y)
Check whether an element is smaller than or equal to another element usingLattice.meet(Element[])
.Element
meet(Element... element)
Return the meet of the provided elements.Element
one()
Return the one of this lattice.String
toString()
Element
valueOf(int i)
Return the element of this chain of given ordinal position.Element
valueOf(String name)
Return an element of this lattice, given its name.Element
zero()
Return the zero of this lattice.Methods inherited from class it.unimi.dsi.lama4j.AbstractLattice
coveringRelation, ensureElementsInLattice, ensureElementsInLattice, ensureElementsInLattice, pscomp, psdiff, symdiff, valueOfZeroOrOne
-
Constructor Details
-
Method Details
-
valueOf
Description copied from interface:Lattice
Return an element of this lattice, given its name.Certain lattices make it possible to define names for elements. This method returns the element corresponding to the provided name.
- Parameters:
name
- the name of an element of this lattice.- Returns:
- the element of this lattice named
name
.
-
valueOf
Return the element of this chain of given ordinal position.Note that while
valueOf(0)
returnzero()
,valueOf(1)
will not returnone()
unless this chain has less than three elements.- Parameters:
i
- the ordinal position in this chain (starting atzero()
with position 0).- Returns:
- the element of this chain of ordinal position
i
.
-
generators
Description copied from interface:Lattice
Return a collection of generators for the lattice. The set will not includezero
orone
. There is no guarantee of freeness or minimality.- Returns:
- a collection of generators.
-
elements
Description copied from class:AbstractLattice
Generate iteratively all elements of this lattice.This methods uses
Lattice.generators()
to obtain an initial set of elements, and then computes joins and meets of all available elements until no new elements are generated. It is expected that concrete subclasses will override this method with an ad hoc, more efficient implementation.It is strongly suggested that concrete subclasses that do not override this method cache its result internally.
- Specified by:
elements
in interfaceLattice
- Overrides:
elements
in classAbstractLattice
- Returns:
- the set of elements of this lattice.
-
one
Description copied from interface:Lattice
Return the one of this lattice.Note that there is no guarantee that the returned element is the only element representing one in this lattice. Other ones may arise from computations, but they will always be equal to the element returned by this method.
- Returns:
- the one of this lattice.
-
zero
Description copied from interface:Lattice
Return the zero of this lattice.Note that there is no guarantee that the returned element is the only element representing zero in this lattice. Other zeroes may arise from computations, but they will always be equal to the element returned by this method.
- Returns:
- the zero of this lattice.
-
join
Description copied from interface:Lattice
Return the join of the provided elements. In particular, upon the empty list of arguments returnszero
, and upon a singleton list the only specified element.- Parameters:
element
- the elements whose join has to be computed.- Returns:
- the join of the provided elements.
-
meet
Description copied from interface:Lattice
Return the meet of the provided elements. In particular, upon the empty list of arguments returnsone
, and upon a singleton list the only specified element.- Parameters:
element
- the elements whose meet has to be computed.- Returns:
- the meet of the provided elements.
-
comp
Description copied from class:AbstractLattice
Check whether two elements are comparable usingLattice.meet(Element[])
.- Specified by:
comp
in interfaceLattice
- Overrides:
comp
in classAbstractLattice
- Parameters:
x
- an element.y
- another element.- Returns:
- true iff
x.meet(y)
equalsx
ory
.
-
leq
Description copied from class:AbstractLattice
Check whether an element is smaller than or equal to another element usingLattice.meet(Element[])
.- Specified by:
leq
in interfaceLattice
- Overrides:
leq
in classAbstractLattice
- Parameters:
x
- an element.y
- another element.- Returns:
- true iff
x.meet(y)
equalsx
.
-
toString
-