KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derby > catalog > IndexDescriptor


1 /*
2
3    Derby - Class org.apache.derby.catalog.IndexDescriptor
4
5    Licensed to the Apache Software Foundation (ASF) under one or more
6    contributor license agreements. See the NOTICE file distributed with
7    this work for additional information regarding copyright ownership.
8    The ASF licenses this file to You under the Apache License, Version 2.0
9    (the "License"); you may not use this file except in compliance with
10    the License. You may obtain a copy of the License at
11
12       http://www.apache.org/licenses/LICENSE-2.0
13
14    Unless required by applicable law or agreed to in writing, software
15    distributed under the License is distributed on an "AS IS" BASIS,
16    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17    See the License for the specific language governing permissions and
18    limitations under the License.
19
20  */

21
22 package org.apache.derby.catalog;
23
24 /**
25  *
26  * This interface describes an index.
27  *
28  * It is used in the column SYS.SYSCONGLOMERATES.DESCRIPTOR
29  * and describes everything about an index except the index name and
30  * the table on which the index is defined.
31  * That information is available
32  * in the columns NAME and TABLEID of the table SYS.SYSCONGLOMERATES.
33  */

34 public interface IndexDescriptor
35 {
36     /**
37      * Returns true if the index is unique.
38      */

39     boolean isUnique();
40
41     /**
42      * Returns an array of column positions in the base table. Each index
43      * column corresponds to a column position in the base table, except
44      * the column representing the location of the row in the base table.
45      * The returned array holds the column positions in the
46      * base table, so, if entry 2 is the number 4, the second
47      * column in the index is the fourth column in the table.
48      */

49     public int[] baseColumnPositions();
50
51     /**
52      * Returns the postion of a column.
53      * <p>
54      * Returns the position of a column within the key (1-based).
55      * 0 means that the column is not in the key.
56      */

57     public Integer JavaDoc getKeyColumnPosition(Integer JavaDoc heapColumnPosition);
58
59     /**
60      * Returns the postion of a column.
61      * <p>
62      * Returns the position of a column within the key (1-based).
63      * 0 means that the column is not in the key. Same as the above
64      * method, but it uses int instead of Integer.
65      */

66     public int getKeyColumnPosition(int heapColumnPosition);
67
68     /**
69      * Returns the number of ordered columns.
70      * <p>
71      * In the future, it will be
72      * possible to store non-ordered columns in an index. These will be
73      * useful for covered queries. The ordered columns will be at the
74      * beginning of the index row, and they will be followed by the
75      * non-ordered columns.
76      *
77      * For now, all columns in an index must be ordered.
78      */

79     int numberOfOrderedColumns();
80
81     /**
82      * Returns the type of the index. For now, we only support B-Trees,
83      * so the value "BTREE" is returned.
84      */

85     String JavaDoc indexType();
86
87     /**
88      * Returns array of boolean telling asc/desc info for each index
89      * key column for convenience of using together with baseColumnPositions
90      * method. Both methods return an array with subscript starting from 0.
91      */

92     public boolean[] isAscending();
93
94     /**
95      * Returns true if the specified column is ascending in the index
96      * (1-based).
97      */

98     boolean isAscending(Integer JavaDoc keyColumnPosition);
99
100     /**
101      * Returns true if the specified column is descending in the index
102      * (1-based). In the current release, only ascending columns are
103      * supported.
104      */

105     boolean isDescending(Integer JavaDoc keyColumnPosition);
106
107     /**
108      * set the baseColumnPositions field of the index descriptor. This
109      * is for updating the field in operations such as "alter table drop
110      * column" where baseColumnPositions is changed.
111      */

112     public void setBaseColumnPositions(int[] baseColumnPositions);
113
114     /**
115      * set the isAscending field of the index descriptor. This
116      * is for updating the field in operations such as "alter table drop
117      * column" where isAscending is changed.
118      */

119     public void setIsAscending(boolean[] isAscending);
120
121     /**
122      * set the numberOfOrderedColumns field of the index descriptor. This
123      * is for updating the field in operations such as "alter table drop
124      * column" where numberOfOrderedColumns is changed.
125      */

126     public void setNumberOfOrderedColumns(int numberOfOrderedColumns);
127 }
128
Popular Tags