Package it.unive.lisa.analysis.lattices
Class ExpressionSet<T extends SymbolicExpression>
- java.lang.Object
-
- it.unive.lisa.analysis.BaseLattice<S>
-
- it.unive.lisa.analysis.lattices.SetLattice<ExpressionSet<T>,T>
-
- it.unive.lisa.analysis.lattices.ExpressionSet<T>
-
- Type Parameters:
T
- the type of the tracked symbolic expressions
- All Implemented Interfaces:
Lattice<ExpressionSet<T>>
,java.lang.Iterable<T>
public class ExpressionSet<T extends SymbolicExpression> extends SetLattice<ExpressionSet<T>,T>
A set lattice containing a set of symbolic expressions.
-
-
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 ExpressionSet()
Builds the empty set lattice element.ExpressionSet(java.util.Set<T> set)
Builds a set lattice element.ExpressionSet(T exp)
Builds a singleton set lattice element.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ExpressionSet<T>
bottom()
Yields the bottom element of this lattice.boolean
equals(java.lang.Object obj)
int
hashCode()
ExpressionSet<T>
lubAux(ExpressionSet<T> other)
Performs the least upper bound operation between this lattice element and the given one, assuming that base cases have already been handled.ExpressionSet<T>
mk(java.util.Set<T> set)
Utility for creating a concrete instance ofSetLattice
given a set.ExpressionSet<SymbolicExpression>
popScope(ScopeToken token)
Pops the scope identified by the given token from the set.ExpressionSet<SymbolicExpression>
pushScope(ScopeToken token)
Pushes a new scope, identified by the give token, in the set.DomainRepresentation
representation()
Yields aDomainRepresentation
of the information contained in this set.ExpressionSet<T>
top()
Yields the top element of this lattice.-
Methods inherited from class it.unive.lisa.analysis.lattices.SetLattice
contains, elements, glb, isBottom, isEmpty, isTop, iterator, lessOrEqualAux, size, toString
-
Methods inherited from class it.unive.lisa.analysis.BaseLattice
lessOrEqual, lub, widening, wideningAux
-
-
-
-
Constructor Detail
-
ExpressionSet
public ExpressionSet()
Builds the empty set lattice element.
-
ExpressionSet
public ExpressionSet(T exp)
Builds a singleton set lattice element.- Parameters:
exp
- the expression
-
ExpressionSet
public ExpressionSet(java.util.Set<T> set)
Builds a set lattice element.- Parameters:
set
- the set of expression
-
-
Method Detail
-
top
public ExpressionSet<T> 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 ExpressionSet<T> 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 ExpressionSet<T> mk(java.util.Set<T> 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<ExpressionSet<T extends SymbolicExpression>,T extends SymbolicExpression>
- 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
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classSetLattice<ExpressionSet<T extends SymbolicExpression>,T extends SymbolicExpression>
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classSetLattice<ExpressionSet<T extends SymbolicExpression>,T extends SymbolicExpression>
-
lubAux
public ExpressionSet<T> lubAux(ExpressionSet<T> other) throws SemanticException
Description copied from class:BaseLattice
Performs the least upper bound operation between this lattice element and the given one, assuming that base cases have already been handled. In particular, it is guaranteed that:other
is notnull
other
is neither top nor bottomthis
is neither top nor bottomthis
andother
are not the same object (according both to==
and toObject.equals(Object)
)
- Overrides:
lubAux
in classSetLattice<ExpressionSet<T extends SymbolicExpression>,T extends SymbolicExpression>
- Parameters:
other
- the other lattice element- Returns:
- the least upper bound between this and other
- Throws:
SemanticException
- if an error occurs during the computation
-
pushScope
public ExpressionSet<SymbolicExpression> pushScope(ScopeToken token) throws SemanticException
Pushes a new scope, identified by the give token, in the set. This recursively invokesSymbolicExpression.pushScope(ScopeToken)
on all elements of the set (return type is forced toExpressionSet<SymbolicExpression>
since this operation returns the root of the hierarchy).- Parameters:
token
- the token identifying the scope to push- Returns:
- a copy of this set where the expressions have the given scope pushed
- Throws:
SemanticException
- if an error occurs during the computation
-
popScope
public ExpressionSet<SymbolicExpression> popScope(ScopeToken token) throws SemanticException
Pops the scope identified by the given token from the set. This recursively invokesSymbolicExpression.popScope(ScopeToken)
on all elements of the set (return type is forced toExpressionSet<SymbolicExpression>
since this operation returns the root of the hierarchy).- Parameters:
token
- the token of the scope to be restored- Returns:
- a copy of this domain where the the expressions have the given scope popped
- Throws:
SemanticException
- if an error occurs during the computation
-
representation
public DomainRepresentation representation()
Yields aDomainRepresentation
of the information contained in this set.- Returns:
- the representation
-
-