Class Product
- All Implemented Interfaces:
Lattice
public class Product extends AbstractLattice
Note that the product of zero lattices is the trivial lattice with one element.
-
Field Summary
-
Method Summary
Modifier and Type Method Description boolean
comp(Element x, Element y)
Check whether two elements are comparable usingLattice.meet(Element[])
.Lattice
component(int k)
Return a component lattice, given its index.Collection<Element>
elements()
Generate iteratively all elements of this lattice.Collection<Element>
generators()
Return a collection of generators for the lattice.boolean
isDistributive()
Return true if this lattice is distributive.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.static Lattice
of(Lattice... lattice)
Return the product of the provided lattices.Element
one()
Return the one of this lattice.Element
proj(Element e, int i)
Project the provided element on a component specified by index.String
toString()
Element
tuple(Element... element)
Return an element of this product given a tuple of elements from its factors.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
-
Method Details
-
of
Return the product of the provided lattices.- Parameters:
lattice
- the lattices whose product has to be computed.- Returns:
- the product of the specified lattices.
-
isDistributive
public boolean isDistributive()Description copied from interface:Lattice
Return true if this lattice is distributive.- Specified by:
isDistributive
in interfaceLattice
- Overrides:
isDistributive
in classAbstractLattice
- Returns:
- true if this lattice is distributive.
-
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.
-
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.
-
proj
Project the provided element on a component specified by index.- Parameters:
e
- an element of this product.i
- a component, specified by its index starting at 0.- Returns:
- the projection of
e
on thei
-th component.
-
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
.
-
tuple
Return an element of this product given a tuple of elements from its factors.- Parameters:
element
- a list of elements from each factor of this product, in the same order.- Returns:
- the element of the product defined by the tuple
element
.
-
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.
-
component
Return a component lattice, given its index.The component lattices of a product are numbered from 0. This method provides access by index to such components.
- Parameters:
k
- a component index.- Returns:
- the component lattice of index
k
.
-
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
-