1 19 package org.netbeans.tax.traversal; 20 21 import org.netbeans.tax.TreeNode; 22 import org.netbeans.tax.InvalidStateException; 23 24 29 public final class TreeNodeIterator { 30 31 private TreeNode root; 32 33 34 private int whatToShow; 35 36 37 private TreeNodeFilter filter; 38 39 40 private boolean valid; 41 42 43 48 public TreeNodeIterator (TreeNode node, int wTS, TreeNodeFilter f) { 49 root = node; 50 whatToShow = wTS; 51 filter = f; 52 53 valid = true; 54 } 55 56 57 59 public TreeNode getRoot () { 60 return root; 61 } 62 63 65 public int getWhatToShow () { 66 return whatToShow; 67 } 68 69 71 public TreeNodeFilter getFilter () { 72 return filter; 73 } 74 75 77 public TreeNode nextNode () throws InvalidStateException { 78 if (!!! valid) { 79 throw new InvalidStateException (Util.THIS.getString ("EXC_TreeNodeIterator.nextNode")); 80 } 81 82 if ( Util.THIS.isLoggable() ) Util.THIS.debug ("[PENDING]: TreeNodeIterator.nextNode ()"); return null; 84 } 85 86 88 public TreeNode previousNode () throws InvalidStateException { 89 if (!!! valid) { 90 throw new InvalidStateException (Util.THIS.getString ("EXC_TreeNodeIterator.previousNode")); 91 } 92 93 if ( Util.THIS.isLoggable() ) Util.THIS.debug ("[PENDING]: TreeNodeIterator.nextNode ()"); return null; 95 } 96 97 99 public void detach () { 100 valid = false; 101 } 102 103 } 104 | Popular Tags |