1 24 25 package com.mckoi.database; 26 27 import com.mckoi.util.IntegerVector; 28 29 40 41 public class FilterTable extends Table { 42 43 46 protected Table parent; 47 48 51 private SelectableScheme[] column_scheme; 52 53 56 public FilterTable(Table parent) { 57 this.parent = parent; 58 } 59 60 63 protected Table getParent() { 64 return parent; 65 } 66 67 70 public Database getDatabase() { 71 return parent.getDatabase(); 72 } 73 74 77 public int getColumnCount() { 78 return parent.getColumnCount(); 79 } 80 81 84 public int getRowCount() { 85 return parent.getRowCount(); 86 } 87 88 93 public int findFieldName(Variable v) { 94 return parent.findFieldName(v); 95 } 96 97 102 public Variable getResolvedVariable(int column) { 103 return parent.getResolvedVariable(column); 104 } 105 106 110 SelectableScheme getSelectableSchemeFor(int column, 111 int original_column, Table table) { 112 113 if (column_scheme == null) { 114 column_scheme = new SelectableScheme[parent.getColumnCount()]; 115 } 116 117 SelectableScheme scheme = column_scheme[column]; 119 if (scheme == null) { 120 121 Table t = table; 124 if (table == this) { 125 t = parent; 126 } 127 128 scheme = parent.getSelectableSchemeFor(column, original_column, t); 130 if (table == this) { 131 column_scheme[column] = scheme; 132 } 133 134 } 135 else { 136 if (table == this) { 139 return scheme; 140 } 141 else { 142 return scheme.getSubsetScheme(table, original_column); 144 } 145 } 146 return scheme; 147 } 148 149 156 void setToRowTableDomain(int column, IntegerVector row_set, 157 TableDataSource ancestor) { 158 if (ancestor == this || ancestor == parent) { 159 return; 160 } 161 else { 162 parent.setToRowTableDomain(column, row_set, ancestor); 163 } 164 } 165 166 170 RawTableInformation resolveToRawTable(RawTableInformation info) { 171 return parent.resolveToRawTable(info); 172 } 173 174 180 public TObject getCellContents(int column, int row) { 181 return parent.getCellContents(column, row); 182 } 183 184 188 public RowEnumeration rowEnumeration() { 189 return parent.rowEnumeration(); 190 } 191 192 199 public DataTableDef getDataTableDef() { 200 return parent.getDataTableDef(); 201 } 202 203 213 void addDataTableListener(DataTableListener listener) { 214 parent.addDataTableListener(listener); 215 } 216 217 223 void removeDataTableListener(DataTableListener listener) { 224 parent.removeDataTableListener(listener); 225 } 226 227 228 236 public void lockRoot(int lock_key) { 237 parent.lockRoot(lock_key); 238 } 239 240 245 public void unlockRoot(int lock_key) { 246 parent.unlockRoot(lock_key); 247 } 248 249 253 public boolean hasRootsLocked() { 254 return parent.hasRootsLocked(); 255 } 256 257 258 259 262 public void printGraph(java.io.PrintStream out, int indent) { 263 for (int i = 0; i < indent; ++i) { 264 out.print(' '); 265 } 266 out.println("F[" + getClass()); 267 268 parent.printGraph(out, indent + 2); 269 270 for (int i = 0; i < indent; ++i) { 271 out.print(' '); 272 } 273 out.println("]"); 274 } 275 276 } 277 | Popular Tags |