|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.commons.jxpath.ri.axes.SimplePathInterpreter
An evaluation mechanism for simple XPaths, which
is much faster than the usual process. It is only used for
xpaths which have no context-dependent parts, consist entirely of
child::name
and self::node()
steps with
predicates that either integer or have the form [@name = ...]
.
Field Summary | |
private static int |
PERFECT_MATCH
|
private static QName |
QNAME_NAME
|
Constructor Summary | |
SimplePathInterpreter()
|
Method Summary | |
private static int |
computeQuality(NodePointer pointer)
For a pointer that matches an actual node, returns 0. |
private static NodePointer |
createChildPointerForStep(PropertyOwnerPointer parentPointer,
Step 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)
|
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)
|
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)
|
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. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final QName QNAME_NAME
private static final int PERFECT_MATCH
Constructor Detail |
public SimplePathInterpreter()
Method Detail |
public static NodePointer interpretSimpleLocationPath(EvalContext context, NodePointer root, Step[] steps)
public static NodePointer interpretSimpleExpressionPath(EvalContext context, NodePointer root, Expression[] predicates, Step[] steps)
private static NodePointer doStep(EvalContext context, NodePointer parent, Step[] steps, int currentStep)
private static NodePointer doStepNoPredicatesPropertyOwner(EvalContext context, PropertyOwnerPointer parentPointer, Step[] steps, int currentStep)
private static NodePointer doStepNoPredicatesStandard(EvalContext context, NodePointer parentPointer, Step[] steps, int currentStep)
private static NodePointer doStepPredicatesPropertyOwner(EvalContext context, PropertyOwnerPointer parentPointer, Step[] steps, int currentStep)
private static NodePointer createChildPointerForStep(PropertyOwnerPointer parentPointer, Step step)
private static NodePointer doStepPredicatesStandard(EvalContext context, NodePointer parent, Step[] steps, int currentStep)
private static NodePointer doPredicate(EvalContext context, NodePointer parent, Step[] steps, int currentStep, Expression[] predicates, int currentPredicate)
private static NodePointer doPredicateName(EvalContext context, NodePointer parent, Step[] steps, int currentStep, Expression[] predicates, int currentPredicate)
private static NodePointer doPredicatesStandard(EvalContext context, java.util.List parents, Step[] steps, int currentStep, Expression[] predicates, int currentPredicate)
private static NodePointer doPredicateIndex(EvalContext context, NodePointer parent, Step[] steps, int currentStep, Expression[] predicates, int currentPredicate)
private static int indexFromPredicate(EvalContext context, Expression predicate)
private static java.lang.String keyFromPredicate(EvalContext context, Expression predicate)
private static int computeQuality(NodePointer pointer)
private static boolean isNameAttributeEqual(NodePointer pointer, java.lang.String name)
private static boolean isCollectionElement(NodePointer pointer, int index)
private static NodePointer valuePointer(NodePointer pointer)
public static NodePointer createNullPointer(EvalContext context, NodePointer parent, Step[] steps, int currentStep)
private static NodePointer createNullPointerForPredicates(EvalContext context, NodePointer parent, Step[] steps, int currentStep, Expression[] predicates, int currentPredicate)
private static NodeIterator getNodeIterator(EvalContext context, NodePointer pointer, Step step)
private static boolean isLangAttribute(QName name)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |