Package uk.ac.starlink.ttools.plot2.data
Class SimpleDataStoreFactory
- java.lang.Object
-
- uk.ac.starlink.ttools.plot2.data.SimpleDataStoreFactory
-
- All Implemented Interfaces:
DataStore
,DataStoreFactory
public class SimpleDataStoreFactory extends java.lang.Object implements DataStoreFactory, DataStore
DataStoreFactory implementation that does no caching. It reads the data as required every time. This has low memory requirements. It may also be faster to use for one-pass plots, but probably not if the same column is used for multiple purposes.- Since:
- 11 Feb 2013
- Author:
- Mark Taylor
-
-
Constructor Summary
Constructors Constructor Description SimpleDataStoreFactory(TupleRunner runner)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete 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.static uk.ac.starlink.table.DomainMapper[]
getUserCoordMappers(DataSpec dataSpec, int icoord)
Utility method to work out the domain mappers for a given coordinate of a DataSpec.boolean
hasData(DataSpec spec)
Indicates whether this store has the data described by a given DataSpec.DataStore
readDataStore(DataSpec[] specs, DataStore prevStore)
Executes instantly and returns this object.
-
-
-
Constructor Detail
-
SimpleDataStoreFactory
public SimpleDataStoreFactory(TupleRunner runner)
Constructor.- Parameters:
runner
- tuple runner dispensed with DataStores
-
-
Method Detail
-
hasData
public boolean hasData(DataSpec spec)
Description copied from interface:DataStore
Indicates whether this store has the data described by a given DataSpec.
-
readDataStore
public DataStore readDataStore(DataSpec[] specs, DataStore prevStore)
Executes instantly and returns this object.- Specified by:
readDataStore
in interfaceDataStoreFactory
- Parameters:
specs
- data specifications; some elements may be nullprevStore
- previously obtained DataStore, or null- Returns:
- new data store
-
getTupleSequence
public TupleSequence getTupleSequence(DataSpec spec)
Description copied from interface:DataStore
Returns the data described by a given DataSpec as a sequence of tuples. Must only be called ifDataStore.hasData(uk.ac.starlink.ttools.plot2.data.DataSpec)
returns true for the given DataSpec; if not, behaviour is undefined.- Specified by:
getTupleSequence
in interfaceDataStore
- Parameters:
spec
- plot data specification object- Returns:
- sequence of values which can be used to perform a plot
-
getTupleRunner
public TupleRunner getTupleRunner()
Description copied from interface:DataStore
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.- Specified by:
getTupleRunner
in interfaceDataStore
- Returns:
- tuple runner
-
getUserCoordMappers
public static uk.ac.starlink.table.DomainMapper[] getUserCoordMappers(DataSpec dataSpec, int icoord)
Utility method to work out the domain mappers for a given coordinate of a DataSpec. For the requested coord, it returns a mapper array with elements filled, in with any mapper known for the given input coordinates that has the sub-type appropriate for that coordinate.- Parameters:
dataSpec
- data specification objecticoord
- index of coordinate indataSpec
- Returns:
- mapper array for decoding values of one coordinate of a data spec
-
-