coins.ast
クラス TreeWalker

java.lang.Object
  |
  +--coins.ast.TreeWalker

public class TreeWalker
extends java.lang.Object

A helper class for traversing a tree.


入れ子クラスの概要
(パッケージプライベート) static class TreeWalker.NodeList
           
 
コンストラクタの概要
TreeWalker(ASTree root)
           
 
メソッドの概要
 ASTree begin()
          Moves to the leftmost leaf node.
 TreeWalker copy()
          Makes a copy of the TreeWalker object.
 ASTree current()
          Returns the object at the current position.
 ASTree left()
          Move to the left child.
 ASTree next()
          Move to the next node in the post-order traversal.
 ASTree parent()
          Move to the parent.
 ASTree right()
          Move to the right child.
 
クラス java.lang.Object から継承したメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

コンストラクタの詳細

TreeWalker

public TreeWalker(ASTree root)
メソッドの詳細

copy

public TreeWalker copy()
Makes a copy of the TreeWalker object. The current position is also copied.


begin

public ASTree begin()
Moves to the leftmost leaf node. This method must be called before next() is called.


next

public ASTree next()
Move to the next node in the post-order traversal. This method skips a Pair node.


current

public ASTree current()
Returns the object at the current position. This method returns null if parent() is called when the current position is a root node.


left

public ASTree left()
Move to the left child. This method returns null if the current position is a leaf node.


right

public ASTree right()
Move to the right child. This method returns null if the current position is a leaf node.


parent

public ASTree parent()
Move to the parent. This method returns null if the current position is a root node.