Class FilterTable

  • All Implemented Interfaces:
    TableDataSource
    Direct Known Subclasses:
    ReferenceTable, SubsetColumnTable

    public class FilterTable
    extends Table
    A table that is a filter for another table. By default, all Table methods are implemented to call the parent. This class should be used when we want to implement a Table filter of some kind. For example, a filter for specific columns, or even rows, etc.

    NOTE: For efficiency reasons, this will store SelectableScheme objects generated by the parent like VirtualTable.

    • Field Detail

      • parent

        protected Table parent
        The Table we are filtering the columns from.
      • column_scheme

        private SelectableScheme[] column_scheme
        The schemes to describe the entity relation in the given column.
    • Constructor Detail

      • FilterTable

        public FilterTable​(Table parent)
        The Constructor.
    • Method Detail

      • getParent

        protected Table getParent()
        Returns the parent table.
      • getDatabase

        public Database getDatabase()
        Returns the parent Database object.
        Specified by:
        getDatabase in class Table
      • getColumnCount

        public int getColumnCount()
        Returns the number of columns in the table.
        Specified by:
        getColumnCount 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
      • 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
      • getSelectableSchemeFor

        SelectableScheme getSelectableSchemeFor​(int column,
                                                int original_column,
                                                Table table)
        Returns a SelectableScheme for the given column in the given VirtualTable row domain.
        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
      • getCellContents

        public TObject getCellContents​(int column,
                                       int row)
        Returns an object that represents the information in the given cell in the table. This will generally be an expensive algorithm, so calls to it should be kept to a minimum. Note that the offset between two rows is not necessarily 1.
        Specified by:
        getCellContents in interface TableDataSource
        Specified by:
        getCellContents in class Table
      • getDataTableDef

        public DataTableDef getDataTableDef()
        Returns a DataTableDef object that defines the name of the table and the layout of the columns of the table. Note that for tables that are joined with other tables, the table name and schema for this object become mangled. For example, a table called 'PERSON' joined with a table called 'MUSIC' becomes a table called 'PERSON#MUSIC' in a null schema.
        Specified by:
        getDataTableDef in interface TableDataSource
        Specified by:
        getDataTableDef in class Table
      • addDataTableListener

        void addDataTableListener​(DataTableListener listener)
        Adds a DataTableListener to the DataTable objects at the root of this table tree hierarchy. If this table represents the join of a number of tables then the DataTableListener is added to all the DataTable objects at the root.

        A DataTableListener is notified of all modifications to the raw entries of the table. This listener can be used for detecting changes in VIEWs, for triggers or for caching of common queries.

        Specified by:
        addDataTableListener in class Table
      • removeDataTableListener

        void removeDataTableListener​(DataTableListener listener)
        Removes a DataTableListener from the DataTable objects at the root of this table tree hierarchy. If this table represents the join of a number of tables, then the DataTableListener is removed from all the DataTable objects at the root.
        Specified by:
        removeDataTableListener in class Table
      • lockRoot

        public void lockRoot​(int lock_key)
        Locks the root table(s) of this table so that it is impossible to overwrite the underlying rows that may appear in this table. This is used when cells in the table need to be accessed 'outside' the lock. So we may have late access to cells in the table. 'lock_key' is a given key that will also unlock the root table(s). NOTE: This is nothing to do with the 'LockingMechanism' object.
        Specified by:
        lockRoot in class Table
      • unlockRoot

        public void unlockRoot​(int lock_key)
        Unlocks the root tables so that the underlying rows may once again be used if they are not locked and have been removed. This should be called some time after the rows have been locked.
        Specified by:
        unlockRoot in class Table
      • hasRootsLocked

        public boolean hasRootsLocked()
        Returns true if the table has its row roots locked (via the lockRoot(int) method.
        Specified by:
        hasRootsLocked in class Table
      • printGraph

        public void printGraph​(java.io.PrintStream out,
                               int indent)
        Prints a graph of the table hierarchy to the stream.
        Overrides:
        printGraph in class Table