Package org.yamcs.studio.data.formula
Class AbstractVNumberToVNumberFormulaFunction
java.lang.Object
org.yamcs.studio.data.formula.AbstractVNumberToVNumberFormulaFunction
- All Implemented Interfaces:
FormulaFunction
public abstract class AbstractVNumberToVNumberFormulaFunction
extends Object
implements FormulaFunction
Abstract class for formula functions that take one
VNumber
as argument and return a VNumber
.
This class takes care of:
- extracting double value from
VNumber
- null handling - returns null if the argument is null
- alarm handling - returns the argument alarm
- time handling - returns the argument time
- display handling - returns display none
-
Constructor Summary
ConstructorDescriptionAbstractVNumberToVNumberFormulaFunction
(String name, String description, String argName) Creates a new function. -
Method Summary
Modifier and TypeMethodDescriptionabstract double
calculate
(double arg) Calculates the result based on the arguments.final Object
Calculate the result of the function given the arguments.The ordered list of the argument names.The ordered list of the arguments type.final String
Return the description of the function.final String
getName()
Return the name of the function.final Class<?>
The type of the function result.final boolean
Whether the function takes a variable number of arguments.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.yamcs.studio.data.formula.FormulaFunction
highestSeverityOf, latestValidTimeOrNowOf
-
Constructor Details
-
AbstractVNumberToVNumberFormulaFunction
Creates a new function.- Parameters:
name
- function name; can't be nulldescription
- function description; can't be nullargName
- the argument name; can't be null
-
-
Method Details
-
getName
Description copied from interface:FormulaFunction
Return the name of the function.- Specified by:
getName
in interfaceFormulaFunction
- Returns:
- the function name
-
getDescription
Description copied from interface:FormulaFunction
Return the description of the function.- Specified by:
getDescription
in interfaceFormulaFunction
- Returns:
- the function description
-
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 interfaceFormulaFunction
- Returns:
- true if the function can accept a variable number of arguments
-
getArgumentTypes
Description copied from interface:FormulaFunction
The ordered list of the arguments type.- Specified by:
getArgumentTypes
in interfaceFormulaFunction
- Returns:
- the types of the arguments
-
getArgumentNames
Description copied from interface:FormulaFunction
The ordered list of the argument names.- Specified by:
getArgumentNames
in interfaceFormulaFunction
- Returns:
- the names of the names
-
getReturnType
Description copied from interface:FormulaFunction
The type of the function result.- Specified by:
getReturnType
in interfaceFormulaFunction
- Returns:
- the result type
-
calculate
Description copied from interface:FormulaFunction
Calculate the result of the function given the arguments.- Specified by:
calculate
in interfaceFormulaFunction
- Parameters:
args
- the argument list- Returns:
- the result of the function
-
calculate
public abstract double calculate(double arg) Calculates the result based on the arguments. This is the only method one has to implement.- Parameters:
arg
- the argument- Returns:
- the result
-