class ModuleNode extends ModuleVisitor {

  public void accept(final ClassVisitor classVisitor) {
    ModuleVisitor moduleVisitor = classVisitor.visitModule(name, access, version);
    if (moduleVisitor == null) {
      return;
    }
    if (mainClass != null) {
      moduleVisitor.visitMainClass(mainClass);
    }
    if (packages != null) {
      for (int i = 0, n = packages.size(); i < n; i++) {
        moduleVisitor.visitPackage(packages.get(i));
      }
    }
    if (requires != null) {
      for (int i = 0, n = requires.size(); i < n; i++) {
        requires.get(i).accept(moduleVisitor);
      }
    }
    if (exports != null) {
      for (int i = 0, n = exports.size(); i < n; i++) {
        exports.get(i).accept(moduleVisitor);
      }
    }
    if (opens != null) {
      for (int i = 0, n = opens.size(); i < n; i++) {
        opens.get(i).accept(moduleVisitor);
      }
    }
    if (uses != null) {
      for (int i = 0, n = uses.size(); i < n; i++) {
        moduleVisitor.visitUse(uses.get(i));
      }
    }
    if (provides != null) {
      for (int i = 0, n = provides.size(); i < n; i++) {
        provides.get(i).accept(moduleVisitor);
      }
    }
  }

  public  ModuleNode(final String name, final int access, final String version);
  public  ModuleNode(
      final int api,
      final String name,
      final int access,
      final String version,
      final List<ModuleRequireNode> requires,
      final List<ModuleExportNode> exports,
      final List<ModuleOpenNode> opens,
      final List<String> uses,
      final List<ModuleProvideNode> provides);

}