final public Unit Class() throws ParseException {
  ClassUnit classUnit = null;
  ClassUnit superClassUnit = null;
  List<Unit> classFields = new ArrayList<Unit>();
  List<Unit> classFieldsCollection = new ArrayList<Unit>();
  String className = null;
  String superClassName = null;
    jj_consume_token(CLASS);
    className = ID();
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case EXTENDS:
      jj_consume_token(EXTENDS);
      superClassName = ID();
      break;
    default:
      jj_la1[1] = jj_gen;
      ;
    }
        if  (MODE == 0){
          /*classUnit = (ClassUnit)UnitFactory.generateUnit(UnitType.CLASS);
          classUnit.setName(className);*/
          classUnit = (ClassUnit) SYMBOL_TABLE.add(className, UnitType.CLASS);
        } else {
            IntegerMuted intBaseMuted = new IntegerMuted(-1);
                    classUnit = (ClassUnit) SYMBOL_TABLE.lookUp(className, UnitType.CLASS, intBaseMuted);
                    if (superClassName == null) {
                      superClassName = "Object";
                    }
                    IntegerMuted intMuted = new IntegerMuted(-1);
                superClassUnit = (ClassUnit)SYMBOL_TABLE.lookUp(superClassName, UnitType.CLASS, intMuted);
                if (superClassUnit == null){
                        {if (true) throw new ParseException("Super class " + superClassName + " has not been declared.");}
                }
                classUnit.setSuperClass(superClassUnit);
        }
    jj_consume_token(LCB);
     SYMBOL_TABLE.enterScopeForUnit(classUnit,MODE);
    label_2:
    while (true) {
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case PRIVATE:
      case PROTECTED:
      case PUBLIC:
      case STATIC:
      case BOOLEAN:
      case CHAR:
      case VOID:
      case INT:
      case ID:
        ;
        break;
      default:
        jj_la1[2] = jj_gen;
        break label_2;
      }
      classFields = Member(classUnit);
        /*
        for (Unit memberUnit: classFields) {
          for (Unit existingUnit : classFieldsCollection) {
            if (existingUnit.getName().equals(memberUnit.getName())) {
             throw new ParseException(memberUnit.getName() + " already declared in  " + className); 
            }
          }
        }*/
        classFieldsCollection.addAll(classFields);
    }
      if (MODE == 0) {
        classUnit.setMembersAndMethods(classFieldsCollection);
      }
    jj_consume_token(RCB);
      SYMBOL_TABLE.exitScope(MODE);
      {if (true) return classUnit;}
    throw new Error("Missing return statement in function");
  }