Class ConsolidatedGraphSeries

  • All Implemented Interfaces:
    Spliterator<nzilbb.ag.Graph>, nzilbb.util.MonitorableSeries<nzilbb.ag.Graph>, nzilbb.util.MonitorableTask

    public class ConsolidatedGraphSeries
    extends Object
    implements nzilbb.util.MonitorableSeries<nzilbb.ag.Graph>
    A Graph series that filters another Graph series, collapsing consecutive instances of the same graph into one graph.

    Annotations from selected layers a copied from subsequent instances into the first, before the first graph is returned.

    Author:
    Robert Fromont robert@fromont.net.nz
    • Constructor Detail

      • ConsolidatedGraphSeries

        public ConsolidatedGraphSeries()
        Default constructor
      • ConsolidatedGraphSeries

        public ConsolidatedGraphSeries​(nzilbb.util.MonitorableSeries<nzilbb.ag.Graph> source)
        Constructor from source series.
        Parameters:
        source - The source of the graphs to consolidate.
    • Method Detail

      • getSource

        public nzilbb.util.MonitorableSeries<nzilbb.ag.Graph> getSource()
        Getter for source: The source of the graphs to consolidate.
        Returns:
        The source of the graphs to consolidate.
      • setSource

        public ConsolidatedGraphSeries setSource​(nzilbb.util.MonitorableSeries<nzilbb.ag.Graph> newSource)
        Setter for source: The source of the graphs to consolidate.
        Parameters:
        newSource - The source of the graphs to consolidate.
      • getCopyLayers

        public Collection<String> getCopyLayers()
        Getter for copyLayers: List of layers to consolidate the annotations of.
        Returns:
        List of layers to consolidate the annotations of.
      • setCopyLayers

        public ConsolidatedGraphSeries setCopyLayers​(Collection<String> newCopyLayers)
        Setter for copyLayers: List of layers to consolidate the annotations of.
        Parameters:
        newCopyLayers - List of layers to consolidate the annotations of.
      • getPercentComplete

        public Integer getPercentComplete()
        Determines how far through the task is is.
        Specified by:
        getPercentComplete in interface nzilbb.util.MonitorableTask
        Returns:
        An integer between 0 and 100 (inclusive), or null if progress can not be calculated.
      • cancel

        public void cancel()
        Cancels the task.
        Specified by:
        cancel in interface nzilbb.util.MonitorableTask
      • getRunning

        public boolean getRunning()
        Reveals whether the task is still running or not.
        Specified by:
        getRunning in interface nzilbb.util.MonitorableTask
        Returns:
        true if the task is currently running, false otherwise.
      • estimateSize

        public long estimateSize()
        Counts the elements in the series, if possible.
        Specified by:
        estimateSize in interface Spliterator<nzilbb.ag.Graph>
        Returns:
        The number of elements in the series, or null if the number is unknown.
      • tryAdvance

        public boolean tryAdvance​(Consumer<? super nzilbb.ag.Graph> action)
        If a remaining element exists, performs the given action on it, returning true; else returns false.
        Specified by:
        tryAdvance in interface Spliterator<nzilbb.ag.Graph>