return EmptyIterator.getInstance(); } else { return new NodeArrayIterator(children); return EmptyIterator.getInstance(); } else { return new NodeArrayIterator(parent.children, siblingPosition + 1, parent.children.length); return EmptyIterator.getInstance(); } else { return new NodeArrayIterator(parent.children, 0, siblingPosition);
/** * Get an iterator that processes the same items in reverse order. * Since this iterator is processing the items backwards, this method * returns an ArrayIterator that processes them forwards. * * @return a new ArrayIterator */ public SequenceIterator getReverseIterator() { return new NodeArrayIterator((NodeInfo[])items, start, end); } }
/** * Get an iterator that processes the same items in reverse order. * Since this iterator is processing the items backwards, this method * returns an ArrayIterator that processes them forwards. * * @return a new ArrayIterator */ public SequenceIterator getReverseIterator() { return new NodeArrayIterator((NodeInfo[])items, start, end); } }
/** * Get another iterator over the same items * * @return a new ArrayIterator */ public SequenceIterator getAnother() { return new NodeArrayIterator((NodeInfo[])items, start, end); }
/** * Get another iterator over the same items * * @return a new ArrayIterator */ public SequenceIterator getAnother() { return new NodeArrayIterator((NodeInfo[])items, start, end); }
static AxisIterator createSelfAxisIterator(XmlObjectNode xmlObjectNode, NodeTest nodeTest, Configuration configuration) { return new NodeArrayIterator(new NodeInfo[] { wrapXmlObjectAsNodeInfo(xmlObjectNode, configuration) }); }
static AxisIterator createPrecedingOrAncestorAxisIterator(XmlObjectNode xmlObjectNode, NodeTest nodeTest, Configuration configuration) { Deque<NodeInfo> precedingOrAncestor = wrapXmlObjectsAsNodeInfos( xmlObjectNode.getXmlObjectPrecedingOrAncestor(), nodeTest, configuration); return new NodeArrayIterator(precedingOrAncestor.toArray(new NodeInfo[precedingOrAncestor.size()])); }
static AxisIterator createAttributeIterator(XmlObjectNode xmlObjectNode, NodeTest nodeTest, Configuration configuration) { if (!(xmlObjectNode instanceof XmlObject)) { return EMPTY_AXIS_ITERATOR; } Deque<NodeInfo> attributes = wrapXmlObjectAttributesAsNodeInfos((XmlObject) xmlObjectNode, ((XmlObject) xmlObjectNode).getXmlObjectAttributes(), configuration, nodeTest); return new NodeArrayIterator(attributes.toArray(new NodeInfo[attributes.size()])); }
static AxisIterator createDescendantIterator(XmlObjectNode xmlObjectNode, NodeTest nodeTest, Configuration configuration) { Deque<NodeInfo> descendants = wrapXmlObjectsAsNodeInfos( xmlObjectNode.getXmlObjectDescendants(), nodeTest, configuration); return new NodeArrayIterator(descendants.toArray(new NodeInfo[descendants.size()])); }
static AxisIterator createChildIterator(XmlObjectNode xmlObjectNode, NodeTest nodeTest, Configuration configuration) { Deque<NodeInfo> children = wrapXmlObjectsAsNodeInfos(xmlObjectNode.getXmlObjectChildren(), nodeTest, configuration); return new NodeArrayIterator(children.toArray(new NodeInfo[children.size()])); }
static AxisIterator createFollowingIterator(XmlObjectNode xmlObjectNode, NodeTest nodeTest, Configuration configuration) { Deque<NodeInfo> following = wrapXmlObjectsAsNodeInfos( xmlObjectNode.getXmlObjectFollowing(), nodeTest, configuration); return new NodeArrayIterator(following.toArray(new NodeInfo[following.size()])); }
static AxisIterator createFollowingSiblingAxisIterator(XmlObjectNode xmlObjectNode, NodeTest nodeTest, Configuration configuration) { Deque<NodeInfo> followingSiblings = wrapXmlObjectsAsNodeInfos( xmlObjectNode.getXmlObjectFollowingSiblings(), nodeTest, configuration); return new NodeArrayIterator(followingSiblings.toArray(new NodeInfo[followingSiblings.size()])); }
static AxisIterator createDescendantOrSelfIterator(XmlObjectNode xmlObjectNode, NodeTest nodeTest, Configuration configuration) { Deque<NodeInfo> descendantsOrSelf = wrapXmlObjectsAsNodeInfos( xmlObjectNode.getXmlObjectDescendants(), nodeTest, configuration); descendantsOrSelf.add(wrapXmlObjectAsNodeInfo(xmlObjectNode, configuration)); return new NodeArrayIterator(descendantsOrSelf.toArray(new NodeInfo[descendantsOrSelf.size()])); }
/** * Return an enumeration over the nodes reached by the given axis from this node * @param axisNumber the axis to be iterated over * @return a AxisIterator that scans the nodes reached by the axis in turn. */ public AxisIterator iterateAxis(byte axisNumber) { switch (axisNumber) { case Axis.ANCESTOR: case Axis.PARENT: case Axis.PRECEDING_OR_ANCESTOR: return SingleNodeIterator.makeIterator(TextFragmentValue.this); case Axis.ANCESTOR_OR_SELF: NodeInfo[] nodes = {this, TextFragmentValue.this}; return new NodeArrayIterator(nodes); case Axis.ATTRIBUTE: case Axis.CHILD: case Axis.DESCENDANT: case Axis.FOLLOWING: case Axis.FOLLOWING_SIBLING: case Axis.NAMESPACE: case Axis.PRECEDING: case Axis.PRECEDING_SIBLING: return EmptyIterator.getInstance(); case Axis.SELF: case Axis.DESCENDANT_OR_SELF: return SingleNodeIterator.makeIterator(this); default: throw new IllegalArgumentException("Unknown axis number " + axisNumber); } }
/** * Return an enumeration over the nodes reached by the given axis from this node * @param axisNumber the axis to be iterated over * @return a AxisIterator that scans the nodes reached by the axis in turn. */ public AxisIterator iterateAxis(byte axisNumber) { switch (axisNumber) { case Axis.ANCESTOR: case Axis.PARENT: case Axis.PRECEDING_OR_ANCESTOR: return SingleNodeIterator.makeIterator(TextFragmentValue.this); case Axis.ANCESTOR_OR_SELF: NodeInfo[] nodes = {this, TextFragmentValue.this}; return new NodeArrayIterator(nodes); case Axis.ATTRIBUTE: case Axis.CHILD: case Axis.DESCENDANT: case Axis.FOLLOWING: case Axis.FOLLOWING_SIBLING: case Axis.NAMESPACE: case Axis.PRECEDING: case Axis.PRECEDING_SIBLING: return EmptyIterator.getInstance(); case Axis.SELF: case Axis.DESCENDANT_OR_SELF: return SingleNodeIterator.makeIterator(this); default: throw new IllegalArgumentException("Unknown axis number " + axisNumber); } }
return new NodeArrayIterator(nodes);
/** * Get an enumeration of the children of this node * @param test A NodeTest to be satisfied by the child nodes, or null * if all child node are to be returned * @return an iterator over the children of this node */ protected final AxisIterator enumerateChildren(NodeTest test) { if (children==null) { return EmptyIterator.getInstance(); } else if (children instanceof NodeImpl) { NodeImpl child = (NodeImpl)children; if (test == null || test instanceof AnyNodeTest) { return SingleNodeIterator.makeIterator(child); } else { return Navigator.filteredSingleton(child, test); } } else { if (test == null || test instanceof AnyNodeTest) { return new NodeArrayIterator((NodeImpl[])children); } else { return new ChildEnumeration(this, test); } } }
return new NodeArrayIterator(nodes);
/** * Get an enumeration of the children of this node * @param test A NodeTest to be satisfied by the child nodes, or null * if all child node are to be returned * @return an iterator over the children of this node */ protected final AxisIterator enumerateChildren(NodeTest test) { if (children==null) { return EmptyIterator.getInstance(); } else if (children instanceof NodeImpl) { NodeImpl child = (NodeImpl)children; if (test == null || test instanceof AnyNodeTest) { return SingleNodeIterator.makeIterator(child); } else { return Navigator.filteredSingleton(child, test); } } else { if (test == null || test instanceof AnyNodeTest) { return new NodeArrayIterator((NodeImpl[])children); } else { return new ChildEnumeration(this, test); } } }
if (matchesDoc && matchesText) { NodeInfo[] nodes = {this, TextFragmentValue.this}; return new NodeArrayIterator(nodes); } else if (matchesDoc && !matchesText) { return SingleNodeIterator.makeIterator(TextFragmentValue.this);