up
Class DefaultTreeHandler

java.lang.Object
  extended by up.DefaultTreeHandler
All Implemented Interfaces:
TreeHandler
Direct Known Subclasses:
GrammarExtractor, ParserHandler, TransformerHandler, TreeCounter, TreePrinter

public class DefaultTreeHandler
extends java.lang.Object
implements TreeHandler

Default implementation of the TreeHandler interface. This implementation provides functionality to build simple pipes of tree handlers, where a given handler can pass on notifications to its successor in the pipe.


Constructor Summary
DefaultTreeHandler()
          Constructs a new handler with no successor.
DefaultTreeHandler(TreeHandler successor)
          Constructs a new handler with the specified successor.
 
Method Summary
 void exit()
          Notifies the successor of this handler about the end of the stream.
 TreeHandler getSuccessor()
          Returns the successor of this handler.
 void init()
          Notifies the successor of this handler about the start of the stream.
 void next(Tree tree)
          Notifies the successor of this handler about the specified tree.
 void setSuccessor(TreeHandler handler)
          Replaces the successor of this handler with the specified handler.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultTreeHandler

public DefaultTreeHandler(TreeHandler successor)
Constructs a new handler with the specified successor.

Parameters:
successor - the successor of this handler

DefaultTreeHandler

public DefaultTreeHandler()
Constructs a new handler with no successor.

Method Detail

getSuccessor

public TreeHandler getSuccessor()
Returns the successor of this handler.

Returns:
the successor of this handler

setSuccessor

public void setSuccessor(TreeHandler handler)
Replaces the successor of this handler with the specified handler.

Parameters:
handler - the new successor of this handler

init

public void init()
Notifies the successor of this handler about the start of the stream.

Specified by:
init in interface TreeHandler

next

public void next(Tree tree)
Notifies the successor of this handler about the specified tree.

Specified by:
next in interface TreeHandler
Parameters:
tree - the tree about which the successor of this handler is to be notified

exit

public void exit()
Notifies the successor of this handler about the end of the stream.

Specified by:
exit in interface TreeHandler