Package it.unive.lisa.analysis.lattices
Class GenericSetLattice<E>
- java.lang.Object
-
- it.unive.lisa.analysis.lattices.SetLattice<GenericSetLattice<E>,E>
-
- it.unive.lisa.analysis.lattices.GenericSetLattice<E>
-
- Type Parameters:
E
- the type of elements of this set
- All Implemented Interfaces:
BaseLattice<GenericSetLattice<E>>
,Lattice<GenericSetLattice<E>>
,StructuredObject
,java.lang.Iterable<E>
public class GenericSetLattice<E> extends SetLattice<GenericSetLattice<E>,E>
A generic ready-to-useSetLattice
with no additional fields, that relies on an underlying boolean value for distinguishing top and bottom values.
-
-
Field Summary
-
Fields inherited from class it.unive.lisa.analysis.lattices.SetLattice
elements, isTop
-
Fields inherited from interface it.unive.lisa.analysis.Lattice
BOTTOM_STRING, TOP_STRING
-
-
Constructor Summary
Constructors Constructor Description GenericSetLattice()
Builds an empty set representing the top element.GenericSetLattice(E element)
Builds a set containing only the given element.GenericSetLattice(java.util.Set<E> elements)
Builds a set with all the given elements.GenericSetLattice(java.util.Set<E> elements, boolean isTop)
Builds a set with all the given elements, also specifying whether an empty set should be considered top or bottom.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description GenericSetLattice<E>
bottom()
Yields the bottom element of this lattice.GenericSetLattice<E>
mk(java.util.Set<E> set)
Utility for creating a concrete instance ofSetLattice
given a set.GenericSetLattice<E>
top()
Yields the top element of this lattice.-
Methods inherited from class it.unive.lisa.analysis.lattices.SetLattice
contains, elements, equals, glbAux, hashCode, isBottom, isEmpty, isTop, iterator, lessOrEqualAux, lubAux, representation, size, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface it.unive.lisa.analysis.BaseLattice
glb, lessOrEqual, lub, narrowing, narrowingAux, widening, wideningAux
-
-
-
-
Constructor Detail
-
GenericSetLattice
public GenericSetLattice()
Builds an empty set representing the top element.
-
GenericSetLattice
public GenericSetLattice(E element)
Builds a set containing only the given element.- Parameters:
element
- the element
-
GenericSetLattice
public GenericSetLattice(java.util.Set<E> elements)
Builds a set with all the given elements.- Parameters:
elements
- the elements
-
GenericSetLattice
public GenericSetLattice(java.util.Set<E> elements, boolean isTop)
Builds a set with all the given elements, also specifying whether an empty set should be considered top or bottom.- Parameters:
elements
- the elementsisTop
- ifelements
is empty, specifies if this set should be considered top or bottom
-
-
Method Detail
-
top
public GenericSetLattice<E> top()
Description copied from interface:Lattice
Yields the top element of this lattice. The returned element should be unique across different calls to this method, sinceLattice.isTop()
uses reference equality by default. If the value returned by this method is not a singleton, overrideLattice.isTop()
accordingly to provide a coherent test.- Returns:
- the top element
-
bottom
public GenericSetLattice<E> bottom()
Description copied from interface:Lattice
Yields the bottom element of this lattice. The returned element should be unique across different calls to this method, sinceLattice.isBottom()
uses reference equality by default. If the value returned by this method is not a singleton, overrideLattice.isBottom()
accordingly to provide a coherent test.- Returns:
- the bottom element
-
mk
public GenericSetLattice<E> mk(java.util.Set<E> set)
Description copied from class:SetLattice
Utility for creating a concrete instance ofSetLattice
given a set. This decouples the instance of set used during computation of the elements to put in the lattice from the actual type of set underlying the lattice.- Specified by:
mk
in classSetLattice<GenericSetLattice<E>,E>
- Parameters:
set
- the set containing the elements that must be included in the lattice instance- Returns:
- a new concrete instance of
SetLattice
containing the elements of the given set
-
-