@Override
 public void check(final ArchieCompilationUnit acu) {
   if (shouldCheckRule(acu)) {
     if (isMatchMethodPattern()) {
       acu.accept(new CheckMethodInvocationsVisitor(acu));
     } else {
       checkImportDeclarations(acu);
     }
   }
 }
  private void checkImportDeclarations(final ArchieCompilationUnit acu) {
    @SuppressWarnings("unchecked")
    List<ImportDeclaration> imports = acu.getCompilationUnit().imports();
    for (ImportDeclaration i : imports) {

      String denyToSrcLocation = getSourceLocation(i.resolveBinding(), null);
      if (denyToSrc != null
          && denyToSrcLocation != null
          && !denyToSrc.matcher(denyToSrcLocation).find()) {
        continue;
      }

      String importName = i.getName().getFullyQualifiedName();

      if (denyTo.matcher(importName).lookingAt()) {
        acu.addMarker(
            "Import dependency "
                + createWarningText(
                    acu.getPackageName(), importName, acu.getSourceLocation(), denyToSrcLocation),
            acu.getCompilationUnit().getLineNumber(i.getStartPosition()),
            IMarker.SEVERITY_WARNING);
      }
    }
  }
 private boolean matchPackageName(final ArchieCompilationUnit acu) {
   return denyFrom.matcher(acu.getFullyQualifiedClassName()).matches();
 }
 private boolean matchSourceLocation(final ArchieCompilationUnit acu) {
   return denyFromSrc != null && denyFromSrc.matcher(acu.getSourceLocation()).find();
 }