org.escot
Class FunctionAdapter

java.lang.Object
  |
  +--org.escot.BasicFeature
        |
        +--org.escot.FunctionAdapter
All Implemented Interfaces:
EscotFeature, FunctionEvaluator

public class FunctionAdapter
extends BasicFeature
implements FunctionEvaluator

Adapts a method which returns a number and takes a single number parameter as a FunctionEvaluator.


Field Summary
protected  Method mMethod
           
protected  Object mTarget
           
 
Fields inherited from class org.escot.BasicFeature
INITIAL_ATTR_CAPACITY, mAttributes, mPCSupport
 
Fields inherited from interface org.escot.FunctionEvaluator
DOMAIN_MAXIMUM_CLOSED, DOMAIN_MAXIMUM_OPEN, DOMAIN_MINIMUM_CLOSED, DOMAIN_MINIMUM_OPEN
 
Fields inherited from interface org.escot.EscotFeature
COLOR_ATTRIBUTE, DESCRIPTION_ATTRIBUTE, ICON16x16_ATTRIBUTE, TYPE_ATTRIBUTE
 
Constructor Summary
FunctionAdapter(Object target, Method m)
           
 
Method Summary
 void addChangeListener(ChangeListener l)
          adds a change listener to this function, to be notified when the function definition changes
 Number evaluateAt(Number number)
          Evaluates the function at the given input.
 void removeChangeListener(ChangeListener l)
          removes a change listener from this function
 String toString()
          converts the function to a string representation
 
Methods inherited from class org.escot.BasicFeature
addPropertyChangeListener, duplicate, getAttribute, getName, putAttribute, removePropertyChangeListener, setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.escot.EscotFeature
addPropertyChangeListener, duplicate, getAttribute, getName, putAttribute, removePropertyChangeListener
 

Field Detail

mTarget

protected Object mTarget

mMethod

protected Method mMethod
Constructor Detail

FunctionAdapter

public FunctionAdapter(Object target,
                       Method m)
Method Detail

evaluateAt

public Number evaluateAt(Number number)
Description copied from interface: FunctionEvaluator
Evaluates the function at the given input.
Specified by:
evaluateAt in interface FunctionEvaluator
Following copied from interface: org.escot.FunctionEvaluator
Parameters:
input - the number to evaluate the function at.
Returns:
the value of the function at the given input.

addChangeListener

public void addChangeListener(ChangeListener l)
Description copied from interface: FunctionEvaluator
adds a change listener to this function, to be notified when the function definition changes
Specified by:
addChangeListener in interface FunctionEvaluator
Following copied from interface: org.escot.FunctionEvaluator
Parameters:
l - a ChangeListener that wants to be notified of changes to this function

removeChangeListener

public void removeChangeListener(ChangeListener l)
Description copied from interface: FunctionEvaluator
removes a change listener from this function
Specified by:
removeChangeListener in interface FunctionEvaluator
Following copied from interface: org.escot.FunctionEvaluator
Parameters:
l - a ChangeListener that no longer wants to listen to change events from this function

toString

public String toString()
Description copied from interface: FunctionEvaluator
converts the function to a string representation
Specified by:
toString in interface FunctionEvaluator
Overrides:
toString in class Object
Following copied from interface: org.escot.FunctionEvaluator
Returns:
either a MathML string or a raw character string representation of the function