# NOT A PART OF SEAMONKEY IN ANY WAY
Some new, some old filres copiedfrom Rhino to form start of prototyping environment for Project Brenda git-svn-id: svn://10.0.0.236/trunk@27571 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
41
mozilla/js/js2/java/PostorderNodeIterator.java
Normal file
41
mozilla/js/js2/java/PostorderNodeIterator.java
Normal file
@@ -0,0 +1,41 @@
|
||||
|
||||
import java.util.Stack;
|
||||
|
||||
class PostorderNodeIterator {
|
||||
|
||||
PostorderNodeIterator(Node n)
|
||||
{
|
||||
stack = new Stack();
|
||||
while (n.first != null) {
|
||||
stack.push(n);
|
||||
n = n.first;
|
||||
}
|
||||
start = n;
|
||||
}
|
||||
|
||||
Node nextNode()
|
||||
{
|
||||
if (current == null)
|
||||
return current = start;
|
||||
|
||||
if (stack.isEmpty())
|
||||
return null;
|
||||
else {
|
||||
current = current.next;
|
||||
if (current != null) {
|
||||
while (current.first != null) {
|
||||
stack.push(current);
|
||||
current = current.first;
|
||||
}
|
||||
}
|
||||
else
|
||||
current = (Node)stack.pop();
|
||||
}
|
||||
|
||||
return current;
|
||||
}
|
||||
|
||||
Node start;
|
||||
Node current;
|
||||
Stack stack;
|
||||
}
|
||||
Reference in New Issue
Block a user