package no.uio.ifi.refaktor.analyze.collectors; import no.uio.ifi.refaktor.utils.CompilationUnitTextSelection; import org.eclipse.jdt.core.dom.ASTNode; import org.eclipse.jdt.core.dom.ASTVisitor; /** * A PropertyCollector is responsible for collecting * properties from an AST, and in particular, properties * from within a selection. * * If the visitor shall be limited to visiting nodes inside * the selection, then subclasses that overrides a * visit(ASTNode node) method must put this formulary * as the first thing inside the method: * * if (!nodeInSelection(node)) * return false; */ public abstract class PropertyCollector extends ASTVisitor { protected final CompilationUnitTextSelection selection; public PropertyCollector(CompilationUnitTextSelection selection) { super(); this.selection = selection; } protected boolean nodeInSelection(ASTNode node) { return selection.surroundsNode(node); } public abstract void clearData(); }