@Override
 public boolean accept(org.lgna.project.ast.NamedUserType userType) {
   if (super.accept(userType)) {
     org.lgna.project.ast.AbstractConstructor constructor =
         userType.getDeclaredConstructor(this.parameterType);
     if (constructor != null) {
       org.lgna.project.ast.AbstractParameter parameter0 =
           constructor.getRequiredParameters().get(0);
       return parameter0.getValueType() == this.parameterType;
     } else {
       return false;
     }
   } else {
     return false;
   }
 }
 @Override
 public boolean accept(org.lgna.project.ast.NamedUserType userType) {
   if (super.accept(userType)) {
     org.lgna.project.ast.NamedUserConstructor constructor = userType.getDeclaredConstructor();
     if (constructor != null) {
       org.lgna.project.ast.ConstructorInvocationStatement constructorInvocationStatement =
           constructor.body.getValue().constructorInvocationStatement.getValue();
       if (constructorInvocationStatement
           instanceof org.lgna.project.ast.SuperConstructorInvocationStatement) {
         if (constructorInvocationStatement.requiredArguments.size() == 1) {
           org.lgna.project.ast.Expression argumentExpression =
               constructorInvocationStatement.requiredArguments.get(0).expression.getValue();
           if (argumentExpression instanceof org.lgna.project.ast.FieldAccess) {
             org.lgna.project.ast.FieldAccess fieldAccess =
                 (org.lgna.project.ast.FieldAccess) argumentExpression;
             return fieldAccess.field.getValue() == this.superArgumentField;
           }
         }
       }
     }
   }
   return false;
 }
  public void setProject(org.lgna.project.Project project) {
    StringBuilder sb = new StringBuilder();
    java.util.Set<org.lgna.project.ast.NamedUserType> types = project.getNamedUserTypes();
    for (org.lgna.project.ast.NamedUserType type : types) {
      boolean wasNullMethodRemoved = false;
      java.util.ListIterator<org.lgna.project.ast.UserMethod> methodIterator =
          type.getDeclaredMethods().listIterator();
      while (methodIterator.hasNext()) {
        org.lgna.project.ast.UserMethod method = methodIterator.next();
        if (method != null) {
          // pass
        } else {
          methodIterator.remove();
          wasNullMethodRemoved = true;
        }
      }
      boolean wasNullFieldRemoved = false;
      java.util.ListIterator<org.lgna.project.ast.UserField> fieldIterator =
          type.getDeclaredFields().listIterator();
      while (fieldIterator.hasNext()) {
        org.lgna.project.ast.UserField field = fieldIterator.next();
        if (field != null) {
          // pass
        } else {
          fieldIterator.remove();
          wasNullFieldRemoved = true;
        }
      }
      if (wasNullMethodRemoved) {
        if (sb.length() > 0) {
          sb.append("\n");
        }
        sb.append("null method was removed from ");
        sb.append(type.getName());
        sb.append(".");
      }
      if (wasNullFieldRemoved) {
        if (sb.length() > 0) {
          sb.append("\n");
        }
        sb.append("null field was removed from ");
        sb.append(type.getName());
        sb.append(".");
      }
    }
    if (sb.length() > 0) {
      javax.swing.SwingUtilities.invokeLater(
          () -> {
            new edu.cmu.cs.dennisc.javax.swing.option.OkDialog.Builder(sb.toString())
                .title("A Problem With Your Project Has Been Fixed")
                .messageType(edu.cmu.cs.dennisc.javax.swing.option.MessageType.WARNING)
                .buildAndShow();
          });
    }
    org.lgna.project.ProgramTypeUtilities.sanityCheckAllTypes(project);

    // If this is the free version of Looking Glass (i.e. no sims) then some projects
    // cannot be opened because they use non-free models or resources. We can check this
    // by verifying whether all of the types in the projects have classes that we can
    // locate. If we can't locate them, then we can't open the project.
    if (!project.doAllTypeClassesExist()) {
      throw new TypeClassNotFoundException(ProgramTypeUtilities.getProjectTypeClasses(project));
    }

    this.setDocument(new ProjectDocument(project));
  }