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>

  • Type Parameters:
    C - the concrete type of the cartesian product
    T1 - the concrete instance of the left-hand side abstract domain of the Cartesian product
    T2 - the concrete instance of the right-hand side abstract domain of the Cartesian product
    E - the type of SymbolicExpression that <T1> and <T2>, and in turn this domain, can process
    I - the type of Identifier that <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-communicating SemanticDomains (i.e., no exchange of information between the abstract domains), assigning the same Identifiers and handling instances of the same SymbolicExpressions.
    • Constructor Detail

      • CartesianProduct

        protected CartesianProduct​(T1 left,
                                   T2 right)
        Builds the Cartesian product abstract domain.
        Parameters:
        left - the left-hand side of the Cartesian product
        right - the right-hand side of the Cartesian product
    • Method Detail

      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • toString

        public final java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • mk

        protected abstract C mk​(T1 left,
                                T2 right)
        Builds a new instance of cartesian product.
        Parameters:
        left - the first domain
        right - the second domain
        Returns:
        the new instance of product
      • assume

        public final C assume​(E expression,
                              ProgramPoint pp)
                       throws SemanticException
        Description copied from interface: SemanticDomain
        Yields 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 return this.
        Specified by:
        assume in interface SemanticDomain<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
      • popScope

        public C popScope​(ScopeToken scope)
                   throws SemanticException
        Description copied from interface: SemanticDomain
        Pops 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:
        popScope in interface SemanticDomain<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
      • lub

        public final C lub​(C other)
                    throws SemanticException
        Description copied from interface: Lattice
        Performs the least upper bound operation between this lattice element and the given one. This operation is commutative.
        Specified by:
        lub in interface Lattice<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: Lattice
        Performs the widening operation between this lattice element and the given one. This operation is not commutative.
        Specified by:
        widening in interface Lattice<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: Lattice
        Yields true if and only if this lattice element is in relation with (usually represented through ≤) the given one. This operation is not commutative.
        Specified by:
        lessOrEqual in interface Lattice<C extends CartesianProduct<C,​T1,​T2,​E,​I>>
        Parameters:
        other - the other lattice element
        Returns:
        true if and only if that condition holds
        Throws:
        SemanticException - if an error occurs during the computation
      • top

        public final C 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, since Lattice.isTop() uses reference equality by default. If the value returned by this method is not a singleton, override Lattice.isTop() accordingly to provide a coherent test.
        Specified by:
        top in interface Lattice<C extends CartesianProduct<C,​T1,​T2,​E,​I>>
        Returns:
        the top element
      • isTop

        public boolean isTop()
        Description copied from interface: Lattice
        Yields true if and only if this object represents the top of the lattice. The default implementation of this method uses reference equality between this and the value returned by Lattice.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.
        Specified by:
        isTop in interface Lattice<C extends CartesianProduct<C,​T1,​T2,​E,​I>>
        Returns:
        true if this is the top of the lattice
      • bottom

        public final C 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, since Lattice.isBottom() uses reference equality by default. If the value returned by this method is not a singleton, override Lattice.isBottom() accordingly to provide a coherent test.
        Specified by:
        bottom in interface Lattice<C extends CartesianProduct<C,​T1,​T2,​E,​I>>
        Returns:
        the bottom element
      • isBottom

        public boolean isBottom()
        Description copied from interface: Lattice
        Yields true if and only if this object represents the bottom of the lattice. The default implementation of this method uses reference equality between this and the value returned by Lattice.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.
        Specified by:
        isBottom in interface Lattice<C extends CartesianProduct<C,​T1,​T2,​E,​I>>
        Returns:
        true if this is the bottom of the lattice