Language Processing
v2.0

step01
Class Adder

Object
  extended by Adder
All Implemented Interfaces:
Visitor

public class Adder
extends Object
implements Visitor

a visitor to compute the value of an XML-based arithmetic expression.


Constructor Summary
Adder()
           
 
Method Summary
 Integer add(Element e)
          deal with <add>.
 Integer document(Document d)
          delegate to the document's root element.
 Integer element(Element e)
          delegate to methods based on element name.
static void main(String... arg)
          take a XML-based arithmetic expression from standard input and write the value to standard output.
 Integer number(Element e)
          deal with <number>.
 Integer subtract(Element e)
          deal with <subtract>.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Adder

public Adder()
Method Detail

document

public Integer document(Document d)
delegate to the document's root element.

Specified by:
document in interface Visitor

element

public Integer element(Element e)
delegate to methods based on element name.

Specified by:
element in interface Visitor

add

public Integer add(Element e)
deal with <add>.


subtract

public Integer subtract(Element e)
deal with <subtract>.


number

public Integer number(Element e)
deal with <number>.


main

public static void main(String... arg)
                 throws Exception
take a XML-based arithmetic expression from standard input and write the value to standard output.

Throws:
Exception


(c) 2008 Axel T. Schreiner