de.rwth.dfa.jvm.samples
Class CFPAbstraction.ArithmeticFunction
java.lang.Object
|
+--de.rwth.dfa.jvm.samples.CPAbstraction.CPFunction
|
+--de.rwth.dfa.jvm.samples.CFPAbstraction.ArithmeticFunction
- All Implemented Interfaces:
- Function
- Direct Known Subclasses:
- CFPAbstraction.BinaryFunction, CFPAbstraction.CompareFunction, CFPAbstraction.ConversionFunction, CFPAbstraction.NegationFunction
- Enclosing class:
- CFPAbstraction
- protected abstract class CFPAbstraction.ArithmeticFunction
- extends CPAbstraction.CPFunction
An abstract class for arithmetic manipulation of the stack.
Field Summary |
protected int |
n
Number of operands of this function. |
Method Summary |
protected void |
apply(java.lang.Object[] locals,
java.util.Stack stack)
Pops the operands from the stack, calls evaluate(Number[]) if the
operands are all numbers, and pushes the result. |
abstract java.lang.Number |
evaluate(java.lang.Number[] values)
Supposed to do the actual operation. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
n
protected int n
- Number of operands of this function.
CFPAbstraction.ArithmeticFunction
public CFPAbstraction.ArithmeticFunction(int n,
int consume,
int produce)
- Creates a new
ArithmeticFunction
instance.
- Parameters:
n
- an int
valueconsume
- an int
valueproduce
- an int
value
apply
protected void apply(java.lang.Object[] locals,
java.util.Stack stack)
throws FunctionException
- Pops the operands from the stack, calls
evaluate(Number[])
if the
operands are all numbers, and pushes the result. Otherwise, it pushes CFPComponentLattice.NONCONSTANTCOMPONENT
or CFPComponentLattice.UNKNOWNCOMPONENT
, depending on the situation.
- Overrides:
apply
in class CPAbstraction.CPFunction
- Parameters:
locals
- an Object[]
valuestack
- a Stack
value- Throws:
FunctionException
- if an error occurs
evaluate
public abstract java.lang.Number evaluate(java.lang.Number[] values)
throws FunctionException
- Supposed to do the actual operation.
- Parameters:
values
- a Number[]
value- Returns:
- a
Number
value - Throws:
FunctionException
- if an error occurs
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object