Main Page | Packages | Class Hierarchy | Class List | File List | Class Members

Interpreter Class Reference

Inheritance diagram for Interpreter:

InterpreterBind InterpreterCall InterpreterDefault InterpreterIf InterpreterIterate List of all members.

Detailed Description

Superclass for the interpreters.

This abstract class implements the chain of responsibility design pattern. All argoprint specific elements are handled by classes extending this class.

Definition at line 46 of file Interpreter.java.

Public Member Functions

 Interpreter ()
 Interpreter (String tagName, ArgoPrintDataSource dataSource)
void setNextHandler (Interpreter nextHandler)
 Specifies the next Interpreter in the chain of responsibility.

void setFirstHandler (Interpreter firstHandler)
 Specifies the first Interpreter in the chain of responsibility.

void handleTag (Node tagNode, Environment env) throws Exception
 Processes the Node or sends it to the next Interpreter.


Protected Member Functions

abstract void processTag (Node tagNode, Environment env) throws Exception
 Processes a tag.

boolean canHandle (Node tagNode)
 Checks if this Interpreter can handle this Node.

Object callDataSource (String callAttr, NamedNodeMap attributes, Environment env) throws Exception
 Uses the attributes what and iterator to call the data source and return the value.

boolean isNodeNamed (Node node, String prefix, String localName)
 Checks if Node has a certain name.

Vector getVector (NodeList nodeList)
 Constructs a Vector from a NodeList.

void recurse (Vector nodes, Environment env) throws Exception
 Recurses on every Node in the Vector.


Protected Attributes

Interpreter _firstHandler
 A reference to the first handler in the chain of responsibility, for recursion.

ArgoPrintDataSource _dataSource
 A reference to the data source to use.


Static Protected Attributes

final String PREFIX = "ap"
 The namespace prefix identifying the elements that shall be processed.


Constructor & Destructor Documentation

Interpreter  ) 
 

Definition at line 63 of file Interpreter.java.

Interpreter String  tagName,
ArgoPrintDataSource  dataSource
 

Parameters:
tagName The name of the tag that this Interpreter can process.
dataSource The ArgoPrintDataSource that this Interpreter should fetch data from.

Definition at line 71 of file Interpreter.java.

References Interpreter._dataSource, and Interpreter._firstHandler.


Member Function Documentation

Object callDataSource String  callAttr,
NamedNodeMap  attributes,
Environment  env
throws Exception [protected]
 

Uses the attributes what and iterator to call the data source and return the value.

Parameters:
callAttr The name of the attribute containing the call.
attributes A NamedNodeMap of map of attributes that must contain at least the attribute what.
env The Environment in which to process the call.
Returns:
The Object as returned from the data source.
Exceptions:
Exception 

Definition at line 146 of file Interpreter.java.

References Interpreter._dataSource, ArgoPrintDataSource.caller(), and ArgoPrintIterator.currentObject().

Referenced by InterpreterIterate.processTag(), InterpreterIf.processTag(), and InterpreterCall.processTag().

boolean canHandle Node  tagNode  )  [protected]
 

Checks if this Interpreter can handle this Node.

Parameters:
tagNode The Node to check.

Reimplemented in InterpreterDefault.

Definition at line 126 of file Interpreter.java.

References Interpreter.PREFIX.

Referenced by Interpreter.handleTag().

Vector getVector NodeList  nodeList  )  [protected]
 

Constructs a Vector from a NodeList.

Parameters:
nodeList The NodeList
Returns:
A vector with the same ordering as the NodeList.

Definition at line 188 of file Interpreter.java.

Referenced by InterpreterIf.processTag(), InterpreterDefault.processTag(), and InterpreterBind.processTag().

void handleTag Node  tagNode,
Environment  env
throws Exception
 

Processes the Node or sends it to the next Interpreter.

Parameters:
tagNode The Node to handle.
env The environment in which the Node is to be processed.

Definition at line 102 of file Interpreter.java.

References Interpreter.canHandle(), and Interpreter.processTag().

Referenced by Main.go(), InterpreterIterate.processTag(), InterpreterBind.processTag(), and Interpreter.recurse().

boolean isNodeNamed Node  node,
String  prefix,
String  localName
[protected]
 

Checks if Node has a certain name.

Parameters:
node The node to check
prefix The namespace prefix
localName The local name
Returns:

Definition at line 175 of file Interpreter.java.

Referenced by InterpreterIf.processTag(), and InterpreterBind.processTag().

abstract void processTag Node  tagNode,
Environment  env
throws Exception [protected, pure virtual]
 

Processes a tag.

Parameters:
tagNode The tag to process.
env The environment in which to process it.

Implemented in InterpreterBind, InterpreterCall, InterpreterDefault, InterpreterIf, and InterpreterIterate.

Referenced by Interpreter.handleTag().

void recurse Vector  nodes,
Environment  env
throws Exception [protected]
 

Recurses on every Node in the Vector.

Parameters:
nodes A vector containing Nodes.
env 
Exceptions:
Exception 

Definition at line 204 of file Interpreter.java.

References Interpreter._firstHandler, and Interpreter.handleTag().

Referenced by InterpreterIf.processTag(), InterpreterDefault.processTag(), and InterpreterBind.processTag().

void setFirstHandler Interpreter  firstHandler  ) 
 

Specifies the first Interpreter in the chain of responsibility.

Parameters:
firstHandler The first Interpreter.

Definition at line 92 of file Interpreter.java.

References Interpreter._firstHandler.

Referenced by Main.Main().

void setNextHandler Interpreter  nextHandler  ) 
 

Specifies the next Interpreter in the chain of responsibility.

Parameters:
nextHandler The next Interpreter.

Definition at line 83 of file Interpreter.java.

Referenced by Main.Main().


Member Data Documentation

ArgoPrintDataSource _dataSource [protected]
 

A reference to the data source to use.

Definition at line 61 of file Interpreter.java.

Referenced by Interpreter.callDataSource(), and Interpreter.Interpreter().

Interpreter _firstHandler [protected]
 

A reference to the first handler in the chain of responsibility, for recursion.

Definition at line 57 of file Interpreter.java.

Referenced by Interpreter.Interpreter(), InterpreterIterate.processTag(), InterpreterBind.processTag(), Interpreter.recurse(), and Interpreter.setFirstHandler().

final String PREFIX = "ap" [static, protected]
 

The namespace prefix identifying the elements that shall be processed.

Definition at line 50 of file Interpreter.java.

Referenced by Interpreter.canHandle(), InterpreterIf.processTag(), and InterpreterBind.processTag().


The documentation for this class was generated from the following file:
Generated on Tue Dec 2 22:50:56 2003 for ArgoPrint by doxygen 1.3.4