Tutorial 4: StructureBuilder, Visitor Pattern


Introduction

This tutorial covers:


I. Visitor Pattern for Evaluating Arithmetic Expressions

Here are the same grammar rules as in tutorial #3. We will use the visitor pattern to evaluate arithmetic expression objects instead.

Here is the UML specification.

Exercises:

  1. Implement (i.e. write Java code) for each of the classes in the UML diagram as specified. Use StructureBuilder to design the class structure. Your labbies will show you how to use StructureBuilder. solutions
  2. Write test code to test your design solution (the solution contains very incomplete test code).

II. StructureBuilder

D. X. Nguyen, Sept. 26, 1999.
dxnguyen@cs.rice.edu