コード例 #1
0
 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;
 }
コード例 #2
0
 /**
  * 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;
 }