Package nzilbb.labbcat.server.db
Class FragmentSeries
- java.lang.Object
-
- nzilbb.labbcat.server.db.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
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface java.util.Spliterator
Spliterator.OfDouble, Spliterator.OfInt, Spliterator.OfLong, Spliterator.OfPrimitive<T extends Object,T_CONS extends Object,T_SPLITR extends Spliterator.OfPrimitive<T,T_CONS,T_SPLITR>>
-
-
Field Summary
-
Fields inherited from interface java.util.Spliterator
CONCURRENT, DISTINCT, IMMUTABLE, NONNULL, ORDERED, SIZED, SORTED, SUBSIZED
-
-
Constructor Summary
Constructors Constructor Description FragmentSeries(Collection<String> fragmentIds, SqlGraphStore store, String[] layers)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcancel()Cancels spliteration; the next call to tryAdvance will return false.intcharacteristics()longestimateSize()Counts the elements in the series, if possible.Collection<String>getFragmentIds()Getter forfragmentIds: A collection of strings that identify a graph fragment.String[]getLayers()Getter forlayers: Layers to load into the fragments.IntegergetPercentComplete()Determines how far through the serialization is.booleangetPrefixNames()Getter forprefixNames: Whether to prefix fragment names with a numeric serial number or not.booleangetRunning()Getter forrunning: Whether the task is currently running.booleangetShiftAnchors()Getter forshiftAnchors: Whether to shift all anchors in the fragment so that the start anchor has an offset of 0.0.SqlGraphStoregetStore()Getter forstore: The graph store object.booleangetTagTarget()Getter fortagTarget: Whether to add an tag identifying the target annotation or not.FragmentSeriessetFragmentIds(Collection<String> newFragmentIds)Setter forfragmentIds: A collection of strings that identify a graph fragment.FragmentSeriessetLayers(String[] newLayers)Setter forlayers: Layers to load into the fragments.FragmentSeriessetPrefixNames(boolean newPrefixNames)Setter forprefixNames: Whether to prefix fragment names with a numeric serial number or not.voidsetRunning(boolean newRunning)Setter forrunning: Whether the task is currently running.FragmentSeriessetShiftAnchors(boolean newShiftAnchors)Setter forshiftAnchors: Whether to shift all anchors in the fragment so that the start anchor has an offset of 0.0.FragmentSeriessetStore(SqlGraphStore newStore)Setter forstore: The graph store object.FragmentSeriessetTagTarget(boolean newTagTarget)Setter fortagTarget: Whether to add an tag identifying the target annotation or not.booleantryAdvance(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.Spliterator<nzilbb.ag.Graph>trySplit()-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Spliterator
forEachRemaining, getComparator, getExactSizeIfKnown, hasCharacteristics
-
-
-
-
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 forrunning: Whether the task is currently running.- Specified by:
getRunningin interfacenzilbb.util.MonitorableTask- Returns:
- Whether the task is currently running.
-
setRunning
public void setRunning(boolean newRunning)
Setter forrunning: Whether the task is currently running.- Parameters:
newRunning- Whether the task is currently running.
-
getStore
public SqlGraphStore getStore()
Getter forstore: The graph store object.- Returns:
- The graph store object.
-
setStore
public FragmentSeries setStore(SqlGraphStore newStore)
Setter forstore: The graph store object.- Parameters:
newStore- The graph store object.
-
getFragmentIds
public Collection<String> getFragmentIds()
Getter forfragmentIds: 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 forfragmentIds: 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 forlayers: Layers to load into the fragments.- Returns:
- Layers to load into the fragments.
-
setLayers
public FragmentSeries setLayers(String[] newLayers)
Setter forlayers: Layers to load into the fragments.- Parameters:
newLayers- Layers to load into the fragments.
-
getShiftAnchors
public boolean getShiftAnchors()
Getter forshiftAnchors: Whether to shift all anchors in the fragment so that the start anchor has an offset of 0.0. Default istrue.- 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 forshiftAnchors: 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 forprefixNames: 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 forprefixNames: 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 fortagTarget: 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 fortagTarget: Whether to add an tag identifying the target annotation or not.- Parameters:
newTagTarget- Whether to add an tag identifying the target annotation or not.
-
characteristics
public int characteristics()
- Specified by:
characteristicsin interfaceSpliterator<nzilbb.ag.Graph>
-
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:
tryAdvancein interfaceSpliterator<nzilbb.ag.Graph>
-
estimateSize
public long estimateSize()
Counts the elements in the series, if possible.- Specified by:
estimateSizein interfaceSpliterator<nzilbb.ag.Graph>- Returns:
- The number of elements in the series, or null if the number is unknown.
-
trySplit
public Spliterator<nzilbb.ag.Graph> trySplit()
- Specified by:
trySplitin interfaceSpliterator<nzilbb.ag.Graph>
-
getPercentComplete
public Integer getPercentComplete()
Determines how far through the serialization is.- Specified by:
getPercentCompletein interfacenzilbb.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:
cancelin interfacenzilbb.util.MonitorableTask
-
-