home *** CD-ROM | disk | FTP | other *** search
- package javax.awt.swing.tree;
-
- import java.util.EmptyStackException;
- import java.util.Enumeration;
- import java.util.NoSuchElementException;
- import java.util.Stack;
-
- final class DefaultMutableTreeNode$PathBetweenNodesEnumeration implements Enumeration {
- // $FF: synthetic field
- private final DefaultMutableTreeNode this$0;
- protected Stack stack;
-
- public DefaultMutableTreeNode$PathBetweenNodesEnumeration(DefaultMutableTreeNode this$0, TreeNode ancestor, TreeNode descendant) {
- this.this$0 = this$0;
- this.this$0 = this$0;
- if (ancestor != null && descendant != null) {
- this.stack = new Stack();
- this.stack.push(descendant);
- TreeNode current = descendant;
-
- while(current != ancestor) {
- current = current.getParent();
- if (current == null && descendant != ancestor) {
- throw new IllegalArgumentException("node " + ancestor + " is not an ancestor of " + descendant);
- }
-
- this.stack.push(current);
- }
-
- } else {
- throw new IllegalArgumentException("argument is null");
- }
- }
-
- public boolean hasMoreElements() {
- return this.stack.size() > 0;
- }
-
- public Object nextElement() {
- try {
- return this.stack.pop();
- } catch (EmptyStackException var1) {
- throw new NoSuchElementException("No more elements");
- }
- }
- }
-