Documentation of 'org.hsqldb.index.IndexAVL' Java class
IndexAVL
org.hsqldb.index

Class IndexAVL

  • All Implemented Interfaces:
    Index, SchemaObject
    Direct Known Subclasses:
    IndexAVLMemory


    public class IndexAVL
    extends java.lang.Object
    implements Index
    Implementation of an AVL tree with parent pointers in nodes. Subclasses of Node implement the tree node objects for memory or disk storage. An Index has a root Node that is linked with other nodes using Java Object references or file pointers, depending on Node implementation.

    An Index object also holds information on table columns (in the form of int indexes) that are covered by it.

    New class derived from Hypersonic SQL code and enhanced in HSQLDB.

    Since:
    Hypersonic SQL
    • Constructor Detail

      • IndexAVL

        public IndexAVL(HsqlNameManager.HsqlName name,
                        long id,
                        TableBase table,
                        int[] columns,
                        boolean[] descending,
                        boolean[] nullsLast,
                        Type[] colTypes,
                        boolean pk,
                        boolean unique,
                        boolean constraint,
                        boolean forward)
        Constructor declaration
        Parameters:
        name - HsqlName of the index
        id - persistnece id
        table - table of the index
        columns - array of column indexes
        descending - boolean[]
        nullsLast - boolean[]
        colTypes - array of column types
        pk - if index is for a primary key
        unique - is this a unique index
        constraint - does this index belonging to a constraint
        forward - is this an auto-index for an FK that refers to a table defined after this table
    • Method Detail

      • getSQL

        public java.lang.String getSQL()
        Specified by:
        getSQL in interface SchemaObject
      • getPosition

        public int getPosition()
        Specified by:
        getPosition in interface Index
      • setPosition

        public void setPosition(int position)
        Specified by:
        setPosition in interface Index
      • getColumnCount

        public int getColumnCount()
        Returns the count of visible columns used
        Specified by:
        getColumnCount in interface Index
      • isUnique

        public boolean isUnique()
        Is this a UNIQUE index?
        Specified by:
        isUnique in interface Index
      • isConstraint

        public boolean isConstraint()
        Does this index belong to a constraint?
        Specified by:
        isConstraint in interface Index
      • getColumns

        public int[] getColumns()
        Returns the array containing column indexes for index
        Specified by:
        getColumns in interface Index
      • getColumnTypes

        public Type[] getColumnTypes()
        Returns the array containing column indexes for index
        Specified by:
        getColumnTypes in interface Index
      • getColumnDesc

        public boolean[] getColumnDesc()
        Description copied from interface: Index
        Returns the count of visible columns used
        Specified by:
        getColumnDesc in interface Index
      • getDefaultColumnMap

        public int[] getDefaultColumnMap()
        Description copied from interface: Index
        Returns the array containing 0, 1, .. column indexes
        Specified by:
        getDefaultColumnMap in interface Index
      • getIndexOrderValue

        public int getIndexOrderValue()
        Returns a value indicating the order of different types of index in the list of indexes for a table. The position of the groups of Indexes in the list in ascending order is as follows: primary key index unique constraint indexes autogenerated foreign key indexes for FK's that reference this table or tables created before this table user created indexes (CREATE INDEX) autogenerated foreign key indexes for FK's that reference tables created after this table Among a group of indexes, the order is based on the order of creation of the index.
        Specified by:
        getIndexOrderValue in interface Index
        Returns:
        ordinal value
      • isForward

        public boolean isForward()
        Specified by:
        isForward in interface Index
      • setClustered

        public void setClustered(boolean clustered)
        Specified by:
        setClustered in interface Index
      • isClustered

        public boolean isClustered()
        Specified by:
        isClustered in interface Index
      • unlinkNodes

        public void unlinkNodes(NodeAVL primaryRoot)
        Removes all links between memory nodes
      • compareRowNonUnique

        public int compareRowNonUnique(Session session,
                                       java.lang.Object[] a,
                                       java.lang.Object[] b,
                                       int[] rowColMap)
        Compares two table rows based on the columns of this index. The rowColMap parameter specifies which columns of the other table are to be compared with the colIndex columns of this index. The rowColMap can cover all or only some columns of this index.
        Specified by:
        compareRowNonUnique in interface Index
        Parameters:
        session - Session
        a - row from another table
        rowColMap - column indexes in the other table
        b - a full row in this table
        Returns:
        comparison result, -1,0,+1
      • compareRowNonUnique

        public int compareRowNonUnique(Session session,
                                       java.lang.Object[] a,
                                       java.lang.Object[] b,
                                       int[] rowColMap,
                                       int fieldCount)
        Specified by:
        compareRowNonUnique in interface Index
      • compareRowNonUnique

        public int compareRowNonUnique(Session session,
                                       java.lang.Object[] a,
                                       java.lang.Object[] b,
                                       int fieldCount)
        As above but use the index column data
        Specified by:
        compareRowNonUnique in interface Index
      • compareRowForChange

        public void compareRowForChange(Session session,
                                        java.lang.Object[] a,
                                        java.lang.Object[] b,
                                        double[] changes)
      • compareRow

        public int compareRow(Session session,
                              java.lang.Object[] a,
                              java.lang.Object[] b)
        Specified by:
        compareRow in interface Index
      • findFirstRow

        public RowIterator findFirstRow(Session session,
                                        PersistentStore store,
                                        java.lang.Object[] rowdata,
                                        int matchCount,
                                        int distinctCount,
                                        int compareType,
                                        boolean reversed,
                                        boolean[] map)
        Return the first node equal to the indexdata object. The rowdata has the same column mapping as this index.
        Specified by:
        findFirstRow in interface Index
        Parameters:
        session - session object
        store - store object
        rowdata - array containing index column data
        matchCount - count of columns to match
        compareType - int
        reversed - boolean
        map - boolean[]
        Returns:
        iterator
      • findFirstRow

        public RowIterator findFirstRow(Session session,
                                        PersistentStore store,
                                        java.lang.Object[] rowdata)
        Return the first node equal to the rowdata object. The rowdata has the same column mapping as this table.
        Specified by:
        findFirstRow in interface Index
        Parameters:
        session - session object
        store - store object
        rowdata - array containing table row data
        Returns:
        iterator
      • findFirstRow

        public RowIterator findFirstRow(Session session,
                                        PersistentStore store,
                                        java.lang.Object[] rowdata,
                                        int[] rowColMap)
        Return the first node equal to the rowdata object. The rowdata has the column mapping provided in rowColMap.
        Specified by:
        findFirstRow in interface Index
        Parameters:
        session - session object
        store - store object
        rowdata - array containing table row data
        rowColMap - int[]
        Returns:
        iterator

DataMelt 3.0 © DataMelt by jWork.ORG

Ads help maintain this website.