Interface DataStore
-
- All Known Implementing Classes:
SimpleDataStoreFactory
,StepDataStore
public interface DataStore
Contains all the actual data required for a plot. To extract usable data for a plot, a suitableDataSpec
object is also required.Because instances of this class manage the data, by keeping track of the
DataStore
s in an application you can control where the memory is used. All the other objects connected with a plot, for instance thePlotLayer
s andDataSpec
s, are cheap to produce and have small memory footprints, so can be created and destroyed as required. As a rule therefore, DataStore objects should be managed by a single class, and references not kept to them by any other potentially long-lived objects.This class also contains a TupleRunner, which manages how TupleSequences acquired from it are used. Although the TupleRunner is not part of the stored data, it is always used in the same places as a DataStore, so it is convenient to carry it around in the same object.
Obtain an instance of this class from a
DataStoreFactory
.- Since:
- 6 Feb 2013
- Author:
- Mark Taylor
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description TupleRunner
getTupleRunner()
Returns an object that manages iteration over tuples.TupleSequence
getTupleSequence(DataSpec spec)
Returns the data described by a given DataSpec as a sequence of tuples.boolean
hasData(DataSpec spec)
Indicates whether this store has the data described by a given DataSpec.
-
-
-
Method Detail
-
hasData
boolean hasData(DataSpec spec)
Indicates whether this store has the data described by a given DataSpec.- Parameters:
spec
- plot data specification object
-
getTupleSequence
TupleSequence getTupleSequence(DataSpec spec)
Returns the data described by a given DataSpec as a sequence of tuples. Must only be called ifhasData(uk.ac.starlink.ttools.plot2.data.DataSpec)
returns true for the given DataSpec; if not, behaviour is undefined.- Parameters:
spec
- plot data specification object- Returns:
- sequence of values which can be used to perform a plot
-
getTupleRunner
TupleRunner getTupleRunner()
Returns an object that manages iteration over tuples. Where possible, the returned TupleRunner should be used for iteration when using this DataStore, since it contains the chosen policy for parallel execution. If only sequential processing is supported however, TupleSequences acquired from this store can be used directly.- Returns:
- tuple runner
-
-