Class Round

  • All Implemented Interfaces:
    AdditionalInformationHandler, CleanUpHandler, Destroyable, GlobalInfoSupporter, LoggingLevelHandler, LoggingSupporter, OptionHandler, QuickInfoSupporter, ShallowCopySupporter<AbstractConversion>, SizeOfHandler, Stoppable, Conversion, Serializable

    public class Round
    extends AbstractConversion
    Rounds double values and turns them into integers.
    When specifying a value larger than zero for 'numDecimals', the rounding will happen at that decimal. In other words:
    rounding(value * 10^numDecimals) / 10^numDecimals

    -logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel)
        The logging level for outputting errors and debugging output.
        default: WARNING
        min-user-mode: Expert
     
    -action <ROUND|CEILING|FLOOR|RINT> (property: action)
        The action to perform on the doubles passing through; ROUND: the closest
        integer to the argument, with ties rounding to positive infinity; CEILING:
         the smallest (closest to negative infinity) double value that is greater
        than or equal to the argument and is equal to a mathematical integer; FLOOR:
         the largest (closest to positive infinity) double value that is less than
        or equal to the argument and is equal to a mathematical integer; RINT: the
        double value that is closest in value to the argument and is equal to a
        mathematical integer
        default: ROUND
     
    -num-decimals <int> (property: numDecimals)
        The number of decimals after the decimal point to use.
        default: 0
        minimum: 0
     
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Detail

      • m_Action

        protected RoundingType m_Action
        the action to perform.
      • m_NumDecimals

        protected int m_NumDecimals
        the number of decimals.
    • Constructor Detail

      • Round

        public Round()
    • Method Detail

      • setAction

        public void setAction​(RoundingType value)
        Sets the action to perform on the doubles.
        Parameters:
        value - the action
      • getAction

        public RoundingType getAction()
        Returns the action to perform on the doubles.
        Returns:
        the action
      • actionTipText

        public String actionTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setNumDecimals

        public void setNumDecimals​(int value)
        Sets the number of decimals after the decimal point to use.
        Parameters:
        value - the number of decimals
      • getNumDecimals

        public int getNumDecimals()
        Returns the number of decimals after the decimal point to use.
        Returns:
        the number of decimals
      • numDecimalsTipText

        public String numDecimalsTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.