diff --git a/protocol/src/test/java/com/zfoo/protocol/field/FieldSpeedTest.java b/protocol/src/test/java/com/zfoo/protocol/field/FieldSpeedTest.java new file mode 100644 index 00000000..77e00498 --- /dev/null +++ b/protocol/src/test/java/com/zfoo/protocol/field/FieldSpeedTest.java @@ -0,0 +1,330 @@ +package com.zfoo.protocol.field; + +import com.esotericsoftware.kryo.Kryo; +import com.esotericsoftware.kryo.io.Input; +import com.esotericsoftware.kryo.io.Output; +import com.google.protobuf.CodedInputStream; +import com.google.protobuf.CodedOutputStream; +import com.zfoo.protocol.ProtocolManager; +import com.zfoo.protocol.field.packet.FieldProtobufObject; +import com.zfoo.protocol.field.packet.FloatObject; +import com.zfoo.protocol.field.packet.IntObject; +import com.zfoo.protocol.field.packet.IntegerObject; +import com.zfoo.protocol.generate.GenerateOperation; +import com.zfoo.protocol.util.StringUtils; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.ByteBufAllocator; +import io.netty.buffer.UnpooledHeapByteBuf; +import org.junit.Test; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Set; + +/** + * 测试各种不同特征的数据类型的序列化和反序列化时间 + * 细致比较性能 + */ +public class FieldSpeedTest { + public static int benchmark = 100000; + public static IntObject intObject=new IntObject(); + public static IntegerObject integerObject=new IntegerObject(); + public static FloatObject floatObject=new FloatObject(); + public static FieldProtobufObject.IntObject protobufIntObject = null; + public static FieldProtobufObject.FloatObject protobufFloatObject = null; + public static long zfooSerializationTime; + public static long zfooDeserializationTime; + public static long kryoSerializationTime; + public static long kryoDeserializationTime; + public static long protobufSerializationTime; + public static long protobufDeserializationTime; + @Test + public void testIntObject() throws IOException { + ByteBuf buffer = new UnpooledHeapByteBuf(ByteBufAllocator.DEFAULT, 10000_0000, 100000000); + benchmark=benchmark*10; + long startTime = System.currentTimeMillis(); + for(int i=0;i kryos = new ThreadLocal<>() { + @Override + protected Kryo initialValue() { + var kryo = new Kryo(); + kryo.register(IntObject.class); + kryo.register(IntegerObject.class); + kryo.register(FloatObject.class); + kryo.register(byte[].class); + kryo.register(Byte[].class); + kryo.register(short[].class); + kryo.register(Short[].class); + kryo.register(int[].class); + kryo.register(Integer[].class); + kryo.register(long[].class); + kryo.register(Long[].class); + kryo.register(float[].class); + kryo.register(Float[].class); + kryo.register(double[].class); + kryo.register(Double[].class); + kryo.register(boolean[].class); + kryo.register(Boolean[].class); + kryo.register(char[].class); + kryo.register(Character[].class); + kryo.register(String[].class); + kryo.register(ArrayList.class); + kryo.register(HashSet.class); + kryo.register(HashMap.class); + // 关闭循环引用,提高性能 + kryo.setReferences(false); + return kryo; + } + }; +} diff --git a/protocol/src/test/java/com/zfoo/protocol/field/packet/FieldProtobufObject.java b/protocol/src/test/java/com/zfoo/protocol/field/packet/FieldProtobufObject.java new file mode 100644 index 00000000..8000f47d --- /dev/null +++ b/protocol/src/test/java/com/zfoo/protocol/field/packet/FieldProtobufObject.java @@ -0,0 +1,2189 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: fieldspeed.proto + +package com.zfoo.protocol.field.packet; + +public final class FieldProtobufObject { + private FieldProtobufObject() {} + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistryLite registry) { + } + + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions( + (com.google.protobuf.ExtensionRegistryLite) registry); + } + public interface IntObjectOrBuilder extends + // @@protoc_insertion_point(interface_extends:IntObject) + com.google.protobuf.MessageOrBuilder { + + /** + * int32 a = 1; + */ + int getA(); + + /** + * int32 b = 2; + */ + int getB(); + + /** + * int32 c = 3; + */ + int getC(); + + /** + * int32 d = 4; + */ + int getD(); + + /** + * int32 e = 5; + */ + int getE(); + + /** + * int32 f = 6; + */ + int getF(); + + /** + * int32 g = 7; + */ + int getG(); + + /** + * int32 h = 8; + */ + int getH(); + + /** + * int32 i = 9; + */ + int getI(); + + /** + * int32 j = 10; + */ + int getJ(); + } + /** + * Protobuf type {@code IntObject} + */ + public static final class IntObject extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:IntObject) + IntObjectOrBuilder { + private static final long serialVersionUID = 0L; + // Use IntObject.newBuilder() to construct. + private IntObject(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private IntObject() { + a_ = 0; + b_ = 0; + c_ = 0; + d_ = 0; + e_ = 0; + f_ = 0; + g_ = 0; + h_ = 0; + i_ = 0; + j_ = 0; + } + + @Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private IntObject( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: { + + a_ = input.readInt32(); + break; + } + case 16: { + + b_ = input.readInt32(); + break; + } + case 24: { + + c_ = input.readInt32(); + break; + } + case 32: { + + d_ = input.readInt32(); + break; + } + case 40: { + + e_ = input.readInt32(); + break; + } + case 48: { + + f_ = input.readInt32(); + break; + } + case 56: { + + g_ = input.readInt32(); + break; + } + case 64: { + + h_ = input.readInt32(); + break; + } + case 72: { + + i_ = input.readInt32(); + break; + } + case 80: { + + j_ = input.readInt32(); + break; + } + default: { + if (!parseUnknownFieldProto3( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return FieldProtobufObject.internal_static_IntObject_descriptor; + } + + @Override + protected FieldAccessorTable + internalGetFieldAccessorTable() { + return FieldProtobufObject.internal_static_IntObject_fieldAccessorTable + .ensureFieldAccessorsInitialized( + IntObject.class, Builder.class); + } + + public static final int A_FIELD_NUMBER = 1; + private int a_; + /** + * int32 a = 1; + */ + public int getA() { + return a_; + } + + public static final int B_FIELD_NUMBER = 2; + private int b_; + /** + * int32 b = 2; + */ + public int getB() { + return b_; + } + + public static final int C_FIELD_NUMBER = 3; + private int c_; + /** + * int32 c = 3; + */ + public int getC() { + return c_; + } + + public static final int D_FIELD_NUMBER = 4; + private int d_; + /** + * int32 d = 4; + */ + public int getD() { + return d_; + } + + public static final int E_FIELD_NUMBER = 5; + private int e_; + /** + * int32 e = 5; + */ + public int getE() { + return e_; + } + + public static final int F_FIELD_NUMBER = 6; + private int f_; + /** + * int32 f = 6; + */ + public int getF() { + return f_; + } + + public static final int G_FIELD_NUMBER = 7; + private int g_; + /** + * int32 g = 7; + */ + public int getG() { + return g_; + } + + public static final int H_FIELD_NUMBER = 8; + private int h_; + /** + * int32 h = 8; + */ + public int getH() { + return h_; + } + + public static final int I_FIELD_NUMBER = 9; + private int i_; + /** + * int32 i = 9; + */ + public int getI() { + return i_; + } + + public static final int J_FIELD_NUMBER = 10; + private int j_; + /** + * int32 j = 10; + */ + public int getJ() { + return j_; + } + + private byte memoizedIsInitialized = -1; + @Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (a_ != 0) { + output.writeInt32(1, a_); + } + if (b_ != 0) { + output.writeInt32(2, b_); + } + if (c_ != 0) { + output.writeInt32(3, c_); + } + if (d_ != 0) { + output.writeInt32(4, d_); + } + if (e_ != 0) { + output.writeInt32(5, e_); + } + if (f_ != 0) { + output.writeInt32(6, f_); + } + if (g_ != 0) { + output.writeInt32(7, g_); + } + if (h_ != 0) { + output.writeInt32(8, h_); + } + if (i_ != 0) { + output.writeInt32(9, i_); + } + if (j_ != 0) { + output.writeInt32(10, j_); + } + unknownFields.writeTo(output); + } + + @Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (a_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(1, a_); + } + if (b_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(2, b_); + } + if (c_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(3, c_); + } + if (d_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(4, d_); + } + if (e_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(5, e_); + } + if (f_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(6, f_); + } + if (g_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(7, g_); + } + if (h_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(8, h_); + } + if (i_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(9, i_); + } + if (j_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(10, j_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @Override + public boolean equals(final Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof IntObject)) { + return super.equals(obj); + } + IntObject other = (IntObject) obj; + + boolean result = true; + result = result && (getA() + == other.getA()); + result = result && (getB() + == other.getB()); + result = result && (getC() + == other.getC()); + result = result && (getD() + == other.getD()); + result = result && (getE() + == other.getE()); + result = result && (getF() + == other.getF()); + result = result && (getG() + == other.getG()); + result = result && (getH() + == other.getH()); + result = result && (getI() + == other.getI()); + result = result && (getJ() + == other.getJ()); + result = result && unknownFields.equals(other.unknownFields); + return result; + } + + @Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + A_FIELD_NUMBER; + hash = (53 * hash) + getA(); + hash = (37 * hash) + B_FIELD_NUMBER; + hash = (53 * hash) + getB(); + hash = (37 * hash) + C_FIELD_NUMBER; + hash = (53 * hash) + getC(); + hash = (37 * hash) + D_FIELD_NUMBER; + hash = (53 * hash) + getD(); + hash = (37 * hash) + E_FIELD_NUMBER; + hash = (53 * hash) + getE(); + hash = (37 * hash) + F_FIELD_NUMBER; + hash = (53 * hash) + getF(); + hash = (37 * hash) + G_FIELD_NUMBER; + hash = (53 * hash) + getG(); + hash = (37 * hash) + H_FIELD_NUMBER; + hash = (53 * hash) + getH(); + hash = (37 * hash) + I_FIELD_NUMBER; + hash = (53 * hash) + getI(); + hash = (37 * hash) + J_FIELD_NUMBER; + hash = (53 * hash) + getJ(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static IntObject parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static IntObject parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static IntObject parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static IntObject parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static IntObject parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static IntObject parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static IntObject parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static IntObject parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static IntObject parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static IntObject parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static IntObject parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static IntObject parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(IntObject prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @Override + protected Builder newBuilderForType( + BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code IntObject} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:IntObject) + IntObjectOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return FieldProtobufObject.internal_static_IntObject_descriptor; + } + + @Override + protected FieldAccessorTable + internalGetFieldAccessorTable() { + return FieldProtobufObject.internal_static_IntObject_fieldAccessorTable + .ensureFieldAccessorsInitialized( + IntObject.class, Builder.class); + } + + // Construct using com.zfoo.protocol.field.packet.FieldProtobufObject.IntObject.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + @Override + public Builder clear() { + super.clear(); + a_ = 0; + + b_ = 0; + + c_ = 0; + + d_ = 0; + + e_ = 0; + + f_ = 0; + + g_ = 0; + + h_ = 0; + + i_ = 0; + + j_ = 0; + + return this; + } + + @Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return FieldProtobufObject.internal_static_IntObject_descriptor; + } + + @Override + public IntObject getDefaultInstanceForType() { + return IntObject.getDefaultInstance(); + } + + @Override + public IntObject build() { + IntObject result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @Override + public IntObject buildPartial() { + IntObject result = new IntObject(this); + result.a_ = a_; + result.b_ = b_; + result.c_ = c_; + result.d_ = d_; + result.e_ = e_; + result.f_ = f_; + result.g_ = g_; + result.h_ = h_; + result.i_ = i_; + result.j_ = j_; + onBuilt(); + return result; + } + + @Override + public Builder clone() { + return (Builder) super.clone(); + } + @Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + Object value) { + return (Builder) super.setField(field, value); + } + @Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + @Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + @Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + @Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + Object value) { + return (Builder) super.addRepeatedField(field, value); + } + @Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof IntObject) { + return mergeFrom((IntObject)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(IntObject other) { + if (other == IntObject.getDefaultInstance()) return this; + if (other.getA() != 0) { + setA(other.getA()); + } + if (other.getB() != 0) { + setB(other.getB()); + } + if (other.getC() != 0) { + setC(other.getC()); + } + if (other.getD() != 0) { + setD(other.getD()); + } + if (other.getE() != 0) { + setE(other.getE()); + } + if (other.getF() != 0) { + setF(other.getF()); + } + if (other.getG() != 0) { + setG(other.getG()); + } + if (other.getH() != 0) { + setH(other.getH()); + } + if (other.getI() != 0) { + setI(other.getI()); + } + if (other.getJ() != 0) { + setJ(other.getJ()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @Override + public final boolean isInitialized() { + return true; + } + + @Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + IntObject parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (IntObject) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int a_ ; + /** + * int32 a = 1; + */ + public int getA() { + return a_; + } + /** + * int32 a = 1; + */ + public Builder setA(int value) { + + a_ = value; + onChanged(); + return this; + } + /** + * int32 a = 1; + */ + public Builder clearA() { + + a_ = 0; + onChanged(); + return this; + } + + private int b_ ; + /** + * int32 b = 2; + */ + public int getB() { + return b_; + } + /** + * int32 b = 2; + */ + public Builder setB(int value) { + + b_ = value; + onChanged(); + return this; + } + /** + * int32 b = 2; + */ + public Builder clearB() { + + b_ = 0; + onChanged(); + return this; + } + + private int c_ ; + /** + * int32 c = 3; + */ + public int getC() { + return c_; + } + /** + * int32 c = 3; + */ + public Builder setC(int value) { + + c_ = value; + onChanged(); + return this; + } + /** + * int32 c = 3; + */ + public Builder clearC() { + + c_ = 0; + onChanged(); + return this; + } + + private int d_ ; + /** + * int32 d = 4; + */ + public int getD() { + return d_; + } + /** + * int32 d = 4; + */ + public Builder setD(int value) { + + d_ = value; + onChanged(); + return this; + } + /** + * int32 d = 4; + */ + public Builder clearD() { + + d_ = 0; + onChanged(); + return this; + } + + private int e_ ; + /** + * int32 e = 5; + */ + public int getE() { + return e_; + } + /** + * int32 e = 5; + */ + public Builder setE(int value) { + + e_ = value; + onChanged(); + return this; + } + /** + * int32 e = 5; + */ + public Builder clearE() { + + e_ = 0; + onChanged(); + return this; + } + + private int f_ ; + /** + * int32 f = 6; + */ + public int getF() { + return f_; + } + /** + * int32 f = 6; + */ + public Builder setF(int value) { + + f_ = value; + onChanged(); + return this; + } + /** + * int32 f = 6; + */ + public Builder clearF() { + + f_ = 0; + onChanged(); + return this; + } + + private int g_ ; + /** + * int32 g = 7; + */ + public int getG() { + return g_; + } + /** + * int32 g = 7; + */ + public Builder setG(int value) { + + g_ = value; + onChanged(); + return this; + } + /** + * int32 g = 7; + */ + public Builder clearG() { + + g_ = 0; + onChanged(); + return this; + } + + private int h_ ; + /** + * int32 h = 8; + */ + public int getH() { + return h_; + } + /** + * int32 h = 8; + */ + public Builder setH(int value) { + + h_ = value; + onChanged(); + return this; + } + /** + * int32 h = 8; + */ + public Builder clearH() { + + h_ = 0; + onChanged(); + return this; + } + + private int i_ ; + /** + * int32 i = 9; + */ + public int getI() { + return i_; + } + /** + * int32 i = 9; + */ + public Builder setI(int value) { + + i_ = value; + onChanged(); + return this; + } + /** + * int32 i = 9; + */ + public Builder clearI() { + + i_ = 0; + onChanged(); + return this; + } + + private int j_ ; + /** + * int32 j = 10; + */ + public int getJ() { + return j_; + } + /** + * int32 j = 10; + */ + public Builder setJ(int value) { + + j_ = value; + onChanged(); + return this; + } + /** + * int32 j = 10; + */ + public Builder clearJ() { + + j_ = 0; + onChanged(); + return this; + } + @Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFieldsProto3(unknownFields); + } + + @Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:IntObject) + } + + // @@protoc_insertion_point(class_scope:IntObject) + private static final IntObject DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new IntObject(); + } + + public static IntObject getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @Override + public IntObject parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new IntObject(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @Override + public IntObject getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + public interface FloatObjectOrBuilder extends + // @@protoc_insertion_point(interface_extends:FloatObject) + com.google.protobuf.MessageOrBuilder { + + /** + * float a = 1; + */ + float getA(); + + /** + * float b = 2; + */ + float getB(); + + /** + * float c = 3; + */ + float getC(); + + /** + * float d = 4; + */ + float getD(); + + /** + * float e = 5; + */ + float getE(); + + /** + * float f = 6; + */ + float getF(); + + /** + * float g = 7; + */ + float getG(); + + /** + * float h = 8; + */ + float getH(); + + /** + * float i = 9; + */ + float getI(); + + /** + * float j = 10; + */ + float getJ(); + } + /** + * Protobuf type {@code FloatObject} + */ + public static final class FloatObject extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:FloatObject) + FloatObjectOrBuilder { + private static final long serialVersionUID = 0L; + // Use FloatObject.newBuilder() to construct. + private FloatObject(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private FloatObject() { + a_ = 0F; + b_ = 0F; + c_ = 0F; + d_ = 0F; + e_ = 0F; + f_ = 0F; + g_ = 0F; + h_ = 0F; + i_ = 0F; + j_ = 0F; + } + + @Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private FloatObject( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 13: { + + a_ = input.readFloat(); + break; + } + case 21: { + + b_ = input.readFloat(); + break; + } + case 29: { + + c_ = input.readFloat(); + break; + } + case 37: { + + d_ = input.readFloat(); + break; + } + case 45: { + + e_ = input.readFloat(); + break; + } + case 53: { + + f_ = input.readFloat(); + break; + } + case 61: { + + g_ = input.readFloat(); + break; + } + case 69: { + + h_ = input.readFloat(); + break; + } + case 77: { + + i_ = input.readFloat(); + break; + } + case 85: { + + j_ = input.readFloat(); + break; + } + default: { + if (!parseUnknownFieldProto3( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return FieldProtobufObject.internal_static_FloatObject_descriptor; + } + + @Override + protected FieldAccessorTable + internalGetFieldAccessorTable() { + return FieldProtobufObject.internal_static_FloatObject_fieldAccessorTable + .ensureFieldAccessorsInitialized( + FloatObject.class, Builder.class); + } + + public static final int A_FIELD_NUMBER = 1; + private float a_; + /** + * float a = 1; + */ + public float getA() { + return a_; + } + + public static final int B_FIELD_NUMBER = 2; + private float b_; + /** + * float b = 2; + */ + public float getB() { + return b_; + } + + public static final int C_FIELD_NUMBER = 3; + private float c_; + /** + * float c = 3; + */ + public float getC() { + return c_; + } + + public static final int D_FIELD_NUMBER = 4; + private float d_; + /** + * float d = 4; + */ + public float getD() { + return d_; + } + + public static final int E_FIELD_NUMBER = 5; + private float e_; + /** + * float e = 5; + */ + public float getE() { + return e_; + } + + public static final int F_FIELD_NUMBER = 6; + private float f_; + /** + * float f = 6; + */ + public float getF() { + return f_; + } + + public static final int G_FIELD_NUMBER = 7; + private float g_; + /** + * float g = 7; + */ + public float getG() { + return g_; + } + + public static final int H_FIELD_NUMBER = 8; + private float h_; + /** + * float h = 8; + */ + public float getH() { + return h_; + } + + public static final int I_FIELD_NUMBER = 9; + private float i_; + /** + * float i = 9; + */ + public float getI() { + return i_; + } + + public static final int J_FIELD_NUMBER = 10; + private float j_; + /** + * float j = 10; + */ + public float getJ() { + return j_; + } + + private byte memoizedIsInitialized = -1; + @Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (a_ != 0F) { + output.writeFloat(1, a_); + } + if (b_ != 0F) { + output.writeFloat(2, b_); + } + if (c_ != 0F) { + output.writeFloat(3, c_); + } + if (d_ != 0F) { + output.writeFloat(4, d_); + } + if (e_ != 0F) { + output.writeFloat(5, e_); + } + if (f_ != 0F) { + output.writeFloat(6, f_); + } + if (g_ != 0F) { + output.writeFloat(7, g_); + } + if (h_ != 0F) { + output.writeFloat(8, h_); + } + if (i_ != 0F) { + output.writeFloat(9, i_); + } + if (j_ != 0F) { + output.writeFloat(10, j_); + } + unknownFields.writeTo(output); + } + + @Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (a_ != 0F) { + size += com.google.protobuf.CodedOutputStream + .computeFloatSize(1, a_); + } + if (b_ != 0F) { + size += com.google.protobuf.CodedOutputStream + .computeFloatSize(2, b_); + } + if (c_ != 0F) { + size += com.google.protobuf.CodedOutputStream + .computeFloatSize(3, c_); + } + if (d_ != 0F) { + size += com.google.protobuf.CodedOutputStream + .computeFloatSize(4, d_); + } + if (e_ != 0F) { + size += com.google.protobuf.CodedOutputStream + .computeFloatSize(5, e_); + } + if (f_ != 0F) { + size += com.google.protobuf.CodedOutputStream + .computeFloatSize(6, f_); + } + if (g_ != 0F) { + size += com.google.protobuf.CodedOutputStream + .computeFloatSize(7, g_); + } + if (h_ != 0F) { + size += com.google.protobuf.CodedOutputStream + .computeFloatSize(8, h_); + } + if (i_ != 0F) { + size += com.google.protobuf.CodedOutputStream + .computeFloatSize(9, i_); + } + if (j_ != 0F) { + size += com.google.protobuf.CodedOutputStream + .computeFloatSize(10, j_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @Override + public boolean equals(final Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof FloatObject)) { + return super.equals(obj); + } + FloatObject other = (FloatObject) obj; + + boolean result = true; + result = result && ( + Float.floatToIntBits(getA()) + == Float.floatToIntBits( + other.getA())); + result = result && ( + Float.floatToIntBits(getB()) + == Float.floatToIntBits( + other.getB())); + result = result && ( + Float.floatToIntBits(getC()) + == Float.floatToIntBits( + other.getC())); + result = result && ( + Float.floatToIntBits(getD()) + == Float.floatToIntBits( + other.getD())); + result = result && ( + Float.floatToIntBits(getE()) + == Float.floatToIntBits( + other.getE())); + result = result && ( + Float.floatToIntBits(getF()) + == Float.floatToIntBits( + other.getF())); + result = result && ( + Float.floatToIntBits(getG()) + == Float.floatToIntBits( + other.getG())); + result = result && ( + Float.floatToIntBits(getH()) + == Float.floatToIntBits( + other.getH())); + result = result && ( + Float.floatToIntBits(getI()) + == Float.floatToIntBits( + other.getI())); + result = result && ( + Float.floatToIntBits(getJ()) + == Float.floatToIntBits( + other.getJ())); + result = result && unknownFields.equals(other.unknownFields); + return result; + } + + @Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + A_FIELD_NUMBER; + hash = (53 * hash) + Float.floatToIntBits( + getA()); + hash = (37 * hash) + B_FIELD_NUMBER; + hash = (53 * hash) + Float.floatToIntBits( + getB()); + hash = (37 * hash) + C_FIELD_NUMBER; + hash = (53 * hash) + Float.floatToIntBits( + getC()); + hash = (37 * hash) + D_FIELD_NUMBER; + hash = (53 * hash) + Float.floatToIntBits( + getD()); + hash = (37 * hash) + E_FIELD_NUMBER; + hash = (53 * hash) + Float.floatToIntBits( + getE()); + hash = (37 * hash) + F_FIELD_NUMBER; + hash = (53 * hash) + Float.floatToIntBits( + getF()); + hash = (37 * hash) + G_FIELD_NUMBER; + hash = (53 * hash) + Float.floatToIntBits( + getG()); + hash = (37 * hash) + H_FIELD_NUMBER; + hash = (53 * hash) + Float.floatToIntBits( + getH()); + hash = (37 * hash) + I_FIELD_NUMBER; + hash = (53 * hash) + Float.floatToIntBits( + getI()); + hash = (37 * hash) + J_FIELD_NUMBER; + hash = (53 * hash) + Float.floatToIntBits( + getJ()); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static FloatObject parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static FloatObject parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static FloatObject parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static FloatObject parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static FloatObject parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static FloatObject parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static FloatObject parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static FloatObject parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static FloatObject parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static FloatObject parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static FloatObject parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static FloatObject parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(FloatObject prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @Override + protected Builder newBuilderForType( + BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code FloatObject} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:FloatObject) + FloatObjectOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return FieldProtobufObject.internal_static_FloatObject_descriptor; + } + + @Override + protected FieldAccessorTable + internalGetFieldAccessorTable() { + return FieldProtobufObject.internal_static_FloatObject_fieldAccessorTable + .ensureFieldAccessorsInitialized( + FloatObject.class, Builder.class); + } + + // Construct using com.zfoo.protocol.field.packet.FieldProtobufObject.FloatObject.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + @Override + public Builder clear() { + super.clear(); + a_ = 0F; + + b_ = 0F; + + c_ = 0F; + + d_ = 0F; + + e_ = 0F; + + f_ = 0F; + + g_ = 0F; + + h_ = 0F; + + i_ = 0F; + + j_ = 0F; + + return this; + } + + @Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return FieldProtobufObject.internal_static_FloatObject_descriptor; + } + + @Override + public FloatObject getDefaultInstanceForType() { + return FloatObject.getDefaultInstance(); + } + + @Override + public FloatObject build() { + FloatObject result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @Override + public FloatObject buildPartial() { + FloatObject result = new FloatObject(this); + result.a_ = a_; + result.b_ = b_; + result.c_ = c_; + result.d_ = d_; + result.e_ = e_; + result.f_ = f_; + result.g_ = g_; + result.h_ = h_; + result.i_ = i_; + result.j_ = j_; + onBuilt(); + return result; + } + + @Override + public Builder clone() { + return (Builder) super.clone(); + } + @Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + Object value) { + return (Builder) super.setField(field, value); + } + @Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + @Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + @Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + @Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + Object value) { + return (Builder) super.addRepeatedField(field, value); + } + @Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof FloatObject) { + return mergeFrom((FloatObject)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(FloatObject other) { + if (other == FloatObject.getDefaultInstance()) return this; + if (other.getA() != 0F) { + setA(other.getA()); + } + if (other.getB() != 0F) { + setB(other.getB()); + } + if (other.getC() != 0F) { + setC(other.getC()); + } + if (other.getD() != 0F) { + setD(other.getD()); + } + if (other.getE() != 0F) { + setE(other.getE()); + } + if (other.getF() != 0F) { + setF(other.getF()); + } + if (other.getG() != 0F) { + setG(other.getG()); + } + if (other.getH() != 0F) { + setH(other.getH()); + } + if (other.getI() != 0F) { + setI(other.getI()); + } + if (other.getJ() != 0F) { + setJ(other.getJ()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @Override + public final boolean isInitialized() { + return true; + } + + @Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + FloatObject parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (FloatObject) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private float a_ ; + /** + * float a = 1; + */ + public float getA() { + return a_; + } + /** + * float a = 1; + */ + public Builder setA(float value) { + + a_ = value; + onChanged(); + return this; + } + /** + * float a = 1; + */ + public Builder clearA() { + + a_ = 0F; + onChanged(); + return this; + } + + private float b_ ; + /** + * float b = 2; + */ + public float getB() { + return b_; + } + /** + * float b = 2; + */ + public Builder setB(float value) { + + b_ = value; + onChanged(); + return this; + } + /** + * float b = 2; + */ + public Builder clearB() { + + b_ = 0F; + onChanged(); + return this; + } + + private float c_ ; + /** + * float c = 3; + */ + public float getC() { + return c_; + } + /** + * float c = 3; + */ + public Builder setC(float value) { + + c_ = value; + onChanged(); + return this; + } + /** + * float c = 3; + */ + public Builder clearC() { + + c_ = 0F; + onChanged(); + return this; + } + + private float d_ ; + /** + * float d = 4; + */ + public float getD() { + return d_; + } + /** + * float d = 4; + */ + public Builder setD(float value) { + + d_ = value; + onChanged(); + return this; + } + /** + * float d = 4; + */ + public Builder clearD() { + + d_ = 0F; + onChanged(); + return this; + } + + private float e_ ; + /** + * float e = 5; + */ + public float getE() { + return e_; + } + /** + * float e = 5; + */ + public Builder setE(float value) { + + e_ = value; + onChanged(); + return this; + } + /** + * float e = 5; + */ + public Builder clearE() { + + e_ = 0F; + onChanged(); + return this; + } + + private float f_ ; + /** + * float f = 6; + */ + public float getF() { + return f_; + } + /** + * float f = 6; + */ + public Builder setF(float value) { + + f_ = value; + onChanged(); + return this; + } + /** + * float f = 6; + */ + public Builder clearF() { + + f_ = 0F; + onChanged(); + return this; + } + + private float g_ ; + /** + * float g = 7; + */ + public float getG() { + return g_; + } + /** + * float g = 7; + */ + public Builder setG(float value) { + + g_ = value; + onChanged(); + return this; + } + /** + * float g = 7; + */ + public Builder clearG() { + + g_ = 0F; + onChanged(); + return this; + } + + private float h_ ; + /** + * float h = 8; + */ + public float getH() { + return h_; + } + /** + * float h = 8; + */ + public Builder setH(float value) { + + h_ = value; + onChanged(); + return this; + } + /** + * float h = 8; + */ + public Builder clearH() { + + h_ = 0F; + onChanged(); + return this; + } + + private float i_ ; + /** + * float i = 9; + */ + public float getI() { + return i_; + } + /** + * float i = 9; + */ + public Builder setI(float value) { + + i_ = value; + onChanged(); + return this; + } + /** + * float i = 9; + */ + public Builder clearI() { + + i_ = 0F; + onChanged(); + return this; + } + + private float j_ ; + /** + * float j = 10; + */ + public float getJ() { + return j_; + } + /** + * float j = 10; + */ + public Builder setJ(float value) { + + j_ = value; + onChanged(); + return this; + } + /** + * float j = 10; + */ + public Builder clearJ() { + + j_ = 0F; + onChanged(); + return this; + } + @Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFieldsProto3(unknownFields); + } + + @Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:FloatObject) + } + + // @@protoc_insertion_point(class_scope:FloatObject) + private static final FloatObject DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new FloatObject(); + } + + public static FloatObject getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @Override + public FloatObject parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new FloatObject(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @Override + public FloatObject getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_IntObject_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_IntObject_fieldAccessorTable; + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_FloatObject_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_FloatObject_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor + getDescriptor() { + return descriptor; + } + private static com.google.protobuf.Descriptors.FileDescriptor + descriptor; + static { + String[] descriptorData = { + "\n\020fieldspeed.proto\"y\n\tIntObject\022\t\n\001a\030\001 \001" + + "(\005\022\t\n\001b\030\002 \001(\005\022\t\n\001c\030\003 \001(\005\022\t\n\001d\030\004 \001(\005\022\t\n\001e" + + "\030\005 \001(\005\022\t\n\001f\030\006 \001(\005\022\t\n\001g\030\007 \001(\005\022\t\n\001h\030\010 \001(\005\022" + + "\t\n\001i\030\t \001(\005\022\t\n\001j\030\n \001(\005\"{\n\013FloatObject\022\t\n\001" + + "a\030\001 \001(\002\022\t\n\001b\030\002 \001(\002\022\t\n\001c\030\003 \001(\002\022\t\n\001d\030\004 \001(\002" + + "\022\t\n\001e\030\005 \001(\002\022\t\n\001f\030\006 \001(\002\022\t\n\001g\030\007 \001(\002\022\t\n\001h\030\010" + + " \001(\002\022\t\n\001i\030\t \001(\002\022\t\n\001j\030\n \001(\002B5\n\036com.zfoo.p" + + "rotocol.field.packetB\023FieldProtobufObjec" + + "tb\006proto3" + }; + com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = + new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() { + public com.google.protobuf.ExtensionRegistry assignDescriptors( + com.google.protobuf.Descriptors.FileDescriptor root) { + descriptor = root; + return null; + } + }; + com.google.protobuf.Descriptors.FileDescriptor + .internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + }, assigner); + internal_static_IntObject_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_IntObject_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_IntObject_descriptor, + new String[] { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", }); + internal_static_FloatObject_descriptor = + getDescriptor().getMessageTypes().get(1); + internal_static_FloatObject_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_FloatObject_descriptor, + new String[] { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", }); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/protocol/src/test/java/com/zfoo/protocol/field/packet/FloatObject.java b/protocol/src/test/java/com/zfoo/protocol/field/packet/FloatObject.java new file mode 100644 index 00000000..ad7cbc29 --- /dev/null +++ b/protocol/src/test/java/com/zfoo/protocol/field/packet/FloatObject.java @@ -0,0 +1,120 @@ +package com.zfoo.protocol.field.packet; + +import com.zfoo.protocol.IPacket; + +import java.util.Objects; + +public class FloatObject implements IPacket { + private float a; + + private float b; + + private float c; + + private float d; + + private float e; + + private float f; + + private float g; + + private float h; + + private float i; + + private float j; + + public float getA() { + return a; + } + + public void setA(float a) { + this.a = a; + } + + public float getB() { + return b; + } + + public void setB(float b) { + this.b = b; + } + + public float getC() { + return c; + } + + public void setC(float c) { + this.c = c; + } + + public float getD() { + return d; + } + + public void setD(float d) { + this.d = d; + } + + public float getE() { + return e; + } + + public void setE(float e) { + this.e = e; + } + + public float getF() { + return f; + } + + public void setF(float f) { + this.f = f; + } + + public float getG() { + return g; + } + + public void setG(float g) { + this.g = g; + } + + public float getH() { + return h; + } + + public void setH(float h) { + this.h = h; + } + + public float getI() { + return i; + } + + public void setI(float i) { + this.i = i; + } + + public float getJ() { + return j; + } + + public void setJ(float j) { + this.j = j; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + FloatObject that = (FloatObject) o; + return Float.compare(that.a, a) == 0 && Float.compare(that.b, b) == 0 && Float.compare(that.c, c) == 0 && Float.compare(that.d, d) == 0 && Float.compare(that.e, e) == 0 && Float.compare(that.f, f) == 0 && Float.compare(that.g, g) == 0 && Float.compare(that.h, h) == 0 && Float.compare(that.i, i) == 0 && Float.compare(that.j, j) == 0; + } + + @Override + public int hashCode() { + return Objects.hash(a, b, c, d, e, f, g, h, i, j); + } +} diff --git a/protocol/src/test/java/com/zfoo/protocol/field/packet/IntObject.java b/protocol/src/test/java/com/zfoo/protocol/field/packet/IntObject.java new file mode 100644 index 00000000..8bdb0f01 --- /dev/null +++ b/protocol/src/test/java/com/zfoo/protocol/field/packet/IntObject.java @@ -0,0 +1,120 @@ +package com.zfoo.protocol.field.packet; + +import com.zfoo.protocol.IPacket; + +import java.util.Objects; + +public class IntObject implements IPacket { + private int a; + + private int b; + + private int c; + + private int d; + + private int e; + + private int f; + + private int g; + + private int h; + + private int i; + + private int j; + + public int getA() { + return a; + } + + public void setA(int a) { + this.a = a; + } + + public int getB() { + return b; + } + + public void setB(int b) { + this.b = b; + } + + public int getC() { + return c; + } + + public void setC(int c) { + this.c = c; + } + + public int getD() { + return d; + } + + public void setD(int d) { + this.d = d; + } + + public int getE() { + return e; + } + + public void setE(int e) { + this.e = e; + } + + public int getF() { + return f; + } + + public void setF(int f) { + this.f = f; + } + + public int getG() { + return g; + } + + public void setG(int g) { + this.g = g; + } + + public int getH() { + return h; + } + + public void setH(int h) { + this.h = h; + } + + public int getI() { + return i; + } + + public void setI(int i) { + this.i = i; + } + + public int getJ() { + return j; + } + + public void setJ(int j) { + this.j = j; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + IntObject intObject = (IntObject) o; + return a == intObject.a && b == intObject.b && c == intObject.c && d == intObject.d && e == intObject.e && f == intObject.f && g == intObject.g && h == intObject.h && i == intObject.i && j == intObject.j; + } + + @Override + public int hashCode() { + return Objects.hash(a, b, c, d, e, f, g, h, i, j); + } +} diff --git a/protocol/src/test/java/com/zfoo/protocol/field/packet/IntegerObject.java b/protocol/src/test/java/com/zfoo/protocol/field/packet/IntegerObject.java new file mode 100644 index 00000000..9ec12ef0 --- /dev/null +++ b/protocol/src/test/java/com/zfoo/protocol/field/packet/IntegerObject.java @@ -0,0 +1,120 @@ +package com.zfoo.protocol.field.packet; + +import com.zfoo.protocol.IPacket; + +import java.util.Objects; + +public class IntegerObject implements IPacket { + private Integer a; + + private Integer b; + + private Integer c; + + private Integer d; + + private Integer e; + + private Integer f; + + private Integer g; + + private Integer h; + + private Integer i; + + private Integer j; + + public Integer getA() { + return a; + } + + public void setA(Integer a) { + this.a = a; + } + + public Integer getB() { + return b; + } + + public void setB(Integer b) { + this.b = b; + } + + public Integer getC() { + return c; + } + + public void setC(Integer c) { + this.c = c; + } + + public Integer getD() { + return d; + } + + public void setD(Integer d) { + this.d = d; + } + + public Integer getE() { + return e; + } + + public void setE(Integer e) { + this.e = e; + } + + public Integer getF() { + return f; + } + + public void setF(Integer f) { + this.f = f; + } + + public Integer getG() { + return g; + } + + public void setG(Integer g) { + this.g = g; + } + + public Integer getH() { + return h; + } + + public void setH(Integer h) { + this.h = h; + } + + public Integer getI() { + return i; + } + + public void setI(Integer i) { + this.i = i; + } + + public Integer getJ() { + return j; + } + + public void setJ(Integer j) { + this.j = j; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + IntegerObject that = (IntegerObject) o; + return a.equals(that.a) && b.equals(that.b) && c.equals(that.c) && d.equals(that.d) && e.equals(that.e) && f.equals(that.f) && g.equals(that.g) && h.equals(that.h) && i.equals(that.i) && j.equals(that.j); + } + + @Override + public int hashCode() { + return Objects.hash(a, b, c, d, e, f, g, h, i, j); + } +} diff --git a/protocol/src/test/resources/fieldspeed.proto b/protocol/src/test/resources/fieldspeed.proto new file mode 100644 index 00000000..e388252a --- /dev/null +++ b/protocol/src/test/resources/fieldspeed.proto @@ -0,0 +1,30 @@ +syntax = "proto3"; + +option java_package = "com.zfoo.protocol.field.packet"; +option java_outer_classname = "FieldProtobufObject"; + +message IntObject{ + int32 a=1; + int32 b=2; + int32 c=3; + int32 d=4; + int32 e=5; + int32 f=6; + int32 g=7; + int32 h=8; + int32 i=9; + int32 j=10; +} + +message FloatObject{ + float a=1; + float b=2; + float c=3; + float d=4; + float e=5; + float f=6; + float g=7; + float h=8; + float i=9; + float j=10; +}