java Main < program.input CopyVisitor { (@ Stack history; void Init(String firstClass) { this.history = new Stack(); try { this.history.push(Class.forName(firstClass).newInstance()); } catch(Exception e) { e.printStackTrace(); } } Object GetResult() { return history.peek(); } @) before -> A,b,B (@ A containingObject = (A)history.peek(); Class theClass = dest.getClass(); Object newPartObject = null; try { newPartObject = theClass.newInstance(); } catch(Exception e) { e.printStackTrace(); } containingObject.set_b((B)newPartObject); this.history.push(newPartObject); @) after -> A,b,B (@ this.history.pop(); @) before -> A,c,C (@ A containingObject = (A)history.peek(); Class theClass = dest.getClass(); Object newPartObject = null; try { newPartObject = theClass.newInstance(); } catch(Exception e) { e.printStackTrace(); } containingObject.set_c((C)newPartObject); this.history.push(newPartObject); @) after -> A,c,C (@ this.history.pop(); @) before C (@ C theObject = (C)history.peek(); theObject.set_i(host.get_i()); @) before -> D,a,A (@ D containingObject = (D)history.peek(); Class theClass = dest.getClass(); Object newPartObject = null; try { newPartObject = theClass.newInstance(); } catch(Exception e) { e.printStackTrace(); } containingObject.set_a((A)newPartObject); this.history.push(newPartObject); @) after -> D,a,A (@ this.history.pop(); @) before D (@ D theObject = (D)history.peek(); theObject.set_s(host.get_s()); @) before CountingVisitor (@ CountingVisitor theObject = (CountingVisitor)history.peek(); theObject.set_total(host.get_total()); @) }