001// Automatically generated by the Thrifty compiler; do not edit!
002// Generated on: 2021-05-17T06:20:27.413Z
003// Source: J:\facedb\facedb-service\FaceDb.thrift at 11:1
004package net.gdface.facedb.thrift.client;
005
006import com.microsoft.thrifty.Adapter;
007import com.microsoft.thrifty.Struct;
008import com.microsoft.thrifty.StructBuilder;
009import com.microsoft.thrifty.TType;
010import com.microsoft.thrifty.ThriftField;
011import com.microsoft.thrifty.protocol.FieldMetadata;
012import com.microsoft.thrifty.protocol.Protocol;
013import com.microsoft.thrifty.util.ProtocolUtil;
014import java.io.IOException;
015import javax.annotation.Generated;
016
017@Generated(
018    value = "com.microsoft.thrifty.gen.ThriftyCodeGenerator",
019    comments = "https://github.com/microsoft/thrifty"
020)
021public final class FAngle implements Struct {
022  public static final Adapter<FAngle, Builder> ADAPTER = new FAngleAdapter();
023
024  @ThriftField(
025      fieldId = 1,
026      isRequired = true
027  )
028  public final Double confidence;
029
030  @ThriftField(
031      fieldId = 2,
032      isRequired = true
033  )
034  public final Integer pitch;
035
036  @ThriftField(
037      fieldId = 3,
038      isRequired = true
039  )
040  public final Integer roll;
041
042  @ThriftField(
043      fieldId = 4,
044      isRequired = true
045  )
046  public final Integer yaw;
047
048  private FAngle(Builder builder) {
049    this.confidence = builder.confidence;
050    this.pitch = builder.pitch;
051    this.roll = builder.roll;
052    this.yaw = builder.yaw;
053  }
054
055  @Override
056  @SuppressWarnings("NumberEquality")
057  public boolean equals(Object other) {
058    if (this == other) return true;
059    if (other == null) return false;
060    if (!(other instanceof FAngle)) return false;
061    FAngle that = (FAngle) other;
062    return (this.confidence == that.confidence || this.confidence.equals(that.confidence))
063        && (this.pitch == that.pitch || this.pitch.equals(that.pitch))
064        && (this.roll == that.roll || this.roll.equals(that.roll))
065        && (this.yaw == that.yaw || this.yaw.equals(that.yaw));
066  }
067
068  @Override
069  public int hashCode() {
070    int code = 16777619;
071    code ^= this.confidence.hashCode();
072    code *= 0x811c9dc5;
073    code ^= this.pitch.hashCode();
074    code *= 0x811c9dc5;
075    code ^= this.roll.hashCode();
076    code *= 0x811c9dc5;
077    code ^= this.yaw.hashCode();
078    code *= 0x811c9dc5;
079    return code;
080  }
081
082  @Override
083  public String toString() {
084    return "FAngle{confidence=" + this.confidence + ", pitch=" + this.pitch + ", roll=" + this.roll + ", yaw=" + this.yaw + "}";
085  }
086
087  @Override
088  public void write(Protocol protocol) throws IOException {
089    ADAPTER.write(protocol, this);
090  }
091
092  public static final class Builder implements StructBuilder<FAngle> {
093    private Double confidence;
094
095    private Integer pitch;
096
097    private Integer roll;
098
099    private Integer yaw;
100
101    public Builder() {
102    }
103
104    public Builder(FAngle struct) {
105      this.confidence = struct.confidence;
106      this.pitch = struct.pitch;
107      this.roll = struct.roll;
108      this.yaw = struct.yaw;
109    }
110
111    public Builder confidence(Double confidence) {
112      if (confidence == null) {
113        throw new NullPointerException("Required field 'confidence' cannot be null");
114      }
115      this.confidence = confidence;
116      return this;
117    }
118
119    public Builder pitch(Integer pitch) {
120      if (pitch == null) {
121        throw new NullPointerException("Required field 'pitch' cannot be null");
122      }
123      this.pitch = pitch;
124      return this;
125    }
126
127    public Builder roll(Integer roll) {
128      if (roll == null) {
129        throw new NullPointerException("Required field 'roll' cannot be null");
130      }
131      this.roll = roll;
132      return this;
133    }
134
135    public Builder yaw(Integer yaw) {
136      if (yaw == null) {
137        throw new NullPointerException("Required field 'yaw' cannot be null");
138      }
139      this.yaw = yaw;
140      return this;
141    }
142
143    @Override
144    public FAngle build() {
145      if (this.confidence == null) {
146        throw new IllegalStateException("Required field 'confidence' is missing");
147      }
148      if (this.pitch == null) {
149        throw new IllegalStateException("Required field 'pitch' is missing");
150      }
151      if (this.roll == null) {
152        throw new IllegalStateException("Required field 'roll' is missing");
153      }
154      if (this.yaw == null) {
155        throw new IllegalStateException("Required field 'yaw' is missing");
156      }
157      return new FAngle(this);
158    }
159
160    @Override
161    public void reset() {
162      this.confidence = null;
163      this.pitch = null;
164      this.roll = null;
165      this.yaw = null;
166    }
167  }
168
169  private static final class FAngleAdapter implements Adapter<FAngle, Builder> {
170    @Override
171    public void write(Protocol protocol, FAngle struct) throws IOException {
172      protocol.writeStructBegin("FAngle");
173      protocol.writeFieldBegin("confidence", 1, TType.DOUBLE);
174      protocol.writeDouble(struct.confidence);
175      protocol.writeFieldEnd();
176      protocol.writeFieldBegin("pitch", 2, TType.I32);
177      protocol.writeI32(struct.pitch);
178      protocol.writeFieldEnd();
179      protocol.writeFieldBegin("roll", 3, TType.I32);
180      protocol.writeI32(struct.roll);
181      protocol.writeFieldEnd();
182      protocol.writeFieldBegin("yaw", 4, TType.I32);
183      protocol.writeI32(struct.yaw);
184      protocol.writeFieldEnd();
185      protocol.writeFieldStop();
186      protocol.writeStructEnd();
187    }
188
189    @Override
190    public FAngle read(Protocol protocol, Builder builder) throws IOException {
191      protocol.readStructBegin();
192      while (true) {
193        FieldMetadata field = protocol.readFieldBegin();
194        if (field.typeId == TType.STOP) {
195          break;
196        }
197        switch (field.fieldId) {
198          case 1: {
199            if (field.typeId == TType.DOUBLE) {
200              double value = protocol.readDouble();
201              builder.confidence(value);
202            } else {
203              ProtocolUtil.skip(protocol, field.typeId);
204            }
205          }
206          break;
207          case 2: {
208            if (field.typeId == TType.I32) {
209              int value = protocol.readI32();
210              builder.pitch(value);
211            } else {
212              ProtocolUtil.skip(protocol, field.typeId);
213            }
214          }
215          break;
216          case 3: {
217            if (field.typeId == TType.I32) {
218              int value = protocol.readI32();
219              builder.roll(value);
220            } else {
221              ProtocolUtil.skip(protocol, field.typeId);
222            }
223          }
224          break;
225          case 4: {
226            if (field.typeId == TType.I32) {
227              int value = protocol.readI32();
228              builder.yaw(value);
229            } else {
230              ProtocolUtil.skip(protocol, field.typeId);
231            }
232          }
233          break;
234          default: {
235            ProtocolUtil.skip(protocol, field.typeId);
236          }
237          break;
238        }
239        protocol.readFieldEnd();
240      }
241      protocol.readStructEnd();
242      return builder.build();
243    }
244
245    @Override
246    public FAngle read(Protocol protocol) throws IOException {
247      return read(protocol, new Builder());
248    }
249  }
250}