Package org.xtce.math

Class MathOperationCalibration

  • All Implemented Interfaces:
    Calibration

    public class MathOperationCalibration
    extends Object
    implements Calibration
    Class to apply a calibration specified in an XTCE document in the form of a Math Operation Calibrator.
    Author:
    David Overeem
    • Constructor Detail

      • MathOperationCalibration

        public MathOperationCalibration​(CalibratorType.MathOperationCalibrator element)
        Constructs a Calibration object based on the MathOperationCalibrator element in the XTCE document.
        Parameters:
        element - MathOperationCalibrator containing the data.
    • Method Detail

      • calibrate

        public Number calibrate​(Number xValue)
                         throws XTCEDatabaseException
        Calibration of values using MathOperationCalibrator has some limited support for common numeric values and operators. Some operators are not yet implemented, but likely will be supported in the future. The following list contains the unsupported operators that are specified in XTCE 1.1:
        • case "&": // really for integer values only?
        • case "|": // really for integer values only?
        • case "<<": // really for integer values only?
        • case ">>": // really for integer values only?
        • case ">>>": // really for integer values only?
        • case "x!": // not in the basic java.lang.Math
        • case "atanh": // not in the basic java.lang.Math
        • case "asinh": // not in the basic java.lang.Math
        • case "acosh": // not in the basic java.lang.Math
        Future implementations will utilize an open source library that implements all the needed functions specifically for BigDecimal, to avoid conversion and precision issues.
        Specified by:
        calibrate in interface Calibration
        Parameters:
        xValue - Number containing the uncalibrated value.
        Returns:
        Number containing the calibrated value after the calibration.
        Throws:
        XTCEDatabaseException - thrown in the event that the math operator is not yet supported, the stack is exhausted, which would occur for an invalid expression, or for an arithmetic error, such as a division by zero.
      • uncalibrate

        public Number uncalibrate​(Number yValue)
                           throws XTCEDatabaseException
        Reverse calibration of values is not yet supported for MathOperationCalibrator.
        Specified by:
        uncalibrate in interface Calibration
        Parameters:
        yValue - Number containing the calibrated value.
        Returns:
        Number containing the uncalibrated value after the reverse calibration operation.
        Throws:
        XTCEDatabaseException - any time this is called.
      • toString

        public String toString()
        Method to create a simple space delimited string that represents the postfix expression from the XTCE MathOperationCalibrator that this object instance represents.
        Overrides:
        toString in class Object
        Returns:
        String containing a space delimited expression of operands and operators in postfix notation.
      • toInfixString

        public String toInfixString()
                             throws XTCEDatabaseException
        Method to create a simple space delimited string that represents the infix expression from the XTCE MathOperationCalibrator that this object instance represents.
        Returns:
        String containing a space delimited expression of operands and operators in infix notation.
        Throws:
        XTCEDatabaseException - thrown in the event that the math operator is not yet supported or the stack is exhausted, which would occur for an invalid expression.