@@ -0,0 +1,2340 @@
+package com.oozinoz.util;%0A%0Aimport java.util.*;%0A%0A/*%0A * Copyright (c) 2001 Steven J. Metsker.%0A * %0A * Steve Metsker makes no representations or warranties about%0A * the fitness of this software for any particular purpose, %0A * including the implied warranty of merchantability.%0A *%0A * Please use this software as you wish with the sole%0A * restriction that you may not claim that you wrote it.%0A */%0A %0A/**%0A * This is the abstract superclass of iterators that can%0A * walk across leaf nodes and composite nodes in a%0A * composite structure.%0A * %3Cp%3E%0A * The depth of an iterator is, for the current iteration, %0A * the number of iterators above it. A typical iterator %0A * walks over a composite, iterating over each child. Each %0A * child, however, may also be a composite, so iterating %0A * over a child means iterating over a child's children. In %0A * a tree structure, the root iterator will at any point be %0A * iterating over one of its children. This child will be %0A * iterating over its children. This recurses down to %0A * component that is either a leaf or it a node that has %0A * been visited before. The depth of iteration, then, is %0A * the depth of a subiterator plus one.%0A *%0A * @author Steven J. Metsker%0A *%0A */%0Apublic abstract class ComponentIterator %0A%7B%0A%0A%0A%09protected Object node;%0A%09protected boolean showInterior = true;%0A%09protected Set visited = new HashSet();%0A%0A/**%0A * Create an iterator over a node in a composite.%0A *%0A * @param node the node to iterate over%0A * @param visited a set to track visited nodes%0A */%0Apublic ComponentIterator(Object node, Set visited)%0A%7B%0A%09this.node = node;%0A%09this.visited = visited;%0A%7D%0A%0A/**%0A * Return the current depth of the iteration%0A *%0A * @return the current depth of the iteration (that is, for%0A *         the current node the number of nodes above it)%0A */%0Apublic abstract int depth();%0A%0A/**%0A * Return true if there is another node to see%0A *%0A * @return true if there is another node to see%0A */%0Apublic abstract boolean hasNext();%0A%0A/**%0A * Return the next node in the iteration%0A *%0A * @return the next node in the iteration%0A */%0Apublic abstract Object next();%0A%0A/**%0A * Determine whether interior (non-leaf) nodes should%0A * appear in iteration.%0A *%0A * @param boolean if true, interior nodes can be returned%0A *                from next()%0A */%0Apublic void setShowInterior(boolean showInterior)%0A%7B%0A%09this.showInterior = showInterior;%0A%7D%0A%7D%0A

Create ComponentIterator.java