// CLASS DICTIONARY
//==========================================================
// solving the capacity checking problem from hw 2
// without modifying the host
// visitor has own stack to keep track of initial value
// is also an exercise with Java wrapper classes (Integer).

// package RecursiveContainer;
import edu.neu.ccs.demeter.dj.*; // no concept of subpackages in Java
import java.util.*;

Container = "(" 
  <contents> List(Item) <capacity> Capacity ")" .
Item : Container | Simple.
List(S) ~ {S}.
Simple =  <name> Ident <w> Weight.
Capacity = <i> Integer.
Weight = <i> Integer.

CheckingVisitorDJ = <iV> DifferenceVisitorDJ <violations> int extends Visitor.
SummingVisitorDJ = <total> int extends Visitor.
DifferenceVisitorDJ = // takes care of computing difference  
  <difference> int 
  <stack> Stack   
  <sV> SummingVisitorDJ extends Visitor. 

Main = .