| 1 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 2 | // Copyright (c) 2018 Saxonica Limited. |
| 3 | // This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. |
| 4 | // If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. |
| 5 | // This Source Code Form is "Incompatible With Secondary Licenses", as defined by the Mozilla Public License, v. 2.0. |
| 6 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 7 | |
| 8 | package net.sf.saxon.expr; |
| 9 | |
| 10 | import net.sf.saxon.om.Item; |
| 11 | import net.sf.saxon.om.SequenceIterator; |
| 12 | import net.sf.saxon.trans.XPathException; |
| 13 | |
| 14 | /** |
| 15 | * ContextMappingFunction is an interface that must be satisfied by an object passed to a |
| 16 | * ContextMappingIterator. It represents an object which, given an Item, can return a |
| 17 | * SequenceIterator that delivers a sequence of zero or more Items. |
| 18 | * <p>This is a specialization of the more general MappingFunction class: it differs in that |
| 19 | * each item being processed becomes the context item while it is being processed.</p> |
| 20 | * |
| 21 | * @param <T> the type of items returned by this ContextMappingFunction |
| 22 | */ |
| 23 | |
| 24 | public interface ContextMappingFunction<T extends Item> { |
| 25 | |
| 26 | /** |
| 27 | * Map one item to a sequence. |
| 28 | * |
| 29 | * @param context The processing context. The item to be mapped is the context item identified |
| 30 | * from this context: the values of position() and last() also relate to the set of items being mapped |
| 31 | * @return a SequenceIterator over the sequence of items that the supplied input |
| 32 | * item maps to |
| 33 | * @throws XPathException if a dynamic error is detected |
| 34 | */ |
| 35 | |
| 36 | SequenceIterator<? extends T> map(XPathContext context) throws XPathException; |
| 37 | |
| 38 | } |
| 39 |