Package apigen.adt

Examples of apigen.adt.Field


  }

  private void genSetFields(Type type) {
    Iterator<Field> fields = type.fieldIterator();
    while (fields.hasNext()) {
      Field field = fields.next();
      genSetField(type, field);
    }
  }
View Full Code Here


    if (type instanceof SeparatedListType) {
      genSeparatedListGetters((SeparatedListType) type);
    } else {
      Iterator<Field> fields = type.fieldIterator();
      while (fields.hasNext()) {
        Field field = fields.next();
        genGetField(type, field);
      }
    }
  }
View Full Code Here

  }

  private void genHasFields(Type type) {
    Iterator<Field> fields = type.fieldIterator();
    while (fields.hasNext()) {
      Field field = fields.next();
      genHasField(type, field);
    }
  }
View Full Code Here

      decl_buf.append("(");
      decl_buf.append(type_name);
      decl_buf.append(" arg");
      Iterator<Field> fields = type.fieldIterator();
      while (fields.hasNext()) {
        Field field = fields.next();
        if (!field.getType().equals(type.getId())) {
          decl_buf.append(", ");
          decl_buf.append(genAcceptor(field));
        }
      }
      decl_buf.append(")");
View Full Code Here

    println("  if (" + buildIsAltName(type, alt) + "(arg)) {");
    print("    return " + cons_name + "(");
    Iterator<Field> fields = type.altFieldIterator(alt.getId());
    while (fields.hasNext()) {
      Field field = fields.next();
      println("");
      print("        ");
      String getter_name = buildGetterName(type, field);
      if (field.getType().equals(type.getId())) {
        String visitor_name = prefix + "visit" + type_id;
        print(visitor_name + "(" + getter_name + "(arg)");
        Iterator<Field> params = type.fieldIterator();
        while (params.hasNext()) {
          Field param = params.next();
          if (!param.getType().equals(type.getId())) {
            print(", ");
            print("accept"
                + StringConversions
                    .makeCapitalizedIdentifier(param
                        .getId()));
          }
        }
        print(")");
      } else {
View Full Code Here

    genSeparatedListGetTail(type);
    genGetField(type, type.getManyField(type.getHeadFieldId()));

    Iterator<Field> seps = type.separatorFieldIterator();
    while (seps.hasNext()) {
      Field sep = seps.next();
      genGetField(type, sep);
    }
  }
View Full Code Here

    println("    return (" + type_name + ") "
        + buildConstructorName(type, type.getEmptyAlternative())
        + "();");
    println("  }");
    println("  else {");
    Field tail = type.getManyField(type.getTailFieldId());
    genGetFieldBody(type, tail, buildTypeName(tail.getType()));
    println("  }");
    println("}");
    println();
    printFoldClose();
  }
View Full Code Here

  private void printDocArgs(String argName, String msg, Type type, Alternative alt) {
    Iterator<Field> fields = type.altFieldIterator(alt.getId());

    while (fields.hasNext()) {
      Field field = fields.next();
      printDocArg(StringConversions.makeIdentifier(field.getId()), msg);
    }
  }
View Full Code Here

  private String buildFieldArgumentList(Type type, Alternative alt) {
    String args = "";
    Iterator<Field> fields = type.altFieldIterator(alt.getId());
    boolean first = true;
    while (fields.hasNext()) {
      Field field = fields.next();
      if (first) {
        first = false;
      } else {
        args += ", ";
      }
      String fieldType = field.getType();
      String typeName = buildTypeName(fieldType);
      if (fieldType.equals(TypeConverter.CHARS_TYPE)
          || fieldType.equals(TypeConverter.STR_TYPE)) {
        typeName = "const " + typeName;
      }
      args += typeName + " "
          + StringConversions.makeIdentifier(field.getId());
    }

    return args;
  }
View Full Code Here

    Iterator<Field> fields = type.altFieldIterator("many");
    String result = "";
    fields.next(); // skip head

    while (fields.hasNext()) {
      Field field = fields.next();

      if (!fields.hasNext()) {
        break; // skip tail
      }

      result += StringConversions.makeIdentifier(field.getId());
      result += ", ";
    }

    return result;
  }
View Full Code Here

TOP

Related Classes of apigen.adt.Field

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.