Class TernaryStatement
- java.lang.Object
-
- it.unive.lisa.program.cfg.statement.Statement
-
- it.unive.lisa.program.cfg.statement.NaryStatement
-
- it.unive.lisa.program.cfg.statement.TernaryStatement
-
- All Implemented Interfaces:
ProgramPoint
,CodeElement
,CodeNode<CFG,Statement,Edge>
,Node<CFG,Statement,Edge>
,java.lang.Comparable<Statement>
public abstract class TernaryStatement extends NaryStatement
AnNaryStatement
with exactly three sub-expressions.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
TernaryStatement(CFG cfg, CodeLocation location, java.lang.String constructName, EvaluationOrder order, Expression left, Expression middle, Expression right)
Builds the statement, happening at the given location in the program.protected
TernaryStatement(CFG cfg, CodeLocation location, java.lang.String constructName, Expression left, Expression middle, Expression right)
Builds the statement, happening at the given location in the program.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description <A extends AbstractState<A>>
AnalysisState<A>backwardSemanticsAux(InterproceduralAnalysis<A> interprocedural, AnalysisState<A> state, ExpressionSet[] params, StatementStore<A> expressions)
Computes the backward semantics of the statement, after the semantics of all sub-expressions have been computed.<A extends AbstractState<A>>
AnalysisState<A>bwdTernarySemantics(InterproceduralAnalysis<A> interprocedural, AnalysisState<A> state, SymbolicExpression left, SymbolicExpression middle, SymbolicExpression right, StatementStore<A> expressions)
Computes the backwards semantics of the statement, after the semantics of the sub-expressions have been computed.<A extends AbstractState<A>>
AnalysisState<A>forwardSemanticsAux(InterproceduralAnalysis<A> interprocedural, AnalysisState<A> state, ExpressionSet[] params, StatementStore<A> expressions)
Computes the forward semantics of the statement, after the semantics of all sub-expressions have been computed.abstract <A extends AbstractState<A>>
AnalysisState<A>fwdTernarySemantics(InterproceduralAnalysis<A> interprocedural, AnalysisState<A> state, SymbolicExpression left, SymbolicExpression middle, SymbolicExpression right, StatementStore<A> expressions)
Computes the forward semantics of the statement, after the semantics of the sub-expressions have been computed.Expression
getLeft()
Yields the left-most (first) sub-expression of this statement.Expression
getMiddle()
Yields the middle (second) sub-expression of this statement.Expression
getRight()
Yields the right-most (third) sub-expression of this statement.-
Methods inherited from class it.unive.lisa.program.cfg.statement.NaryStatement
accept, backwardSemantics, equals, forwardSemantics, getConstructName, getOrder, getStatementEvaluatedAfter, getStatementEvaluatedBefore, getSubExpressions, hashCode, setOffset, toString
-
Methods inherited from class it.unive.lisa.program.cfg.statement.Statement
compareTo, getCFG, getEvaluationPredecessor, getEvaluationSuccessor, getLocation, getOffset, 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
-
-
-
-
Constructor Detail
-
TernaryStatement
protected TernaryStatement(CFG cfg, CodeLocation location, java.lang.String constructName, Expression left, Expression middle, Expression right)
Builds the statement, happening at the given location in the program. TheEvaluationOrder
isLeftToRightEvaluation
.- Parameters:
cfg
- the cfg that this statement belongs tolocation
- the location where the statement is defined within the programconstructName
- the name of the construct represented by this statementleft
- the first sub-expression of this statementmiddle
- the second sub-expression of this statementright
- the third sub-expression of this statement
-
TernaryStatement
protected TernaryStatement(CFG cfg, CodeLocation location, java.lang.String constructName, EvaluationOrder order, Expression left, Expression middle, Expression right)
Builds the statement, happening at the given location in the program.- Parameters:
cfg
- the cfg that this statement belongs tolocation
- the location where the statement is defined within the programconstructName
- the name of the construct represented by this statementorder
- the evaluation order of the sub-expressionsleft
- the first sub-expression of this statementmiddle
- the second sub-expression of this statementright
- the third sub-expression of this statement
-
-
Method Detail
-
getLeft
public Expression getLeft()
Yields the left-most (first) sub-expression of this statement.- Returns:
- the left-most sub-expression
-
getMiddle
public Expression getMiddle()
Yields the middle (second) sub-expression of this statement.- Returns:
- the middle sub-expression
-
getRight
public Expression getRight()
Yields the right-most (third) sub-expression of this statement.- Returns:
- the right-most sub-expression
-
forwardSemanticsAux
public <A extends AbstractState<A>> AnalysisState<A> forwardSemanticsAux(InterproceduralAnalysis<A> interprocedural, AnalysisState<A> state, ExpressionSet[] params, StatementStore<A> expressions) throws SemanticException
Description copied from class:NaryStatement
Computes the forward semantics of the statement, after the semantics of all sub-expressions have been computed. Meta variables from the sub-expressions will be forgotten after this call returns.- Specified by:
forwardSemanticsAux
in classNaryStatement
- Type Parameters:
A
- the type ofAbstractState
- Parameters:
interprocedural
- the interprocedural analysis of the program to analyzestate
- the state where the statement is to be evaluatedparams
- the symbolic expressions representing the computed values of the sub-expressions of this statementexpressions
- the cache where analysis states of intermediate expressions are stored and that can be accessed to query for post-states of parameters expressions- Returns:
- the
AnalysisState
representing the abstract result of the execution of this statement - Throws:
SemanticException
- if something goes wrong during the computation
-
fwdTernarySemantics
public abstract <A extends AbstractState<A>> AnalysisState<A> fwdTernarySemantics(InterproceduralAnalysis<A> interprocedural, AnalysisState<A> state, SymbolicExpression left, SymbolicExpression middle, SymbolicExpression right, StatementStore<A> expressions) throws SemanticException
Computes the forward semantics of the statement, after the semantics of the sub-expressions have been computed. Meta variables from the sub-expressions will be forgotten after this statement returns.- Type Parameters:
A
- the type ofAbstractState
- Parameters:
interprocedural
- the interprocedural analysis of the program to analyzestate
- the state where the statement is to be evaluatedleft
- the symbolic expression representing the computed value of the first sub-expression of this statementmiddle
- the symbolic expression representing the computed value of the second sub-expression of this statementright
- the symbolic expression representing the computed value of the third sub-expression of this statementexpressions
- the cache where analysis states of intermediate expressions are stored and that can be accessed to query for post-states of parameters expressions- Returns:
- the
AnalysisState
representing the abstract result of the execution of this statement - Throws:
SemanticException
- if something goes wrong during the computation
-
backwardSemanticsAux
public <A extends AbstractState<A>> AnalysisState<A> backwardSemanticsAux(InterproceduralAnalysis<A> interprocedural, AnalysisState<A> state, ExpressionSet[] params, StatementStore<A> expressions) throws SemanticException
Description copied from class:NaryStatement
Computes the backward semantics of the statement, after the semantics of all sub-expressions have been computed. Meta variables from the sub-expressions will be forgotten after this call returns. By default, this method delegates toNaryStatement.forwardSemanticsAux(InterproceduralAnalysis, AnalysisState, ExpressionSet[], StatementStore)
, as it is fine for most atomic statements. One should redefine this method if a statement's semantics is composed of a series of smaller operations.- Overrides:
backwardSemanticsAux
in classNaryStatement
- Type Parameters:
A
- the type ofAbstractState
- Parameters:
interprocedural
- the interprocedural analysis of the program to analyzestate
- the state where the statement is to be evaluatedparams
- the symbolic expressions representing the computed values of the sub-expressions of this statementexpressions
- the cache where analysis states of intermediate expressions are stored and that can be accessed to query for post-states of parameters expressions- Returns:
- the
AnalysisState
representing the abstract result of the execution of this statement - Throws:
SemanticException
- if something goes wrong during the computation
-
bwdTernarySemantics
public <A extends AbstractState<A>> AnalysisState<A> bwdTernarySemantics(InterproceduralAnalysis<A> interprocedural, AnalysisState<A> state, SymbolicExpression left, SymbolicExpression middle, SymbolicExpression right, StatementStore<A> expressions) throws SemanticException
Computes the backwards semantics of the statement, after the semantics of the sub-expressions have been computed. Meta variables from the sub-expressions will be forgotten after this statement returns. By default, this method delegates tofwdTernarySemantics(InterproceduralAnalysis, AnalysisState, SymbolicExpression, SymbolicExpression, SymbolicExpression, StatementStore)
, as it is fine for most atomic statements. One should redefine this method if a statement's semantics is composed of a series of smaller operations.- Type Parameters:
A
- the type ofAbstractState
- Parameters:
interprocedural
- the interprocedural analysis of the program to analyzestate
- the state where the statement is to be evaluatedleft
- the symbolic expression representing the computed value of the first sub-expression of this statementmiddle
- the symbolic expression representing the computed value of the second sub-expression of this statementright
- the symbolic expression representing the computed value of the third sub-expression of this statementexpressions
- the cache where analysis states of intermediate expressions are stored and that can be accessed to query for post-states of parameters expressions- Returns:
- the
AnalysisState
representing the abstract result of the execution of this statement - Throws:
SemanticException
- if something goes wrong during the computation
-
-