Class FunctionReferenceExample
- java.lang.Object
-
- edu.uiuc.ncsa.qdl.extensions.example.FunctionReferenceExample
-
- All Implemented Interfaces:
QDLFunction
,Serializable
public class FunctionReferenceExample extends Object implements QDLFunction
Created by Jeff Gaynor
on 10/7/21 at 4:40 PM- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description FunctionReferenceExample()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
evaluate(Object[] objects, State state)
The method that is invoked by QDL.int[]
getArgCount()
The contract is that when QDL invokes this method, it will faithfully give all of the arguments as an array of Objects.List<String>
getDocumentation(int argCount)
Return documentation to be displayed in the workspace.String
getName()
The name of this function as you want it invoked in QDL.
-
-
-
Method Detail
-
getName
public String getName()
Description copied from interface:QDLFunction
The name of this function as you want it invoked in QDL.- Specified by:
getName
in interfaceQDLFunction
- Returns:
-
getArgCount
public int[] getArgCount()
Description copied from interface:QDLFunction
The contract is that when QDL invokes this method, it will faithfully give all of the arguments as an array of Objects. Overloading is not possible in QDL (it is weakly typed) except by argument count, so if this is called "foo" and you have versions with 3 and 4 arguments, then f(a,b,c) would be executed with the arguments passed. To achieve overloading for Java methods, have the number of arguments this accepts as the elements of the array. So if this has a value of [1,2,3] then this function will be invoked if called with 1, 2 or 3 arguments and an error will be raised, if, say, 4 are passed.- Specified by:
getArgCount
in interfaceQDLFunction
- Returns:
-
evaluate
public Object evaluate(Object[] objects, State state)
Description copied from interface:QDLFunction
The method that is invoked by QDL. It will have the arguments evaluated and put in to the array of objects. It is up to you to do any checking you see fit. State is supplied if needed.- Specified by:
evaluate
in interfaceQDLFunction
- Returns:
-
getDocumentation
public List<String> getDocumentation(int argCount)
Description copied from interface:QDLFunction
Return documentation to be displayed in the workspace. Short version displays the first line (element of the list) so make sure that is informative. The long version should contain details of use.- Specified by:
getDocumentation
in interfaceQDLFunction
- Returns:
-
-