--- /dev/null
+/*\r
+\r
+ Derby - Class org.apache.derby.impl.sql.catalog.IndexInfoImpl\r
+\r
+ Licensed to the Apache Software Foundation (ASF) under one or more\r
+ contributor license agreements. See the NOTICE file distributed with\r
+ this work for additional information regarding copyright ownership.\r
+ The ASF licenses this file to you under the Apache License, Version 2.0\r
+ (the "License"); you may not use this file except in compliance with\r
+ the License. You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+ Unless required by applicable law or agreed to in writing, software\r
+ distributed under the License is distributed on an "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ See the License for the specific language governing permissions and\r
+ limitations under the License.\r
+\r
+ */\r
+\r
+package org.apache.derby.impl.sql.catalog;\r
+\r
+import org.apache.derby.iapi.services.sanity.SanityManager;\r
+\r
+import org.apache.derby.iapi.sql.dictionary.CatalogRowFactory;\r
+import org.apache.derby.iapi.sql.dictionary.ConglomerateDescriptor;\r
+import org.apache.derby.iapi.sql.dictionary.IndexRowGenerator;\r
+\r
+import org.apache.derby.catalog.UUID;\r
+\r
+/**\r
+* A poor mans structure used in DataDictionaryImpl.java.\r
+* Used to save information about system indexes.\r
+*\r
+*/\r
+class IndexInfoImpl\r
+{\r
+ private IndexRowGenerator irg;\r
+\r
+ private long conglomerateNumber;\r
+ \r
+ private final CatalogRowFactory crf;\r
+ private final int indexNumber;\r
+\r
+ /**\r
+ * Constructor\r
+ *\r
+ * @param indexNumber (0-based) number of index within catalog's indexes\r
+ * @param crf CatalogRowFactory for the catalog\r
+ */\r
+ IndexInfoImpl(int indexNumber, CatalogRowFactory crf)\r
+ {\r
+ this.crf = crf;\r
+ this.indexNumber = indexNumber;\r
+ this.conglomerateNumber = -1;\r
+ }\r
+\r
+ /**\r
+ * Get the conglomerate number for the index.\r
+ *\r
+ * @return long The conglomerate number for the index.\r
+ */\r
+ long getConglomerateNumber()\r
+ {\r
+ return conglomerateNumber;\r
+ }\r
+\r
+ /**\r
+ * Set the conglomerate number for the index.\r
+ *\r
+ * @param conglomerateNumber The conglomerateNumber for the index.\r
+ */\r
+ void setConglomerateNumber(long conglomerateNumber)\r
+ {\r
+ this.conglomerateNumber = conglomerateNumber;\r
+ }\r
+\r
+ /**\r
+ * Get the index name for the index.\r
+ *\r
+ * @return String The index name for the index.\r
+ */\r
+ String getIndexName()\r
+ {\r
+ return crf.getIndexName(indexNumber);\r
+ }\r
+\r
+ /**\r
+ * Get the column count for the index.\r
+ *\r
+ * @return int The column count for the index.\r
+ */\r
+ int getColumnCount()\r
+ {\r
+ return crf.getIndexColumnCount(indexNumber);\r
+ }\r
+\r
+ /**\r
+ * Get the IndexRowGenerator for this index.\r
+ *\r
+ * @return IndexRowGenerator The IRG for this index.\r
+ */\r
+ IndexRowGenerator getIndexRowGenerator()\r
+ {\r
+ return irg;\r
+ }\r
+\r
+ /**\r
+ * Set the IndexRowGenerator for this index.\r
+ *\r
+ * @param irg The IndexRowGenerator for this index.\r
+ */\r
+ void setIndexRowGenerator(IndexRowGenerator irg)\r
+ {\r
+ this.irg = irg;\r
+ }\r
+\r
+ /**\r
+ * Get the base column position for a column within a catalog\r
+ * given the (0-based) column number for the column within the index.\r
+ *\r
+ * @param colNumber The column number within the index\r
+ *\r
+ * @return int The base column position for the column.\r
+ */\r
+ int getBaseColumnPosition(int colNumber)\r
+ {\r
+ return crf.getIndexColumnPositions(indexNumber)[colNumber];\r
+ }\r
+\r
+ /**\r
+ * Return whether or not this index is declared unique\r
+ *\r
+ * @return boolean Whether or not this index is declared unique\r
+ */\r
+ boolean isIndexUnique()\r
+ {\r
+ return crf.isIndexUnique(indexNumber);\r
+ }\r
+}\r