RSS feed
[root]
/
document
/
software design
/
Design pattern example in aspect programming
/
visitor
/
aspectj
/
examples
login:
password:
title search:
Search this site
Enter your search terms
Web
www.carfield.com.hk
Submit search form
Prev
Next
Wed Mar 24 16:00:00 GMT 2004
Visitor
public abstract aspect Visitor { // To make sure that all visitors are treated equally and can be // passed on as arguments, we define an interface for them: // // Defining the method signatures here reduces reusability of // the abstract aspect, but ensures type safety interface VNode {} interface VRegularNode extends VNode{} interface VLeaf extends VNode {} public interface NodeVisitor { public void visitRegularNode(VNode node); public void visitLeaf(VNode node); public String report(); } // The individual accept() code is attached to the appropriate // classes in the element structure: public void VNode.accept(NodeVisitor nv) {} public void VRegularNode.accept(NodeVisitor nv) { nv.visitRegularNode(this); } public void VLeaf.accept(NodeVisitor nv) { nv.visitLeaf(this); } }
(google search)
(amazon search)
1
2
3
second
download zip of files only
Prev
Next