public class SimplePathInterpreter
extends java.lang.Object
child::name
and self::node()
steps with
predicates that either integer or have the form [@name = ...]
.Modifier and Type | Field and Description |
---|---|
private static int |
PERFECT_MATCH |
private static QName |
QNAME_NAME |
Constructor and Description |
---|
SimplePathInterpreter() |
Modifier and Type | Method and Description |
---|---|
private static int |
computeQuality(NodePointer pointer)
For a pointer that matches an actual node, returns 0.
|
private static NodePointer |
createChildPointerForStep(PropertyOwnerPointer parentPointer,
Step step)
Create the child pointer for a given step.
|
static NodePointer |
createNullPointer(EvalContext context,
NodePointer parent,
Step[] steps,
int currentStep)
Creates a "null pointer" that
a) represents the requested path and
b) can be used for creation of missing nodes in the path.
|
private static NodePointer |
createNullPointerForPredicates(EvalContext context,
NodePointer parent,
Step[] steps,
int currentStep,
Expression[] predicates,
int currentPredicate)
Creates a "null pointer" that starts with predicates.
|
private static NodePointer |
doPredicate(EvalContext context,
NodePointer parent,
Step[] steps,
int currentStep,
Expression[] predicates,
int currentPredicate)
Evaluates predicates and proceeds with the subsequent steps
of the path.
|
private static NodePointer |
doPredicateIndex(EvalContext context,
NodePointer parent,
Step[] steps,
int currentStep,
Expression[] predicates,
int currentPredicate)
Evaluate a subscript predicate: see if the node is a collection and
if the index is inside the collection.
|
private static NodePointer |
doPredicateName(EvalContext context,
NodePointer parent,
Step[] steps,
int currentStep,
Expression[] predicates,
int currentPredicate)
Execute a NameAttributeTest predicate
|
private static NodePointer |
doPredicatesStandard(EvalContext context,
java.util.List parents,
Step[] steps,
int currentStep,
Expression[] predicates,
int currentPredicate)
Called exclusively for standard InfoSet nodes, e.g.
|
private static NodePointer |
doStep(EvalContext context,
NodePointer parent,
Step[] steps,
int currentStep)
Recursive evaluation of a path.
|
private static NodePointer |
doStepNoPredicatesPropertyOwner(EvalContext context,
PropertyOwnerPointer parentPointer,
Step[] steps,
int currentStep)
We have a step that starts with a property owner (bean, map, etc) and has
no predicates.
|
private static NodePointer |
doStepNoPredicatesStandard(EvalContext context,
NodePointer parentPointer,
Step[] steps,
int currentStep)
A path that starts with a standard InfoSet node (e.g.
|
private static NodePointer |
doStepPredicatesPropertyOwner(EvalContext context,
PropertyOwnerPointer parentPointer,
Step[] steps,
int currentStep)
A path that starts with a property owner.
|
private static NodePointer |
doStepPredicatesStandard(EvalContext context,
NodePointer parent,
Step[] steps,
int currentStep)
A path that starts with a standard InfoSet node, e.g.
|
private static NodeIterator |
getNodeIterator(EvalContext context,
NodePointer pointer,
Step step)
Get a NodeIterator.
|
private static int |
indexFromPredicate(EvalContext context,
Expression predicate)
Extract an integer from a subscript predicate.
|
static NodePointer |
interpretSimpleExpressionPath(EvalContext context,
NodePointer root,
Expression[] predicates,
Step[] steps)
Interpret the steps of a simple expression path that
starts with the given root, which is the result of evaluation
of the root expression of the expression path, applies the
given predicates to it and then follows the given steps.
|
static NodePointer |
interpretSimpleLocationPath(EvalContext context,
NodePointer root,
Step[] steps)
Interpret a simple path that starts with the given root and
follows the given steps.
|
private static boolean |
isCollectionElement(NodePointer pointer,
int index)
Returns true if the pointer is a collection and the index is
withing the bounds of the collection.
|
private static boolean |
isLangAttribute(QName name)
Learn whether
name is a lang attribute. |
private static boolean |
isNameAttributeEqual(NodePointer pointer,
java.lang.String name)
Returns true if the pointer has an attribute called "name" and
its value is equal to the supplied string.
|
private static java.lang.String |
keyFromPredicate(EvalContext context,
Expression predicate)
Extracts the string value of the expression from a predicate like
[@name=expression].
|
private static NodePointer |
valuePointer(NodePointer pointer)
For an intermediate pointer (e.g.
|
private static final QName QNAME_NAME
private static final int PERFECT_MATCH
public static NodePointer interpretSimpleLocationPath(EvalContext context, NodePointer root, Step[] steps)
context
- evaluation contextroot
- root pointersteps
- path stepspublic static NodePointer interpretSimpleExpressionPath(EvalContext context, NodePointer root, Expression[] predicates, Step[] steps)
context
- evaluation contextroot
- root pointerpredicates
- predicates corresponding to steps
steps
- path stepsprivate static NodePointer doStep(EvalContext context, NodePointer parent, Step[] steps, int currentStep)
context
- evaluation contextparent
- parent pointersteps
- path stepscurrentStep
- step numberprivate static NodePointer doStepNoPredicatesPropertyOwner(EvalContext context, PropertyOwnerPointer parentPointer, Step[] steps, int currentStep)
context
- evaluation contextparentPointer
- property owner pointersteps
- path stepscurrentStep
- step numberprivate static NodePointer doStepNoPredicatesStandard(EvalContext context, NodePointer parentPointer, Step[] steps, int currentStep)
context
- evaluation contextparentPointer
- parent pointersteps
- path stepscurrentStep
- step numberprivate static NodePointer doStepPredicatesPropertyOwner(EvalContext context, PropertyOwnerPointer parentPointer, Step[] steps, int currentStep)
context
- evaluation contextparentPointer
- parent pointersteps
- path stepscurrentStep
- step numberprivate static NodePointer createChildPointerForStep(PropertyOwnerPointer parentPointer, Step step)
parentPointer
- parent pointerstep
- associated stepprivate static NodePointer doStepPredicatesStandard(EvalContext context, NodePointer parent, Step[] steps, int currentStep)
context
- evaluation contextparent
- parent pointersteps
- path stepscurrentStep
- step numberprivate static NodePointer doPredicate(EvalContext context, NodePointer parent, Step[] steps, int currentStep, Expression[] predicates, int currentPredicate)
context
- evaluation contextparent
- parent pointersteps
- path stepscurrentStep
- step numberpredicates
- predicate expressionscurrentPredicate
- int predicate numberprivate static NodePointer doPredicateName(EvalContext context, NodePointer parent, Step[] steps, int currentStep, Expression[] predicates, int currentPredicate)
context
- evaluation contextparent
- parent pointersteps
- path stepscurrentStep
- int step numberpredicates
- predicatescurrentPredicate
- int predicate numberprivate static NodePointer doPredicatesStandard(EvalContext context, java.util.List parents, Step[] steps, int currentStep, Expression[] predicates, int currentPredicate)
context
- evaluation contextparents
- List of parent pointerssteps
- path stepscurrentStep
- step numberpredicates
- predicatescurrentPredicate
- int predicate numberprivate static NodePointer doPredicateIndex(EvalContext context, NodePointer parent, Step[] steps, int currentStep, Expression[] predicates, int currentPredicate)
context
- evaluation contextparent
- parent pointersteps
- path stepscurrentStep
- step numberpredicates
- predicatescurrentPredicate
- int predicate numberprivate static int indexFromPredicate(EvalContext context, Expression predicate)
context
- evaluation contextpredicate
- to evaluateprivate static java.lang.String keyFromPredicate(EvalContext context, Expression predicate)
context
- evaluation contextpredicate
- predicate to evaluateprivate static int computeQuality(NodePointer pointer)
pointer
- input pointerprivate static boolean isNameAttributeEqual(NodePointer pointer, java.lang.String name)
pointer
- input pointername
- name to checkprivate static boolean isCollectionElement(NodePointer pointer, int index)
pointer
- input pointerindex
- to checkprivate static NodePointer valuePointer(NodePointer pointer)
pointer
- input pointerpublic static NodePointer createNullPointer(EvalContext context, NodePointer parent, Step[] steps, int currentStep)
context
- evaluation contextparent
- parent pointersteps
- path stepscurrentStep
- step numberprivate static NodePointer createNullPointerForPredicates(EvalContext context, NodePointer parent, Step[] steps, int currentStep, Expression[] predicates, int currentPredicate)
context
- evaluation contextparent
- parent pointersteps
- path stepscurrentStep
- step numberpredicates
- predicatescurrentPredicate
- int predicate numberprivate static NodeIterator getNodeIterator(EvalContext context, NodePointer pointer, Step step)
context
- evaluation contextpointer
- owning pointerstep
- triggering stepprivate static boolean isLangAttribute(QName name)
name
is a lang attribute.name
- to compare