1 public class movevisitor extends visitor 2 { 3 protected float deltaX; 4 protected float deltaY; 5 6 public movevisitor(float x, float y) 7 { 8 deltaX=x; 9 deltaY=y; 10 } 11 12 public void visitPOINT (point p) 13 { 14 p.set(p.X+deltaX,p.Y+deltaY); 15 } 16 17 public void visitLINE (line l) 18 { 19 l.Begin.receive(this); 20 l.End.receive(this); 21 } 22 23 public void visitCIRCLE (circle c) 24 { 25 c.Center.receive(this); 26 } 27 }