Class Replace

  • All Implemented Interfaces:
    it.unive.lisa.program.cfg.ProgramPoint, it.unive.lisa.program.CodeElement, it.unive.lisa.util.datastructures.graph.code.CodeNode<it.unive.lisa.program.cfg.CFG,​it.unive.lisa.program.cfg.statement.Statement,​it.unive.lisa.program.cfg.edge.Edge>, it.unive.lisa.util.datastructures.graph.Node<it.unive.lisa.program.cfg.CFG,​it.unive.lisa.program.cfg.statement.Statement,​it.unive.lisa.program.cfg.edge.Edge>, java.lang.Comparable<it.unive.lisa.program.cfg.statement.Statement>

    public class Replace
    extends it.unive.lisa.program.cfg.statement.TernaryExpression
    An expression modeling the string replace operation. The type of all three operands must be StringType. The type of this expression is the StringType.

    Since in most languages string operations are provided through calls to library functions, this class contains a field whose purpose is to optionally store a Statement that is rewritten to an instance of this class (i.e., a call to a NativeCFG modeling the library function). If present, such statement will be used as ProgramPoint for semantics computations. This allows subclasses to implement PluggableStatement easily without redefining the semantics provided by this class.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected it.unive.lisa.program.cfg.statement.Statement originating
      Statement that has been rewritten to this operation, if any.
    • Constructor Summary

      Constructors 
      Constructor Description
      Replace​(it.unive.lisa.program.cfg.CFG cfg, it.unive.lisa.program.cfg.CodeLocation location, it.unive.lisa.program.cfg.statement.Expression left, it.unive.lisa.program.cfg.statement.Expression middle, it.unive.lisa.program.cfg.statement.Expression right)
      Builds the replace.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected int compareSameClassAndParams​(it.unive.lisa.program.cfg.statement.Statement o)  
      <A extends it.unive.lisa.analysis.AbstractState<A>>
      it.unive.lisa.analysis.AnalysisState<A>
      fwdTernarySemantics​(it.unive.lisa.interprocedural.InterproceduralAnalysis<A> interprocedural, it.unive.lisa.analysis.AnalysisState<A> state, it.unive.lisa.symbolic.SymbolicExpression left, it.unive.lisa.symbolic.SymbolicExpression middle, it.unive.lisa.symbolic.SymbolicExpression right, it.unive.lisa.analysis.StatementStore<A> expressions)  
      • Methods inherited from class it.unive.lisa.program.cfg.statement.TernaryExpression

        backwardSemanticsAux, bwdTernarySemantics, forwardSemanticsAux, getLeft, getMiddle, getRight
      • Methods inherited from class it.unive.lisa.program.cfg.statement.NaryExpression

        accept, backwardSemantics, compareSameClass, equals, forwardSemantics, getConstructName, getOrder, getStatementEvaluatedAfter, getStatementEvaluatedBefore, getSubExpressions, hashCode, toString
      • Methods inherited from class it.unive.lisa.program.cfg.statement.Expression

        getMetaVariables, getParentStatement, getRootStatement, getStaticType, setParentStatement
      • Methods inherited from class it.unive.lisa.program.cfg.statement.Statement

        compareTo, getCFG, getEvaluationPredecessor, getEvaluationSuccessor, getLocation, stopsExecution, throwsError
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface it.unive.lisa.program.cfg.ProgramPoint

        getProgram
    • Field Detail

      • originating

        protected it.unive.lisa.program.cfg.statement.Statement originating
        Statement that has been rewritten to this operation, if any. This is to accomodate the fact that, in most languages, string operations are performed through calls, and one might want to provide the semantics of those calls through NativeCFG that rewrites to instances of this class.
    • Constructor Detail

      • Replace

        public Replace​(it.unive.lisa.program.cfg.CFG cfg,
                       it.unive.lisa.program.cfg.CodeLocation location,
                       it.unive.lisa.program.cfg.statement.Expression left,
                       it.unive.lisa.program.cfg.statement.Expression middle,
                       it.unive.lisa.program.cfg.statement.Expression right)
        Builds the replace.
        Parameters:
        cfg - the CFG where this operation lies
        location - the code location where this operation is defined
        left - the left-hand side of this operation
        middle - the middle operand of this operation
        right - the right-hand side of this operation
    • Method Detail

      • compareSameClassAndParams

        protected int compareSameClassAndParams​(it.unive.lisa.program.cfg.statement.Statement o)
        Specified by:
        compareSameClassAndParams in class it.unive.lisa.program.cfg.statement.NaryExpression
      • fwdTernarySemantics

        public <A extends it.unive.lisa.analysis.AbstractState<A>> it.unive.lisa.analysis.AnalysisState<A> fwdTernarySemantics​(it.unive.lisa.interprocedural.InterproceduralAnalysis<A> interprocedural,
                                                                                                                               it.unive.lisa.analysis.AnalysisState<A> state,
                                                                                                                               it.unive.lisa.symbolic.SymbolicExpression left,
                                                                                                                               it.unive.lisa.symbolic.SymbolicExpression middle,
                                                                                                                               it.unive.lisa.symbolic.SymbolicExpression right,
                                                                                                                               it.unive.lisa.analysis.StatementStore<A> expressions)
                                                                                                                        throws it.unive.lisa.analysis.SemanticException
        Specified by:
        fwdTernarySemantics in class it.unive.lisa.program.cfg.statement.TernaryExpression
        Throws:
        it.unive.lisa.analysis.SemanticException