Created
December 27, 2011 05:18
-
-
Save pfmiles/1522776 to your computer and use it in GitHub Desktop.
Flexible visitor interface for AST walking...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ComparingNode implements DataFilterNode { | |
public <P, R> R accept(DataFilterVisitor<P, R> visitor, P param) { | |
return visitor.visitComparingNode(this, param); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface DataFilterNode { | |
public <P, R> R accept(DataFilterVisitor<P, R> visitor, P param); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface DataFilterVisitor<P, R> { | |
R visitUnionNode(UnionNode node, P param); | |
R visitIntersectionNode(IntersectionNode node, P param); | |
R visitComparingNode(ComparingNode comparingNode, P param); | |
...... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Or pass a newly created 'param' every time you start a new child node's visit.