Class Stopwatch

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

    public class Stopwatch
    extends AbstractDisplay
    Stops the execution time of the flow, till either the user stops the flow or the flow finishes by itself

    Valid options are:

    -D <int> (property: debugLevel)
        The greater the number the more additional info the scheme may output to
        the console (0 = off).
        default: 0
        minimum: 0
     
    -name <java.lang.String> (property: name)
        The name of the actor.
        default: Stopwatch
     
    -annotation <adams.core.base.BaseText> (property: annotations)
        The annotations to attach to this actor.
        default:
     
    -skip (property: skip)
        If set to true, transformation is skipped and the input token is just forwarded
        as it is.
     
    -stop-flow-on-error (property: stopFlowOnError)
        If set to true, the flow gets stopped in case this actor encounters an error;
         useful for critical actors.
     
    -width <int> (property: width)
        The width of the dialog.
        default: 100
        minimum: 1
     
    -height <int> (property: height)
        The height of the dialog.
        default: 56
        minimum: 1
     
    -x <int> (property: x)
        The X position of the dialog (>=0: absolute, -1: left, -2: center, -3: right
        ).
        default: -3
        minimum: -3
     
    -y <int> (property: y)
        The Y position of the dialog (>=0: absolute, -1: top, -2: center, -3: bottom
        ).
        default: -1
        minimum: -3
     
    -update-interval <int> (property: updateInterval)
        The wait period in milli-seconds before the stopwatch display is being updated.
        default: 500
        minimum: 10
     
    -prefix <java.lang.String> (property: prefix)
        The prefix text for the time display.
        default:
     
    -suffix <java.lang.String> (property: suffix)
        The suffix text for the time display.
        default:
     
    -show-seconds (property: showSeconds)
        If enabled, the seconds are displayed in the stopwatch output as well.
     
    -font <java.awt.Font> (property: font)
        The font to use for displaying the time.
        default: monospaced-PLAIN-16
     
    Version:
    $Revision$
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Detail

      • m_UpdateInterval

        protected int m_UpdateInterval
        the update interval in msec.
      • m_Prefix

        protected String m_Prefix
        the text to prefix the time.
      • m_Suffix

        protected String m_Suffix
        the text to suffix the time.
      • m_ShowSeconds

        protected boolean m_ShowSeconds
        whether to show the seconds as well.
      • m_Font

        protected Font m_Font
        the font for the display.
    • Constructor Detail

      • Stopwatch

        public Stopwatch()
    • Method Detail

      • getDefaultX

        protected int getDefaultX()
        Returns the default X position for the dialog.
        Overrides:
        getDefaultX in class AbstractDisplay
        Returns:
        the default X position
      • getDefaultWidth

        protected int getDefaultWidth()
        Returns the default width for the dialog.
        Overrides:
        getDefaultWidth in class AbstractDisplay
        Returns:
        the default width
      • getDefaultHeight

        protected int getDefaultHeight()
        Returns the default height for the dialog.
        Overrides:
        getDefaultHeight in class AbstractDisplay
        Returns:
        the default height
      • setPrefix

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

        public String getPrefix()
        Returns the prefix for the time display.
        Returns:
        the prefix string
      • 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.
      • setSuffix

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

        public String getSuffix()
        Returns the suffix for the time display.
        Returns:
        the suffix string
      • 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.
      • setShowSeconds

        public void setShowSeconds​(boolean value)
        Sets whether to display seconds as well.
        Parameters:
        value - if true then seconds are displayed as well
      • getShowSeconds

        public boolean getShowSeconds()
        Returns whether to display seconds as well.
        Returns:
        true if seconds are displayed as well
      • showSecondsTipText

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

        public void setUpdateInterval​(int value)
        Sets the wait period before the display is updated.
        Parameters:
        value - interval in msecs
      • getUpdateInterval

        public int getUpdateInterval()
        Returns the wait period before updating the display.
        Returns:
        interval in msecs
      • updateIntervalTipText

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

        public void setFont​(Font value)
        Sets the font for the time display.
        Parameters:
        value - the font
      • getFont

        public Font getFont()
        Returns the font for the time display.
        Returns:
        the font
      • fontTipText

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

        protected String doExecute()
        Executes the flow item.
        Overrides:
        doExecute in class AbstractDisplay
        Returns:
        null if everything is fine, otherwise error message
      • wrapUp

        public void wrapUp()
        Cleans up after the execution has finished. Graphical output is left untouched.
        Specified by:
        wrapUp in interface Actor
        Overrides:
        wrapUp in class AbstractDisplay