Package nzilbb.labbcat.server.db
Class ResultSeries
- java.lang.Object
-
- nzilbb.labbcat.server.db.ResultSeries
-
- All Implemented Interfaces:
Spliterator<nzilbb.ag.Graph>,nzilbb.util.MonitorableSeries<nzilbb.ag.Graph>,nzilbb.util.MonitorableTask
public class ResultSeries extends Object implements nzilbb.util.MonitorableSeries<nzilbb.ag.Graph>
An implementation of Spliterator<Graph> that enumerates fragments corresponding to a search result set.- 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 ResultSeries(long search_id, 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.voidfinalize()Finalize method called by the garbage collector.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.longgetSearchId()Getter forsearchId: result.search_id key value.SqlGraphStoregetStore()Getter forstore: The graph store object.booleangetTagTarget()Getter fortagTarget: Whether to add an tag identifying the target annotation or not.booleanhasMoreElements()Tests if this enumeration contains more elements.ResultSeriessetLayers(String[] newLayers)Setter forlayers: Layers to load into the fragments.ResultSeriessetPrefixNames(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.ResultSeriessetSearchId(long newSearchId)Setter forsearchId: result.search_id key value.ResultSeriessetStore(SqlGraphStore newStore)Setter forstore: The graph store object.ResultSeriessetTagTarget(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
-
ResultSeries
public ResultSeries(long search_id, SqlGraphStore store, String[] layers) throws SQLExceptionConstructor.- 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 ResultSeries setStore(SqlGraphStore newStore)
Setter forstore: The graph store object.- Parameters:
newStore- The graph store object.
-
getSearchId
public long getSearchId()
Getter forsearchId: result.search_id key value.- Returns:
- result.search_id key value.
-
setSearchId
public ResultSeries setSearchId(long newSearchId)
Setter forsearchId: result.search_id key value.- Parameters:
newSearchId- result.search_id key value.
-
getLayers
public String[] getLayers()
Getter forlayers: Layers to load into the fragments.- Returns:
- Layers to load into the fragments.
-
setLayers
public ResultSeries setLayers(String[] newLayers)
Setter forlayers: Layers to load into the fragments.- Parameters:
newLayers- Layers to load into the fragments.
-
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 ResultSeries 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 ResultSeries 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.
-
finalize
public void finalize()
Finalize method called by the garbage collector.This implementation ensures SQL resources are disposed of.
-
characteristics
public int characteristics()
- Specified by:
characteristicsin interfaceSpliterator<nzilbb.ag.Graph>
-
hasMoreElements
public boolean hasMoreElements()
Tests if this enumeration contains more elements.
-
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
-
-