@@ -0,0 +1,749 @@
+// --------------------- %E6%8A%BD%E8%B1%A1%E5%85%83%E7%B4%A0%0A%0Apublic abstract class Element %7B%0A    public abstract void doSomething();%0A    public abstract void accept(Visitor visitor);%0A%7D%0A%0A// --------------------- %E5%85%B7%E4%BD%93%E5%85%83%E7%B4%A0%0A%0Apublic class ConcreteElement extends Element %7B%0A    public void doSomething() %7B%0A        System.out.println(%22ConcreteElement doSomething...%22);%0A    %7D%0A%0A    public void accept(Visitor visitor) %7B%0A        visitor.visit(this);%0A    %7D%0A%7D%0A%0A// --------------------- %E5%85%B7%E4%BD%93%E8%AE%BF%E9%97%AE%E8%80%85%0A%0Apublic class Visitor %7B%0A    public void visit(ConcreteElement element) %7B%0A        element.doSomething();%0A    %7D%0A%7D%0A%0A// --------------------- test code%0A%0Apublic static void main(String%5B%5D args) %7B%0A    Visitor visitor = new Visitor();%0A    Element element = new ConcreteElement();%0A%0A    element.accept(visitor);%0A%7D

add visitor pattern