Package uk.ac.starlink.topcat.plot2
Class GuiDataStore
- java.lang.Object
-
- uk.ac.starlink.topcat.plot2.GuiDataStore
-
- All Implemented Interfaces:
uk.ac.starlink.ttools.plot2.data.DataStore
public class GuiDataStore extends java.lang.Object implements uk.ac.starlink.ttools.plot2.data.DataStore
DataStore wrapper implementation suitable for use from a GUI application. This wrapper does two things.First, it checks for thread interruptions regularly, and stops dispensing tuples from the data store if in case of interruption. The thread interruption status is undisturbed, and clients should in general check the interuption status of the thread following use of an instance of this class.
Second, it optionally updates a progress bar as tuples are read. For this to work, it needs to know up front (at least a guess for) how many tuples will be read in total over the lifetime of the store.
- Since:
- 15 Nov 2013
- Author:
- Mark Taylor
-
-
Constructor Summary
Constructors Constructor Description GuiDataStore(uk.ac.starlink.ttools.plot2.data.DataStore base)
Constructs a data store that checks for interruptions.GuiDataStore(uk.ac.starlink.ttools.plot2.data.DataStore base, javax.swing.BoundedRangeModel progModel, long tupleCount)
Constructs a data store that checks for interruptions and optionally reports progress.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description uk.ac.starlink.ttools.plot2.data.TupleSequence
getTupleSequence(uk.ac.starlink.ttools.plot2.data.DataSpec dataSpec)
boolean
hasData(uk.ac.starlink.ttools.plot2.data.DataSpec dataSpec)
-
-
-
Constructor Detail
-
GuiDataStore
public GuiDataStore(uk.ac.starlink.ttools.plot2.data.DataStore base)
Constructs a data store that checks for interruptions.- Parameters:
base
- data store to which most behaviour will be delegated
-
GuiDataStore
public GuiDataStore(uk.ac.starlink.ttools.plot2.data.DataStore base, javax.swing.BoundedRangeModel progModel, long tupleCount)
Constructs a data store that checks for interruptions and optionally reports progress. IfprogBar
is null ortupleCount
is negative, there will be no progress updating, but the interruption handling will still take place.- Parameters:
base
- base data store to which most behaviour is delegatedprogModel
- progress bar model, or nulltupleCount
- total number of tuples expected to be read during the life of this data store; -1 may be supplied if not known
-
-
Method Detail
-
hasData
public boolean hasData(uk.ac.starlink.ttools.plot2.data.DataSpec dataSpec)
- Specified by:
hasData
in interfaceuk.ac.starlink.ttools.plot2.data.DataStore
-
getTupleSequence
public uk.ac.starlink.ttools.plot2.data.TupleSequence getTupleSequence(uk.ac.starlink.ttools.plot2.data.DataSpec dataSpec)
- Specified by:
getTupleSequence
in interfaceuk.ac.starlink.ttools.plot2.data.DataStore
-
-