/** * Iterate the path-expression in a given context * @param context the evaluation context */ public SequenceIterator iterate(final XPathContext context) throws XPathException { // This class delivers the result of the expression in unsorted order, // without removal of duplicates. SequenceIterator result = start.iterate(context); XPathContext context2 = context.newMinorContext(); context2.setCurrentIterator(result); context2.setOrigin(this); context2.setOriginatingConstructType(Location.PATH_EXPRESSION); return new ContextMappingIterator(this, context2); }
/** * Iterate the path-expression in a given context * @param context the evaluation context */ public SequenceIterator iterate(XPathContext context) throws XPathException { // This class delivers the result of the path expression in unsorted order, // without removal of duplicates. If sorting and deduplication are needed, // this is achieved by wrapping the path expression in a DocumentSorter SequenceIterator master = start.iterate(context); XPathContext context2 = context.newMinorContext(); context2.setCurrentIterator(master); context2.setOrigin(this); //context2.setOriginatingConstructType(Location.PATH_EXPRESSION); return new ContextMappingIterator(this, context2); }
public SequenceIterator getAnother() throws XPathException { SequenceIterator newBase = base.getAnother(); XPathContext c2 = context; if (c2!=null) { c2 = c2.newMinorContext(); c2.setCurrentIterator(newBase); c2.setOrigin(context.getOrigin()); } return new ContextMappingIterator(action, c2); }
public SequenceIterator getAnother() throws XPathException { SequenceIterator newBase = base.getAnother(); XPathContext c2 = context; if (c2!=null) { c2 = c2.newMinorContext(); c2.setCurrentIterator(newBase); c2.setOrigin(context.getOrigin()); } return new ContextMappingIterator(action, c2); }
/** * Make a new XPath context for evaluating patterns if there is any possibility that the * pattern uses local variables * * @param context The existing XPath context * @return a new XPath context (or the existing context if no new context was created) */ private XPathContext perhapsMakeNewContext(XPathContext context) { int patternLocals = context.getController().getExecutable().getLargestPatternStackFrame(); if (patternLocals > 0) { context = context.newContext(); context.setOrigin(context.getController()); ((XPathContextMajor)context).openStackFrame(patternLocals); } return context; }
/** * Make a new XPath context for evaluating patterns if there is any possibility that the * pattern uses local variables * * @param context The existing XPath context * @return a new XPath context (or the existing context if no new context was created) */ private XPathContext perhapsMakeNewContext(XPathContext context) { int patternLocals = context.getController().getExecutable().getLargestPatternStackFrame(); if (patternLocals > 0) { context = context.newContext(); context.setOrigin(context.getController()); ((XPathContextMajor)context).openStackFrame(patternLocals); } return context; }
/** * Enumerate the results of the expression */ public SequenceIterator iterate(XPathContext context) throws XPathException { SequenceIterator iter = select.iterate(context); if (iter instanceof EmptyIterator) { return iter; } XPathContext xpc = context.newMinorContext(); xpc.setOrigin(this); AtomicComparer[] comps = comparators; if (comparators == null) { comps = new AtomicComparer[sortKeyDefinitions.length]; for (int s = 0; s < sortKeyDefinitions.length; s++) { AtomicComparer comp = sortKeyDefinitions[s].getFinalComparator(); if (comp == null) { comp = sortKeyDefinitions[s].makeComparator(xpc); } comps[s] = comp; } } iter = new SortedIterator(xpc, iter, this, comps); ((SortedIterator) iter).setHostLanguage(getHostLanguage()); return iter; }
/** * Enumerate the results of the expression */ public SequenceIterator iterate(XPathContext context) throws XPathException { SequenceIterator iter = select.iterate(context); if (iter instanceof EmptyIterator) { return iter; } XPathContext xpc = context.newMinorContext(); xpc.setOrigin(this); AtomicComparer[] comps = comparators; if (comparators == null) { comps = new AtomicComparer[sortKeyDefinitions.length]; for (int s = 0; s < sortKeyDefinitions.length; s++) { AtomicComparer comp = sortKeyDefinitions[s].getFinalComparator(); if (comp == null) { comp = sortKeyDefinitions[s].makeComparator(xpc); } comps[s] = comp; } } iter = new SortedIterator(xpc, iter, this, comps); ((SortedIterator) iter).setHostLanguage(getHostLanguage()); return iter; }
/** * Enumerate the results of the expression */ public SequenceIterator iterate(XPathContext context) throws XPathException { SequenceIterator iter = select.iterate(context); if (iter instanceof EmptyIterator) { return iter; } XPathContext xpc = context.newMinorContext(); xpc.setOrigin(this); AtomicComparer[] comps = comparators; if (comparators == null) { comps = new AtomicComparer[sortKeyDefinitions.length]; for (int s = 0; s < sortKeyDefinitions.length; s++) { AtomicComparer comp = sortKeyDefinitions[s].getFinalComparator(); if (comp == null) { comp = sortKeyDefinitions[s].makeComparator(xpc); } comps[s] = comp; } } iter = new SortedIterator(xpc, iter, this, comps); ((SortedIterator) iter).setHostLanguage(getHostLanguage()); return iter; }
Controller controller = context.getController(); XPathContext c2 = context.newMinorContext(); c2.setOrigin(this); SequenceOutputter seq = controller.allocateSequenceOutputter(20); PipelineConfiguration pipe = controller.makePipelineConfiguration();
Controller controller = context.getController(); XPathContext c2 = context.newMinorContext(); c2.setOrigin(this); SequenceOutputter seq = controller.allocateSequenceOutputter(1); PipelineConfiguration pipe = controller.makePipelineConfiguration();
Controller controller = context.getController(); XPathContext c2 = context.newMinorContext(); c2.setOrigin(this); SequenceOutputter seq = controller.allocateSequenceOutputter(1); PipelineConfiguration pipe = controller.makePipelineConfiguration();
Controller controller = context.getController(); XPathContext c2 = context.newMinorContext(); c2.setOrigin(this); SequenceOutputter seq = controller.allocateSequenceOutputter(1); PipelineConfiguration pipe = controller.makePipelineConfiguration();
Controller controller = context.getController(); XPathContext c2 = context.newMinorContext(); c2.setOrigin(this); SequenceOutputter seq = controller.allocateSequenceOutputter(1); PipelineConfiguration pipe = controller.makePipelineConfiguration();
Controller controller = context.getController(); XPathContext c2 = context.newMinorContext(); c2.setOrigin(this); SequenceOutputter seq = controller.allocateSequenceOutputter(1); PipelineConfiguration pipe = controller.makePipelineConfiguration();
Controller controller = context.getController(); XPathContext c2 = context.newMinorContext(); c2.setOrigin(this); SequenceOutputter seq = controller.allocateSequenceOutputter(20); PipelineConfiguration pipe = controller.makePipelineConfiguration();
Controller controller = context.getController(); XPathContext c2 = context.newMinorContext(); c2.setOrigin(this); SequenceOutputter seq = controller.allocateSequenceOutputter(10); PipelineConfiguration pipe = controller.makePipelineConfiguration();
/** * Evaluate as an expression. We rely on the fact that when these instructions * are generated by XQuery, there will always be a valueExpression to evaluate * the content */ public Item evaluateItem(XPathContext context) throws XPathException { Controller controller = context.getController(); XPathContext c2 = context.newMinorContext(); c2.setOrigin(this); SequenceOutputter seq = controller.allocateSequenceOutputter(1); PipelineConfiguration pipe = controller.makePipelineConfiguration(); pipe.setHostLanguage(getHostLanguage()); seq.setPipelineConfiguration(pipe); c2.setTemporaryReceiver(seq); process(c2); seq.close(); Item item = seq.getFirstItem(); seq.reset(); return item; }
/** * Evaluate as an expression. We rely on the fact that when these instructions * are generated by XQuery, there will always be a valueExpression to evaluate * the content */ public Item evaluateItem(XPathContext context) throws XPathException { Controller controller = context.getController(); XPathContext c2 = context.newMinorContext(); c2.setOrigin(this); SequenceOutputter seq = controller.allocateSequenceOutputter(1); PipelineConfiguration pipe = controller.makePipelineConfiguration(); pipe.setHostLanguage(getHostLanguage()); seq.setPipelineConfiguration(pipe); c2.setTemporaryReceiver(seq); process(c2); seq.close(); Item item = seq.getFirstItem(); seq.reset(); return item; }
/** * Evaluate as an expression. We rely on the fact that when these instructions * are generated by XQuery, there will always be a valueExpression to evaluate * the content */ public Item evaluateItem(XPathContext context) throws XPathException { Controller controller = context.getController(); XPathContext c2 = context.newMinorContext(); c2.setOrigin(this); SequenceOutputter seq = controller.allocateSequenceOutputter(1); PipelineConfiguration pipe = controller.makePipelineConfiguration(); pipe.setHostLanguage(getHostLanguage()); seq.setPipelineConfiguration(pipe); c2.setTemporaryReceiver(seq); process(c2); seq.close(); Item item = seq.getFirstItem(); seq.reset(); return item; }