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 IMetadatadatasetMetadataMetadata for the tabulated dataset.private intestimatedRecordCountTotal records held - or to be held - in this dataset.private ArrayList<IRecordHolder>recordHoldersTheIRecordHolderobjects. -
Constructor Summary
Constructors Constructor Description TabulatedDataset()Generic constructor. -
Method Summary
Modifier and Type Method Description voidaddRecordHolder(IRecordHolder table)Add a singleIRecordHolderto the end of the container.voidaddRecordHolders(ArrayList<IRecordHolder> recordHolders)Add a collection ofIRecordHolderobjects to the end of the container.intgetEstimatedRecordCount()Gets the total records held - or to be held - in this dataset.IMetadatagetMetadata()Gets the metadata for this dataset.IRecordHoldergetRecordHolder(int index)Get a singleIRecordHolderat an index.ArrayList<IRecordHolder>getRecordHolders()Get allIRecordHolderobjects.voidsetEstimatedRecordCount(int estimatedRecordCount)Sets the total records held - or to be held - in this dataset.voidsetMetadata(IMetadata datasetMetadata)Sets the metadata for this dataset.voidsetRecordHolder(int index, IRecordHolder recordHolder)Set a singleIRecordHolderat an index.
-
Field Details
-
datasetMetadata
Metadata for the tabulated dataset. -
recordHolders
TheIRecordHolderobjects. -
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:
setEstimatedRecordCountin 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:
getEstimatedRecordCountin interfaceIDataset- Returns:
- int Number of records or estimate.
-
setMetadata
Sets the metadata for this dataset.- Specified by:
setMetadatain interfaceIDataset- Parameters:
datasetMetadata- The metadata object for this dataset.
-
getMetadata
Gets the metadata for this dataset.- Specified by:
getMetadatain interfaceIDataset- Returns:
- IMetadata The metadata object for this dataset.
-
setRecordHolder
Set a singleIRecordHolderat an index.- Specified by:
setRecordHolderin interfaceIDataset- Parameters:
index- Location to add RecordHolder.recordHolder- RecordHolder to add.
-
addRecordHolder
Add a singleIRecordHolderto the end of the container.- Specified by:
addRecordHolderin interfaceIDataset- Parameters:
table- RecordHolder to add.
-
addRecordHolders
Add a collection ofIRecordHolderobjects to the end of the container.- Specified by:
addRecordHoldersin interfaceIDataset- Parameters:
recordHolders- Record holders to add.
-
getRecordHolder
Get a singleIRecordHolderat an index.- Specified by:
getRecordHolderin interfaceIDataset- Parameters:
index- Location of RecordHolder.- Returns:
- IRecordHolder IRecordHolder requested.
-
getRecordHolders
Get allIRecordHolderobjects.- Specified by:
getRecordHoldersin interfaceIDataset- Returns:
- ArrayList IRecordHolder collection requested.
-