Class TabulatedDataset
java.lang.Object
io.github.ajevans.dbcode.data.structures.TabulatedDataset
- All Implemented Interfaces:
IDataset
public class TabulatedDataset extends Object implements IDataset
Dataset containing one or more
IRecordHolder
objects, usually but
not by necessity, Table
objects.
As all IRecordHolder
objects are held as
IRecordHolder
, they'll need casting on access.
Has its own metadata, as well as any IRecordHolder
objects
having their own.
- Author:
- Andy Evans
- Version: 1.0 01 Mar 2021
-
Field Summary
Fields Modifier and Type Field Description private IMetadata
datasetMetadata
Metadata for the tabulated dataset.private int
estimatedRecordCount
Total records held - or to be held - in this dataset.private ArrayList<IRecordHolder>
recordHolders
TheIRecordHolder
objects. -
Constructor Summary
Constructors Constructor Description TabulatedDataset()
Generic constructor. -
Method Summary
Modifier and Type Method Description void
addRecordHolder(IRecordHolder table)
Add a singleIRecordHolder
to the end of the container.void
addRecordHolders(ArrayList<IRecordHolder> recordHolders)
Add a collection ofIRecordHolder
objects to the end of the container.int
getEstimatedRecordCount()
Gets the total records held - or to be held - in this dataset.IMetadata
getMetadata()
Gets the metadata for this dataset.IRecordHolder
getRecordHolder(int index)
Get a singleIRecordHolder
at an index.ArrayList<IRecordHolder>
getRecordHolders()
Get allIRecordHolder
objects.void
setEstimatedRecordCount(int estimatedRecordCount)
Sets the total records held - or to be held - in this dataset.void
setMetadata(IMetadata datasetMetadata)
Sets the metadata for this dataset.void
setRecordHolder(int index, IRecordHolder recordHolder)
Set a singleIRecordHolder
at an index.
-
Field Details
-
datasetMetadata
Metadata for the tabulated dataset. -
recordHolders
TheIRecordHolder
objects. -
estimatedRecordCount
private int estimatedRecordCountTotal records held - or to be held - in this dataset. Used for progress monitoring only.
-
-
Constructor Details
-
TabulatedDataset
public TabulatedDataset()Generic constructor.
-
-
Method Details
-
setEstimatedRecordCount
public void setEstimatedRecordCount(int estimatedRecordCount)Sets the total records held - or to be held - in this dataset.For data streaming this may be a calculation of the estimated number of records to be held rather than the actual records, hence the name.
- Specified by:
setEstimatedRecordCount
in interfaceIDataset
- Parameters:
estimatedRecordCount
- Number of records or estimate.
-
getEstimatedRecordCount
public int getEstimatedRecordCount()Gets the total records held - or to be held - in this dataset.For data streaming this may be a calculation of the estimated number of records to be held rather than the actual records, hence the name - it should only be used for processing progress estimations, not drawing on data. For the latter, use
getRecordHolders().getRecords().get(i).size()
.- Specified by:
getEstimatedRecordCount
in interfaceIDataset
- Returns:
- int Number of records or estimate.
-
setMetadata
Sets the metadata for this dataset.- Specified by:
setMetadata
in interfaceIDataset
- Parameters:
datasetMetadata
- The metadata object for this dataset.
-
getMetadata
Gets the metadata for this dataset.- Specified by:
getMetadata
in interfaceIDataset
- Returns:
- IMetadata The metadata object for this dataset.
-
setRecordHolder
Set a singleIRecordHolder
at an index.- Specified by:
setRecordHolder
in interfaceIDataset
- Parameters:
index
- Location to add RecordHolder.recordHolder
- RecordHolder to add.
-
addRecordHolder
Add a singleIRecordHolder
to the end of the container.- Specified by:
addRecordHolder
in interfaceIDataset
- Parameters:
table
- RecordHolder to add.
-
addRecordHolders
Add a collection ofIRecordHolder
objects to the end of the container.- Specified by:
addRecordHolders
in interfaceIDataset
- Parameters:
recordHolders
- Record holders to add.
-
getRecordHolder
Get a singleIRecordHolder
at an index.- Specified by:
getRecordHolder
in interfaceIDataset
- Parameters:
index
- Location of RecordHolder.- Returns:
- IRecordHolder IRecordHolder requested.
-
getRecordHolders
Get allIRecordHolder
objects.- Specified by:
getRecordHolders
in interfaceIDataset
- Returns:
- ArrayList IRecordHolder collection requested.
-