Interface SemanticDomain<D extends SemanticDomain<D,​E,​I>,​E extends SymbolicExpression,​I extends Identifier>

    • Method Detail

      • assign

        D assign​(I id,
                 E expression,
                 ProgramPoint pp)
          throws SemanticException
        Yields a copy of this domain, where id has been assigned to value.
        Parameters:
        id - the identifier to assign the value to
        expression - the expression to assign
        pp - 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

        D smallStepSemantics​(E expression,
                             ProgramPoint pp)
                      throws SemanticException
        Yields a copy of this domain, that has been modified accordingly to the semantics of the given expression.
        Parameters:
        expression - the expression whose semantics need to be computed
        pp - 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

        D assume​(E expression,
                 ProgramPoint pp)
          throws SemanticException
        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.
        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

        D forgetIdentifier​(Identifier id)
                    throws SemanticException
        Forgets an Identifier. This means that all information regarding the given id will be lost. This method should be invoked whenever an identifier gets out of scope.
        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
      • forgetIdentifiersIf

        D forgetIdentifiersIf​(java.util.function.Predicate<Identifier> test)
                       throws SemanticException
        Forgets all Identifiers that match the given predicate. This means that all information regarding the those identifiers will be lost. This method should be invoked whenever an identifier gets out of scope.
        Parameters:
        test - the test to identify the targets of the removal
        Returns:
        the semantic domain without information about the ids
        Throws:
        SemanticException - if an error occurs during the computation
      • forgetIdentifiers

        default D forgetIdentifiers​(java.lang.Iterable<Identifier> ids)
                             throws SemanticException
        Forgets all the given Identifiers. The default implementation of this method iterates on ids, invoking forgetIdentifier(Identifier) on each element.
        Parameters:
        ids - the collection of identifiers to forget
        Returns:
        the semantic domain without information about the given ids
        Throws:
        SemanticException - if an error occurs during the computation
      • pushScope

        D pushScope​(ScopeToken token)
             throws SemanticException
        Pushes 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 with popScope(ScopeToken).
        Parameters:
        token - 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

        D popScope​(ScopeToken token)
            throws SemanticException
        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.
        Parameters:
        token - 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
      • getDomainInstance

        default <T> T getDomainInstance​(java.lang.Class<T> domain)
        Yields the instance of a specific domain, of class domain, contained inside the domain. If this domain is an instance of the specified class, then this is returned. Otherwise, inner domains are recursively checked (enabling retrieval of semantic domains through Cartesian products or other types of combinations), returning the first that is instance of domain.

        The default implementation of this method returns this if domain.isAssignableFrom(getClass()) == true, otherwise it returns null.
        Type Parameters:
        T - the type of domain to retrieve
        Parameters:
        domain - the class of the domain instance to retrieve
        Returns:
        the instance of that domain, or null