Package it.unive.lisa.analysis.lattices
Class GenericMapLattice<K,V extends Lattice<V>>
- java.lang.Object
-
- it.unive.lisa.analysis.lattices.FunctionalLattice<GenericMapLattice<K,V>,K,V>
-
- it.unive.lisa.analysis.lattices.GenericMapLattice<K,V>
-
- Type Parameters:
K
- the type of keys of this mapV
- the type of values of this map
- All Implemented Interfaces:
BaseLattice<GenericMapLattice<K,V>>
,Lattice<GenericMapLattice<K,V>>
,StructuredObject
,java.lang.Iterable<java.util.Map.Entry<K,V>>
public class GenericMapLattice<K,V extends Lattice<V>> extends FunctionalLattice<GenericMapLattice<K,V>,K,V>
A generic ready-to-useFunctionalLattice
with no additional fields, that relies on the underlying lattice instance for distinguishing top and bottom values.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class it.unive.lisa.analysis.lattices.FunctionalLattice
FunctionalLattice.FunctionalLift<V extends Lattice<V>>, FunctionalLattice.KeyFunctionalLift<K>
-
-
Field Summary
-
Fields inherited from class it.unive.lisa.analysis.lattices.FunctionalLattice
function, lattice
-
Fields inherited from interface it.unive.lisa.analysis.Lattice
BOTTOM_STRING, TOP_STRING
-
-
Constructor Summary
Constructors Constructor Description GenericMapLattice(V lattice)
Builds the map.GenericMapLattice(V lattice, java.util.Map<K,V> function)
Builds the map.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description GenericMapLattice<K,V>
bottom()
Yields the bottom element of this lattice.GenericMapLattice<K,V>
mk(V lattice, java.util.Map<K,V> function)
Builds a instance of this class from the given lattice instance and the given mapping.V
stateOfUnknown(K key)
Yields the value that should be returned byFunctionalLattice.getState(Object)
whenever the given key is not present in this map.GenericMapLattice<K,V>
top()
Yields the top element of this lattice.-
Methods inherited from class it.unive.lisa.analysis.lattices.FunctionalLattice
equals, functionalLift, getKeys, getMap, getOtDefault, getState, getValues, glbAux, glbKeys, hashCode, isBottom, isTop, iterator, lessOrEqualAux, lubAux, lubKeys, mkNewFunction, narrowingAux, putState, representation, toString, wideningAux
-
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, widening
-
-
-
-
Constructor Detail
-
GenericMapLattice
public GenericMapLattice(V lattice)
Builds the map.- Parameters:
lattice
- the underlying lattice of values
-
-
Method Detail
-
top
public GenericMapLattice<K,V> 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 GenericMapLattice<K,V> 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 GenericMapLattice<K,V> mk(V lattice, java.util.Map<K,V> function)
Description copied from class:FunctionalLattice
Builds a instance of this class from the given lattice instance and the given mapping.- Specified by:
mk
in classFunctionalLattice<GenericMapLattice<K,V extends Lattice<V>>,K,V extends Lattice<V>>
- Parameters:
lattice
- an instance of lattice to be used during semantic operations to retrieve top and bottom valuesfunction
- the function representing the mapping contained in the new environment; can benull
- Returns:
- a new instance of this class
-
stateOfUnknown
public V stateOfUnknown(K key)
Description copied from class:FunctionalLattice
Yields the value that should be returned byFunctionalLattice.getState(Object)
whenever the given key is not present in this map.- Specified by:
stateOfUnknown
in classFunctionalLattice<GenericMapLattice<K,V extends Lattice<V>>,K,V extends Lattice<V>>
- Parameters:
key
- the key that is missing- Returns:
- the lattice element for keys not in the mapping
-
-