public void init(Object o,int depth,int traversal){
  m_queue.clear();
  m_depth=depth;
  if (traversal < 0 || traversal >= Constants.TRAVERSAL_COUNT)   throw new IllegalArgumentException("Unrecognized traversal type: " + traversal);
  m_traversal=traversal;
  m_includeNodes=(traversal == Constants.NODE_TRAVERSAL || traversal == Constants.NODE_AND_EDGE_TRAVERSAL);
  m_includeEdges=(traversal == Constants.EDGE_TRAVERSAL || traversal == Constants.NODE_AND_EDGE_TRAVERSAL);
  if (m_includeNodes) {
    if (o instanceof Node) {
      m_queue.add(o,0);
    }
 else {
      Iterator tuples=(Iterator)o;
      while (tuples.hasNext())       m_queue.add(tuples.next(),0);
    }
  }
 else {
    if (o instanceof Node) {
      Node n=(Node)o;
      m_queue.visit(n,0);
      Iterator edges=getEdges(n);
      while (edges.hasNext()) {
        Edge e=(Edge)edges.next();
        Node nn=e.getAdjacentNode(n);
        m_queue.visit(nn,1);
        if (m_queue.getDepth(e) < 0)         m_queue.add(e,1);
      }
    }
 else {
      Iterator tuples=(Iterator)o;
      while (tuples.hasNext()) {
        Node n=(Node)tuples.next();
        m_queue.visit(n,0);
        Iterator edges=getEdges(n);
        while (edges.hasNext()) {
          Edge e=(Edge)edges.next();
          Node nn=e.getAdjacentNode(n);
          m_queue.visit(nn,1);
          if (m_queue.getDepth(e) < 0)           m_queue.add(e,1);
        }
      }
    }
  }
}

public void init ( Object o , int depth , int traversal ) { m_queue . clear ( ) ; m_depth = depth ; if ( traversal < 0 || traversal >= Constants . TRAVERSAL_COUNT ) throw new IllegalArgumentException ( "Unrecognized traversal type: " + traversal ) ; m_traversal = traversal ; m_includeNodes = ( traversal == Constants . NODE_TRAVERSAL || traversal == Constants . NODE_AND_EDGE_TRAVERSAL ) ; m_includeEdges = ( traversal == Constants . EDGE_TRAVERSAL || traversal == Constants . NODE_AND_EDGE_TRAVERSAL ) ; if ( m_includeNodes ) { if ( o instanceof Node ) { m_queue . add ( o , 0 ) ; } else { Iterator tuples = ( Iterator ) o ; while ( tuples . hasNext ( ) ) m_queue . add ( tuples . next ( ) , 0 ) ; } } else { if ( o instanceof Node ) { Node n = ( Node ) o ; m_queue . visit ( n , 0 ) ; Iterator edges = getEdges ( n ) ; while ( edges . hasNext ( ) ) { Edge e = ( Edge ) edges . next ( ) ; Node nn = e . getAdjacentNode ( n ) ; m_queue . visit ( nn , 1 ) ; if ( m_queue . getDepth ( e ) < 0 ) m_queue . add ( e , 1 ) ; } } else { Iterator tuples = ( Iterator ) o ; while ( tuples . hasNext ( ) ) { Node n = ( Node ) tuples . next ( ) ; m_queue . visit ( n , 0 ) ; Iterator edges = getEdges ( n ) ; while ( edges . hasNext ( ) ) { Edge e = ( Edge ) edges . next ( ) ; Node nn = e . getAdjacentNode ( n ) ; m_queue . visit ( nn , 1 ) ; if ( m_queue . getDepth ( e ) < 0 ) m_queue . add ( e , 1 ) ; } } } } }
initialize ( or re - initialize ) this iterator .
