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 Details

    • datasetMetadata

      private IMetadata datasetMetadata
      Metadata for the tabulated dataset.
    • recordHolders

      private ArrayList<IRecordHolder> recordHolders
      The IRecordHolder objects.
    • estimatedRecordCount

      private int estimatedRecordCount
      Total 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 interface IDataset
      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 interface IDataset
      Returns:
      int Number of records or estimate.
    • setMetadata

      public void setMetadata​(IMetadata datasetMetadata)
      Sets the metadata for this dataset.
      Specified by:
      setMetadata in interface IDataset
      Parameters:
      datasetMetadata - The metadata object for this dataset.
    • getMetadata

      public IMetadata getMetadata()
      Gets the metadata for this dataset.
      Specified by:
      getMetadata in interface IDataset
      Returns:
      IMetadata The metadata object for this dataset.
    • setRecordHolder

      public void setRecordHolder​(int index, IRecordHolder recordHolder)
      Set a single IRecordHolder at an index.
      Specified by:
      setRecordHolder in interface IDataset
      Parameters:
      index - Location to add RecordHolder.
      recordHolder - RecordHolder to add.
    • addRecordHolder

      public void addRecordHolder​(IRecordHolder table)
      Add a single IRecordHolder to the end of the container.
      Specified by:
      addRecordHolder in interface IDataset
      Parameters:
      table - RecordHolder to add.
    • addRecordHolders

      public void addRecordHolders​(ArrayList<IRecordHolder> recordHolders)
      Add a collection of IRecordHolder objects to the end of the container.
      Specified by:
      addRecordHolders in interface IDataset
      Parameters:
      recordHolders - Record holders to add.
    • getRecordHolder

      public IRecordHolder getRecordHolder​(int index)
      Get a single IRecordHolder at an index.
      Specified by:
      getRecordHolder in interface IDataset
      Parameters:
      index - Location of RecordHolder.
      Returns:
      IRecordHolder IRecordHolder requested.
    • getRecordHolders

      public ArrayList<IRecordHolder> getRecordHolders()
      Get all IRecordHolder objects.
      Specified by:
      getRecordHolders in interface IDataset
      Returns:
      ArrayList IRecordHolder collection requested.