// Path: hawtbuf-proto/src/main/java/org/fusesource/hawtbuf/proto/WireFormat.java
// public static final int WIRETYPE_FIXED32 = 5;
// 
// Path: hawtbuf-proto/src/main/java/org/fusesource/hawtbuf/proto/WireFormat.java
// public static final int WIRETYPE_FIXED64 = 1;
// 
// Path: hawtbuf-proto/src/main/java/org/fusesource/hawtbuf/proto/WireFormat.java
// public static final int WIRETYPE_LENGTH_DELIMITED = 2;
// 
// Path: hawtbuf-proto/src/main/java/org/fusesource/hawtbuf/proto/WireFormat.java
// public static final int WIRETYPE_VARINT = 0;
// 
// Path: hawtbuf-proto/src/main/java/org/fusesource/hawtbuf/proto/WireFormat.java
// public static int makeTag(int fieldNumber, int wireType) {
//     return (fieldNumber << TAG_TYPE_BITS) | wireType;
// }


import java.util.Map;
import java.util.StringTokenizer;
import org.fusesource.hawtbuf.proto.compiler.parser.ParseException;
import org.fusesource.hawtbuf.proto.compiler.parser.ProtoParser;
import static org.fusesource.hawtbuf.proto.WireFormat.WIRETYPE_FIXED32;
import static org.fusesource.hawtbuf.proto.WireFormat.WIRETYPE_FIXED64;
import static org.fusesource.hawtbuf.proto.WireFormat.WIRETYPE_LENGTH_DELIMITED;
import static org.fusesource.hawtbuf.proto.WireFormat.WIRETYPE_VARINT;
import static org.fusesource.hawtbuf.proto.WireFormat.makeTag;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.LinkedHashMap;
        p("public " + className + " mergeUnframed(org.fusesource.hawtbuf.proto.CodedInputStream input) throws java.io.IOException {");
        indent();
        {
            p("copyCheck();");
            p("while (true) {");
            indent();
            {
                p("int tag = input.readTag();");
                p("if ((tag & 0x07) == 4) {");
                p("   return this;");
                p("}");

                p("switch (tag) {");
                p("case 0:");
                p("   return this;");
                p("default: {");

                p("   break;");
                p("}");

                for (FieldDescriptor field : m.getFields().values()) {
                    String uname = uCamel(field.getName());
                    String setter = "set" + uname;
                    boolean repeated = field.getRule() == FieldDescriptor.REPEATED_RULE;
                    if (repeated) {
                        setter = "create" + uname + "List().add";
                    }
                    if (field.getType() == FieldDescriptor.STRING_TYPE) {
                        p("case "
                                + makeTag(field.getTag(),
// Path: hawtbuf-proto/src/main/java/org/fusesource/hawtbuf/proto/WireFormat.java
// public static final int WIRETYPE_FIXED32 = 5;
// 
// Path: hawtbuf-proto/src/main/java/org/fusesource/hawtbuf/proto/WireFormat.java
// public static final int WIRETYPE_FIXED64 = 1;
// 
// Path: hawtbuf-proto/src/main/java/org/fusesource/hawtbuf/proto/WireFormat.java
// public static final int WIRETYPE_LENGTH_DELIMITED = 2;
// 
// Path: hawtbuf-proto/src/main/java/org/fusesource/hawtbuf/proto/WireFormat.java
// public static final int WIRETYPE_VARINT = 0;
// 
// Path: hawtbuf-proto/src/main/java/org/fusesource/hawtbuf/proto/WireFormat.java
// public static int makeTag(int fieldNumber, int wireType) {
//     return (fieldNumber << TAG_TYPE_BITS) | wireType;
// }


// Path: hawtbuf-protoc/src/main/java/org/fusesource/hawtbuf/proto/compiler/AltJavaGenerator.java
import java.util.Map;
import java.util.StringTokenizer;
import org.fusesource.hawtbuf.proto.compiler.parser.ParseException;
import org.fusesource.hawtbuf.proto.compiler.parser.ProtoParser;
import static org.fusesource.hawtbuf.proto.WireFormat.WIRETYPE_FIXED32;
import static org.fusesource.hawtbuf.proto.WireFormat.WIRETYPE_FIXED64;
import static org.fusesource.hawtbuf.proto.WireFormat.WIRETYPE_LENGTH_DELIMITED;
import static org.fusesource.hawtbuf.proto.WireFormat.WIRETYPE_VARINT;
import static org.fusesource.hawtbuf.proto.WireFormat.makeTag;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.LinkedHashMap;

        p("public " + className + " mergeUnframed(org.fusesource.hawtbuf.proto.CodedInputStream input) throws java.io.IOException {");
        indent();
        {
            p("copyCheck();");
            p("while (true) {");
            indent();
            {
                p("int tag = input.readTag();");
                p("if ((tag & 0x07) == 4) {");
                p("   return this;");
                p("}");

                p("switch (tag) {");
                p("case 0:");
                p("   return this;");
                p("default: {");

                p("   break;");
                p("}");

                for (FieldDescriptor field : m.getFields().values()) {
                    String uname = uCamel(field.getName());
                    String setter = "set" + uname;
                    boolean repeated = field.getRule() == FieldDescriptor.REPEATED_RULE;
                    if (repeated) {
                        setter = "create" + uname + "List().add";
                    }
                    if (field.getType() == FieldDescriptor.STRING_TYPE) {
                        p("case "
                                + makeTag(field.getTag(),
                                WIRETYPE_LENGTH_DELIMITED) + ":");