Main { // main program (@ public static void main(String args[]) throws Exception { A parsed = A.parse(System.in); A parsed2 = A.parse(System.in); System.out.println("parsed..."); if(parsed.Equal(parsed2)) { System.out.println("Equal."); } else { System.out.println("Not Equal."); } } @) } A { traversal EqualTraversal(EqualVisitor v) { to *; } (@ boolean Equal(A second) { EqualVisitor v = new EqualVisitor(); v.SetSecond(second); this.EqualTraversal(v); return v.IsEqual(); } @) } EqualVisitor { (@ boolean equal = true; Vector history = new Vector(); void SetSecond(Object second) { this.history = new Vector(); this.equal = true; this.history.addElement(second); } boolean IsEqual() { return this.equal; } @) before EqualVisitor (@ Object second = this.history.elementAt(this.history.size() - 1); if(this.equal) { if(second.getClass().toString().compareTo(host.getClass().toString()) != 0) { this.equal = false; } } @) before Main (@ Object second = this.history.elementAt(this.history.size() - 1); if(this.equal) { if(second.getClass().toString().compareTo(host.getClass().toString()) != 0) { this.equal = false; } } @) before A (@ Object second = this.history.elementAt(this.history.size() - 1); if(this.equal) { if(second.getClass().toString().compareTo(host.getClass().toString()) != 0) { this.equal = false; } } @) before B (@ Object second = this.history.elementAt(this.history.size() - 1); if(this.equal) { if(second.getClass().toString().compareTo(host.getClass().toString()) != 0) { this.equal = false; } } @) before C (@ Object second = this.history.elementAt(this.history.size() - 1); if(this.equal) { if(second.getClass().toString().compareTo(host.getClass().toString()) != 0) { this.equal = false; } if(this.equal) { if(!host.get_integer().equals(((C)second).get_integer())) { this.equal = false; } } } @) before D (@ Object second = this.history.elementAt(this.history.size() - 1); if(this.equal) { if(second.getClass().toString().compareTo(host.getClass().toString()) != 0) { this.equal = false; } if(this.equal) { if(!host.get_integer().equals(((D)second).get_integer())) { this.equal = false; } } } @) before -> A,b,B (@ if(this.equal) { Object second = this.history.elementAt(this.history.size() - 1); this.history.addElement(((A)second).get_b()); } @) after -> A,b,B (@ if(this.equal) { this.history.removeElementAt(this.history.size() - 1); } @) before -> A,c,C (@ if(this.equal) { Object second = this.history.elementAt(this.history.size() - 1); this.history.addElement(((A)second).get_c()); } @) after -> A,c,C (@ if(this.equal) { this.history.removeElementAt(this.history.size() - 1); } @) }