]> git.uio.no Git - ifi-stolz-refaktor.git/blame - software/no.uio.ifi.refaktor/src/no/uio/ifi/refaktor/extractors/collectors/PropertyCollector.java
Adding the interface PropertiesExtractor.
[ifi-stolz-refaktor.git] / software / no.uio.ifi.refaktor / src / no / uio / ifi / refaktor / extractors / collectors / PropertyCollector.java
CommitLineData
74581229
EK
1package no.uio.ifi.refaktor.extractors.collectors;
2
1d39ea7d 3import no.uio.ifi.refaktor.utils.CompilationUnitTextSelection;
74581229
EK
4
5import org.eclipse.jdt.core.dom.ASTNode;
6import org.eclipse.jdt.core.dom.ASTVisitor;
74581229 7
520985c2
EK
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 */
74581229
EK
21public abstract class PropertyCollector extends ASTVisitor {
22
1d39ea7d 23 private final CompilationUnitTextSelection selection;
74581229 24
1d39ea7d 25 public PropertyCollector(CompilationUnitTextSelection selection) {
74581229
EK
26 super();
27 this.selection = selection;
28 }
29
1d39ea7d 30 protected CompilationUnitTextSelection getSelection() {
74581229
EK
31 return selection;
32 }
33
74581229 34 protected boolean nodeInSelection(ASTNode node) {
639b7be0 35 return selection.surroundsNode(node);
74581229 36 }
ee6a0b5b
EK
37
38 public abstract void clearData();
74581229 39}