]> git.uio.no Git - ifi-stolz-refaktor.git/blame - case-study/refaktor-after/src/no/uio/ifi/refaktor/change/changers/AggregationAnalyzerChanger.java
Case Study: adding data and statistics
[ifi-stolz-refaktor.git] / case-study / refaktor-after / src / no / uio / ifi / refaktor / change / changers / AggregationAnalyzerChanger.java
CommitLineData
1b2798f6
EK
1package no.uio.ifi.refaktor.change.changers;
2
3import no.uio.ifi.refaktor.analyze.ExtractAndMoveMethodCandidate;
4import no.uio.ifi.refaktor.analyze.analyzers.AggregationAnalyzer;
5import no.uio.ifi.refaktor.analyze.exceptions.RefaktorAnalyzerException;
6import no.uio.ifi.refaktor.change.executors.ExtractAndMoveMethodExecutor;
7
8import org.eclipse.core.runtime.CoreException;
9import org.eclipse.core.runtime.IProgressMonitor;
10
11/**
12 * A {@link RefaktorChanger} that is responsible for running an
13 * {@link AggregationAnalyzer} and executing the
14 * {@link ExtractAndMoveMethodExecutor} on all results returned from it.
15 */
16public class AggregationAnalyzerChanger implements RefaktorChanger {
17
18 private AggregationAnalyzer<ExtractAndMoveMethodCandidate> analyzer;
19
20 public AggregationAnalyzerChanger(AggregationAnalyzer<ExtractAndMoveMethodCandidate> analyzer) {
21 this.analyzer = analyzer;
22 }
23
24 @Override
25 public void checkPreconditions() throws RefaktorAnalyzerException {
26 analyzer.analyze();
27 }
28
29 @Override
30 public void execute(IProgressMonitor monitor) throws CoreException {
31 for (ExtractAndMoveMethodCandidate result: analyzer.getResults()) {
32 result.generated_2051493397028639653(this);
33 }
34 }
35}