Class Round

  • All Implemented Interfaces:
    AdditionalInformationHandler, CleanUpHandler, Destroyable, GlobalInfoSupporter, LoggingLevelHandler, LoggingSupporter, OptionHandler, QuickInfoSupporter, ShallowCopySupporter<Actor>, SizeOfHandler, Stoppable, StoppableWithFeedback, VariablesInspectionHandler, VariableChangeListener, Actor, ErrorHandler, InputConsumer, OutputProducer, Serializable, Comparable

    public class Round
    extends AbstractTransformer
    Performs the specified rounding operation on double tokens.
    If 'numDecimals' is zero, it will generate integers otherwise doubles.

    Input/output:
    - accepts:
       java.lang.Double
       java.lang.Double[]
    - generates:
       java.lang.Integer
       java.lang.Integer[]


    -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
     
    -name <java.lang.String> (property: name)
        The name of the actor.
        default: Round
     
    -annotation <adams.core.base.BaseAnnotation> (property: annotations)
        The annotations to attach to this actor.
        default:
     
    -skip <boolean> (property: skip)
        If set to true, transformation is skipped and the input token is just forwarded
        as it is.
        default: false
     
    -stop-flow-on-error <boolean> (property: stopFlowOnError)
        If set to true, the flow execution at this level gets stopped in case this
        actor encounters an error; the error gets propagated; useful for critical
        actors.
        default: false
        min-user-mode: Expert
     
    -silent <boolean> (property: silent)
        If enabled, then no errors are output in the console; Note: the enclosing
        actor handler must have this enabled as well.
        default: false
        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.
      • accepts

        public Class[] accepts()
        Returns the class that the consumer accepts.
        Returns:
        java.lang.Double.class, java.lang.Double[].class
      • generates

        public Class[] generates()
        Returns the class of objects that it generates.
        Returns:
        java.lang.Integer.class, java.lang.Integer[].class
      • doExecute

        protected String doExecute()
        Executes the flow item.
        Specified by:
        doExecute in class AbstractActor
        Returns:
        null if everything is fine, otherwise error message