Class Pipeline

  • All Implemented Interfaces:
    ConnectionValidator, SettingsProvider, StepIndexer, java.util.Comparator<Step>

    public class Pipeline
    extends java.lang.Object
    implements ConnectionValidator, SettingsProvider, StepIndexer
    Pipeline has the list of steps in a computer vision algorithm, as well as the set of connections between the inputs and outputs of different steps. The pipeline class is responsible for listening for other components of the application (such as the GUI) adding or removing steps and connections, and for registering and unregistering them from the event bus when appropriate.
    • Constructor Detail

      • Pipeline

        public Pipeline()
    • Method Detail

      • clear

        public void clear()
        Remove everything in the pipeline.
      • getSources

        public final com.google.common.collect.ImmutableList<Source> getSources()
        Returns a snapshot of all of the sources in the pipeline.
        Returns:
        an Immutable copy of the sources at the current point in the pipeline.
        See Also:
        Why we use ImmutableList return type
      • getSteps

        public final com.google.common.collect.ImmutableList<Step> getSteps()
        Returns a snapshot of all of the steps in the pipeline.
        Returns:
        an Immutable copy of the steps at the current point in the pipeline.
        See Also:
        Why we use ImmutableList return type
      • getConnections

        public java.util.Set<Connection> getConnections()
        Returns:
        The unmodifiable set of connections between inputs and outputs of steps.
      • getAppSettings

        public AppSettings getAppSettings()
        Description copied from interface: SettingsProvider
        Gets the current global app settings. This object may become out of date if the settings are edited by the user, so objects requiring a preference value should also subscribe to AppSettingsChangedEvent to get updates.
        Specified by:
        getAppSettings in interface SettingsProvider
        Returns:
        the current global app settings
      • canConnect

        public boolean canConnect​(OutputSocket<?> outputSocket,
                                  InputSocket<?> inputSocket)
        Description copied from interface: ConnectionValidator
        Determines if an output socket can be connected to an input socket.
        Specified by:
        canConnect in interface ConnectionValidator
        Parameters:
        outputSocket - The output socket to connect to the input socket
        inputSocket - The input socket to accept the output value of the output socket
        Returns:
        True if a valid connection can be made from these two Sockets
      • addStepBetween

        public void addStepBetween​(Step stepToAdd,
                                   @Nullable
                                   Step lower,
                                   @Nullable
                                   Step higher)
        Adds the step between two other steps.
        Parameters:
        stepToAdd - The step to add to the pipeline.
        lower - The step to be added above.
        higher - The step to be added below.
      • moveStepBetween

        public void moveStepBetween​(Step toMove,
                                    @Nullable
                                    Step lower,
                                    @Nullable
                                    Step higher)
        Parameters:
        toMove - The step to move.
        lower - The lower step.
        higher - The upper step.
      • addStep

        public void addStep​(int index,
                            Step step)
        Adds the given step to the pipeline.
        Parameters:
        index - The index to add the step at.
        step - The step to be added.
      • addStep

        public void addStep​(Step step)
      • removeStep

        public void removeStep​(Step step)
        Removes the given step from the pipeline.
        Parameters:
        step - The step to be removed.
      • moveStep

        public void moveStep​(Step step,
                             int delta)
        Moves the step by the given number of spaces.
        Parameters:
        step - The step to move.
        delta - The distance to move it.
      • indexOf

        public int indexOf​(Step step)
        Description copied from interface: StepIndexer
        Gets the index of the given step.
        Specified by:
        indexOf in interface StepIndexer
        Parameters:
        step - the step to get the index of
        Returns:
        the index of the given step, or -1 if this object does not contain that step