]> git.uio.no Git - ifi-stolz-refaktor.git/blob - software/no.uio.ifi.refaktor/src/no/uio/ifi/refaktor/analyze/analyzers/LegalStatementsChecker.java
ExtractAndMoveMethodAnalysisResult: renaming to ExtractAndMoveMethodCandidate
[ifi-stolz-refaktor.git] / software / no.uio.ifi.refaktor / src / no / uio / ifi / refaktor / analyze / analyzers / LegalStatementsChecker.java
1 package no.uio.ifi.refaktor.analyze.analyzers;
2
3 import java.util.LinkedList;
4 import java.util.List;
5
6 import no.uio.ifi.refaktor.analyze.collectors.ReturnStatementsChecker;
7 import no.uio.ifi.refaktor.analyze.exceptions.CheckerException;
8 import no.uio.ifi.refaktor.utils.CompilationUnitTextSelection;
9
10 public class LegalStatementsChecker {
11
12         private final List<Checker> checkers;
13
14         public LegalStatementsChecker(CompilationUnitTextSelection selection) {
15                 checkers = new LinkedList<Checker>();
16                 checkers.add(new EnclosingInstanceReferenceChecker(selection));
17                 // TODO: check out org.eclipse.jdt.internal.corext.refactoring.structure.MoveInstanceMethodProcessor.RecursiveCallFinder 
18                 checkers.add(new ReturnStatementsChecker(selection));
19                 checkers.add(new AmbiguousReturnValueChecker(selection));
20                 checkers.add(new IllegalStatementsChecker(selection));
21         }
22
23         public boolean allStatementsAreLegal() {
24                 try {
25                         for(Checker checker: checkers)
26                                 checker.check();
27                 } catch (CheckerException e) {
28                         return false;
29                 }
30                 return true;
31         }
32
33 }