Package org.yamcs.studio.data.formula
Class AbstractVIntNumberVIntNumberToVIntNumberFormulaFunction
java.lang.Object
org.yamcs.studio.data.formula.AbstractVIntNumberVIntNumberToVIntNumberFormulaFunction
- All Implemented Interfaces:
FormulaFunction
public abstract class AbstractVIntNumberVIntNumberToVIntNumberFormulaFunction
extends Object
implements FormulaFunction
Abstract class for formula functions that take two integer
VNumber as arguments and return an integer
VNumber.
This class takes care of:
- extracting int value from the
VNumber - 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 Summary
ConstructorsConstructorDescriptionAbstractVIntNumberVIntNumberToVIntNumberFormulaFunction(String name, String description, String arg1Name, String arg2Name) Creates a new function. -
Method Summary
Modifier and TypeMethodDescriptionabstract intcalculate(int arg1, int arg2) Calculates the result based on the two arguments.final ObjectCalculate the result of the function given the arguments.The ordered list of the argument names.The ordered list of the arguments type.final StringReturn the description of the function.final StringgetName()Return the name of the function.final Class<?>The type of the function result.final booleanWhether 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, waitMethods inherited from interface org.yamcs.studio.data.formula.FormulaFunction
highestSeverityOf, latestValidTimeOrNowOf
-
Constructor Details
-
AbstractVIntNumberVIntNumberToVIntNumberFormulaFunction
public AbstractVIntNumberVIntNumberToVIntNumberFormulaFunction(String name, String description, String arg1Name, String arg2Name) Creates a new function.- Parameters:
name- function name; can't be nulldescription- function description; can't be nullarg1Name- first argument name; can't be nullarg2Name- second argument name; can't be null
-
-
Method Details
-
getName
Description copied from interface:FormulaFunctionReturn the name of the function.- Specified by:
getNamein interfaceFormulaFunction- Returns:
- the function name
-
getDescription
Description copied from interface:FormulaFunctionReturn the description of the function.- Specified by:
getDescriptionin interfaceFormulaFunction- Returns:
- the function description
-
isVarArgs
public final boolean isVarArgs()Description copied from interface:FormulaFunctionWhether 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:
isVarArgsin interfaceFormulaFunction- Returns:
- true if the function can accept a variable number of arguments
-
getArgumentTypes
Description copied from interface:FormulaFunctionThe ordered list of the arguments type.- Specified by:
getArgumentTypesin interfaceFormulaFunction- Returns:
- the types of the arguments
-
getArgumentNames
Description copied from interface:FormulaFunctionThe ordered list of the argument names.- Specified by:
getArgumentNamesin interfaceFormulaFunction- Returns:
- the names of the names
-
getReturnType
Description copied from interface:FormulaFunctionThe type of the function result.- Specified by:
getReturnTypein interfaceFormulaFunction- Returns:
- the result type
-
calculate
Description copied from interface:FormulaFunctionCalculate the result of the function given the arguments.- Specified by:
calculatein interfaceFormulaFunction- Parameters:
args- the argument list- Returns:
- the result of the function
-
calculate
public abstract int calculate(int arg1, int arg2) Calculates the result based on the two arguments. This is the only method one has to implement.- Parameters:
arg1- the first argumentarg2- the second argument- Returns:
- the result
-