public interface FunctionModel
This interface provides methods to add and remove script functions in the Expression Editor accessible from Assignment and If program nodes among others.
Added functions merely serve as an easy way for the end customer to use the contributed functions. The implementation
of a given script function must be added in the preamble of program through the use of
InstallationNodeContribution.generateScript(ScriptWriter)
.
The full set of functions which can be contributed must be added in the preamble at all times, regardless of whether they are added to the Expression Editor or not. Otherwise old programs that rely on a script function contribution might stop working.
See alsoFunction
.Modifier and Type | Method and Description |
---|---|
Function |
addFunction(String name,
String... argumentNames) |
Function |
getFunction(String name) |
Collection<Function> |
getFunctions(Filter<Function> filter) |
boolean |
removeFunction(Function function) |
Function addFunction(String name, String... argumentNames) throws FunctionException
name
- Name of the function. Safe names must match regex [a-zA-Z][a-zA-Z0-9_]{0,24} for a total of 25
characters. A range of Universal Robots reserved names exists and cannot be used. In case of an
illegal or reserved name, an FunctionException
will be thrown.argumentNames
- Is a list of hints (for the function arguments) to be shown comma separated inside angle
brackets in the Expression Editor. No more than five arguments can be specified. The hints
must also match the regex [a-zA-Z][a-zA-Z0-9_]{0,14} for a total of 15 characters.
Otherwise an FunctionException
will be thrown.FunctionException
- if the name is illegal or more than five arguments are specified.boolean removeFunction(Function function)
function
- Function to be removed. Only functions added by this URCap can be removed.true
, if the function was successfully removed.
false
otherwise (e.g. if the function was not added by this URCap).Function getFunction(String name)
name
- The name of the function.Collection<Function> getFunctions(Filter<Function> filter)
filter
- The filter being applied to the full list of added functions (by URCaps).Copyright © 2021. All rights reserved.