java.lang.Object
dev.metaschema.core.metapath.FocusContext
Represents the focus context for Metapath evaluation, containing the context
item, position, and size as defined in the
XPath 3.1 evaluation
context.
The focus context is established when evaluating predicates and provides the
information needed by the fn:position() and fn:last()
functions.
-
Method Summary
Modifier and TypeMethodDescriptionGet the context item.intGet the context position.intgetSize()Get the context size.static FocusContextCreate a new focus context for the given item at the specified position within a sequence.
-
Method Details
-
of
Create a new focus context for the given item at the specified position within a sequence.- Parameters:
item- the context itemposition- the 1-based position of the item within the sequencesize- the total number of items in the sequence- Returns:
- a new focus context
- Throws:
IllegalArgumentException- if position is less than 1, size is less than 1, or position is greater than size
-
getContextItem
Get the context item.- Returns:
- the context item
-
getPosition
public int getPosition()Get the context position.This is the 1-based position of the context item within the sequence currently being processed, as returned by
fn:position().- Returns:
- the context position (1-based)
-
getSize
public int getSize()Get the context size.This is the total number of items in the sequence currently being processed, as returned by
fn:last().- Returns:
- the context size
-