/** * Determine whether this is the same node as another node. DOM Level 3 method. * @return true if this Node object and the supplied Node object represent the * same node in the tree. */ public final boolean isSameNode(Node other) { if (other instanceof NodeOverNodeInfo) { return node.isSameNodeInfo(((NodeOverNodeInfo)other).node); } else { return false; } }
/** * Determine whether this is the same node as another node. <br /> * Note: a.isSameNode(b) if and only if generateId(a)==generateId(b) * @return true if this Node object and the supplied Node object represent the * same node in the tree. */ public boolean isSameNodeInfo(NodeInfo other) { if (other instanceof StrippedNode) { return node.isSameNodeInfo(((StrippedNode)other).node); } else { return node.isSameNodeInfo(other); } }
/** * Determine whether this is the same node as another node. <br /> * Note: a.isSameNode(b) if and only if generateId(a)==generateId(b) * @return true if this Node object and the supplied Node object represent the * same node in the tree. */ public boolean isSameNodeInfo(NodeInfo other) { if (other instanceof StrippedNode) { return node.isSameNodeInfo(((StrippedNode)other).node); } else { return node.isSameNodeInfo(other); } }
/** * Determine whether this is the same node as another node. <br /> * Note: a.isSameNode(b) if and only if generateId(a)==generateId(b) * @return true if this Node object and the supplied Node object represent the * same node in the tree. */ public boolean isSameNodeInfo(NodeInfo other) { if (other instanceof StrippedNode) { return node.isSameNodeInfo(((StrippedNode)other).node); } else { return node.isSameNodeInfo(other); } }
/** * Determine whether this is the same node as another node. * Note: a.isSameNodeInfo(b) if and only if generateId(a)==generateId(b). * This method has the same semantics as isSameNode() in DOM Level 3, but * works on Saxon NodeInfo objects rather than DOM Node objects. * * @param other the node to be compared with this node * @return true if this NodeInfo object and the supplied NodeInfo object represent * the same node in the tree. */ public boolean isSameNodeInfo(NodeInfo other) { return other instanceof NamespaceNodeImpl && element.isSameNodeInfo(((NamespaceNodeImpl)other).element) && nscode == ((NamespaceNodeImpl)other).nscode; }
/** * Determine whether this is the same node as another node. * Note: a.isSameNodeInfo(b) if and only if generateId(a)==generateId(b). * This method has the same semantics as isSameNode() in DOM Level 3, but * works on Saxon NodeInfo objects rather than DOM Node objects. * * @param other the node to be compared with this node * @return true if this NodeInfo object and the supplied NodeInfo object represent * the same node in the tree. */ public boolean isSameNodeInfo(NodeInfo other) { return this == other || !(other instanceof UnconstructedParent) && node != null && node.isSameNodeInfo(other); }
/** * Determine whether this is the same node as another node. * Note: a.isSameNodeInfo(b) if and only if generateId(a)==generateId(b). * This method has the same semantics as isSameNode() in DOM Level 3, but * works on Saxon NodeInfo objects rather than DOM Node objects. * * @param other the node to be compared with this node * @return true if this NodeInfo object and the supplied NodeInfo object represent * the same node in the tree. */ public boolean isSameNodeInfo(NodeInfo other) { return other instanceof NamespaceNodeImpl && element.isSameNodeInfo(((NamespaceNodeImpl)other).element) && nscode == ((NamespaceNodeImpl)other).nscode; }
/** * Determine whether this is the same node as another node. * Note: a.isSameNodeInfo(b) if and only if generateId(a)==generateId(b). * This method has the same semantics as isSameNode() in DOM Level 3, but * works on Saxon NodeInfo objects rather than DOM Node objects. * * @param other the node to be compared with this node * @return true if this NodeInfo object and the supplied NodeInfo object represent * the same node in the tree. */ public boolean isSameNodeInfo(NodeInfo other) { return other instanceof VirtualCopy && documentNumber == other.getDocumentNumber() && original.isSameNodeInfo(((VirtualCopy)other).original); }
/** * Test whether a node is an ancestor-or-self of another * @param a the putative ancestor * @param d the putative descendant * @return true if a is an ancestor of d */ private boolean isAncestorOrSelf(NodeInfo a, NodeInfo d) { while (true) { if (a.isSameNodeInfo(d)) { return true; } d = d.getParent(); if (d == null) { return false; } } }
public Item next() throws XPathException { while (true) { NodeInfo next = (NodeInfo)iterator.next(); if (next == null) { current = null; position = -1; return null; } if (current != null && next.isSameNodeInfo(current)) { continue; } else { position++; current = next; return current; } } }
/** * Test whether a node is an ancestor-or-self of another * @param a the putative ancestor * @param d the putative descendant * @return true if a is an ancestor of d */ private boolean isAncestorOrSelf(NodeInfo a, NodeInfo d) { while (true) { if (a.isSameNodeInfo(d)) { return true; } d = d.getParent(); if (d == null) { return false; } } }
/** * The <code>equals()</code> relation between two XdmNode objects is true if they both represent the same * node. That is, it corresponds to the "is" operator in XPath. * * @param other the object to be compared * @return true if and only if the other object is an XdmNode instance representing the same node */ public boolean equals(Object other) { return other instanceof XdmNode && getUnderlyingNode().isSameNodeInfo(((XdmNode) other).getUnderlyingNode()); }
private boolean compareIdentity(NodeInfo node1, NodeInfo node2) { switch (operator) { case Token.IS: return node1.isSameNodeInfo(node2); case Token.PRECEDES: return GlobalOrderComparer.getInstance().compare(node1, node2) < 0; case Token.FOLLOWS: return GlobalOrderComparer.getInstance().compare(node1, node2) > 0; default: throw new UnsupportedOperationException("Unknown node identity test"); } }
/** * Determine whether this node has the is-id property * * @return true if the node is an ID */ public boolean isId() { // this looks very inefficient, but the method isn't actually used... return getDocumentRoot().selectID(getStringValue()).isSameNodeInfo(this); }
private boolean compareIdentity(NodeInfo node1, NodeInfo node2) { switch (operator) { case Token.IS: return node1.isSameNodeInfo(node2); case Token.PRECEDES: return GlobalOrderComparer.getInstance().compare(node1, node2) < 0; case Token.FOLLOWS: return GlobalOrderComparer.getInstance().compare(node1, node2) > 0; default: throw new UnsupportedOperationException("Unknown node identity test"); } }
/** * Determine whether this node has the is-id property * * @return true if the node is an ID */ public boolean isId() { // this looks very inefficient, but the method isn't actually used... return getDocumentRoot().selectID(getStringValue()).isSameNodeInfo(this); }
/** * Determine whether this node has the is-id property * * @return true if the node is an ID */ public boolean isId() { // this looks very inefficient, but the method isn't actually used... return getDocumentRoot().selectID(getStringValue()).isSameNodeInfo(this); }
private boolean compareIdentity(NodeInfo node1, NodeInfo node2) { switch (operator) { case Token.IS: return node1.isSameNodeInfo(node2); case Token.PRECEDES: return GlobalOrderComparer.getInstance().compare(node1, node2) < 0; case Token.FOLLOWS: return GlobalOrderComparer.getInstance().compare(node1, node2) > 0; default: throw new UnsupportedOperationException("Unknown node identity test"); } }
/** * Determine whether this node has the is-id property * * @return true if the node is an ID */ public boolean isId() { // this looks very inefficient, but the method isn't actually used... return getDocumentRoot().selectID(getStringValue()).isSameNodeInfo(this); }
/** * Determine whether this node has the is-id property * * @return true if the node is an ID */ public boolean isId() { // this looks very inefficient, but the method isn't actually used... return getDocumentRoot().selectID(getStringValue()).isSameNodeInfo(this); }