1 package com.daffodilwoods.daffodildb.server.datasystem.indexsystem; 2 3 import com.daffodilwoods.database.resource.*; 4 import com.daffodilwoods.database.general.QualifiedIdentifier; 5 import java.util.ArrayList ; 6 import com.daffodilwoods.daffodildb.server.datasystem.interfaces._TableCharacteristics; 7 import com.daffodilwoods.daffodildb.server.datasystem.persistentsystem.versioninfo.VersionHandler; 8 import com.daffodilwoods.daffodildb.server.datasystem.interfaces.Utility; 9 10 16 17 public class IndexInformations implements _IndexInformation{ 18 19 22 private QualifiedIdentifier sourceTableName; 23 24 27 private String indexName; 28 29 32 private QualifiedIdentifier indexTableName; 33 34 37 private String [] indexColumnNames; 38 39 42 private int[] indexColumnIndexes; 43 44 47 private boolean[] orderType; 48 49 52 public int rootClusterAddress; 53 54 57 private int rootClusterSize; 58 59 63 64 67 private int numberOfRecords; 68 69 72 73 private boolean isVariable; 74 private boolean isDefault; 75 76 77 78 79 public IndexInformations(QualifiedIdentifier sourceTableName0,String indexName0 80 ,int controlClusterAddress0, boolean isVariable0,Object [] columnInformations0,VersionHandler versionHandler) throws DException{ 81 sourceTableName = sourceTableName0; 82 indexName = indexName0; 83 rootClusterAddress = controlClusterAddress0; 84 if(rootClusterAddress == 0) 85 Thread.dumpStack(); 86 isVariable = isVariable0; 87 int len = columnInformations0.length; 88 indexColumnNames = new String [len]; 89 orderType = new boolean[len]; 90 indexColumnIndexes = new int[len]; 91 for( int i = 0 ; i < len ; i++ ){ 92 Object [] columns = (Object [])columnInformations0[i]; 93 indexColumnNames[i] = (String )columns[0]; 94 orderType[i] = ((Boolean )columns[1]).booleanValue(); 95 indexColumnIndexes[i] = columns[2].hashCode(); 96 } 97 isDefault = versionHandler.isDefault(indexColumnNames); 118 119 } 120 public IndexInformations(String [] columnNames,VersionHandler versionHandler) { 121 indexColumnNames = columnNames; 122 isDefault = versionHandler.isDefault(indexColumnNames); orderType = new boolean[indexColumnNames.length]; 124 java.util.Arrays.fill(orderType,true); 125 } 126 127 128 133 134 public String [] getColumns() throws DException { 135 return indexColumnNames; 136 } 137 138 143 144 public String getIndexName() throws DException{ 145 return indexName; 146 } 147 148 153 154 public boolean[] getOrderOfColumns() throws DException { 155 return orderType; 156 } 157 158 163 164 public boolean isVariableColumn() throws DException { 165 return isVariable; 166 } 167 168 169 public QualifiedIdentifier getQualifiedIdentifier() throws DException { 170 return new QualifiedIdentifier(null,null,indexName); 171 } 172 173 174 public QualifiedIdentifier getIndexTableName() throws DException { 175 return indexTableName; 176 } 177 178 public int getSize() throws DException { 179 return numberOfRecords; 180 } 181 182 183 184 185 public Object [][] getColumnInformation () throws DException{ 186 ArrayList indexStructure = new ArrayList (); 187 for(int i =0 ; i < indexColumnNames.length; i++){ 188 indexStructure.add(new Object []{indexColumnNames[i],Utility.getBooleanValue(orderType[i]),new Integer (indexColumnIndexes[i]),new Integer (i)}); 189 } 190 return (Object [][])indexStructure.toArray(new Object [0][]); 191 } 192 193 public void setControlClusterAddress(int rootClusterAddress0) throws DException { 194 rootClusterAddress = rootClusterAddress0; 195 if(rootClusterAddress == 0) 196 Thread.dumpStack(); 197 } 198 199 200 public int[] getColumnIndexes() throws DException { 201 return indexColumnIndexes; 202 } 203 204 public void refresh() { 205 } 206 207 public boolean isDefault(){ 208 return isDefault; 209 } 210 211 212 public String toString() { 213 return "INDEXNAME :: ["+indexName+"] COLUMNS :: "+java.util.Arrays.asList(indexColumnNames)+" isDefault :: ["+isDefault+"]"; 214 } 215 216 public void update() throws DException { 217 throw new UnsupportedOperationException ("method does not supported "); 218 } 219 220 public void setIndexTableName(QualifiedIdentifier name) { 221 indexTableName = name; 222 } 223 224 public void updateIndexs(_TableCharacteristics tc) throws DException{ 225 for(int i =0 ; i < indexColumnNames.length ; i++) 226 indexColumnIndexes[i] = tc.getIndexForColumnName(indexColumnNames[i]); 227 rootClusterAddress = 0; 228 rootClusterSize = 0; 229 numberOfRecords = 0; 230 } 231 232 public int getControlClusterAddress() throws DException{ 233 return rootClusterAddress; 234 } 235 public boolean setIsDefault(boolean flag){ 236 return isDefault = flag; 237 } 238 239 public boolean isSystemGenerated() { 240 241 throw new java.lang.UnsupportedOperationException ("Method isSystemGenerated() not yet implemented."); 242 } 243 public boolean isUpdated() { 244 245 throw new java.lang.UnsupportedOperationException ("Method isUpdated() not yet implemented."); 246 } 247 public void setColumnNames(String [] parm1) throws com.daffodilwoods.database.resource.DException { 248 249 throw new java.lang.UnsupportedOperationException ("Method setColumnNames() not yet implemented."); 250 } 251 public void setColumnIndexes(int[] parm1) throws com.daffodilwoods.database.resource.DException { 252 253 throw new java.lang.UnsupportedOperationException ("Method setColumnIndexes() not yet implemented."); 254 } 255 public void setOrderOfColumns(boolean[] parm1) throws com.daffodilwoods.database.resource.DException { 256 257 throw new java.lang.UnsupportedOperationException ("Method setOrderOfColumns() not yet implemented."); 258 } 259 public void setIsUpdatedFlag(boolean parm1) throws com.daffodilwoods.database.resource.DException { 260 261 throw new java.lang.UnsupportedOperationException ("Method setIsUpdatedFlag() not yet implemented."); 262 } 263 264 } 265 | Popular Tags |