/** * Tests if this node matches the given test. Attribute nodes are text * nodes, too, because they can contain a value. * * @param test the test object * @return a flag if this node corresponds to the test */ @Override public boolean testNode(final NodeTest test) { if (test instanceof NodeTypeTest && ((NodeTypeTest) test).getNodeType() == Compiler.NODE_TYPE_TEXT) { return true; } return super.testNode(test); }
final QName name = nameTest.getNodeName(); return nameTest.isWildcard() ? createSubNodeListForWildcardName( node, name) : createSubNodeListForName(node, name); if (typeTest.getNodeType() == Compiler.NODE_TYPE_NODE || typeTest.getNodeType() == Compiler.NODE_TYPE_TEXT)
public NodeIterator childIterator(NodeTest test, boolean reverse, NodePointer startWith) { if (test instanceof NodeNameTest) { NodeNameTest nodeNameTest = (NodeNameTest) test; if (!nodeNameTest.isWildcard()) { String localName = nodeNameTest.getNodeName().getName(); String nameSpace = nodeNameTest.getNamespaceURI(); if (nameSpace == null) nameSpace = getNamespaceResolver().getNamespaceURI(""); return new AttributeNodeIterator(this, Types.typeName(nameSpace, localName)); } else { return new AttributeNodeIterator(this); } } if (test instanceof NodeTypeTest) { NodeTypeTest nodeTypeTest = (NodeTypeTest) test; if (nodeTypeTest.getNodeType() == Compiler.NODE_TYPE_NODE) { return new AttributeNodeIterator(this); } } return super.childIterator(test, reverse, startWith); }
public Object equal(Object left, Object right) { return isNameAttributeTest((Expression) left) ? new NameAttributeTest((Expression) left, (Expression) right) : new CoreOperationEqual((Expression) left, (Expression) right); }
public Object expressionPath(Object expression, Object[] predicates, Object[] steps) { return new ExpressionPath( (Expression) expression, toExpressionArray(predicates), toStepArray(steps)); }
/** * not() implementation. * @param context evaluation context * @return Boolean */ protected Object functionNot(EvalContext context) { assertArgCount(1); return InfoSetUtil.booleanValue(getArg1().computeValue(context)) ? Boolean.FALSE : Boolean.TRUE; }
public Object step(int axis, Object nodeTest, Object[] predicates) { return new Step( axis, (NodeTest) nodeTest, toExpressionArray(predicates)); }
public Object and(Object[] arguments) { return new CoreOperationAnd(toExpressionArray(arguments)); }
public Object function(Object name, Object[] args) { return new ExtensionFunction((QName) name, toExpressionArray(args)); }
public Object union(Object[] arguments) { return new CoreOperationUnion(toExpressionArray(arguments)); }
public Object locationPath(boolean absolute, Object[] steps) { return new LocationPath(absolute, toStepArray(steps)); }
public Object greaterThan(Object left, Object right) { return new CoreOperationGreaterThan( (Expression) left, (Expression) right); }
/** * Given a root context, walks a path therefrom and builds a context * that contains all nodes matching the path. * @param context evaluation context * @return EvaluationContext */ protected EvalContext evalSteps(EvalContext context) { return buildContextChain(context, steps.length, false); }
/** * Returns true if this expression should be re-evaluated * each time the current position in the context changes. * @return boolean */ public synchronized boolean isContextDependent() { if (!contextDependencyKnown) { contextDependent = computeContextDependent(); contextDependencyKnown = true; } return contextDependent; }
/** * null() implementation. * @param context evaluation context * @return null */ protected Object functionNull(EvalContext context) { assertArgCount(0); return null; }
public NodeIterator childIterator(NodeTest test, boolean reverse, NodePointer startWith) { if (test instanceof NodeNameTest) { NodeNameTest nodeNameTest = (NodeNameTest) test; if (!nodeNameTest.isWildcard()) { String localName = nodeNameTest.getNodeName().getName(); String nameSpace = nodeNameTest.getNamespaceURI(); if (nameSpace == null) nameSpace = getNamespaceResolver().getNamespaceURI(""); return new SingleFeatureTypeAttributeIterator( this, featureType, Types.typeName(nameSpace, localName)); } else { return new FeatureTypeAttributeIterator(this, featureType); } } if (test instanceof NodeTypeTest) { NodeTypeTest nodeTypeTest = (NodeTypeTest) test; if (nodeTypeTest.getNodeType() == Compiler.NODE_TYPE_NODE) { return new FeatureTypeAttributeIterator(this, featureType); } } return super.childIterator(test, reverse, startWith); } }
/** * Tests if this node matches the given test. Configuration nodes are text * nodes, too because they can contain a value. * * @param test the test object * @return a flag if this node corresponds to the test */ @Override public boolean testNode(final NodeTest test) { if (test instanceof NodeTypeTest && ((NodeTypeTest) test).getNodeType() == Compiler.NODE_TYPE_TEXT) { return true; } return super.testNode(test); }
public NodeIterator childIterator(NodeTest test, boolean reverse, NodePointer startWith) { if (test instanceof NodeNameTest) { NodeNameTest nodeNameTest = (NodeNameTest) test; if (!nodeNameTest.isWildcard()) { String localName = nodeNameTest.getNodeName().getName(); String nameSpace = nodeNameTest.getNamespaceURI(); if (nameSpace == null) nameSpace = getNamespaceResolver().getNamespaceURI(""); return new SingleFeatureTypeAttributeIterator( this, ((ComplexType) attType), Types.typeName(nameSpace, localName)); } else { return new FeatureTypeAttributeIterator(this, ((ComplexType) attType)); } } if (test instanceof NodeTypeTest) { NodeTypeTest nodeTypeTest = (NodeTypeTest) test; if (nodeTypeTest.getNodeType() == Compiler.NODE_TYPE_NODE) { return new FeatureTypeAttributeIterator(this, ((ComplexType) attType)); } } return super.childIterator(test, reverse, startWith); }
public boolean testNode(NodeTest nodeTest) { return nodeTest == null || ((nodeTest instanceof NodeTypeTest) && ((NodeTypeTest) nodeTest).getNodeType() == Compiler.NODE_TYPE_NODE); }