ptolemy.data.expr
Class CachedMethod.BaseConvertCachedMethod

java.lang.Object
  extended by ptolemy.data.expr.CachedMethod
      extended by ptolemy.data.expr.CachedMethod.BaseConvertCachedMethod
Enclosing class:
CachedMethod

public static class CachedMethod.BaseConvertCachedMethod
extends CachedMethod

A cached method that converts the object on which the method is invoked as well as the arguments. This allows us to, for example, invoke instance methods of ptolemy.math.Complex on tokens of type ComplexToken. This cached method can only operate on methods.


Nested Class Summary
 
Nested classes/interfaces inherited from class ptolemy.data.expr.CachedMethod
CachedMethod.ArgumentConversion, CachedMethod.ArrayMapCachedMethod, CachedMethod.BaseConvertCachedMethod, CachedMethod.MatrixMapCachedMethod, CachedMethod.TypeArgumentConversion
 
Field Summary
private  CachedMethod.ArgumentConversion _baseConversion
           
 
Fields inherited from class ptolemy.data.expr.CachedMethod
ARRAYTOKEN_CONVERSION, FUNCTION, IDENTITY_CONVERSION, IMPOSSIBLE_CONVERSION, METHOD, NATIVE_CONVERSION
 
Constructor Summary
private CachedMethod.BaseConvertCachedMethod(java.lang.String methodName, Type[] argumentTypes, java.lang.reflect.Method method, CachedMethod.ArgumentConversion baseConversion, CachedMethod.ArgumentConversion[] conversions)
           
 
Method Summary
 CachedMethod.ArgumentConversion getBaseConversion()
          Return the conversion that is applied to the object upon which the method is invoked.
 Token invoke(java.lang.Object[] argValues)
          Apply the operation represented by this object to the specified arguments.
 
Methods inherited from class ptolemy.data.expr.CachedMethod
_areConversionsPreferable, _getConversion, _polymorphicGetMethod, clear, equals, findMethod, getCachedMethodType, getConversions, getMethod, getReturnType, hashCode, isFunction, isMethod, isValid, methodDescription, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

_baseConversion

private CachedMethod.ArgumentConversion _baseConversion
Constructor Detail

CachedMethod.BaseConvertCachedMethod

private CachedMethod.BaseConvertCachedMethod(java.lang.String methodName,
                                             Type[] argumentTypes,
                                             java.lang.reflect.Method method,
                                             CachedMethod.ArgumentConversion baseConversion,
                                             CachedMethod.ArgumentConversion[] conversions)
                                      throws IllegalActionException
Throws:
IllegalActionException
Method Detail

getBaseConversion

public CachedMethod.ArgumentConversion getBaseConversion()
Return the conversion that is applied to the object upon which the method is invoked.

Returns:
The conversion that is applied to the object upon which the method is invoked.

invoke

public Token invoke(java.lang.Object[] argValues)
             throws IllegalActionException
Description copied from class: CachedMethod
Apply the operation represented by this object to the specified arguments. This method performs any necessary conversions on token arguments, and, if necessary, converts the returned value into a token. This method may be overridden by derived classes to implement non-standard conversions.

Overrides:
invoke in class CachedMethod
Parameters:
argValues - An array of Token objects that will be used as the arguments.
Returns:
The result of the method invocation, as a Token.
Throws:
IllegalActionException - If this cached method is not valid, or the invoked method throws it.