Package it.unive.lisa.analysis.lattices
Class ExpressionSet
- java.lang.Object
-
- it.unive.lisa.analysis.lattices.SetLattice<ExpressionSet,SymbolicExpression>
-
- it.unive.lisa.analysis.lattices.ExpressionSet
-
- All Implemented Interfaces:
BaseLattice<ExpressionSet>
,Lattice<ExpressionSet>
,ScopedObject<ExpressionSet>
,StructuredObject
,java.lang.Iterable<SymbolicExpression>
public class ExpressionSet extends SetLattice<ExpressionSet,SymbolicExpression> implements ScopedObject<ExpressionSet>
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(SymbolicExpression exp)
Builds a singleton set lattice element.ExpressionSet(java.util.Set<SymbolicExpression> set)
Builds a set lattice element.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ExpressionSet
bottom()
Yields the bottom element of this lattice.boolean
equals(java.lang.Object obj)
int
hashCode()
ExpressionSet
lubAux(ExpressionSet other)
Performs the least upper bound operation between this lattice element and the given one, assuming that base cases have already been handled.ExpressionSet
mk(java.util.Set<SymbolicExpression> set)
Utility for creating a concrete instance ofSetLattice
given a set.ExpressionSet
popScope(ScopeToken token)
Pops the scope identified by the given token from this object.ExpressionSet
pushScope(ScopeToken token)
Pushes a new scope, identified by the give token, in this object.ExpressionSet
top()
Yields the top element of this lattice.-
Methods inherited from class it.unive.lisa.analysis.lattices.SetLattice
contains, elements, glbAux, isBottom, isEmpty, isTop, iterator, lessOrEqualAux, 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
-
ExpressionSet
public ExpressionSet()
Builds the empty set lattice element.
-
ExpressionSet
public ExpressionSet(SymbolicExpression exp)
Builds a singleton set lattice element.- Parameters:
exp
- the expression
-
ExpressionSet
public ExpressionSet(java.util.Set<SymbolicExpression> set)
Builds a set lattice element.- Parameters:
set
- the set of expression
-
-
Method Detail
-
top
public ExpressionSet 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.- Specified by:
top
in interfaceLattice<ExpressionSet>
- Returns:
- the top element
-
bottom
public ExpressionSet 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.- Specified by:
bottom
in interfaceLattice<ExpressionSet>
- Returns:
- the bottom element
-
mk
public ExpressionSet mk(java.util.Set<SymbolicExpression> 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,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()
- Specified by:
hashCode
in interfaceBaseLattice<ExpressionSet>
- Overrides:
hashCode
in classSetLattice<ExpressionSet,SymbolicExpression>
-
equals
public boolean equals(java.lang.Object obj)
- Specified by:
equals
in interfaceBaseLattice<ExpressionSet>
- Overrides:
equals
in classSetLattice<ExpressionSet,SymbolicExpression>
-
lubAux
public ExpressionSet lubAux(ExpressionSet other) throws SemanticException
Description copied from interface: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)
)
- Specified by:
lubAux
in interfaceBaseLattice<ExpressionSet>
- Overrides:
lubAux
in classSetLattice<ExpressionSet,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 pushScope(ScopeToken token) throws SemanticException
Description copied from interface:ScopedObject
Pushes a new scope, identified by the give token, in this object. This causes all variables not associated with a scope (and thus visible) to be mapped to the given scope and hidden away, until the scope is popped withScopedObject.popScope(ScopeToken)
.- Specified by:
pushScope
in interfaceScopedObject<ExpressionSet>
- Parameters:
token
- the token identifying the scope to push- Returns:
- a copy of this object where the local unscoped variables have been hidden
- Throws:
SemanticException
- if an error occurs during the computation
-
popScope
public ExpressionSet popScope(ScopeToken token) throws SemanticException
Description copied from interface:ScopedObject
Pops the scope identified by the given token from this object. This causes all the visible variables (i.e. that are not mapped to a scope) to be removed, while the local variables that were associated to the given scope token (and thus hidden) will become visible again.- Specified by:
popScope
in interfaceScopedObject<ExpressionSet>
- Parameters:
token
- the token of the scope to be restored- Returns:
- a copy of this object where the local variables have been removed, while the variables mapped to the given scope are visible again
- Throws:
SemanticException
- if an error occurs during the computation
-
-