Class FragmentSeries

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

    public class FragmentSeries
    extends Object
    implements nzilbb.util.MonitorableSeries<nzilbb.ag.Graph>
    An implementation of Spliterator<Graph> that enumerates fragments corresponding to a list of selected fragment Ids.
    Author:
    Robert Fromont robert@fromont.net.nz
    • Constructor Detail

      • FragmentSeries

        public FragmentSeries​(Collection<String> fragmentIds,
                              SqlGraphStore store,
                              String[] layers)
                       throws SQLException
        Constructor.
        Parameters:
        fragmentIds - A collection of strings that identify a graph fragment.

        These can be something like:

        • g_3;em_11_23;n_19985-n_20003;p_4;#=ew_0_12611;prefix=001-;[0]=ew_0_12611
        • AgnesShacklock-01.trs;60.897-67.922;prefix=001-
        • AgnesShacklock-01.trs;60.897-67.922;m_-1_23-
        Throws:
        SQLException - If an error occurs retrieving results.
    • Method Detail

      • getRunning

        public boolean getRunning()
        Getter for running: Whether the task is currently running.
        Specified by:
        getRunning in interface nzilbb.util.MonitorableTask
        Returns:
        Whether the task is currently running.
      • setRunning

        public void setRunning​(boolean newRunning)
        Setter for running: Whether the task is currently running.
        Parameters:
        newRunning - Whether the task is currently running.
      • getStore

        public SqlGraphStore getStore()
        Getter for store: The graph store object.
        Returns:
        The graph store object.
      • setStore

        public FragmentSeries setStore​(SqlGraphStore newStore)
        Setter for store: The graph store object.
        Parameters:
        newStore - The graph store object.
      • getFragmentIds

        public Collection<String> getFragmentIds()
        Getter for fragmentIds: A collection of strings that identify a graph fragment.
        Returns:
        A collection of strings that identify a graph fragment.
      • setFragmentIds

        public FragmentSeries setFragmentIds​(Collection<String> newFragmentIds)
        Setter for fragmentIds: A collection of strings that identify a graph fragment.
        Parameters:
        newFragmentIds - A collection of strings that identify a graph fragment.
      • getLayers

        public String[] getLayers()
        Getter for layers: Layers to load into the fragments.
        Returns:
        Layers to load into the fragments.
      • setLayers

        public FragmentSeries setLayers​(String[] newLayers)
        Setter for layers: Layers to load into the fragments.
        Parameters:
        newLayers - Layers to load into the fragments.
      • getShiftAnchors

        public boolean getShiftAnchors()
        Getter for shiftAnchors: Whether to shift all anchors in the fragment so that the start anchor has an offset of 0.0. Default is true.
        Returns:
        Whether to shift all anchors in the fragment so that the start anchor has an offset of 0.0.
      • setShiftAnchors

        public FragmentSeries setShiftAnchors​(boolean newShiftAnchors)
        Setter for shiftAnchors: Whether to shift all anchors in the fragment so that the start anchor has an offset of 0.0.
        Parameters:
        newShiftAnchors - Whether to shift all anchors in the fragment so that the start anchor has an offset of 0.0.
      • getPrefixNames

        public boolean getPrefixNames()
        Getter for prefixNames: Whether to prefix fragment names with a numeric serial number or not.
        Returns:
        Whether to prefix fragment names with a numeric serial number or not.
      • setPrefixNames

        public FragmentSeries setPrefixNames​(boolean newPrefixNames)
        Setter for prefixNames: Whether to prefix fragment names with a numeric serial number or not.
        Parameters:
        newPrefixNames - Whether to prefix fragment names with a numeric serial number or not.
      • getTagTarget

        public boolean getTagTarget()
        Getter for tagTarget: Whether to add an tag identifying the target annotation or not.
        Returns:
        Whether to add an tag identifying the target annotation or not.
      • setTagTarget

        public FragmentSeries setTagTarget​(boolean newTagTarget)
        Setter for tagTarget: Whether to add an tag identifying the target annotation or not.
        Parameters:
        newTagTarget - Whether to add an tag identifying the target annotation or not.
      • tryAdvance

        public boolean tryAdvance​(Consumer<? super nzilbb.ag.Graph> action)
        Returns the next element of this enumeration if this enumeration object has at least one more element to provide.
        Specified by:
        tryAdvance in interface Spliterator<nzilbb.ag.Graph>
      • 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.
      • getPercentComplete

        public Integer getPercentComplete()
        Determines how far through the serialization 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 spliteration; the next call to tryAdvance will return false.
        Specified by:
        cancel in interface nzilbb.util.MonitorableTask