/** * Set the base iterator * * @param base the iterator over the sequence to be filtered * @param context the context in which the (outer) filter expression is evaluated */ public void setSequence(SequenceIterator<?> base, XPathContext context) { filterContext = context.newMinorContext(); this.base = (FocusIterator<T>)filterContext.trackFocus(base); }
/** * Constructor * * @param base An iteration of the items to be filtered * @param filter The expression defining the filter predicate * @param context The context in which the expression is being evaluated */ public FilterIterator(SequenceIterator<T> base, Expression filter, XPathContext context) { this.filter = filter; filterContext = context.newMinorContext(); this.base = filterContext.trackFocus(base); }
/** * Set the base iterator * * @param base the iterator over the sequence to be filtered * @param context the context in which the (outer) filter expression is evaluated */ public void setSequence(SequenceIterator<?> base, XPathContext context) { filterContext = context.newMinorContext(); this.base = (FocusIterator<T>)filterContext.trackFocus(base); }
public GroupStartingIterator(SequenceIterator population, Pattern startPattern, XPathContext context) throws XPathException { this.population = population; this.startPattern = startPattern; baseContext = context; runningContext = context.newMinorContext(); runningContext.setCurrentIterator(population); // the first item in the population always starts a new group next = population.next(); }
public GroupStartingIterator(SequenceIterator population, Pattern startPattern, XPathContext context) throws XPathException { this.population = population; this.startPattern = startPattern; baseContext = context; runningContext = context.newMinorContext(); runningContext.setCurrentIterator(population); // the first item in the population always starts a new group next = population.next(); }
public GroupEndingIterator(SequenceIterator population, Pattern endPattern, XPathContext context) throws XPathException { this.population = population; this.endPattern = endPattern; baseContext = context; runningContext = context.newMinorContext(); runningContext.setCurrentIterator(population); // the first item in the population always starts a new group next = population.next(); }
public GroupEndingIterator(Expression select, Pattern endPattern, XPathContext context) throws XPathException { this.select = select; this.pattern = endPattern; baseContext = context; runningContext = context.newMinorContext(); this.population = runningContext.trackFocus(select.iterate(context)); // the first item in the population always starts a new group next = population.next(); }
public GroupStartingIterator(Expression select, Pattern startPattern, XPathContext context) throws XPathException { this.select = select; this.pattern = startPattern; baseContext = context; runningContext = context.newMinorContext(); this.population = runningContext.trackFocus(select.iterate(context)); // the first item in the population always starts a new group next = population.next(); }
public GroupEndingIterator(Expression select, Pattern endPattern, XPathContext context) throws XPathException { this.select = select; this.pattern = endPattern; baseContext = context; runningContext = context.newMinorContext(); this.population = runningContext.trackFocus(select.iterate(context)); // the first item in the population always starts a new group next = population.next(); }
public SequenceIterator getAnother() throws XPathException { XPathContext c2 = keyContext.newMinorContext(); c2.setOriginatingConstructType(Location.GROUPING_KEY); return new GroupByIterator(population.getAnother(), keyExpression, c2, collator); }
public GroupStartingIterator(Expression select, Pattern startPattern, XPathContext context) throws XPathException { this.select = select; this.pattern = startPattern; baseContext = context; runningContext = context.newMinorContext(); this.population = runningContext.trackFocus(select.iterate(context)); // the first item in the population always starts a new group next = population.next(); }
public SequenceIterator getAnother() throws XPathException { XPathContext c2 = keyContext.newMinorContext(); c2.setOriginatingConstructType(Location.GROUPING_KEY); return new GroupByIterator(population.getAnother(), keyExpression, c2, collator); }
public MergeKeyMappingFunction(XPathContext baseContext, MergeSource ms) { this.baseContext = baseContext; this.ms = ms; keyContext = baseContext.newMinorContext(); keyContext.setTemporaryOutputState(StandardNames.XSL_MERGE_KEY); manualIterator = new ManualIterator<>(); manualIterator.setPosition(1); keyContext.setCurrentIterator(manualIterator); } public SequenceIterator<ExternalObject<ItemWithMergeKeys>> map(XPathContext context)
public MergeKeyMappingFunction(XPathContext baseContext, MergeSource ms) { this.baseContext = baseContext; this.ms = ms; keyContext = baseContext.newMinorContext(); keyContext.setTemporaryOutputState(StandardNames.XSL_MERGE_KEY); manualIterator = new ManualIterator<>(); manualIterator.setPosition(1); keyContext.setCurrentIterator(manualIterator); } public SequenceIterator<ExternalObject<ItemWithMergeKeys>> map(XPathContext context)
private boolean matchesPredicate(Item<?> item, XPathContext context) throws XPathException { XPathContext c2 = context.newMinorContext(); ManualIterator<Item<?>> si = new ManualIterator<>(item); c2.setCurrentIterator(si); try { return getPredicate().effectiveBooleanValue(c2); } catch (XPathException.Circularity e) { throw e; } catch (XPathException ex) { handleDynamicError(ex, c2); return false; } }
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); }
/** * Select nodes in a document using this PatternFinder. * * @param doc the document node at the root of a tree * @param context the dynamic evaluation context * @return an iterator over the selected nodes in the document. */ public SequenceIterator<? extends NodeInfo> selectNodes(TreeInfo doc, XPathContext context) throws XPathException { XPathContext c2 = context.newMinorContext(); ManualIterator<NodeInfo> mi = new ManualIterator<>(doc.getRootNode()); c2.setCurrentIterator(mi); return (SequenceIterator<? extends NodeInfo>)getSelectionExpression().iterate(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); }
private SequenceIterator getInputIterator(AtomicComparer[] comps, SequenceIterator inputIterator, MergeSource ms, XPathContext c2) throws XPathException { XPathContext c4 = c2.newMinorContext(); c4.setTemporaryOutputState(StandardNames.XSL_MERGE_KEY); FocusIterator<?> rowIntr = c4.trackFocus(ms.getRowSelect().iterate(c2)); MergeKeyMappingFunction addMergeKeys = new MergeKeyMappingFunction(c4, ms); ContextMappingIterator<ExternalObject<ItemWithMergeKeys>> contextMapKeysItr = new ContextMappingIterator<>(addMergeKeys, c4); inputIterator = makeMergeIterator(inputIterator, comps, ms, contextMapKeysItr); return inputIterator; }
private SequenceIterator getInputIterator(AtomicComparer[] comps, SequenceIterator inputIterator, MergeSource ms, XPathContext c2) throws XPathException { XPathContext c4 = c2.newMinorContext(); c4.setTemporaryOutputState(StandardNames.XSL_MERGE_KEY); FocusIterator<?> rowIntr = c4.trackFocus(ms.getRowSelect().iterate(c2)); MergeKeyMappingFunction addMergeKeys = new MergeKeyMappingFunction(c4, ms); ContextMappingIterator<ExternalObject<ItemWithMergeKeys>> contextMapKeysItr = new ContextMappingIterator<>(addMergeKeys, c4); inputIterator = makeMergeIterator(inputIterator, comps, ms, contextMapKeysItr); return inputIterator; }