code: public int countNumOfAvailableNodes(String scope,
                                        Collection<Node> excludedNodes) {
      boolean isExcluded=false;
      if (scope.startsWith("~")) {
        isExcluded=true;
        scope=scope.substring(1);
      }
      scope = NodeBase.normalize(scope);
      int count=0; // the number of nodes in both scope & excludedNodes
      netlock.readLock().lock();
      try {
        for(Node node:excludedNodes) {
          if ((NodeBase.getPath(node)+NodeBase.PATH_SEPARATOR_STR).
              startsWith(scope+NodeBase.PATH_SEPARATOR_STR)) {
            count++;
          }
        }
        Node n=getNode(scope);
        int scopeNodeCount=1;
        if (n instanceof InnerNode) {
          scopeNodeCount=((InnerNode)n).getNumOfLeaves();
        }
        if (isExcluded) {
          return clusterMap.getNumOfLeaves()-
            scopeNodeCount-excludedNodes.size()+count;
        } else {
          return scopeNodeCount-count;
        }
      } finally {
        netlock.readLock().unlock();
      }
    }
docs: return the number of leaves in <i>scope</i> but not in <i>excludedNodes</i>
  if scope starts with ~, return the number of nodes that are not
  in <i>scope</i> and <i>excludedNodes</i>;
  @param scope a path string that may start with ~
  @param excludedNodes a list of nodes
  @return number of available nodes