1 package com.daffodilwoods.daffodildb.server.sql99.fulltext.dql.iterator; 2 3 import com.daffodilwoods.daffodildb.server.sql99.utils.BaseExceptionSingleIterator; 4 import com.daffodilwoods.daffodildb.server.sql99.dql.iterator._Iterator; 5 import com.daffodilwoods.database.resource.DException; 6 import com.daffodilwoods.daffodildb.utils.field.FieldBase; 7 import com.daffodilwoods.daffodildb.server.sql99.utils._Reference; 8 import com.daffodilwoods.daffodildb.server.sql99.common.ColumnDetails; 9 import com.daffodilwoods.daffodildb.server.sql99.common._KeyColumnInformation; 10 import com.daffodilwoods.daffodildb.utils.comparator.SuperComparator; 11 import com.daffodilwoods.daffodildb.server.datasystem.interfaces._IndexIterator; 12 import com.daffodilwoods.daffodildb.server.datasystem.interfaces._IndexIteratorInfo; 13 import com.daffodilwoods.daffodildb.server.sql99.common.GeneralPurposeStaticClass; 14 import com.daffodilwoods.daffodildb.server.sql99.common.ExecutionPlanForBrowser; 15 16 26 public class ContainsIterator extends BaseExceptionSingleIterator implements _IndexIteratorInfo{ 27 28 31 _Iterator fullTextIndex; 32 35 _Iterator tableIterator; 36 39 ColumnDetails[] documentId; 40 41 public ContainsIterator(_Iterator fullTextIterator,_Iterator tableIterator)throws DException{ 42 fullTextIndex = fullTextIterator; 43 this.tableIterator = tableIterator; 44 documentId = new ColumnDetails[]{GeneralPurposeStaticClass.getColumnDetails("documentId")}; 45 } 46 47 52 public boolean first() throws DException { 53 return fullTextIndex.first(); 54 } 55 56 61 public boolean next() throws DException { 62 return fullTextIndex.next(); 63 } 64 65 70 public boolean last() throws DException { 71 return fullTextIndex.last(); 72 } 73 74 79 public boolean previous() throws DException { 80 return fullTextIndex.previous(); 81 } 82 83 91 public Object getColumnValues() throws DException { 92 tableIterator.seek(fullTextIndex.getColumnValues(documentId)); 93 return tableIterator.getColumnValues(); 94 } 95 96 public Object getColumnValues(int[] columns) throws DException { 97 tableIterator.seek(fullTextIndex.getColumnValues(documentId)); 98 return tableIterator.getColumnValues(columns); 99 } 100 101 public Object getColumnValues(_Reference[] references) throws DException { 102 Object [] fbsToRet = new Object [references.length]; 103 for (int i = 0; i < references.length; i++) { 104 fbsToRet[i] = getColumnValues(references[i]); 105 } 106 return fbsToRet; 107 } 108 109 public Object getColumnValues(_Reference reference) throws DException { 110 tableIterator.seek(fullTextIndex.getColumnValues(documentId)); 111 return tableIterator.getColumnValues(reference); 112 } 113 114 public FieldBase field(_Reference reference) throws com.daffodilwoods.database.resource.DException { 115 tableIterator.seek(fullTextIndex.getColumnValues(documentId)); 116 return tableIterator.field(reference); 117 } 118 119 public FieldBase[] fields(_Reference[] references) throws com.daffodilwoods.database.resource.DException { 120 FieldBase[] fbsToRet = new FieldBase[references.length]; 121 for (int i = 0; i < references.length; i++) { 122 fbsToRet[i] = field(references[i]); 123 } 124 return fbsToRet; 125 } 126 127 public FieldBase[] fields(int[] columns) throws com.daffodilwoods.database.resource.DException { 128 return (FieldBase[]) getColumnValues(columns); 129 } 130 131 public Object [] getUniqueColumnReference() throws DException { 132 return tableIterator.getUniqueColumnReference(); 133 } 134 135 public _KeyColumnInformation[] getKeyColumnInformations() throws DException { 136 return tableIterator.getKeyColumnInformations(); 137 } 138 public int getBtreeIndex() throws DException { 139 return ((_IndexIteratorInfo)tableIterator).getBtreeIndex(); 140 } 141 public boolean locateKey(Object key, boolean top) throws DException { 142 return ((_IndexIteratorInfo)tableIterator).locateKey(key,top); 143 144 } 145 public void ensureRecordInMemory() throws DException { 146 ((_IndexIteratorInfo)tableIterator).ensureRecordInMemory(); 147 } 148 public void moveOnActualKey(Object key) throws DException { 149 ((_IndexIteratorInfo)tableIterator).moveOnActualKey(key); 150 } 151 public Object getActualKey() throws DException { 152 return ((_IndexIteratorInfo)tableIterator).getActualKey(); 153 154 } 155 public boolean seekKeyAddress(Object indexKey) throws DException { 156 return ((_IndexIteratorInfo)tableIterator).seekKeyAddress(indexKey); 157 } 158 public Object getPhysicalAddress() throws DException { 159 return ((_IndexIteratorInfo)tableIterator).getPhysicalAddress(); 160 } 161 public SuperComparator getComparator() { 162 return ((_IndexIteratorInfo)tableIterator).getComparator(); 163 } 164 public SuperComparator getObjectComparator() throws DException { 165 return ((_IndexIteratorInfo)tableIterator).getObjectComparator(); 166 167 } 168 public void setConditionVariableValue(_Reference[] references, Object [] values, int priority) throws DException { 169 tableIterator.setConditionVariableValue(references,values,priority); 170 171 } 172 public String toString(){ 173 String str = "Contains[FullTextIndex["+fullTextIndex+"]Table["+tableIterator+"]]"; 174 return str; 175 } 176 177 public ExecutionPlanForBrowser getExecutionPlanForBrowser() throws DException { 178 ExecutionPlanForBrowser cplan = tableIterator.getExecutionPlanForBrowser(); 179 ExecutionPlanForBrowser cplans[] = cplan == null ? null : 180 new ExecutionPlanForBrowser[] { 181 cplan}; 182 ExecutionPlanForBrowser plan = new ExecutionPlanForBrowser("ContainsClause", 183 "ContainsIterator", cplans, null, null, null); 184 return plan; 185 } 186 187 } 188 | Popular Tags |