|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.jxpath.ri.axes.SimplePathInterpreter
public class 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)
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. |
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)
context
- evaluation contextroot
- root pointersteps
- path steps
public static NodePointer interpretSimpleExpressionPath(EvalContext context, NodePointer root, Expression[] predicates, Step[] steps)
context
- evaluation contextroot
- root pointerpredicates
- predicates corresponding to steps
steps
- path steps
private static NodePointer doStep(EvalContext context, NodePointer parent, Step[] steps, int currentStep)
context
- evaluation contextparent
- parent pointersteps
- path stepscurrentStep
- step number
private static NodePointer doStepNoPredicatesPropertyOwner(EvalContext context, PropertyOwnerPointer parentPointer, Step[] steps, int currentStep)
context
- evaluation contextparentPointer
- property owner pointersteps
- path stepscurrentStep
- step number
private static NodePointer doStepNoPredicatesStandard(EvalContext context, NodePointer parentPointer, Step[] steps, int currentStep)
context
- evaluation contextparentPointer
- parent pointersteps
- path stepscurrentStep
- step number
private static NodePointer doStepPredicatesPropertyOwner(EvalContext context, PropertyOwnerPointer parentPointer, Step[] steps, int currentStep)
context
- evaluation contextparentPointer
- parent pointersteps
- path stepscurrentStep
- step number
private static NodePointer createChildPointerForStep(PropertyOwnerPointer parentPointer, Step step)
parentPointer
- parent pointerstep
- associated step
private static NodePointer doStepPredicatesStandard(EvalContext context, NodePointer parent, Step[] steps, int currentStep)
context
- evaluation contextparent
- parent pointersteps
- path stepscurrentStep
- step number
private 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 number
private 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 number
private 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 number
private 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 number
private static int indexFromPredicate(EvalContext context, Expression predicate)
context
- evaluation contextpredicate
- to evaluate
private static java.lang.String keyFromPredicate(EvalContext context, Expression predicate)
context
- evaluation contextpredicate
- predicate to evaluate
private static int computeQuality(NodePointer pointer)
pointer
- input pointer
private static boolean isNameAttributeEqual(NodePointer pointer, java.lang.String name)
pointer
- input pointername
- name to check
private static boolean isCollectionElement(NodePointer pointer, int index)
pointer
- input pointerindex
- to check
private static NodePointer valuePointer(NodePointer pointer)
pointer
- input pointer
public static NodePointer createNullPointer(EvalContext context, NodePointer parent, Step[] steps, int currentStep)
context
- evaluation contextparent
- parent pointersteps
- path stepscurrentStep
- step number
private 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 number
private static NodeIterator getNodeIterator(EvalContext context, NodePointer pointer, Step step)
context
- evaluation contextpointer
- owning pointerstep
- triggering step
private static boolean isLangAttribute(QName name)
name
is a lang attribute.
name
- to compare
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |