public NodeSet except(NodeSet other) { AVLTreeNodeSet r = new AVLTreeNodeSet(); NodeProxy l; for (Iterator i = iterator(); i.hasNext(); ) { l = (NodeProxy) i.next(); if (!other.contains(l)) { r.add(l); } } return r; }
/** * Return a new node set which represents the union of the current node set and the given node * set. * * @param other */ public NodeSet union(NodeSet other) { NewArrayNodeSet result = new NewArrayNodeSet(); result.addAll(other); NodeProxy p, c; for (Iterator i = iterator(); i.hasNext(); ) { p = (NodeProxy) i.next(); if (other.contains(p)) { c = other.get(p); if (c != null) c.addMatches(p); } else result.add(p); } return result; }