Package ptolemy.data.expr
Class CachedMethod.ArrayMapCachedMethod
- java.lang.Object
-
- ptolemy.data.expr.CachedMethod
-
- ptolemy.data.expr.CachedMethod.ArrayMapCachedMethod
-
- Enclosing class:
- CachedMethod
public static class CachedMethod.ArrayMapCachedMethod extends CachedMethod
A class representing the invocation of a scalar method on an array of elements.
-
-
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
-
Fields inherited from class ptolemy.data.expr.CachedMethod
ARRAYTOKEN_CONVERSION, FUNCTION, IDENTITY_CONVERSION, IMPOSSIBLE_CONVERSION, METHOD, NATIVE_CONVERSION
-
-
Constructor Summary
Constructors Constructor Description ArrayMapCachedMethod(java.lang.String methodName, Type[] argumentTypes, int type, CachedMethod cachedMethod, boolean[] reducedArgs)
Constructs a CachedMethod$ArrayMapCachedMethod object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Type
getReturnType()
Override the base class to return an array type with the element type being the return type of the underlying scalar method.Token
invoke(java.lang.Object[] argValues)
Invoke the method represented by this CachedMethod.boolean
isValid()
Override the base class to correctly implement the isValid() method.java.lang.String
methodDescription()
Return an appropriate description of the method being invoked.-
Methods inherited from class ptolemy.data.expr.CachedMethod
_areConversionsPreferable, _getConversion, _polymorphicGetMethod, clear, equals, findMethod, getCachedMethodType, getConversions, getMethod, hashCode, isFunction, isMethod, toString
-
-
-
-
Constructor Detail
-
ArrayMapCachedMethod
public ArrayMapCachedMethod(java.lang.String methodName, Type[] argumentTypes, int type, CachedMethod cachedMethod, boolean[] reducedArgs) throws IllegalActionException
Constructs a CachedMethod$ArrayMapCachedMethod object.- Parameters:
methodName
- The name of the method.argumentTypes
- The types of the arguments.type
- An integer specifying the typecachedMethod
- The method to be invokedreducedArgs
- An array of booleans where if an element of the array is true and the corresponding argument is an ArrayToken, then invoke() handles those arguments specially.- Throws:
IllegalActionException
- Not thrown in this derived class, but the superclass throws it if the return type of the cached method cannot be determined.
-
-
Method Detail
-
invoke
public Token invoke(java.lang.Object[] argValues) throws IllegalActionException
Invoke the method represented by this CachedMethod. This implements any conversions necessary to turn token arguments into other arguments, and to convert the result back into a token.- Overrides:
invoke
in classCachedMethod
- Parameters:
argValues
- An array of token objects that will be used as the arguments. Note that each element must be an ArrayToken and each ArrayToken must have the same length as the other ArrayTokens.- Returns:
- The token result of the method invocation.
- Throws:
IllegalActionException
- If the invoked method throws it.
-
isValid
public boolean isValid()
Override the base class to correctly implement the isValid() method.- Overrides:
isValid
in classCachedMethod
- Returns:
- True if a method was found.
-
getReturnType
public Type getReturnType() throws IllegalActionException
Override the base class to return an array type with the element type being the return type of the underlying scalar method.- Overrides:
getReturnType
in classCachedMethod
- Returns:
- An ArrayType with an appropriate element type.
- Throws:
IllegalActionException
- If a method or function with the correct argument types was not found.
-
methodDescription
public java.lang.String methodDescription()
Return an appropriate description of the method being invoked.- Overrides:
methodDescription
in classCachedMethod
- Returns:
- A description of the method being invoked.
-
-