private boolean excluded(ArrayList instructions, String pkg) {
   for (Iterator i = instructions.iterator(); i.hasNext(); ) {
     Instruction f = (Instruction) i.next();
     if (f.matches(pkg)) {
       return f.isNegated();
     }
   }
   return true;
 }
    boolean matches(String text) {
      boolean result;

      if (null == text) {
        result = m_instruction.matches(m_defaultValue);
      } else {
        result = m_instruction.matches(text);
      }

      return m_instruction.isNegated() ? !result : result;
    }
  private String getExportedPackages() throws MojoExecutionException {
    if (exportPackages == null) {
      return null;
    }

    Set allpackages = new HashSet();

    ArrayList<Instruction> instructions = new ArrayList<Instruction>();
    StringTokenizer st = new StringTokenizer(exportPackages, ",");
    while (st.hasMoreTokens()) {
      instructions.add(Instruction.getPattern(st.nextToken().trim()));
    }

    try {
      File classes = new File(project.getBuild().getOutputDirectory());
      if (classes.exists()) {
        addExportedPackages(allpackages, instructions, classes);
      }
      for (Iterator<Artifact> i = getIncludedArtifacts().iterator(); i.hasNext(); ) {
        Artifact a = (Artifact) i.next();
        getLog().info("Processing " + a);
        File f = a.getFile();
        addExportedPackages(allpackages, instructions, f);
      }
    } catch (IOException e) {
      throw new MojoExecutionException(e.getMessage(), e);
    }

    StringBuffer sb = new StringBuffer();
    for (Iterator i = allpackages.iterator(); i.hasNext(); ) {
      String pkg = (String) i.next();
      if (sb.length() > 0) sb.append(',');
      sb.append(pkg);
    }
    return sb.length() > 0 ? sb.toString() : null;
  }
 public DependencyFilter(String expression, String defaultValue) {
   m_instruction = Instruction.getPattern(expression);
   m_defaultValue = defaultValue;
 }