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.


Inner classes inherited from class de.rwth.domains.Function
Function.Tools
 
Field Summary
protected  int n
          Number of operands of this function.
 
Fields inherited from class de.rwth.dfa.jvm.samples.CPAbstraction.CPFunction
consume, produce
 
Constructor Summary
CFPAbstraction.ArithmeticFunction(int n, int consume, int produce)
          Creates a new ArithmeticFunction instance.
 
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 de.rwth.dfa.jvm.samples.CPAbstraction.CPFunction
apply, getDomain, getRange
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

n

protected int n
Number of operands of this function.
Constructor Detail

CFPAbstraction.ArithmeticFunction

public CFPAbstraction.ArithmeticFunction(int n,
                                         int consume,
                                         int produce)
Creates a new ArithmeticFunction instance.
Parameters:
n - an int value
consume - an int value
produce - an int value
Method Detail

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[] value
stack - 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