Class DefaultDataTable

  • All Implemented Interfaces:
    RootTable, TableDataSource
    Direct Known Subclasses:
    DataTable, FunctionTable, TemporaryTable

    public abstract class DefaultDataTable
    extends AbstractDataTable
    This represents a default implementation of a DataTable. It encapsulates information that is core to all DataTable objects. That is,

    The table name, The description of the table fields, A set of SelectableScheme objects to describe row relations, A counter for the number of rows in the table.

    There are two classes that extend this object. DataTable which is a DataTable that is a direct mapping to an internal table stored in the Database files. And TemporaryTable that contains information generated on the fly by the DBMS.

    • Field Detail

      • database

        private Database database
        The Database object that this table is a child of.
      • row_count

        protected int row_count
        The number of rows in the table.
      • column_scheme

        private SelectableScheme[] column_scheme
        A list of schemes for managing the data relations of each column.
    • Constructor Detail

      • DefaultDataTable

        DefaultDataTable​(Database database)
        The Constructor.
    • Method Detail

      • getDatabase

        public Database getDatabase()
        Returns the Database object this table is part of.
        Specified by:
        getDatabase in class Table
      • getRootColumnScheme

        protected SelectableScheme getRootColumnScheme​(int column)
        Returns the SelectableScheme for the given column. This is different from 'getColumnScheme(int column)' because this is designed to be overridden so derived classes can manage their own SelectableScheme sources.
      • clearColumnScheme

        protected void clearColumnScheme​(int column)
        Clears the SelectableScheme information for the given column.
      • blankSelectableSchemes

        protected void blankSelectableSchemes()
        Blanks all the column schemes in the table to an initial state. This will make all schemes of type InsertSearch.

        NOTE: The current default SelectableScheme type is InsertSearch. We may want to make this variable.

      • blankSelectableSchemes

        protected void blankSelectableSchemes​(int type)
        Blanks all the column schemes in this table to a specific type of scheme. If Type = 0 then InsertSearch (fast but takes up memory - requires each insert and delete from the table to be logged). If type = 1 then BlindSearch (slower but uses no memory and doesn't require insert and delete to be logged).
      • getColumnCount

        public int getColumnCount()
        Returns the number of columns in the table.
        Specified by:
        getColumnCount in class Table
      • getResolvedVariable

        public Variable getResolvedVariable​(int column)
        Returns a fully qualified Variable object that represents the name of the column at the given index. For example, new Variable(new TableName("APP", "CUSTOMER"), "ID")
        Specified by:
        getResolvedVariable in class Table
      • findFieldName

        public int findFieldName​(Variable v)
        Given a fully qualified variable field name, ie. 'APP.CUSTOMER.CUSTOMERID' this will return the column number the field is at. Returns -1 if the field does not exist in the table.
        Specified by:
        findFieldName in class Table
      • getSelectableSchemeFor

        SelectableScheme getSelectableSchemeFor​(int column,
                                                int original_column,
                                                Table table)
        Returns a SelectableScheme object for the given column of the VirtualTable. The Table parameter specifies the domain in which the scheme should be given. If table != this, we can safely assume it is a VirtualTable.
        Specified by:
        getSelectableSchemeFor in class Table
      • setToRowTableDomain

        void setToRowTableDomain​(int column,
                                 IntegerVector row_set,
                                 TableDataSource ancestor)
        Given a set, this trickles down through the Table hierarchy resolving the given row_set to a form that the given ancestor understands. Say you give the set { 0, 1, 2, 3, 4, 5, 6 }, this function may check down three levels and return a new 7 element set with the rows fully resolved to the given ancestors domain.
        Specified by:
        setToRowTableDomain in class Table
      • resolveToRawTable

        RawTableInformation resolveToRawTable​(RawTableInformation info)
        Return the list of DataTable and row sets that make up the raw information in this table. For a DataTable itselt, this is trivial. NOTE: Using this method is extremely inefficient, and should never be used. It is included only to complete feature set. IDEA: Put a warning to check if this method is ever used.
        Specified by:
        resolveToRawTable in class Table
      • addCellToColumnSchemes

        void addCellToColumnSchemes​(int row_number,
                                    int column_number)
        Adds a single column of a row to the selectable scheme indexing.
      • addRowToColumnSchemes

        void addRowToColumnSchemes​(int row_number)
        This is called when a row is in the table, and the SelectableScheme objects for each column need to be notified of the rows existance, therefore build up the relational model for the columns.
      • removeRowToColumnSchemes

        void removeRowToColumnSchemes​(int row_number)
        This is called when an index to a row needs to be removed from the SelectableScheme objects. This occurs when we have a modification log of row removals that haven't actually happened to old backed up scheme.