/**
   * Constructs a ClassPoolVisitor to efficiently travel to the specified classes and class members.
   *
   * @param keepClassSpecifications the list of KeepClassSpecification instances, defining of the
   *     classes and class members to visit.
   * @param classVisitor the ClassVisitor to be applied to matching classes.
   * @param memberVisitor the MemberVisitor to be applied to matching class members.
   */
  public static ClassPoolVisitor createClassPoolVisitor(
      List keepClassSpecifications,
      ClassVisitor classVisitor,
      MemberVisitor memberVisitor,
      boolean shrinking,
      boolean optimizing,
      boolean obfuscating) {
    MultiClassPoolVisitor multiClassPoolVisitor = new MultiClassPoolVisitor();

    if (keepClassSpecifications != null) {
      for (int index = 0; index < keepClassSpecifications.size(); index++) {
        KeepClassSpecification keepClassSpecification =
            (KeepClassSpecification) keepClassSpecifications.get(index);

        if ((shrinking && !keepClassSpecification.allowShrinking)
            || (optimizing && !keepClassSpecification.allowOptimization)
            || (obfuscating && !keepClassSpecification.allowObfuscation)) {
          multiClassPoolVisitor.addClassPoolVisitor(
              createClassPoolVisitor(keepClassSpecification, classVisitor, memberVisitor));
        }
      }
    }

    return multiClassPoolVisitor;
  }
  /**
   * Constructs a ClassPoolVisitor to efficiently travel to the specified classes and class members.
   *
   * @param classSpecifications the list of ClassSpecification instances, defining of the classes
   *     and class members to visit.
   * @param classVisitor the ClassVisitor to be applied to matching classes.
   * @param memberVisitor the MemberVisitor to be applied to matching class members.
   */
  public static ClassPoolVisitor createClassPoolVisitor(
      List classSpecifications, ClassVisitor classVisitor, MemberVisitor memberVisitor) {
    MultiClassPoolVisitor multiClassPoolVisitor = new MultiClassPoolVisitor();

    if (classSpecifications != null) {
      for (int index = 0; index < classSpecifications.size(); index++) {
        ClassSpecification classSpecification = (ClassSpecification) classSpecifications.get(index);

        multiClassPoolVisitor.addClassPoolVisitor(
            createClassPoolVisitor(classSpecification, classVisitor, memberVisitor));
      }
    }

    return multiClassPoolVisitor;
  }