Class SweepAction<T>

    • Constructor Detail

    • Method Detail

      • addSweepValueListener

        public Listener<T> addSweepValueListener​(Listener<T> listener)
        Adds a listener that is triggered every time the current sweep value is changed.
        Parameters:
        listener - Listener to add
        Returns:
        The listener that was added
      • removeSweepValueListener

        public void removeSweepValueListener​(Listener listener)
        Removes the specified listener from this action - if it was added to begin with.
        Parameters:
        listener - The listener to remove
      • reset

        public void reset()
        Description copied from interface: Action
        Resets the action to the state it was in before being run.
        Specified by:
        reset in interface Action<T>
        Specified by:
        reset in class AbstractAction<java.lang.Void>
      • getSweepValues

        public java.util.List<T> getSweepValues()
        Returns an unmodifiable list of values that this action will sweep over.
        Returns:
        Sweep values
      • getSweepStrings

        public java.util.List<java.lang.String> getSweepStrings()
        Returns an unmodifiable list of the string representations of the values this action will sweep over.
        Returns:
        String representation of sweep values
      • setSweepValues

        public void setSweepValues​(T... values)
        Sets the values for this action to sweep over.
        Parameters:
        values - Sweep values to use
      • setSweepValues

        public void setSweepValues​(java.lang.Iterable<T> values)
        Sets the values for this action to sweep over.
        Parameters:
        values - Sweep values to use
      • generateActionsForValue

        public java.util.List<Action> generateActionsForValue​(T value)
        Generates the set of actions for the iteration of the sweep with the given value.
        Parameters:
        value - Value of iteration
        Returns:
        List of actions
      • getCurrentSweepValue

        public T getCurrentSweepValue()
        Returns the current value of the swept variable.
        Returns:
        Current sweep value
      • getCurrentSweepString

        public java.lang.String getCurrentSweepString()
        Returns the string representation of the current value of the swept variable.
        Returns:
        String representation of current sweep value
      • setAttribute

        public void setAttribute​(java.lang.String key,
                                 java.lang.String value)
        Description copied from interface: Action
        Sets the value of the specified attribute for this action.
        Specified by:
        setAttribute in interface Action<T>
        Overrides:
        setAttribute in class AbstractAction<java.lang.Void>
        Parameters:
        key - Attribute key
        value - Attribute value
      • setFormatter

        public void setFormatter​(SweepAction.Formatter<T> formatter)
        Specifies how the sweep variable should be converted to a string.
        Parameters:
        formatter - Formatter to use
      • format

        public java.lang.String format​(T value)
      • regenerateActions

        protected void regenerateActions()
        Regenerates all the sub-actions for this sweep.
      • resume

        public void resume()
        Description copied from interface: Action
        Resumes the action from where it was last interrupted
      • start

        public void start()
        Description copied from interface: Action
        Runs the action. Should only return once the action is complete/interrupted/failed.
        Specified by:
        start in interface Action<T>
        Specified by:
        start in class AbstractAction<java.lang.Void>
      • start

        protected void start​(boolean resume)
      • stop

        public void stop()
        Description copied from interface: Action
        Interrupts and stops the action.
        Specified by:
        stop in interface Action<T>
        Specified by:
        stop in class AbstractAction<java.lang.Void>
      • skip

        public void skip()
        Description copied from interface: Action
        Marks the action to be skipped next time it is run, or immediately if it is currently running.
        Specified by:
        skip in interface Action<T>
        Specified by:
        skip in class AbstractAction<java.lang.Void>
      • runFinalActions

        protected void runFinalActions()
      • getError

        public java.lang.Exception getError()
        Description copied from interface: Action
        Returns the exception that caused the the action to result in failure.
        Returns:
        Exception
      • isRunning

        public boolean isRunning()
        Description copied from interface: Action
        Returns whether the action is currently running or not.
        Specified by:
        isRunning in interface Action<T>
        Specified by:
        isRunning in class AbstractAction<java.lang.Void>
        Returns:
        Is it running?
      • getData

        public java.lang.Void getData()
        Description copied from interface: Action
        Returns whatever data this action generates.
        Specified by:
        getData in interface Action<T>
        Specified by:
        getData in class AbstractAction<java.lang.Void>
        Returns:
        Generated data
      • addAction

        public <R extends Action> R addAction​(R action)
      • addActions

        public void addActions​(java.util.Collection<Action> actions)
      • removeAction

        public void removeAction​(Action action)
      • removeActions

        public void removeActions​(java.util.Collection<Action> actions)
      • clearActions

        public void clearActions()
      • getActions

        public java.util.List<Action> getActions()
      • getChildren

        public java.util.List<Action> getChildren()
        Description copied from interface: Action
        Returns an unmodifiable list of sub-actions that this action contains. The exact meaning of a sub-action and how it relates to the running of this action depends on the type of action this is.
        Specified by:
        getChildren in interface Action<T>
        Specified by:
        getChildren in class AbstractAction<java.lang.Void>
        Returns:
        List of sub-actions
      • getChildrenByValue

        public java.util.List<Action> getChildrenByValue​(T value)
        Returns an unmodifiable list of the actions in the iteration of the sweep with the given value.
        Parameters:
        value - Value
        Returns:
        List of actions
      • getFinalActions

        public java.util.List<Action> getFinalActions()
      • addFinalAction

        public <R extends Action> R addFinalAction​(R action)
      • addFinalActions

        public void addFinalActions​(java.util.Collection<Action> actions)
      • removeFinalAction

        public void removeFinalAction​(Action action)
      • clearFinalActions

        public void clearFinalActions()
      • getDisplay

        public SweepActionDisplay<T> getDisplay()
        Description copied from interface: Action
        Returns the JavaFX node used to display this action in an ActionQueueDisplay object.
        Returns:
        Node
      • setMeasurement

        public void setMeasurement​(Measurement measure)
      • copy

        public SweepAction<T> copy()
        Description copied from interface: Action
        Creates a deep copy of this action.
        Returns:
        Deep copy of this action