Class Debug

  • All Implemented Interfaces:
    CleanUpHandler, Destroyable, GlobalInfoSupporter, LoggingLevelHandler, LoggingSupporter, OptionHandler, ShallowCopySupporter<FlowExecutionListener>, SizeOfHandler, Stoppable, FlowExecutionListener, GraphicalFlowExecutionListener, Serializable, Comparable

    public class Debug
    extends AbstractGraphicalFlowExecutionListener
    implements Stoppable
    Allows the user to define breakpoints that suspend the execution of the flow, allowing the inspection of the current flow state.
    Tokens can only inspected during 'preInput', 'preExecute' and 'postOutput' of Breakpoint control actors. Step-wise debugging stops in 'preExecute', which should be able to access the current token in case of input consumers (ie transformers and sinks).

    -logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel)
        The logging level for outputting errors and debugging output.
        default: WARNING
     
    -width <int> (property: width)
        The width of the dialog.
        default: 800
        minimum: -1
     
    -height <int> (property: height)
        The height of the dialog.
        default: 600
        minimum: -1
     
    -breakpoint <adams.flow.execution.debug.AbstractBreakpoint> [-breakpoint ...] (property: breakpoints)
        The breakpoints to use for suspending the flow execution.
        default: 
     
    -watch <adams.core.base.BaseString> [-watch ...] (property: watches)
        The expression to display initially in the watch dialog; the type of the 
        watch needs to be specified as well.
        default: 
     
    -watch-type <VARIABLE|BOOLEAN|NUMERIC|STRING> [-watch-type ...] (property: watchTypes)
        The types of the watch expressions; determines how the expressions get evaluated 
        and displayed.
        default: 
     
    -view <SOURCE|EXPRESSIONS|VARIABLES|STORAGE|INSPECT_TOKEN|BREAKPOINTS> [-view ...] (property: views)
        The views to display automatically when the breakpoint is reached.
        default: 
     
    -step-by-step <boolean> (property: stepByStep)
        Whether to start in step-by-step mode or wait for first breakpoint.
        default: false
     
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Detail

      • m_Width

        protected int m_Width
        the width of the dialog.
      • m_Height

        protected int m_Height
        the height of the dialog.
      • m_Views

        protected View[] m_Views
        the views to display automatically.
      • m_Watches

        protected BaseString[] m_Watches
        the watch expressions.
      • m_StepByStep

        protected boolean m_StepByStep
        whether to start in auto-progress mode.
      • m_ControlPanel

        protected transient ControlPanel m_ControlPanel
        control panel.
      • m_Blocked

        protected boolean m_Blocked
        whether the GUI currently blocks the flow execution.
      • m_Current

        protected transient Actor m_Current
        the current actor.
      • m_Stopped

        protected boolean m_Stopped
        whether the flow got stopped.
    • Constructor Detail

      • Debug

        public Debug()
    • Method Detail

      • getDefaultWidth

        protected int getDefaultWidth()
        Returns the default width for the dialog.
        Returns:
        the default width
      • setWidth

        public void setWidth​(int value)
        Sets the width of the dialog.
        Parameters:
        value - the width
      • getWidth

        public int getWidth()
        Returns the currently set width of the dialog.
        Returns:
        the width
      • widthTipText

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

        protected int getDefaultHeight()
        Returns the default height for the dialog.
        Returns:
        the default height
      • setHeight

        public void setHeight​(int value)
        Sets the height of the dialog.
        Parameters:
        value - the height
      • getHeight

        public int getHeight()
        Returns the currently set height of the dialog.
        Returns:
        the height
      • heightTipText

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

        public void setBreakpoints​(AbstractBreakpoint[] value)
        Sets the breakpoints to use for suspending the flow execution.
        Parameters:
        value - the breakpoints
      • getBreakpoints

        public AbstractBreakpoint[] getBreakpoints()
        Returns the breakpoints to use for suspending the flow execution.
        Returns:
        the breakpoints
      • breakpointsTipText

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

        public void setScopeRestriction​(AbstractScopeRestriction value)
        Sets the restriction for the scope to use for suspending the flow execution.
        Parameters:
        value - the restriction
      • getScopeRestriction

        public AbstractScopeRestriction getScopeRestriction()
        Returns the restriction for the scope to use for suspending the flow execution.
        Returns:
        the restriction
      • scopeRestrictionTipText

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

        public void setWatches​(BaseString[] value)
        Sets the watch expressions for the watch dialog.
        Parameters:
        value - the expressions
      • getWatches

        public BaseString[] getWatches()
        Returns the watch expressions for the watch dialog.
        Returns:
        the expressions
      • watchesTipText

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

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

        public void setViews​(View[] value)
        Sets the views to display automatically.
        Parameters:
        value - the views
      • getViews

        public View[] getViews()
        Returns the views to display automatically.
        Returns:
        the views
      • viewsTipText

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

        public void setStepByStep​(boolean value)
        Sets whether to start in step-by-step mode or wait for first breakpoint.
        Parameters:
        value - true if to start in step-by-step mode
      • getStepByStep

        public boolean getStepByStep()
        Returns whether to start in step-by-step mode or wait for first breakpoint.
        Returns:
        true if to start in step-by-step mode
      • stepByStepTipText

        public String stepByStepTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the gui
      • setStepMode

        public void setStepMode​(boolean value)
        Sets whether step mode is used.
        Parameters:
        value - true if step mode
      • isStepMode

        public boolean isStepMode()
        Returns whether step mode is used.
        Returns:
        true if step mode
      • refreshGUI

        public void refreshGUI()
        Refreshes the control panel.
      • isBlocked

        public boolean isBlocked()
        Returns whether the flow execution is currently blocked.
      • blockExecution

        public void blockExecution()
        Blocks the flow execution.
      • removeOneOffBreakpoints

        public void removeOneOffBreakpoints​(AbstractBreakpoint toKeep)
        Removes all one-off breakpoints apart from the specified one.
        Parameters:
        toKeep - the breakpoint to keep
      • unblockExecution

        public void unblockExecution()
        Unblocks the flow execution.
      • displayControlPanelIfNecessary

        protected boolean displayControlPanelIfNecessary()
        Instantiates/displays the control panel if necessary.
        Returns:
        true if either already present or successfully displayed
      • triggered

        protected void triggered​(AbstractBreakpoint point,
                                 Actor actor,
                                 ExecutionStage stage)
        Suspends the flow execution.
        Parameters:
        point - the breakpoint that triggered the suspend
        actor - the current actor
        stage - the hook method (eg preInput)
      • triggered

        protected void triggered​(AbstractBreakpoint point,
                                 Actor actor,
                                 ExecutionStage stage,
                                 Token token)
        Suspends the flow execution.
        Parameters:
        point - the breakpoint that triggered the suspend
        actor - the current actor
        stage - the hook method (eg preInput)
        token - the current token
      • stopExecution

        public void stopExecution()
        Stops the execution.
        Specified by:
        stopExecution in interface Stoppable