de.rwth.dfa.jvm.samples
Class CPAbstraction.CPFunction

java.lang.Object
  |
  +--de.rwth.dfa.jvm.samples.CPAbstraction.CPFunction
All Implemented Interfaces:
Function
Direct Known Subclasses:
CFPAbstraction.ArithmeticFunction, CPAbstraction.AllocationFunction, CPAbstraction.DupFunction, CPAbstraction.ExceptionHeaderFunction, CPAbstraction.GenericFunction, CPAbstraction.IncLocalFunction, CPAbstraction.PopFunction, CPAbstraction.PushConstantFunction, CPAbstraction.PushLocalFunction, CPAbstraction.StoreLocalFunction, CPAbstraction.SwapFunction
Enclosing class:
CPAbstraction

public abstract class CPAbstraction.CPFunction
extends java.lang.Object
implements Function

The abstract base class of all function of this abstraction.


Inner classes inherited from class de.rwth.domains.Function
Function.Tools
 
Field Summary
protected  int consume
          The number of elements consumed from the operand stack by this function.
protected  int produce
          The number of elements produced by this function on the operand stack.
 
Constructor Summary
CPAbstraction.CPFunction(int consume, int produce)
          Creates a new CPFunction instance.
 
Method Summary
 java.lang.Object apply(java.lang.Object x)
          Applies this function to an element of the CFPLattice for this abstraction and returns the result.
protected abstract  void apply(java.lang.Object[] locals, java.util.Stack stack)
          Supposed to perform the actual operation.
 Set getDomain()
          Returns the CFPLattice for this abstraction.
 Set getRange()
          Returns the CFPLattice for this abstraction.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

consume

protected int consume
The number of elements consumed from the operand stack by this function.

produce

protected int produce
The number of elements produced by this function on the operand stack.
Constructor Detail

CPAbstraction.CPFunction

public CPAbstraction.CPFunction(int consume,
                                int produce)
Creates a new CPFunction instance.
Parameters:
consume - an int value
produce - an int value
Method Detail

getRange

public Set getRange()
Returns the CFPLattice for this abstraction.
Specified by:
getRange in interface Function
Returns:
a Set value

getDomain

public Set getDomain()
Returns the CFPLattice for this abstraction.
Specified by:
getDomain in interface Function
Returns:
a Set value

apply

public java.lang.Object apply(java.lang.Object x)
                       throws FunctionException
Applies this function to an element of the CFPLattice for this abstraction and returns the result. It extracts the components and calls apply(Object[],Stack). If the stack component is not a stack, but top or bottom of CFPStackLattice, the second argument in null.
Specified by:
apply in interface Function
Parameters:
x - an Object value
Returns:
an Object value
Throws:
FunctionException - if an error occurs

apply

protected abstract void apply(java.lang.Object[] locals,
                              java.util.Stack stack)
                       throws FunctionException
Supposed to perform the actual operation. The modification is done on the arguments, therfore there is no return value.
Parameters:
locals - an Object[] value
stack - a Stack value
Throws:
FunctionException - if an error occurs