private RuntimeIterator getMatchingRuntimeIterator(String receiverId, List expansionList) throws QueryInvocationTargetException { Iterator iterator = expansionList.iterator(); while (iterator.hasNext()) { RuntimeIterator ritr = (RuntimeIterator) iterator.next(); if (ritr.getCmpIteratorDefn().getName().equals(receiverId)) { return ritr; } } throw new QueryInvocationTargetException("Unable to locate correct iterator for " + receiverId); }
/** * Calculates set of Runtime Iterators on which a given CompiledValue ultimately depends. The * independent iterators may belong to other scopes. * <p> * This function will populate the set to its independent RuntimeIterators. However if the * CompiledValue happens to be a CompiledIteratorDef & if it is independent of any other * RuntimeIterators then no addition will be done in the Set. * <p> * TODO: the behavior of this function will change if we modify the computeDependency function of * the CompiledIteratorDef as in that case the Set will be added with the self RuntimeIterator ( * if the CompiledIteratorDef is independent) which is not the case now. * <p> * TODO: If a CompiledIteratorDef has only one dependent RuntimeIterator should it still be stored * in a Set or should it be a single value? */ void computeUltimateDependencies(CompiledValue cv, Set set) { Set dependencySet = this.getDependencySet(cv, true /* readOnly */); if (dependencySet != Collections.emptySet()) { Iterator iter = dependencySet.iterator(); RuntimeIterator rIter; while (iter.hasNext()) { rIter = (RuntimeIterator) iter.next(); Set indRuntimeIterators = (Set) this.itrDefToIndpndtRuntimeItrMap.get(rIter.getCmpIteratorDefn()); if (indRuntimeIterators != null) { set.addAll(indRuntimeIterators); } } } }
RuntimeIterator iteratorInCurrentScope = (RuntimeIterator) iter.next(); Set itrSet = (Set) itrDefToIndpndtRuntimeItrMap.get(iteratorInCurrentScope.getCmpIteratorDefn()); if (rIter != iteratorInCurrentScope && itrSet.size() == 1 && ((RuntimeIterator) itrSet.iterator().next()) == rIter) {
CompiledIteratorDef cIterDef = rIter.getCmpIteratorDefn(); CompiledValue colnExpr = cIterDef.getCollectionExpr();
if (currentLevel.getCmpIteratorDefn().getCollectionExpr() .getType() == OQLLexerTokenTypes.RegionPath) { key = currentLevel.getCmpIteratorDefn().getName() + ':' + currentLevel.getDefinition(); } else if (currentLevel.getCmpIteratorDefn().getCollectionExpr() .getType() == OQLLexerTokenTypes.LITERAL_select) { useDerivedResults = false; CompiledValue path = currentLevel.getCmpIteratorDefn().getCollectionExpr(); if (useDerivedResults && derivedResults != null && path.hasIdentifierAtLeafNode()) { key = getCompiledIdFromPath(path).getId()