public abstract class AbstractFunction extends Object implements Function
Function
implementations.Module: equations-api
To use this in your app, include the following dependency in your POM:
<dependency> <groupId>org.cytoscape</groupId> <artifactId>equations-api</artifactId> </dependency>
Modifier | Constructor and Description |
---|---|
protected |
AbstractFunction(ArgDescriptor[] argDescriptors)
Base class constructor for easy creation of
Function s from function argument descriptors. |
Modifier and Type | Method and Description |
---|---|
protected boolean |
argTypesAreValid(Class[] argTypes)
Returns true of false if the args passed in had arity of a type mismatch.
|
abstract Object |
evaluateFunction(Object[] args)
Used to invoke this function.
|
abstract String |
getFunctionSummary()
Used to provide help for users.
|
abstract String |
getName()
Used to parse the function string.
|
List<Class<?>> |
getPossibleArgTypes(Class[] leadingArgs)
Used with the equation builder.
|
abstract Class |
getReturnType()
Returns the static return type of this function.
|
String |
getUsageDescription()
Used to provide help for users.
|
Class |
validateArgTypes(Class[] argTypes)
Returns the return type of this function.
|
protected AbstractFunction(ArgDescriptor[] argDescriptors)
Function
s from function argument descriptors.argDescriptors
- an array describing the Function
argument listpublic abstract String getName()
public abstract String getFunctionSummary()
getFunctionSummary
in interface Function
public final String getUsageDescription()
getUsageDescription
in interface Function
public abstract Class getReturnType()
getReturnType
in interface Function
protected final boolean argTypesAreValid(Class[] argTypes)
argTypes
- the args to check for wrong arity or a type mismatch.public final Class validateArgTypes(Class[] argTypes)
validateArgTypes
in interface Function
argTypes
- the args to check for wrong arity or a type mismatch.public abstract Object evaluateFunction(Object[] args) throws FunctionError
evaluateFunction
in interface Function
args
- the function arguments which must correspond in type and number to what getParameterTypes() returns.ArithmeticException
- thrown if a numeric error, e.g. a division by zero occurred.IllegalArgumentException
- thrown for any error that is not a numeric error,
for example if a function only accepts positive numbers and a negative number was passed in.FunctionError
public final List<Class<?>> getPossibleArgTypes(Class[] leadingArgs)
getPossibleArgTypes
in interface Function
leadingArgs
- the types of the arguments that have already been selected by the user.Copyright 2011-2015 Cytoscape Consortium. All rights reserved.