1 6 package com.daffodilwoods.daffodildb.server.datadictionarysystem; 7 import com.daffodilwoods.daffodildb.server.datasystem.indexsystem._IndexInformation; 8 import com.daffodilwoods.database.resource.*; 9 import com.daffodilwoods.database.general.*; 10 import java.util.ArrayList ; 11 import com.daffodilwoods.daffodildb.server.sql99.utils._Reference; 12 13 public class IndexInformation implements _IndexInformation{ 14 public QualifiedIdentifier sourceTableName; 15 public String indexName; 16 public String indexTableName; 17 public String [] indexColumnName; 18 public int[] indexColumnIndexes; 19 public boolean[] orderType; 20 public long rootClusterAddress; 21 public int rootClusterSize; 22 public int rootClusterRecordNumber; 23 public int numberOfRecords; 24 public String indexColumns; 25 public String orderTypeColumn; 26 public boolean fixedVariable; 27 public boolean isUpdate; 28 public boolean is_system_generated; 29 public boolean is_default = false; 30 33 34 public IndexInformation(QualifiedIdentifier sourceTableName,String indexName,String indexTableName, 35 String [] indexColumnName,int[] indexColumnIndexes,boolean[] orderType,long rootClusterAddress,int rootClusterSize, 36 int rootClusterRecordNumber,int numberOfRecords,boolean fixedVariable,boolean isSystemGenerated) 37 { 38 this.sourceTableName = sourceTableName; 39 this.indexName = indexName; 40 this.indexTableName = indexTableName; 41 this.indexColumnName = indexColumnName; 42 this.rootClusterAddress = rootClusterAddress; 43 this.rootClusterSize = rootClusterSize; 44 this.rootClusterRecordNumber = rootClusterRecordNumber; 45 this.numberOfRecords = numberOfRecords; 46 this.fixedVariable = fixedVariable; 47 this.orderType = orderType; 48 indexColumns = ""; 49 orderTypeColumn = ""; 50 this.indexColumnIndexes = indexColumnIndexes; 51 is_system_generated = isSystemGenerated; 52 61 62 if( indexColumnName != null ){ 63 StringBuffer st = new StringBuffer (50); 64 st.append(indexColumnName[0]); 65 for(int i=1;i<indexColumnName.length;i++){ 66 st.append(',');st.append(indexColumnName[i]); 67 } 68 indexColumns = st.toString(); 69 } 70 if( orderType != null ){ 71 StringBuffer st = new StringBuffer (50); 72 st.append(orderType[0]); 73 for (int i = 1; i < orderType.length; i++) { 74 st.append(',');st.append(orderType[i]); 75 } 76 orderTypeColumn = st.toString(); 77 } 78 } 79 80 public String [] getColumns() throws DException { 81 return indexColumnName; 82 } 83 84 public boolean[] getOrderOfColumns() throws DException { 85 return orderType; 86 } 87 88 public int[] getColumnIndexes() throws DException { 89 return indexColumnIndexes; 90 } 91 92 public boolean isVariableColumn() throws DException { 93 return fixedVariable; 94 } 95 96 97 public QualifiedIdentifier getQualifiedIdentifier() throws DException { 98 return new QualifiedIdentifier(null,null,indexName); 99 } 100 101 public QualifiedIdentifier getIndexTableName() throws DException { 102 return new QualifiedIdentifier (sourceTableName.catalog,sourceTableName.schema,indexTableName); 103 } 104 public Object [][] getColumnInformation() throws DException{ 105 ArrayList indexStructure = new ArrayList (); 106 for(int i =0 ; i < indexColumnName.length; i++){ 107 Object [] structure = null; 108 try { 109 structure = new Object [] {indexColumnName[i], new Boolean (orderType[i]), new Integer (indexColumnIndexes[i]), new Integer (i)}; 110 } catch (ArrayIndexOutOfBoundsException ex) { 111 throw ex; 112 } 113 indexStructure.add(structure); 114 } 115 return (Object [][])indexStructure.toArray(new Object [0][]); 116 } 117 118 public String getIndexName() throws DException { 119 return indexName; 120 } 121 public int getSize() throws DException { 122 return 0; 123 } 124 public long getRootClusterAddress() throws DException { 125 return rootClusterAddress; 126 } 127 public int getRootClusterSize() throws DException { 128 129 throw new java.lang.UnsupportedOperationException ("Method getRootClusterSize() not yet implemented."); 130 } 131 public short getRootClusterRecordNumber() throws DException { 132 133 throw new java.lang.UnsupportedOperationException ("Method getRootClusterRecordNumber() not yet implemented."); 134 } 135 public int getNumberOfRecords() throws DException { 136 137 throw new java.lang.UnsupportedOperationException ("Method getNumberOfRecords() not yet implemented."); 138 } 139 public void setControlClusterAddress(int parm1) throws DException { 140 rootClusterAddress = parm1; 141 } 142 public void setRootClusterSize(int parm1) throws DException { 143 144 throw new java.lang.UnsupportedOperationException ("Method setRootClusterSize() not yet implemented."); 145 } 146 public void setRootClusterRecordNumber(int parm1) throws DException { 147 148 throw new java.lang.UnsupportedOperationException ("Method setRootClusterRecordNumber() not yet implemented."); 149 } 150 public void setNumberOfRecords(int parm1) throws DException { 151 152 throw new java.lang.UnsupportedOperationException ("Method setNumberOfRecords() not yet implemented."); 153 } 154 public boolean isDefault() { 155 156 return is_default; 157 } 158 159 public void update() throws DException { 160 if(!isUpdate){ 161 int size = indexColumnName.length; 162 int len = indexColumnName.length + 1; 163 String [] names = new String [len]; 164 int [] indexes = new int[len]; 165 boolean [] types = new boolean[len]; 166 System.arraycopy(indexColumnName,0,names,0,size); 167 System.arraycopy(indexColumnIndexes,0,indexes,0,size); 168 System.arraycopy(orderType,0,types,0,size); 169 names[size] = SystemFields.systemFields[SystemFields.rowId]; 170 indexes[size] = SystemFields.rowId; 171 types[size] = true; 172 indexColumnName = names; 173 indexColumnIndexes = indexes; 174 orderType = types; 175 isUpdate = true; 176 } 177 } 178 179 public int getControlClusterAddress() throws DException { 180 return (int)rootClusterAddress; 181 } 182 183 public boolean isSystemGenerated(){ 184 return is_system_generated; 185 } 186 187 public boolean isUpdated(){ 188 return isUpdate; 189 } 190 191 public void setColumnNames(String [] columnNames) throws DException{ 192 indexColumnName = columnNames; 193 } 194 public void setColumnIndexes(int[] columnIndexes) throws DException{ 195 indexColumnIndexes = columnIndexes; 196 } 197 public void setOrderOfColumns(boolean[] orderOfColumns) throws DException{ 198 orderType = orderOfColumns; 199 } 200 public void setIsUpdatedFlag(boolean isUpdated0) throws DException{ 201 isUpdate = isUpdated0; 202 } 203 204 public void setDefault(){ 205 is_default = true; 206 } 207 } 208 | Popular Tags |