# Class CountDataStore

java.lang.Object
uk.ac.starlink.topcat.plot2.CountDataStore

All Implemented Interfaces:
  `uk.ac.starlink.ttools.plot2.data.DataStore`

public class CountDataStore extends Object implements uk.ac.starlink.ttools.plot2.data.DataStore
Wrapper data store implementation used only for counting the number of tuples requested from it.

The intention is that an operation involving data access can be run using this data store to find out how many tuples in total would be read by the operation. In order to run quickly however, this implementation does not supply all those rows, it truncates the number of tuples dispensed per sequence to a given (small) number. When the operation is complete, the `getTupleCount()` method can be called.

Since:
  15 Nov 2013
Author:
  Mark Taylor

## Constructor Summary

Constructors
Constructor
Description
`CountDataStore(uk.ac.starlink.ttools.plot2.data.DataStore base, int maxCount)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`long`
`getTupleCount()`
Returns the total number of tuples represented by the tuple sequences dispensed by this data store since construction time.
`uk.ac.starlink.ttools.plot2.data.TupleRunner`
`getTupleRunner()`
`uk.ac.starlink.ttools.plot2.data.TupleSequence`
`getTupleSequence(uk.ac.starlink.ttools.plot2.data.DataSpec spec)`
`boolean`
`hasData(uk.ac.starlink.ttools.plot2.data.DataSpec spec)`

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### CountDataStore

public CountDataStore(uk.ac.starlink.ttools.plot2.data.DataStore base, int maxCount)
Constructor.

Parameters:
  `base` - base data store to which most operations are delegated
  `maxCount` - maximum number of tuples actually dispensed from tuplesequences acquired from this store

## Method Details

### hasData

public boolean hasData(uk.ac.starlink.ttools.plot2.data.DataSpec spec)

Specified by:
  `hasData` in interface `uk.ac.starlink.ttools.plot2.data.DataStore`

### getTupleSequence

public uk.ac.starlink.ttools.plot2.data.TupleSequence getTupleSequence(uk.ac.starlink.ttools.plot2.data.DataSpec spec)

Specified by:
  `getTupleSequence` in interface `uk.ac.starlink.ttools.plot2.data.DataStore`

### getTupleRunner

public uk.ac.starlink.ttools.plot2.data.TupleRunner getTupleRunner()

Specified by:
  `getTupleRunner` in interface `uk.ac.starlink.ttools.plot2.data.DataStore`

### getTupleCount

public long getTupleCount()
Returns the total number of tuples represented by the tuple sequences dispensed by this data store since construction time.

Returns:
  total tuple count for non-truncated tuple sequences dispensed to date, or -1 if not known