]> git.uio.no Git - ifi-stolz-refaktor.git/blob - case-study/refaktor-after/src/no/uio/ifi/refaktor/analyze/collectors/PropertyCollector.java
Case Study: adding data and statistics
[ifi-stolz-refaktor.git] / case-study / refaktor-after / src / no / uio / ifi / refaktor / analyze / collectors / PropertyCollector.java
1 package no.uio.ifi.refaktor.analyze.collectors;
2
3 import no.uio.ifi.refaktor.textselection.CompilationUnitTextSelection;
4
5 import org.eclipse.jdt.core.dom.ASTNode;
6 import org.eclipse.jdt.core.dom.ASTVisitor;
7
8 /**
9  * A PropertyCollector is responsible for collecting
10  * properties from an AST, and in particular, properties
11  * from within a selection.
12  * 
13  * If the visitor shall be limited to visiting nodes inside
14  * the selection, then subclasses that overrides a 
15  * visit(ASTNode node) method must put this formulary 
16  * as the first thing inside the method:
17  * 
18  *              if (!nodeInSelection(node))
19  *                      return false;
20  */
21 public abstract class PropertyCollector extends ASTVisitor {
22
23         protected final CompilationUnitTextSelection selection;
24
25         public PropertyCollector(CompilationUnitTextSelection selection) {
26                 super();
27                 this.selection = selection;
28         }
29
30         protected boolean nodeInSelection(ASTNode node) {
31                 return selection.surroundsNode(node);
32         }
33
34         public abstract void clearData();
35 }