Class ProgressConsole

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

    public class ProgressConsole
    extends AbstractSink
    Outputs progress information in the console. The incoming token is used as 'current' value to be displayed. For convenience, the incoming token representing a number can also be in string format. Only outputs something if different from the last output.

    Input/output:
    - accepts:
       java.lang.Number
       java.lang.String


    -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: ProgressConsole
     
    -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
     
    -min <double> (property: minimum)
        The minimum to use.
        default: 0.0
     
    -max <double> (property: maximum)
        The maximum to use.
        default: 100.0
     
    -prefix <java.lang.String> (property: prefix)
        The prefix string to print before the percentage.
        default:
     
    -format <adams.data.DecimalFormatString> (property: format)
        The format string to use for outputting the current value, use empty string
        to suppress output.
        default: #.#%
        more: https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/text/DecimalFormat.html
     
    -suffix <java.lang.String> (property: suffix)
        The suffix string to print before the percentage.
        default:
     
    -title <java.lang.String> (property: title)
        The 'title' to use, used as prefix to the generated progress string, separated
        by ': '
        default:
     
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Detail

      • m_Minimum

        protected double m_Minimum
        the minimum of the progress bar.
      • m_Maximum

        protected double m_Maximum
        the maximum of the progress bar.
      • m_Prefix

        protected String m_Prefix
        the prefix.
      • m_Suffix

        protected String m_Suffix
        the suffix.
      • m_Title

        protected String m_Title
        the title.
      • m_ActualFormat

        protected transient DecimalFormat m_ActualFormat
        the actual format.
      • m_LastOutput

        protected transient String m_LastOutput
        the last string that was output.
    • Constructor Detail

      • ProgressConsole

        public ProgressConsole()
    • Method Detail

      • reset

        protected void reset()
        Resets the scheme.
        Overrides:
        reset in class AbstractActor
      • setMinimum

        public void setMinimum​(double value)
        Sets the minimum.
        Parameters:
        value - the minimum
      • getMinimum

        public double getMinimum()
        Returns the minimum.
        Returns:
        the minimum
      • minimumTipText

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

        public void setMaximum​(double value)
        Sets the maximum.
        Parameters:
        value - the maximum
      • getMaximum

        public double getMaximum()
        Returns the maximum.
        Returns:
        the maximum
      • maximumTipText

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

        public void setPrefix​(String value)
        Sets the prefix string.
        Parameters:
        value - the prefix
      • getPrefix

        public String getPrefix()
        Returns the prefix string.
        Returns:
        the prefix
      • prefixTipText

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

        public void setTitle​(String value)
        Sets the optional title string.
        Parameters:
        value - the title
      • getTitle

        public String getTitle()
        Returns the optional title string.
        Returns:
        the title
      • titleTipText

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

        public void setFormat​(DecimalFormatString value)
        Sets the format string for the current value.
        Parameters:
        value - the format, empty string to suppress output
      • getFormat

        public DecimalFormatString getFormat()
        Returns the format string for the current value.
        Returns:
        the format, empty string is suppressing output
      • formatTipText

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

        public void setSuffix​(String value)
        Sets the suffix string.
        Parameters:
        value - the suffix
      • getSuffix

        public String getSuffix()
        Returns the suffix string.
        Returns:
        the suffix
      • suffixTipText

        public String suffixTipText()
        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:
        the Class of objects that can be processed
      • doExecute

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