All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.gdface.facedb.thrift.client.FAngle Maven / Gradle / Ivy

// Automatically generated by the Thrifty compiler; do not edit!
// Generated on: 2019-09-24T07:53:45.878Z
// Source: J:\facedb\FaceDb.thrift at 8:1
package net.gdface.facedb.thrift.client;

import com.microsoft.thrifty.Adapter;
import com.microsoft.thrifty.Struct;
import com.microsoft.thrifty.StructBuilder;
import com.microsoft.thrifty.TType;
import com.microsoft.thrifty.ThriftField;
import com.microsoft.thrifty.protocol.FieldMetadata;
import com.microsoft.thrifty.protocol.Protocol;
import com.microsoft.thrifty.util.ProtocolUtil;
import java.io.IOException;
import javax.annotation.Generated;

@Generated(
    value = "com.microsoft.thrifty.gen.ThriftyCodeGenerator",
    comments = "https://github.com/microsoft/thrifty"
)
public final class FAngle implements Struct {
  public static final Adapter ADAPTER = new FAngleAdapter();

  @ThriftField(
      fieldId = 1,
      isRequired = true
  )
  public final Double confidence;

  @ThriftField(
      fieldId = 2,
      isRequired = true
  )
  public final Integer pitch;

  @ThriftField(
      fieldId = 3,
      isRequired = true
  )
  public final Integer roll;

  @ThriftField(
      fieldId = 4,
      isRequired = true
  )
  public final Integer yaw;

  private FAngle(Builder builder) {
    this.confidence = builder.confidence;
    this.pitch = builder.pitch;
    this.roll = builder.roll;
    this.yaw = builder.yaw;
  }

  @Override
  @SuppressWarnings("NumberEquality")
  public boolean equals(Object other) {
    if (this == other) return true;
    if (other == null) return false;
    if (!(other instanceof FAngle)) return false;
    FAngle that = (FAngle) other;
    return (this.confidence == that.confidence || this.confidence.equals(that.confidence))
        && (this.pitch == that.pitch || this.pitch.equals(that.pitch))
        && (this.roll == that.roll || this.roll.equals(that.roll))
        && (this.yaw == that.yaw || this.yaw.equals(that.yaw));
  }

  @Override
  public int hashCode() {
    int code = 16777619;
    code ^= this.confidence.hashCode();
    code *= 0x811c9dc5;
    code ^= this.pitch.hashCode();
    code *= 0x811c9dc5;
    code ^= this.roll.hashCode();
    code *= 0x811c9dc5;
    code ^= this.yaw.hashCode();
    code *= 0x811c9dc5;
    return code;
  }

  @Override
  public String toString() {
    return "FAngle{confidence=" + this.confidence + ", pitch=" + this.pitch + ", roll=" + this.roll + ", yaw=" + this.yaw + "}";
  }

  @Override
  public void write(Protocol protocol) throws IOException {
    ADAPTER.write(protocol, this);
  }

  public static final class Builder implements StructBuilder {
    private Double confidence;

    private Integer pitch;

    private Integer roll;

    private Integer yaw;

    public Builder() {
    }

    public Builder(FAngle struct) {
      this.confidence = struct.confidence;
      this.pitch = struct.pitch;
      this.roll = struct.roll;
      this.yaw = struct.yaw;
    }

    public Builder confidence(Double confidence) {
      if (confidence == null) {
        throw new NullPointerException("Required field 'confidence' cannot be null");
      }
      this.confidence = confidence;
      return this;
    }

    public Builder pitch(Integer pitch) {
      if (pitch == null) {
        throw new NullPointerException("Required field 'pitch' cannot be null");
      }
      this.pitch = pitch;
      return this;
    }

    public Builder roll(Integer roll) {
      if (roll == null) {
        throw new NullPointerException("Required field 'roll' cannot be null");
      }
      this.roll = roll;
      return this;
    }

    public Builder yaw(Integer yaw) {
      if (yaw == null) {
        throw new NullPointerException("Required field 'yaw' cannot be null");
      }
      this.yaw = yaw;
      return this;
    }

    @Override
    public FAngle build() {
      if (this.confidence == null) {
        throw new IllegalStateException("Required field 'confidence' is missing");
      }
      if (this.pitch == null) {
        throw new IllegalStateException("Required field 'pitch' is missing");
      }
      if (this.roll == null) {
        throw new IllegalStateException("Required field 'roll' is missing");
      }
      if (this.yaw == null) {
        throw new IllegalStateException("Required field 'yaw' is missing");
      }
      return new FAngle(this);
    }

    @Override
    public void reset() {
      this.confidence = null;
      this.pitch = null;
      this.roll = null;
      this.yaw = null;
    }
  }

  private static final class FAngleAdapter implements Adapter {
    @Override
    public void write(Protocol protocol, FAngle struct) throws IOException {
      protocol.writeStructBegin("FAngle");
      protocol.writeFieldBegin("confidence", 1, TType.DOUBLE);
      protocol.writeDouble(struct.confidence);
      protocol.writeFieldEnd();
      protocol.writeFieldBegin("pitch", 2, TType.I32);
      protocol.writeI32(struct.pitch);
      protocol.writeFieldEnd();
      protocol.writeFieldBegin("roll", 3, TType.I32);
      protocol.writeI32(struct.roll);
      protocol.writeFieldEnd();
      protocol.writeFieldBegin("yaw", 4, TType.I32);
      protocol.writeI32(struct.yaw);
      protocol.writeFieldEnd();
      protocol.writeFieldStop();
      protocol.writeStructEnd();
    }

    @Override
    public FAngle read(Protocol protocol, Builder builder) throws IOException {
      protocol.readStructBegin();
      while (true) {
        FieldMetadata field = protocol.readFieldBegin();
        if (field.typeId == TType.STOP) {
          break;
        }
        switch (field.fieldId) {
          case 1: {
            if (field.typeId == TType.DOUBLE) {
              double value = protocol.readDouble();
              builder.confidence(value);
            } else {
              ProtocolUtil.skip(protocol, field.typeId);
            }
          }
          break;
          case 2: {
            if (field.typeId == TType.I32) {
              int value = protocol.readI32();
              builder.pitch(value);
            } else {
              ProtocolUtil.skip(protocol, field.typeId);
            }
          }
          break;
          case 3: {
            if (field.typeId == TType.I32) {
              int value = protocol.readI32();
              builder.roll(value);
            } else {
              ProtocolUtil.skip(protocol, field.typeId);
            }
          }
          break;
          case 4: {
            if (field.typeId == TType.I32) {
              int value = protocol.readI32();
              builder.yaw(value);
            } else {
              ProtocolUtil.skip(protocol, field.typeId);
            }
          }
          break;
          default: {
            ProtocolUtil.skip(protocol, field.typeId);
          }
          break;
        }
        protocol.readFieldEnd();
      }
      protocol.readStructEnd();
      return builder.build();
    }

    @Override
    public FAngle read(Protocol protocol) throws IOException {
      return read(protocol, new Builder());
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy