Class AbstractFunction

java.lang.Object
org.cytoscape.equations.AbstractFunction
All Implemented Interfaces:
Function

public abstract class AbstractFunction extends Object implements Function
Base class for all Function implementations.

Cytoscape Backwards Compatibility (Abstract Class): This class is abstract and meant to be extended by users. This means that we may add methods for minor version updates. Methods will only be removed for major version updates.

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>
  • Constructor Details

    • AbstractFunction

      protected AbstractFunction(ArgDescriptor[] argDescriptors)
      Base class constructor for easy creation of Functions from function argument descriptors.
      Parameters:
      argDescriptors - an array describing the Function argument list
  • Method Details

    • getArgumentDescriptors

      public List<ArgDescriptor> getArgumentDescriptors()
      Returns the usage descriptions for the function's arguments. Used to provide help for users. This is an optional operation, may return null.
      Specified by:
      getArgumentDescriptors in interface Function
    • getUsageDescription

      public final String getUsageDescription()
      Used to provide help for users. Unlike getFunctionSummary(), this describes how to call this function, like "Call with SIN(number)."
      Specified by:
      getUsageDescription in interface Function
      Returns:
      a description of how to use this function
    • argTypesAreValid

      protected final boolean argTypesAreValid(Class[] argTypes)
    • validateArgTypes

      public Class validateArgTypes(Class[] argTypes)
      Specified by:
      validateArgTypes in interface Function
      Returns:
      the return type for this function (Double.cLass, String.class, or Boolean.class) or null if the args passed in had the wrong arity or a type mismatch Note that this is different from getReturnType() in that it will never return the wildcard Object.class. It is used by the parser which knows the actual type of the arguments in any given call to this function.
    • getPossibleArgTypes

      public final List<Class<?>> getPossibleArgTypes(Class[] leadingArgs)
      Used with the equation builder.
      Specified by:
      getPossibleArgTypes in interface Function
      Parameters:
      leadingArgs - the types of the arguments that have already been selected by the user.
      Returns:
      the set of arguments (must be a collection of String.class, Long.class, Double.class, Boolean.class and List.class) that are candidates for the next argument. A null return indicates that no further arguments are valid. Please note that if the returned set contains a null, this indicates an optional additional argument.