1 package com.daffodilwoods.daffodildb.server.sql99.expression.booleanvalueexpression; 2 3 import java.io.*; 4 5 import com.daffodilwoods.daffodildb.server.datasystem.indexsystem.*; 6 import com.daffodilwoods.daffodildb.server.datasystem.interfaces.*; 7 import com.daffodilwoods.daffodildb.server.sql99.common.*; 8 import com.daffodilwoods.daffodildb.server.sql99.dql.execution.*; 9 import com.daffodilwoods.daffodildb.server.sql99.dql.plan.condition.*; 10 import com.daffodilwoods.daffodildb.server.sql99.dql.plan.table.*; 11 import com.daffodilwoods.daffodildb.server.sql99.expression.booleanvalueexpression.predicates.*; 12 import com.daffodilwoods.daffodildb.server.sql99.expression.rowvalueexpression.*; 13 import com.daffodilwoods.daffodildb.server.sql99.token.*; 14 import com.daffodilwoods.daffodildb.server.sql99.utils.*; 15 import com.daffodilwoods.database.resource.*; 16 import com.daffodilwoods.database.sqlinitiator.*; 17 import com.daffodilwoods.database.utility.*; 18 import com.daffodilwoods.daffodildb.server.sql99.dql.execution._SingleTableCondition; 19 20 35 36 public class booleanfactor extends AbstractBooleanValueExpression implements booleanterm, Serializable, IntegerPool, ExecutionPlanConstants, JoinConditionTableGetter,_SingleTableCondition { 37 38 public booleantest _booleantest0; 39 public SRESERVEDWORD1206543922 _OptSRESERVEDWORD12065439221; 40 41 public booleanfactor() { 42 } 43 44 public booleanfactor(booleantest object) { 45 _booleantest0 = object; 46 } 47 48 56 57 public double getCost(long rowCount, boolean index) throws DException { 58 return _booleantest0.getCost(rowCount, index); 59 } 60 61 70 71 public _QualifiedBVE getQualifiedBVE(TableDetails[] tableDetails) throws DException { 72 return (_OptSRESERVEDWORD12065439221 == null) ? 73 _booleantest0.getQualifiedBVE(tableDetails) : new QualifiedBVE(null, this); 74 } 75 76 85 86 public int canUseForSeek() throws DException { 87 if (_OptSRESERVEDWORD12065439221 != null) { 88 return TypeConstants.NOSEEK; 89 } 90 return _booleantest0.canUseForSeek(); 91 92 93 } 94 95 103 104 public void setColumnPredicates(_AllColumnPredicates allColumnPredicates) throws 105 DException { 106 if (_OptSRESERVEDWORD12065439221 != null) { 107 allColumnPredicates.addToNonIndex(this); 108 } else { 109 _booleantest0.setColumnPredicates(allColumnPredicates); 110 } 111 } 112 113 public int getConditionType() throws DException { 114 return _booleantest0.getConditionType(); 115 } 116 117 131 132 public _BVEPlan getExecutionPlan() throws DException { 133 if (_OptSRESERVEDWORD12065439221 == null) { return _booleantest0.getExecutionPlan(); 135 } 136 return new BVEAllTablePlan(null, null, this); 137 } 138 139 158 159 public Object run(Object object) throws com.daffodilwoods.database.resource. 160 DException { 161 if (_OptSRESERVEDWORD12065439221 == null) { 162 return _booleantest0.run(object); 163 } 164 return predicate.boolResultForCompliment[_booleantest0.run(object).hashCode() + 165 2]; 166 } 167 168 175 176 public ParameterInfo[] getParameterInfo() throws DException { 177 return _booleantest0.getParameterInfo(); 178 } 179 180 185 186 public void verifyValues(_VariableValueOperations vv) throws DException { 187 if (_booleantest0._booleanprimary1 instanceof JoinConditionTableGetter) { 188 ( (JoinConditionTableGetter) _booleantest0._booleanprimary1).verifyValues( 189 vv); 190 } 191 } 192 193 198 199 public AbstractRowValueExpression[] getChilds() { 200 AbstractRowValueExpression[] childs = new AbstractRowValueExpression[] { 201 (AbstractRowValueExpression) (_booleantest0)}; 202 return childs; 203 } 204 205 214 215 public boolean isNullPredicate() throws DException { 216 if (_OptSRESERVEDWORD12065439221 != null) { 217 return false; 218 } 219 return _booleantest0.isNullPredicate(); 220 } 221 222 229 230 public long getEstimatedRows(long noOfRows) throws DException { 231 return _booleantest0.getEstimatedRows(noOfRows); 232 } 233 234 257 258 public _IndexPredicateInterface getCost(_Order order, String [] queryColumns, 259 Object session, 260 TableDetails tableDetail, ColumnDetails[] aggregateColumns) throws 261 DException { 262 AllColumnPredicates allColumnPredicate = initializeAllColumnPredicate( 263 tableDetail); 264 return calculateCost(order, queryColumns, session, tableDetail, 265 allColumnPredicate, aggregateColumns); 266 } 267 268 private IndexPredicate calculateCost(_Order order, String [] queryColumns, 269 Object session, TableDetails tableDetail, 270 AllColumnPredicates allColumnPredicate, ColumnDetails[] aggregateColumns) throws DException { 271 IndexPredicate resultantIndexPredicate = null; 272 _IndexInformation[] indexInformation = ( (_IndexTable) session). 273 getIndexInformations(); 274 ColumnDetails aggColumn = aggregateColumns == null ? null : aggregateColumns[0].getExistingColumnDetails()[0]; 275 for (int i = 0; i < indexInformation.length; ++i) { 276 IndexPredicate indexPredicate = (IndexPredicate) allColumnPredicate. 277 splitForIndex(indexInformation[i], i); 278 indexPredicate.setTableDetails(tableDetail); 279 if (TableReferenceMerger.checkForAggregateColumn(aggColumn, indexInformation[i])) { 280 double cost = CostCalculator.computeCostForIndex(indexPredicate, session, 281 order, queryColumns, indexInformation[i], i); 282 indexPredicate.setCost(cost); 283 if (aggColumn != null) { 284 indexPredicate.setIndex(i); 285 } 286 resultantIndexPredicate = checkForMinimum(indexPredicate, 287 resultantIndexPredicate); 288 } 289 } 290 if (resultantIndexPredicate.getOrder() == null && order != null) { 291 order.setSolvableByIndex(true); 292 } 293 return resultantIndexPredicate; 294 } 295 296 private AllColumnPredicates initializeAllColumnPredicate(TableDetails 297 tableDetail) throws DException { 298 AllColumnPredicates allColumnPredicate = new AllColumnPredicates(); 299 allColumnPredicate.setTableDetails(tableDetail); 300 _booleantest0.setColumnPredicates(allColumnPredicate); 301 return allColumnPredicate; 302 } 303 304 private IndexPredicate checkForMinimum(IndexPredicate indexPredicate1, 305 IndexPredicate indexPredicate2) throws 306 DException { 307 if (indexPredicate2 == null) { 308 return indexPredicate1; 309 } 310 double comingCost = indexPredicate1.getCost(); 311 double inCost = indexPredicate2.getCost(); 312 return inCost > comingCost 313 ? indexPredicate1 : indexPredicate2; 314 } 315 316 323 324 public TableDetails[] getCorrespondingTablesInvolved(TableDetails[] td) throws 325 com.daffodilwoods.database.resource.DException { 326 if (_booleantest0._booleanprimary1 instanceof JoinConditionTableGetter) { 327 return ( (JoinConditionTableGetter) _booleantest0._booleanprimary1). 328 getCorrespondingTablesInvolved(td); 329 } 330 return null; 331 } 332 333 341 342 public void setDefaultValues(_VariableValueOperations variableValueOperation) throws 343 DException { 344 if (_OptSRESERVEDWORD12065439221 == null) { 345 _booleantest0.setDefaultValues(variableValueOperation); 346 } 347 } 348 349 354 355 public boolean checkForSubQuery() throws DException { 356 return _booleantest0.checkForSubQuery(); 357 } 358 359 public String toString() { 360 StringBuffer sb = new StringBuffer (); 361 sb.append(" "); 362 if (_OptSRESERVEDWORD12065439221 != null) { 363 sb.append(_OptSRESERVEDWORD12065439221); 364 } 365 sb.append(" "); 366 sb.append(_booleantest0); 367 return sb.toString(); 368 } 369 370 public Object clone() throws CloneNotSupportedException { 371 booleanfactor tempClass = new booleanfactor(); 372 tempClass._booleantest0 = (booleantest) _booleantest0.clone(); 373 if (_OptSRESERVEDWORD12065439221 != null) { 374 tempClass._OptSRESERVEDWORD12065439221 = (SRESERVEDWORD1206543922) 375 _OptSRESERVEDWORD12065439221.clone(); 376 } 377 try { 378 tempClass.getColumnDetails(); 379 } catch (DException ex) { 380 throw new RuntimeException (ex.getMessage()); 381 } 382 return tempClass; 383 } 384 385 public booleanvalueexpression getSingleTableCondition() throws DException { 386 return checkForMultipleTables() ? null : this; 387 } 388 389 } 390 | Popular Tags |