package no.uio.ifi.refaktor.analyze.analyzers; import java.util.LinkedList; import java.util.List; import no.uio.ifi.refaktor.analyze.ExtractAndMoveMethodCandidate; import no.uio.ifi.refaktor.analyze.comparators.FavorNoUnfixesCandidateComparator; import no.uio.ifi.refaktor.analyze.exceptions.NoTargetFoundException; import no.uio.ifi.refaktor.analyze.exceptions.RefaktorAnalyzerException; import no.uio.ifi.refaktor.debugging.RefaktorDebug; import org.eclipse.jdt.core.IMethod; import org.eclipse.jdt.core.IType; import org.eclipse.jdt.core.JavaModelException; /** * Responsible for analyzing all methods in a type for * candidates to the Extract and Move Method refactoring. */ public class TypeWideExtractAndMoveMethodAnalyzer implements AggregationAnalyzer { private final IType type; final List candidates; public TypeWideExtractAndMoveMethodAnalyzer(IType type) { this.type = type; candidates = new LinkedList(); } @Override public List getResults() { return candidates; } @Override public void analyze() throws RefaktorAnalyzerException { try { analyzeMethodsInType(); } catch (JavaModelException e) { RefaktorDebug.log(e); } } private void analyzeMethodsInType() throws JavaModelException { for (IMethod method: type.getMethods()) { analyzeMethod(method); } } private void analyzeMethod(IMethod method) { try { SearchBasedExtractAndMoveMethodAnalyzer analyzer = new SearchBasedExtractAndMoveMethodAnalyzer(method, new FavorNoUnfixesCandidateComparator()); analyzer.generated_8976769988341837625(this); } catch (NoTargetFoundException e) { // Ignoring } catch (AssertionError err) { RefaktorDebug.log(err); } catch (Exception e) { RefaktorDebug.log(e); } } public void generated_6956230269237502630( CompilationUnitWideExtractAndMoveMethodAnalyzer compilationunitwideextractandmovemethodanalyzer) { analyze(); compilationunitwideextractandmovemethodanalyzer.results.addAll(getResults()); } }