Class CartesianProduct<C extends CartesianProduct<C,T1,T2,E,I>,T1 extends SemanticDomain<T1,E,I> & Lattice<T1>,T2 extends SemanticDomain<T2,E,I> & Lattice<T2>,E extends SymbolicExpression,I extends Identifier>
- java.lang.Object
-
- it.unive.lisa.analysis.combination.CartesianProduct<C,T1,T2,E,I>
-
- Type Parameters:
C- the concrete type of the cartesian productT1- the concrete instance of the left-hand side abstract domain of the Cartesian productT2- the concrete instance of the right-hand side abstract domain of the Cartesian productE- the type ofSymbolicExpressionthat<T1>and<T2>, and in turn this domain, can processI- the type ofIdentifierthat<T1>and<T2>, and in turn this domain, handle
- All Implemented Interfaces:
Lattice<C>,SemanticDomain<C,E,I>
- Direct Known Subclasses:
ValueCartesianProduct
public abstract class CartesianProduct<C extends CartesianProduct<C,T1,T2,E,I>,T1 extends SemanticDomain<T1,E,I> & Lattice<T1>,T2 extends SemanticDomain<T2,E,I> & Lattice<T2>,E extends SymbolicExpression,I extends Identifier> extends java.lang.Object implements SemanticDomain<C,E,I>, Lattice<C>
A generic Cartesian product abstract domain between two non-communicatingSemanticDomains (i.e., no exchange of information between the abstract domains), assigning the sameIdentifiers and handling instances of the sameSymbolicExpressions.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface it.unive.lisa.analysis.SemanticDomain
SemanticDomain.Satisfiability
-
-
Field Summary
Fields Modifier and Type Field Description protected T1leftThe left-hand side abstract domain.protected T2rightThe right-hand side abstract domain.-
Fields inherited from interface it.unive.lisa.analysis.Lattice
BOTTOM_REPR, BOTTOM_STRING, TOP_REPR, TOP_STRING
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedCartesianProduct(T1 left, T2 right)Builds the Cartesian product abstract domain.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Cassign(I id, E expression, ProgramPoint pp)Yields a copy of this domain, whereidhas been assigned tovalue.Cassume(E expression, ProgramPoint pp)Yields a copy of this domain, modified by assuming that the given expression holds.Cbottom()Yields the bottom element of this lattice.booleanequals(java.lang.Object obj)CforgetIdentifier(Identifier id)Forgets anIdentifier.inthashCode()booleanisBottom()Yieldstrueif and only if this object represents the bottom of the lattice.booleanisTop()Yieldstrueif and only if this object represents the top of the lattice.booleanlessOrEqual(C other)Yieldstrueif and only if this lattice element is in relation with (usually represented through ≤) the given one.Club(C other)Performs the least upper bound operation between this lattice element and the given one.protected abstract Cmk(T1 left, T2 right)Builds a new instance of cartesian product.CpopScope(ScopeToken scope)Pops the scope identified by the given token from the domain.CpushScope(ScopeToken scope)Pushes a new scope, identified by the give token, in the domain.DomainRepresentationrepresentation()Yields aDomainRepresentationof the information contained in this domain's instance.SemanticDomain.Satisfiabilitysatisfies(E expression, ProgramPoint pp)Checks if the given expression is satisfied by the abstract values of this domain, returning an instance ofSemanticDomain.Satisfiability.CsmallStepSemantics(E expression, ProgramPoint pp)Yields a copy of this domain, that has been modified accordingly to the semantics of the givenexpression.Ctop()Yields the top element of this lattice.java.lang.StringtoString()Cwidening(C other)Performs the widening operation between this lattice element and the given one.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface it.unive.lisa.analysis.SemanticDomain
forgetIdentifiers
-
-
-
-
Method Detail
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
toString
public final java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
mk
protected abstract C mk(T1 left, T2 right)
Builds a new instance of cartesian product.- Parameters:
left- the first domainright- the second domain- Returns:
- the new instance of product
-
representation
public final DomainRepresentation representation()
Description copied from interface:SemanticDomainYields aDomainRepresentationof the information contained in this domain's instance.- Specified by:
representationin interfaceSemanticDomain<C extends CartesianProduct<C,T1,T2,E,I>,T1 extends SemanticDomain<T1,E,I> & Lattice<T1>,T2 extends SemanticDomain<T2,E,I> & Lattice<T2>>- Returns:
- the representation
-
assign
public final C assign(I id, E expression, ProgramPoint pp) throws SemanticException
Description copied from interface:SemanticDomainYields a copy of this domain, whereidhas been assigned tovalue.- Specified by:
assignin interfaceSemanticDomain<C extends CartesianProduct<C,T1,T2,E,I>,T1 extends SemanticDomain<T1,E,I> & Lattice<T1>,T2 extends SemanticDomain<T2,E,I> & Lattice<T2>>- Parameters:
id- the identifier to assign the value toexpression- the expression to assignpp- the program point that where this operation is being evaluated- Returns:
- a copy of this domain, modified by the assignment
- Throws:
SemanticException- if an error occurs during the computation
-
smallStepSemantics
public final C smallStepSemantics(E expression, ProgramPoint pp) throws SemanticException
Description copied from interface:SemanticDomainYields a copy of this domain, that has been modified accordingly to the semantics of the givenexpression.- Specified by:
smallStepSemanticsin interfaceSemanticDomain<C extends CartesianProduct<C,T1,T2,E,I>,T1 extends SemanticDomain<T1,E,I> & Lattice<T1>,T2 extends SemanticDomain<T2,E,I> & Lattice<T2>>- Parameters:
expression- the expression whose semantics need to be computedpp- the program point that where this operation is being evaluated- Returns:
- a copy of this domain, modified accordingly to the semantics of
expression - Throws:
SemanticException- if an error occurs during the computation
-
assume
public final C assume(E expression, ProgramPoint pp) throws SemanticException
Description copied from interface:SemanticDomainYields a copy of this domain, modified by assuming that the given expression holds. It is required that the returned domain is in relation with this one. A safe (but imprecise) implementation of this method can always returnthis.- Specified by:
assumein interfaceSemanticDomain<C extends CartesianProduct<C,T1,T2,E,I>,T1 extends SemanticDomain<T1,E,I> & Lattice<T1>,T2 extends SemanticDomain<T2,E,I> & Lattice<T2>>- Parameters:
expression- the expression to assume to hold.pp- the program point that where this operation is being evaluated- Returns:
- the (optionally) modified copy of this domain
- Throws:
SemanticException- if an error occurs during the computation
-
forgetIdentifier
public final C forgetIdentifier(Identifier id) throws SemanticException
Description copied from interface:SemanticDomainForgets anIdentifier. This means that all information regarding the givenidwill be lost. This method should be invoked whenever an identifier gets out of scope.- Specified by:
forgetIdentifierin interfaceSemanticDomain<C extends CartesianProduct<C,T1,T2,E,I>,T1 extends SemanticDomain<T1,E,I> & Lattice<T1>,T2 extends SemanticDomain<T2,E,I> & Lattice<T2>>- Parameters:
id- the identifier to forget- Returns:
- the semantic domain without information about the given id
- Throws:
SemanticException- if an error occurs during the computation
-
pushScope
public C pushScope(ScopeToken scope) throws SemanticException
Description copied from interface:SemanticDomainPushes a new scope, identified by the give token, in the domain. This causes information about 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 withSemanticDomain.popScope(ScopeToken).- Specified by:
pushScopein interfaceSemanticDomain<C extends CartesianProduct<C,T1,T2,E,I>,T1 extends SemanticDomain<T1,E,I> & Lattice<T1>,T2 extends SemanticDomain<T2,E,I> & Lattice<T2>>- Parameters:
scope- the token identifying the scope to push- Returns:
- a copy of this domain where the local variables have been hidden
- Throws:
SemanticException- if an error occurs during the computation
-
popScope
public C popScope(ScopeToken scope) throws SemanticException
Description copied from interface:SemanticDomainPops the scope identified by the given token from the domain. This causes all the visible variables (i.e. that are not mapped to a scope) to be removed from the domain, while the local variables that were associated to the given scope token (and thus hidden) will become visible again.- Specified by:
popScopein interfaceSemanticDomain<C extends CartesianProduct<C,T1,T2,E,I>,T1 extends SemanticDomain<T1,E,I> & Lattice<T1>,T2 extends SemanticDomain<T2,E,I> & Lattice<T2>>- Parameters:
scope- the token of the scope to be restored- Returns:
- a copy of this domain 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
-
satisfies
public final SemanticDomain.Satisfiability satisfies(E expression, ProgramPoint pp) throws SemanticException
Description copied from interface:SemanticDomainChecks if the given expression is satisfied by the abstract values of this domain, returning an instance ofSemanticDomain.Satisfiability.- Specified by:
satisfiesin interfaceSemanticDomain<C extends CartesianProduct<C,T1,T2,E,I>,T1 extends SemanticDomain<T1,E,I> & Lattice<T1>,T2 extends SemanticDomain<T2,E,I> & Lattice<T2>>- Parameters:
expression- the expression whose satisfiability is to be evaluatedpp- the program point that where this operation is being evaluated- Returns:
SemanticDomain.Satisfiability.SATISFIEDis the expression is satisfied by the values of this domain,SemanticDomain.Satisfiability.NOT_SATISFIEDif it is not satisfied, orSemanticDomain.Satisfiability.UNKNOWNif it is either impossible to determine if it satisfied, or if it is satisfied by some values and not by some others (this is equivalent to a TOP boolean value)- Throws:
SemanticException- if an error occurs during the computation
-
lub
public final C lub(C other) throws SemanticException
Description copied from interface:LatticePerforms the least upper bound operation between this lattice element and the given one. This operation is commutative.- Specified by:
lubin interfaceLattice<C extends CartesianProduct<C,T1,T2,E,I>>- Parameters:
other- the other lattice element- Returns:
- the least upper bound
- Throws:
SemanticException- if an error occurs during the computation
-
widening
public final C widening(C other) throws SemanticException
Description copied from interface:LatticePerforms the widening operation between this lattice element and the given one. This operation is not commutative.- Specified by:
wideningin interfaceLattice<C extends CartesianProduct<C,T1,T2,E,I>>- Parameters:
other- the other lattice element- Returns:
- the widening between this and other
- Throws:
SemanticException- if an error occurs during the computation
-
lessOrEqual
public final boolean lessOrEqual(C other) throws SemanticException
Description copied from interface:LatticeYieldstrueif and only if this lattice element is in relation with (usually represented through ≤) the given one. This operation is not commutative.- Specified by:
lessOrEqualin interfaceLattice<C extends CartesianProduct<C,T1,T2,E,I>>- Parameters:
other- the other lattice element- Returns:
trueif and only if that condition holds- Throws:
SemanticException- if an error occurs during the computation
-
top
public final C top()
Description copied from interface:LatticeYields 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.
-
isTop
public boolean isTop()
Description copied from interface:LatticeYieldstrueif and only if this object represents the top of the lattice. The default implementation of this method uses reference equality betweenthisand the value returned byLattice.top(), thus assuming that the top element is a singleton. If this is not the case, override this method accordingly to provide a coherent test.
-
bottom
public final C bottom()
Description copied from interface:LatticeYields 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.
-
isBottom
public boolean isBottom()
Description copied from interface:LatticeYieldstrueif and only if this object represents the bottom of the lattice. The default implementation of this method uses reference equality betweenthisand the value returned byLattice.bottom(), thus assuming that the bottom element is a singleton. If this is not the case, override this method accordingly to provide a coherent test.
-
-