Package nzilbb.labbcat.server.db
Class ConsolidatedGraphSeries
- java.lang.Object
-
- nzilbb.labbcat.server.db.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
-
-
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 ConsolidatedGraphSeries()
Default constructorConsolidatedGraphSeries(nzilbb.util.MonitorableSeries<nzilbb.ag.Graph> source)
Constructor from source series.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
cancel()
Cancels the task.int
characteristics()
ConsolidatedGraphSeries
copyLayer(String layerId)
Add a layer to #copyLayers.long
estimateSize()
Counts the elements in the series, if possible.Collection<String>
getCopyLayers()
Getter forcopyLayers
: List of layers to consolidate the annotations of.Integer
getPercentComplete()
Determines how far through the task is is.boolean
getRunning()
Reveals whether the task is still running or not.nzilbb.util.MonitorableSeries<nzilbb.ag.Graph>
getSource()
Getter forsource
: The source of the graphs to consolidate.ConsolidatedGraphSeries
setCopyLayers(Collection<String> newCopyLayers)
Setter forcopyLayers
: List of layers to consolidate the annotations of.ConsolidatedGraphSeries
setSource(nzilbb.util.MonitorableSeries<nzilbb.ag.Graph> newSource)
Setter forsource
: The source of the graphs to consolidate.boolean
tryAdvance(Consumer<? super nzilbb.ag.Graph> action)
If a remaining element exists, performs the given action on it, returning true; else returns false.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
-
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 forsource
: 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 forsource
: The source of the graphs to consolidate.- Parameters:
newSource
- The source of the graphs to consolidate.
-
getCopyLayers
public Collection<String> getCopyLayers()
Getter forcopyLayers
: 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 forcopyLayers
: List of layers to consolidate the annotations of.- Parameters:
newCopyLayers
- List of layers to consolidate the annotations of.
-
copyLayer
public ConsolidatedGraphSeries copyLayer(String layerId)
Add a layer to #copyLayers.- Parameters:
layerId
-- Returns:
- this
-
getPercentComplete
public Integer getPercentComplete()
Determines how far through the task is is.- Specified by:
getPercentComplete
in interfacenzilbb.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 interfacenzilbb.util.MonitorableTask
-
getRunning
public boolean getRunning()
Reveals whether the task is still running or not.- Specified by:
getRunning
in interfacenzilbb.util.MonitorableTask
- Returns:
- true if the task is currently running, false otherwise.
-
characteristics
public int characteristics()
- Specified by:
characteristics
in interfaceSpliterator<nzilbb.ag.Graph>
-
estimateSize
public long estimateSize()
Counts the elements in the series, if possible.- Specified by:
estimateSize
in 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:
trySplit
in interfaceSpliterator<nzilbb.ag.Graph>
-
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 interfaceSpliterator<nzilbb.ag.Graph>
-
-