Class AbstractVNumberArrayVNumberToVNumberArrayFormulaFunction

java.lang.Object
org.yamcs.studio.data.formula.AbstractVNumberArrayVNumberToVNumberArrayFormulaFunction
All Implemented Interfaces:
FormulaFunction

public abstract class AbstractVNumberArrayVNumberToVNumberArrayFormulaFunction extends Object implements FormulaFunction
Abstract class for formula functions that take a VNumber and a VNumberArray as arguments and return a VNumberArray.

This class takes care of:

  • extracting double value from VNumber
  • extracting ListNumber value from VNumberArray
  • null handling - returns null if one argument is null
  • alarm handling - returns highest alarm
  • time handling - returns latest time, or now if no time is available
  • display handling - returns display none
  • Constructor Details

    • AbstractVNumberArrayVNumberToVNumberArrayFormulaFunction

      public AbstractVNumberArrayVNumberToVNumberArrayFormulaFunction(String name, String description, String arg1Name, String arg2Name)
      Creates a new function.
      Parameters:
      name - function name; can't be null
      description - function description; can't be null
      arg1Name - first argument name; can't be null
      arg2Name - second argument name; can't be null
  • Method Details

    • isVarArgs

      public final boolean isVarArgs()
      Description copied from interface: FormulaFunction
      Whether the function takes a variable number of arguments.

      Variable arguments can only be at the end of the argument list, and have the same type.

      Specified by:
      isVarArgs in interface FormulaFunction
      Returns:
      true if the function can accept a variable number of arguments
    • getName

      public final String getName()
      Description copied from interface: FormulaFunction
      Return the name of the function.
      Specified by:
      getName in interface FormulaFunction
      Returns:
      the function name
    • getDescription

      public final String getDescription()
      Description copied from interface: FormulaFunction
      Return the description of the function.
      Specified by:
      getDescription in interface FormulaFunction
      Returns:
      the function description
    • getArgumentTypes

      public final List<Class<?>> getArgumentTypes()
      Description copied from interface: FormulaFunction
      The ordered list of the arguments type.
      Specified by:
      getArgumentTypes in interface FormulaFunction
      Returns:
      the types of the arguments
    • getArgumentNames

      public final List<String> getArgumentNames()
      Description copied from interface: FormulaFunction
      The ordered list of the argument names.
      Specified by:
      getArgumentNames in interface FormulaFunction
      Returns:
      the names of the names
    • getReturnType

      public final Class<?> getReturnType()
      Description copied from interface: FormulaFunction
      The type of the function result.
      Specified by:
      getReturnType in interface FormulaFunction
      Returns:
      the result type
    • calculate

      public final Object calculate(List<Object> args)
      Description copied from interface: FormulaFunction
      Calculate the result of the function given the arguments.
      Specified by:
      calculate in interface FormulaFunction
      Parameters:
      args - the argument list
      Returns:
      the result of the function
    • calculate

      public abstract ListNumber calculate(ListNumber arg1, double arg2)
      Calculates the result based on the two arguments. This is the only method one has to implement.
      Parameters:
      arg1 - the first argument; not null
      arg2 - the second argument
      Returns:
      the result; not null