 /*______________________________________________________________________________
                                                       WWS Coding Team

    Traversal.java
      7/31/98

      Generic Traversal class. 
      
      Developed by:     David Wagstaff
                        Jeff Sabin

      Disclaimer:

            This program is an unpublished copyrighted work which is proprietary
            to Novell, Inc. and contains confidential information that is not
            to be reproduced or disclosed to any other person or entity without
            prior written consent from Novell, Inc. in each and every instance.

            WARNING:  Unauthorized reproduction of this program as well as
            unauthorized preparation of derivative works based upon the
            program or distribution of copies by sale, rental, lease or
            lending are violations of federal copyright laws and state trade
            secret laws, punishable by civil and criminal penalties.

______________________________________________________________________________*/


/**
  *
  * Generic Traversal class. 
  * 
  * @version 1.0 7/31/98
  * @author Jeff Sabin/David Wagstaff
  *
  */
class Traversal
	{
	public Traversal() {}

	private void traverse(Visitor v, Object o, Strategy s)
		{
		while (s.hasMoreChildren(o))
			{
			Object child=s.nextChild(o);
			v.before(child);
			if (s.hasMoreChildren(child))
				traverse(v,child,s);
			v.after(child);
			}
		} 

	public void traverse(Object o, Visitor v, Strategy s)
		{
		v.before(this); //before traversing
		v.before(o);	//before root object
		traverse(v,o,s);
		v.after(o);		//after root object
		v.after(this);	//after traversing
		}
 	}

