package no.uio.ifi.refaktor.analyze.analyzers; import java.util.LinkedList; import java.util.List; import no.uio.ifi.refaktor.analyze.collectors.ReturnStatementsChecker; import no.uio.ifi.refaktor.analyze.exceptions.IllegalExpressionFoundException; import no.uio.ifi.refaktor.analyze.exceptions.IllegalStatementFoundException; import no.uio.ifi.refaktor.utils.CompilationUnitTextSelection; public class LegalStatementsChecker { private final List checkers; public LegalStatementsChecker(CompilationUnitTextSelection selection) { checkers = new LinkedList(); checkers.add(new ReturnStatementsChecker(selection)); checkers.add(new IllegalStatementsChecker(selection)); } public boolean allStatementsAreLegal() { try { for(Checker checker: checkers) checker.check(); } catch (IllegalStatementFoundException e) { return false; } catch (IllegalExpressionFoundException e) { return false; } return true; } }