public TreeNodeIterator(Node root,boolean preorder){
  m_preorder=preorder;
  m_root=root;
  m_stack=new ArrayList();
  m_stack.add(root);
  if (!preorder) {
    for (Node n=root.getChild(0); n != null; n=n.getChild(0))     m_stack.add(n);
  }
}

public TreeNodeIterator ( Node root , boolean preorder ) { m_preorder = preorder ; m_root = root ; m_stack = new ArrayList ( ) ; m_stack . add ( root ) ; if ( ! preorder ) { for ( Node n = root . getChild ( 0 ) ; n != null ; n = n . getChild ( 0 ) ) m_stack . add ( n ) ; } }
create a new treenodeiterator over the given subtree .
