// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: tensorflow/core/protobuf/struct.proto

package org.tensorflow.proto.framework;

/**
 * <pre>
 * Represents a tf.TypeSpec
 * </pre>
 *
 * Protobuf type {@code tensorflow.TypeSpecProto}
 */
public  final class TypeSpecProto extends
    com.google.protobuf.GeneratedMessageV3 implements
    // @@protoc_insertion_point(message_implements:tensorflow.TypeSpecProto)
    TypeSpecProtoOrBuilder {
private static final long serialVersionUID = 0L;
  // Use TypeSpecProto.newBuilder() to construct.
  private TypeSpecProto(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
    super(builder);
  }
  private TypeSpecProto() {
    typeSpecClass_ = 0;
    typeSpecClassName_ = "";
  }

  @java.lang.Override
  @SuppressWarnings({"unused"})
  protected java.lang.Object newInstance(
      UnusedPrivateParameter unused) {
    return new TypeSpecProto();
  }

  @java.lang.Override
  public final com.google.protobuf.UnknownFieldSet
  getUnknownFields() {
    return this.unknownFields;
  }
  private TypeSpecProto(
      com.google.protobuf.CodedInputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    this();
    if (extensionRegistry == null) {
      throw new java.lang.NullPointerException();
    }
    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: {
            int rawValue = input.readEnum();

            typeSpecClass_ = rawValue;
            break;
          }
          case 18: {
            org.tensorflow.proto.framework.StructuredValue.Builder subBuilder = null;
            if (typeState_ != null) {
              subBuilder = typeState_.toBuilder();
            }
            typeState_ = input.readMessage(org.tensorflow.proto.framework.StructuredValue.parser(), extensionRegistry);
            if (subBuilder != null) {
              subBuilder.mergeFrom(typeState_);
              typeState_ = subBuilder.buildPartial();
            }

            break;
          }
          case 26: {
            java.lang.String s = input.readStringRequireUtf8();

            typeSpecClassName_ = s;
            break;
          }
          case 32: {

            numFlatComponents_ = input.readInt32();
            break;
          }
          default: {
            if (!parseUnknownField(
                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 org.tensorflow.proto.framework.StructProtos.internal_static_tensorflow_TypeSpecProto_descriptor;
  }

  @java.lang.Override
  protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return org.tensorflow.proto.framework.StructProtos.internal_static_tensorflow_TypeSpecProto_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            org.tensorflow.proto.framework.TypeSpecProto.class, org.tensorflow.proto.framework.TypeSpecProto.Builder.class);
  }

  /**
   * Protobuf enum {@code tensorflow.TypeSpecProto.TypeSpecClass}
   */
  public enum TypeSpecClass
      implements com.google.protobuf.ProtocolMessageEnum {
    /**
     * <code>UNKNOWN = 0;</code>
     */
    UNKNOWN(0),
    /**
     * <pre>
     * tf.SparseTensorSpec
     * </pre>
     *
     * <code>SPARSE_TENSOR_SPEC = 1;</code>
     */
    SPARSE_TENSOR_SPEC(1),
    /**
     * <pre>
     * tf.IndexedSlicesSpec
     * </pre>
     *
     * <code>INDEXED_SLICES_SPEC = 2;</code>
     */
    INDEXED_SLICES_SPEC(2),
    /**
     * <pre>
     * tf.RaggedTensorSpec
     * </pre>
     *
     * <code>RAGGED_TENSOR_SPEC = 3;</code>
     */
    RAGGED_TENSOR_SPEC(3),
    /**
     * <pre>
     * tf.TensorArraySpec
     * </pre>
     *
     * <code>TENSOR_ARRAY_SPEC = 4;</code>
     */
    TENSOR_ARRAY_SPEC(4),
    /**
     * <pre>
     * tf.data.DatasetSpec
     * </pre>
     *
     * <code>DATA_DATASET_SPEC = 5;</code>
     */
    DATA_DATASET_SPEC(5),
    /**
     * <pre>
     * IteratorSpec from data/ops/iterator_ops.py
     * </pre>
     *
     * <code>DATA_ITERATOR_SPEC = 6;</code>
     */
    DATA_ITERATOR_SPEC(6),
    /**
     * <pre>
     * tf.OptionalSpec
     * </pre>
     *
     * <code>OPTIONAL_SPEC = 7;</code>
     */
    OPTIONAL_SPEC(7),
    /**
     * <pre>
     * PerReplicaSpec from distribute/values.py
     * </pre>
     *
     * <code>PER_REPLICA_SPEC = 8;</code>
     */
    PER_REPLICA_SPEC(8),
    /**
     * <pre>
     * tf.VariableSpec
     * </pre>
     *
     * <code>VARIABLE_SPEC = 9;</code>
     */
    VARIABLE_SPEC(9),
    /**
     * <pre>
     * RowPartitionSpec from ragged/row_partition.py
     * </pre>
     *
     * <code>ROW_PARTITION_SPEC = 10;</code>
     */
    ROW_PARTITION_SPEC(10),
    /**
     * <pre>
     * The type registered as type_spec_class_name.
     * </pre>
     *
     * <code>REGISTERED_TYPE_SPEC = 12;</code>
     */
    REGISTERED_TYPE_SPEC(12),
    /**
     * <pre>
     * Subclasses of tf.ExtensionType
     * </pre>
     *
     * <code>EXTENSION_TYPE_SPEC = 13;</code>
     */
    EXTENSION_TYPE_SPEC(13),
    UNRECOGNIZED(-1),
    ;

    /**
     * <code>UNKNOWN = 0;</code>
     */
    public static final int UNKNOWN_VALUE = 0;
    /**
     * <pre>
     * tf.SparseTensorSpec
     * </pre>
     *
     * <code>SPARSE_TENSOR_SPEC = 1;</code>
     */
    public static final int SPARSE_TENSOR_SPEC_VALUE = 1;
    /**
     * <pre>
     * tf.IndexedSlicesSpec
     * </pre>
     *
     * <code>INDEXED_SLICES_SPEC = 2;</code>
     */
    public static final int INDEXED_SLICES_SPEC_VALUE = 2;
    /**
     * <pre>
     * tf.RaggedTensorSpec
     * </pre>
     *
     * <code>RAGGED_TENSOR_SPEC = 3;</code>
     */
    public static final int RAGGED_TENSOR_SPEC_VALUE = 3;
    /**
     * <pre>
     * tf.TensorArraySpec
     * </pre>
     *
     * <code>TENSOR_ARRAY_SPEC = 4;</code>
     */
    public static final int TENSOR_ARRAY_SPEC_VALUE = 4;
    /**
     * <pre>
     * tf.data.DatasetSpec
     * </pre>
     *
     * <code>DATA_DATASET_SPEC = 5;</code>
     */
    public static final int DATA_DATASET_SPEC_VALUE = 5;
    /**
     * <pre>
     * IteratorSpec from data/ops/iterator_ops.py
     * </pre>
     *
     * <code>DATA_ITERATOR_SPEC = 6;</code>
     */
    public static final int DATA_ITERATOR_SPEC_VALUE = 6;
    /**
     * <pre>
     * tf.OptionalSpec
     * </pre>
     *
     * <code>OPTIONAL_SPEC = 7;</code>
     */
    public static final int OPTIONAL_SPEC_VALUE = 7;
    /**
     * <pre>
     * PerReplicaSpec from distribute/values.py
     * </pre>
     *
     * <code>PER_REPLICA_SPEC = 8;</code>
     */
    public static final int PER_REPLICA_SPEC_VALUE = 8;
    /**
     * <pre>
     * tf.VariableSpec
     * </pre>
     *
     * <code>VARIABLE_SPEC = 9;</code>
     */
    public static final int VARIABLE_SPEC_VALUE = 9;
    /**
     * <pre>
     * RowPartitionSpec from ragged/row_partition.py
     * </pre>
     *
     * <code>ROW_PARTITION_SPEC = 10;</code>
     */
    public static final int ROW_PARTITION_SPEC_VALUE = 10;
    /**
     * <pre>
     * The type registered as type_spec_class_name.
     * </pre>
     *
     * <code>REGISTERED_TYPE_SPEC = 12;</code>
     */
    public static final int REGISTERED_TYPE_SPEC_VALUE = 12;
    /**
     * <pre>
     * Subclasses of tf.ExtensionType
     * </pre>
     *
     * <code>EXTENSION_TYPE_SPEC = 13;</code>
     */
    public static final int EXTENSION_TYPE_SPEC_VALUE = 13;


    public final int getNumber() {
      if (this == UNRECOGNIZED) {
        throw new java.lang.IllegalArgumentException(
            "Can't get the number of an unknown enum value.");
      }
      return value;
    }

    /**
     * @deprecated Use {@link #forNumber(int)} instead.
     */
    @java.lang.Deprecated
    public static TypeSpecClass valueOf(int value) {
      return forNumber(value);
    }

    public static TypeSpecClass forNumber(int value) {
      switch (value) {
        case 0: return UNKNOWN;
        case 1: return SPARSE_TENSOR_SPEC;
        case 2: return INDEXED_SLICES_SPEC;
        case 3: return RAGGED_TENSOR_SPEC;
        case 4: return TENSOR_ARRAY_SPEC;
        case 5: return DATA_DATASET_SPEC;
        case 6: return DATA_ITERATOR_SPEC;
        case 7: return OPTIONAL_SPEC;
        case 8: return PER_REPLICA_SPEC;
        case 9: return VARIABLE_SPEC;
        case 10: return ROW_PARTITION_SPEC;
        case 12: return REGISTERED_TYPE_SPEC;
        case 13: return EXTENSION_TYPE_SPEC;
        default: return null;
      }
    }

    public static com.google.protobuf.Internal.EnumLiteMap<TypeSpecClass>
        internalGetValueMap() {
      return internalValueMap;
    }
    private static final com.google.protobuf.Internal.EnumLiteMap<
        TypeSpecClass> internalValueMap =
          new com.google.protobuf.Internal.EnumLiteMap<TypeSpecClass>() {
            public TypeSpecClass findValueByNumber(int number) {
              return TypeSpecClass.forNumber(number);
            }
          };

    public final com.google.protobuf.Descriptors.EnumValueDescriptor
        getValueDescriptor() {
      return getDescriptor().getValues().get(ordinal());
    }
    public final com.google.protobuf.Descriptors.EnumDescriptor
        getDescriptorForType() {
      return getDescriptor();
    }
    public static final com.google.protobuf.Descriptors.EnumDescriptor
        getDescriptor() {
      return org.tensorflow.proto.framework.TypeSpecProto.getDescriptor().getEnumTypes().get(0);
    }

    private static final TypeSpecClass[] VALUES = values();

    public static TypeSpecClass valueOf(
        com.google.protobuf.Descriptors.EnumValueDescriptor desc) {
      if (desc.getType() != getDescriptor()) {
        throw new java.lang.IllegalArgumentException(
          "EnumValueDescriptor is not for this type.");
      }
      if (desc.getIndex() == -1) {
        return UNRECOGNIZED;
      }
      return VALUES[desc.getIndex()];
    }

    private final int value;

    private TypeSpecClass(int value) {
      this.value = value;
    }

    // @@protoc_insertion_point(enum_scope:tensorflow.TypeSpecProto.TypeSpecClass)
  }

  public static final int TYPE_SPEC_CLASS_FIELD_NUMBER = 1;
  private int typeSpecClass_;
  /**
   * <code>.tensorflow.TypeSpecProto.TypeSpecClass type_spec_class = 1;</code>
   */
  public int getTypeSpecClassValue() {
    return typeSpecClass_;
  }
  /**
   * <code>.tensorflow.TypeSpecProto.TypeSpecClass type_spec_class = 1;</code>
   */
  public org.tensorflow.proto.framework.TypeSpecProto.TypeSpecClass getTypeSpecClass() {
    @SuppressWarnings("deprecation")
    org.tensorflow.proto.framework.TypeSpecProto.TypeSpecClass result = org.tensorflow.proto.framework.TypeSpecProto.TypeSpecClass.valueOf(typeSpecClass_);
    return result == null ? org.tensorflow.proto.framework.TypeSpecProto.TypeSpecClass.UNRECOGNIZED : result;
  }

  public static final int TYPE_STATE_FIELD_NUMBER = 2;
  private org.tensorflow.proto.framework.StructuredValue typeState_;
  /**
   * <pre>
   * The value returned by TypeSpec._serialize().
   * </pre>
   *
   * <code>.tensorflow.StructuredValue type_state = 2;</code>
   */
  public boolean hasTypeState() {
    return typeState_ != null;
  }
  /**
   * <pre>
   * The value returned by TypeSpec._serialize().
   * </pre>
   *
   * <code>.tensorflow.StructuredValue type_state = 2;</code>
   */
  public org.tensorflow.proto.framework.StructuredValue getTypeState() {
    return typeState_ == null ? org.tensorflow.proto.framework.StructuredValue.getDefaultInstance() : typeState_;
  }
  /**
   * <pre>
   * The value returned by TypeSpec._serialize().
   * </pre>
   *
   * <code>.tensorflow.StructuredValue type_state = 2;</code>
   */
  public org.tensorflow.proto.framework.StructuredValueOrBuilder getTypeStateOrBuilder() {
    return getTypeState();
  }

  public static final int TYPE_SPEC_CLASS_NAME_FIELD_NUMBER = 3;
  private volatile java.lang.Object typeSpecClassName_;
  /**
   * <pre>
   * The name of the TypeSpec class.
   *  * If type_spec_class == REGISTERED_TYPE_SPEC, the TypeSpec class is
   *    the one registered under this name. For types registered outside
   *    core TensorFlow by an add-on library, that library must be loaded
   *    before this value can be deserialized by StructureCoder.
   *  * If type_spec_class specifies a particular TypeSpec class, this field is
   *    redundant with the type_spec_class enum, and is only used for error
   *    reporting in older binaries that do not know the tupe_spec_class enum.
   * </pre>
   *
   * <code>string type_spec_class_name = 3;</code>
   */
  public java.lang.String getTypeSpecClassName() {
    java.lang.Object ref = typeSpecClassName_;
    if (ref instanceof java.lang.String) {
      return (java.lang.String) ref;
    } else {
      com.google.protobuf.ByteString bs = 
          (com.google.protobuf.ByteString) ref;
      java.lang.String s = bs.toStringUtf8();
      typeSpecClassName_ = s;
      return s;
    }
  }
  /**
   * <pre>
   * The name of the TypeSpec class.
   *  * If type_spec_class == REGISTERED_TYPE_SPEC, the TypeSpec class is
   *    the one registered under this name. For types registered outside
   *    core TensorFlow by an add-on library, that library must be loaded
   *    before this value can be deserialized by StructureCoder.
   *  * If type_spec_class specifies a particular TypeSpec class, this field is
   *    redundant with the type_spec_class enum, and is only used for error
   *    reporting in older binaries that do not know the tupe_spec_class enum.
   * </pre>
   *
   * <code>string type_spec_class_name = 3;</code>
   */
  public com.google.protobuf.ByteString
      getTypeSpecClassNameBytes() {
    java.lang.Object ref = typeSpecClassName_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b = 
          com.google.protobuf.ByteString.copyFromUtf8(
              (java.lang.String) ref);
      typeSpecClassName_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int NUM_FLAT_COMPONENTS_FIELD_NUMBER = 4;
  private int numFlatComponents_;
  /**
   * <pre>
   * The number of flat tensor components required by this TypeSpec.
   * </pre>
   *
   * <code>int32 num_flat_components = 4;</code>
   */
  public int getNumFlatComponents() {
    return numFlatComponents_;
  }

  private byte memoizedIsInitialized = -1;
  @java.lang.Override
  public final boolean isInitialized() {
    byte isInitialized = memoizedIsInitialized;
    if (isInitialized == 1) return true;
    if (isInitialized == 0) return false;

    memoizedIsInitialized = 1;
    return true;
  }

  @java.lang.Override
  public void writeTo(com.google.protobuf.CodedOutputStream output)
                      throws java.io.IOException {
    if (typeSpecClass_ != org.tensorflow.proto.framework.TypeSpecProto.TypeSpecClass.UNKNOWN.getNumber()) {
      output.writeEnum(1, typeSpecClass_);
    }
    if (typeState_ != null) {
      output.writeMessage(2, getTypeState());
    }
    if (!getTypeSpecClassNameBytes().isEmpty()) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 3, typeSpecClassName_);
    }
    if (numFlatComponents_ != 0) {
      output.writeInt32(4, numFlatComponents_);
    }
    unknownFields.writeTo(output);
  }

  @java.lang.Override
  public int getSerializedSize() {
    int size = memoizedSize;
    if (size != -1) return size;

    size = 0;
    if (typeSpecClass_ != org.tensorflow.proto.framework.TypeSpecProto.TypeSpecClass.UNKNOWN.getNumber()) {
      size += com.google.protobuf.CodedOutputStream
        .computeEnumSize(1, typeSpecClass_);
    }
    if (typeState_ != null) {
      size += com.google.protobuf.CodedOutputStream
        .computeMessageSize(2, getTypeState());
    }
    if (!getTypeSpecClassNameBytes().isEmpty()) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, typeSpecClassName_);
    }
    if (numFlatComponents_ != 0) {
      size += com.google.protobuf.CodedOutputStream
        .computeInt32Size(4, numFlatComponents_);
    }
    size += unknownFields.getSerializedSize();
    memoizedSize = size;
    return size;
  }

  @java.lang.Override
  public boolean equals(final java.lang.Object obj) {
    if (obj == this) {
     return true;
    }
    if (!(obj instanceof org.tensorflow.proto.framework.TypeSpecProto)) {
      return super.equals(obj);
    }
    org.tensorflow.proto.framework.TypeSpecProto other = (org.tensorflow.proto.framework.TypeSpecProto) obj;

    if (typeSpecClass_ != other.typeSpecClass_) return false;
    if (hasTypeState() != other.hasTypeState()) return false;
    if (hasTypeState()) {
      if (!getTypeState()
          .equals(other.getTypeState())) return false;
    }
    if (!getTypeSpecClassName()
        .equals(other.getTypeSpecClassName())) return false;
    if (getNumFlatComponents()
        != other.getNumFlatComponents()) return false;
    if (!unknownFields.equals(other.unknownFields)) return false;
    return true;
  }

  @java.lang.Override
  public int hashCode() {
    if (memoizedHashCode != 0) {
      return memoizedHashCode;
    }
    int hash = 41;
    hash = (19 * hash) + getDescriptor().hashCode();
    hash = (37 * hash) + TYPE_SPEC_CLASS_FIELD_NUMBER;
    hash = (53 * hash) + typeSpecClass_;
    if (hasTypeState()) {
      hash = (37 * hash) + TYPE_STATE_FIELD_NUMBER;
      hash = (53 * hash) + getTypeState().hashCode();
    }
    hash = (37 * hash) + TYPE_SPEC_CLASS_NAME_FIELD_NUMBER;
    hash = (53 * hash) + getTypeSpecClassName().hashCode();
    hash = (37 * hash) + NUM_FLAT_COMPONENTS_FIELD_NUMBER;
    hash = (53 * hash) + getNumFlatComponents();
    hash = (29 * hash) + unknownFields.hashCode();
    memoizedHashCode = hash;
    return hash;
  }

  public static org.tensorflow.proto.framework.TypeSpecProto parseFrom(
      java.nio.ByteBuffer data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static org.tensorflow.proto.framework.TypeSpecProto parseFrom(
      java.nio.ByteBuffer data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }
  public static org.tensorflow.proto.framework.TypeSpecProto parseFrom(
      com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static org.tensorflow.proto.framework.TypeSpecProto parseFrom(
      com.google.protobuf.ByteString data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }
  public static org.tensorflow.proto.framework.TypeSpecProto parseFrom(byte[] data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static org.tensorflow.proto.framework.TypeSpecProto parseFrom(
      byte[] data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }
  public static org.tensorflow.proto.framework.TypeSpecProto parseFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input);
  }
  public static org.tensorflow.proto.framework.TypeSpecProto 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 org.tensorflow.proto.framework.TypeSpecProto parseDelimitedFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseDelimitedWithIOException(PARSER, input);
  }
  public static org.tensorflow.proto.framework.TypeSpecProto 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 org.tensorflow.proto.framework.TypeSpecProto parseFrom(
      com.google.protobuf.CodedInputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input);
  }
  public static org.tensorflow.proto.framework.TypeSpecProto parseFrom(
      com.google.protobuf.CodedInputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input, extensionRegistry);
  }

  @java.lang.Override
  public Builder newBuilderForType() { return newBuilder(); }
  public static Builder newBuilder() {
    return DEFAULT_INSTANCE.toBuilder();
  }
  public static Builder newBuilder(org.tensorflow.proto.framework.TypeSpecProto prototype) {
    return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
  }
  @java.lang.Override
  public Builder toBuilder() {
    return this == DEFAULT_INSTANCE
        ? new Builder() : new Builder().mergeFrom(this);
  }

  @java.lang.Override
  protected Builder newBuilderForType(
      com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
    Builder builder = new Builder(parent);
    return builder;
  }
  /**
   * <pre>
   * Represents a tf.TypeSpec
   * </pre>
   *
   * Protobuf type {@code tensorflow.TypeSpecProto}
   */
  public static final class Builder extends
      com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
      // @@protoc_insertion_point(builder_implements:tensorflow.TypeSpecProto)
      org.tensorflow.proto.framework.TypeSpecProtoOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor
        getDescriptor() {
      return org.tensorflow.proto.framework.StructProtos.internal_static_tensorflow_TypeSpecProto_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return org.tensorflow.proto.framework.StructProtos.internal_static_tensorflow_TypeSpecProto_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              org.tensorflow.proto.framework.TypeSpecProto.class, org.tensorflow.proto.framework.TypeSpecProto.Builder.class);
    }

    // Construct using org.tensorflow.proto.framework.TypeSpecProto.newBuilder()
    private Builder() {
      maybeForceBuilderInitialization();
    }

    private Builder(
        com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
      super(parent);
      maybeForceBuilderInitialization();
    }
    private void maybeForceBuilderInitialization() {
      if (com.google.protobuf.GeneratedMessageV3
              .alwaysUseFieldBuilders) {
      }
    }
    @java.lang.Override
    public Builder clear() {
      super.clear();
      typeSpecClass_ = 0;

      if (typeStateBuilder_ == null) {
        typeState_ = null;
      } else {
        typeState_ = null;
        typeStateBuilder_ = null;
      }
      typeSpecClassName_ = "";

      numFlatComponents_ = 0;

      return this;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.Descriptor
        getDescriptorForType() {
      return org.tensorflow.proto.framework.StructProtos.internal_static_tensorflow_TypeSpecProto_descriptor;
    }

    @java.lang.Override
    public org.tensorflow.proto.framework.TypeSpecProto getDefaultInstanceForType() {
      return org.tensorflow.proto.framework.TypeSpecProto.getDefaultInstance();
    }

    @java.lang.Override
    public org.tensorflow.proto.framework.TypeSpecProto build() {
      org.tensorflow.proto.framework.TypeSpecProto result = buildPartial();
      if (!result.isInitialized()) {
        throw newUninitializedMessageException(result);
      }
      return result;
    }

    @java.lang.Override
    public org.tensorflow.proto.framework.TypeSpecProto buildPartial() {
      org.tensorflow.proto.framework.TypeSpecProto result = new org.tensorflow.proto.framework.TypeSpecProto(this);
      result.typeSpecClass_ = typeSpecClass_;
      if (typeStateBuilder_ == null) {
        result.typeState_ = typeState_;
      } else {
        result.typeState_ = typeStateBuilder_.build();
      }
      result.typeSpecClassName_ = typeSpecClassName_;
      result.numFlatComponents_ = numFlatComponents_;
      onBuilt();
      return result;
    }

    @java.lang.Override
    public Builder clone() {
      return super.clone();
    }
    @java.lang.Override
    public Builder setField(
        com.google.protobuf.Descriptors.FieldDescriptor field,
        java.lang.Object value) {
      return super.setField(field, value);
    }
    @java.lang.Override
    public Builder clearField(
        com.google.protobuf.Descriptors.FieldDescriptor field) {
      return super.clearField(field);
    }
    @java.lang.Override
    public Builder clearOneof(
        com.google.protobuf.Descriptors.OneofDescriptor oneof) {
      return super.clearOneof(oneof);
    }
    @java.lang.Override
    public Builder setRepeatedField(
        com.google.protobuf.Descriptors.FieldDescriptor field,
        int index, java.lang.Object value) {
      return super.setRepeatedField(field, index, value);
    }
    @java.lang.Override
    public Builder addRepeatedField(
        com.google.protobuf.Descriptors.FieldDescriptor field,
        java.lang.Object value) {
      return super.addRepeatedField(field, value);
    }
    @java.lang.Override
    public Builder mergeFrom(com.google.protobuf.Message other) {
      if (other instanceof org.tensorflow.proto.framework.TypeSpecProto) {
        return mergeFrom((org.tensorflow.proto.framework.TypeSpecProto)other);
      } else {
        super.mergeFrom(other);
        return this;
      }
    }

    public Builder mergeFrom(org.tensorflow.proto.framework.TypeSpecProto other) {
      if (other == org.tensorflow.proto.framework.TypeSpecProto.getDefaultInstance()) return this;
      if (other.typeSpecClass_ != 0) {
        setTypeSpecClassValue(other.getTypeSpecClassValue());
      }
      if (other.hasTypeState()) {
        mergeTypeState(other.getTypeState());
      }
      if (!other.getTypeSpecClassName().isEmpty()) {
        typeSpecClassName_ = other.typeSpecClassName_;
        onChanged();
      }
      if (other.getNumFlatComponents() != 0) {
        setNumFlatComponents(other.getNumFlatComponents());
      }
      this.mergeUnknownFields(other.unknownFields);
      onChanged();
      return this;
    }

    @java.lang.Override
    public final boolean isInitialized() {
      return true;
    }

    @java.lang.Override
    public Builder mergeFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      org.tensorflow.proto.framework.TypeSpecProto parsedMessage = null;
      try {
        parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        parsedMessage = (org.tensorflow.proto.framework.TypeSpecProto) e.getUnfinishedMessage();
        throw e.unwrapIOException();
      } finally {
        if (parsedMessage != null) {
          mergeFrom(parsedMessage);
        }
      }
      return this;
    }

    private int typeSpecClass_ = 0;
    /**
     * <code>.tensorflow.TypeSpecProto.TypeSpecClass type_spec_class = 1;</code>
     */
    public int getTypeSpecClassValue() {
      return typeSpecClass_;
    }
    /**
     * <code>.tensorflow.TypeSpecProto.TypeSpecClass type_spec_class = 1;</code>
     */
    public Builder setTypeSpecClassValue(int value) {
      typeSpecClass_ = value;
      onChanged();
      return this;
    }
    /**
     * <code>.tensorflow.TypeSpecProto.TypeSpecClass type_spec_class = 1;</code>
     */
    public org.tensorflow.proto.framework.TypeSpecProto.TypeSpecClass getTypeSpecClass() {
      @SuppressWarnings("deprecation")
      org.tensorflow.proto.framework.TypeSpecProto.TypeSpecClass result = org.tensorflow.proto.framework.TypeSpecProto.TypeSpecClass.valueOf(typeSpecClass_);
      return result == null ? org.tensorflow.proto.framework.TypeSpecProto.TypeSpecClass.UNRECOGNIZED : result;
    }
    /**
     * <code>.tensorflow.TypeSpecProto.TypeSpecClass type_spec_class = 1;</code>
     */
    public Builder setTypeSpecClass(org.tensorflow.proto.framework.TypeSpecProto.TypeSpecClass value) {
      if (value == null) {
        throw new NullPointerException();
      }
      
      typeSpecClass_ = value.getNumber();
      onChanged();
      return this;
    }
    /**
     * <code>.tensorflow.TypeSpecProto.TypeSpecClass type_spec_class = 1;</code>
     */
    public Builder clearTypeSpecClass() {
      
      typeSpecClass_ = 0;
      onChanged();
      return this;
    }

    private org.tensorflow.proto.framework.StructuredValue typeState_;
    private com.google.protobuf.SingleFieldBuilderV3<
        org.tensorflow.proto.framework.StructuredValue, org.tensorflow.proto.framework.StructuredValue.Builder, org.tensorflow.proto.framework.StructuredValueOrBuilder> typeStateBuilder_;
    /**
     * <pre>
     * The value returned by TypeSpec._serialize().
     * </pre>
     *
     * <code>.tensorflow.StructuredValue type_state = 2;</code>
     */
    public boolean hasTypeState() {
      return typeStateBuilder_ != null || typeState_ != null;
    }
    /**
     * <pre>
     * The value returned by TypeSpec._serialize().
     * </pre>
     *
     * <code>.tensorflow.StructuredValue type_state = 2;</code>
     */
    public org.tensorflow.proto.framework.StructuredValue getTypeState() {
      if (typeStateBuilder_ == null) {
        return typeState_ == null ? org.tensorflow.proto.framework.StructuredValue.getDefaultInstance() : typeState_;
      } else {
        return typeStateBuilder_.getMessage();
      }
    }
    /**
     * <pre>
     * The value returned by TypeSpec._serialize().
     * </pre>
     *
     * <code>.tensorflow.StructuredValue type_state = 2;</code>
     */
    public Builder setTypeState(org.tensorflow.proto.framework.StructuredValue value) {
      if (typeStateBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        typeState_ = value;
        onChanged();
      } else {
        typeStateBuilder_.setMessage(value);
      }

      return this;
    }
    /**
     * <pre>
     * The value returned by TypeSpec._serialize().
     * </pre>
     *
     * <code>.tensorflow.StructuredValue type_state = 2;</code>
     */
    public Builder setTypeState(
        org.tensorflow.proto.framework.StructuredValue.Builder builderForValue) {
      if (typeStateBuilder_ == null) {
        typeState_ = builderForValue.build();
        onChanged();
      } else {
        typeStateBuilder_.setMessage(builderForValue.build());
      }

      return this;
    }
    /**
     * <pre>
     * The value returned by TypeSpec._serialize().
     * </pre>
     *
     * <code>.tensorflow.StructuredValue type_state = 2;</code>
     */
    public Builder mergeTypeState(org.tensorflow.proto.framework.StructuredValue value) {
      if (typeStateBuilder_ == null) {
        if (typeState_ != null) {
          typeState_ =
            org.tensorflow.proto.framework.StructuredValue.newBuilder(typeState_).mergeFrom(value).buildPartial();
        } else {
          typeState_ = value;
        }
        onChanged();
      } else {
        typeStateBuilder_.mergeFrom(value);
      }

      return this;
    }
    /**
     * <pre>
     * The value returned by TypeSpec._serialize().
     * </pre>
     *
     * <code>.tensorflow.StructuredValue type_state = 2;</code>
     */
    public Builder clearTypeState() {
      if (typeStateBuilder_ == null) {
        typeState_ = null;
        onChanged();
      } else {
        typeState_ = null;
        typeStateBuilder_ = null;
      }

      return this;
    }
    /**
     * <pre>
     * The value returned by TypeSpec._serialize().
     * </pre>
     *
     * <code>.tensorflow.StructuredValue type_state = 2;</code>
     */
    public org.tensorflow.proto.framework.StructuredValue.Builder getTypeStateBuilder() {
      
      onChanged();
      return getTypeStateFieldBuilder().getBuilder();
    }
    /**
     * <pre>
     * The value returned by TypeSpec._serialize().
     * </pre>
     *
     * <code>.tensorflow.StructuredValue type_state = 2;</code>
     */
    public org.tensorflow.proto.framework.StructuredValueOrBuilder getTypeStateOrBuilder() {
      if (typeStateBuilder_ != null) {
        return typeStateBuilder_.getMessageOrBuilder();
      } else {
        return typeState_ == null ?
            org.tensorflow.proto.framework.StructuredValue.getDefaultInstance() : typeState_;
      }
    }
    /**
     * <pre>
     * The value returned by TypeSpec._serialize().
     * </pre>
     *
     * <code>.tensorflow.StructuredValue type_state = 2;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
        org.tensorflow.proto.framework.StructuredValue, org.tensorflow.proto.framework.StructuredValue.Builder, org.tensorflow.proto.framework.StructuredValueOrBuilder> 
        getTypeStateFieldBuilder() {
      if (typeStateBuilder_ == null) {
        typeStateBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
            org.tensorflow.proto.framework.StructuredValue, org.tensorflow.proto.framework.StructuredValue.Builder, org.tensorflow.proto.framework.StructuredValueOrBuilder>(
                getTypeState(),
                getParentForChildren(),
                isClean());
        typeState_ = null;
      }
      return typeStateBuilder_;
    }

    private java.lang.Object typeSpecClassName_ = "";
    /**
     * <pre>
     * The name of the TypeSpec class.
     *  * If type_spec_class == REGISTERED_TYPE_SPEC, the TypeSpec class is
     *    the one registered under this name. For types registered outside
     *    core TensorFlow by an add-on library, that library must be loaded
     *    before this value can be deserialized by StructureCoder.
     *  * If type_spec_class specifies a particular TypeSpec class, this field is
     *    redundant with the type_spec_class enum, and is only used for error
     *    reporting in older binaries that do not know the tupe_spec_class enum.
     * </pre>
     *
     * <code>string type_spec_class_name = 3;</code>
     */
    public java.lang.String getTypeSpecClassName() {
      java.lang.Object ref = typeSpecClassName_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs =
            (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        typeSpecClassName_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     * <pre>
     * The name of the TypeSpec class.
     *  * If type_spec_class == REGISTERED_TYPE_SPEC, the TypeSpec class is
     *    the one registered under this name. For types registered outside
     *    core TensorFlow by an add-on library, that library must be loaded
     *    before this value can be deserialized by StructureCoder.
     *  * If type_spec_class specifies a particular TypeSpec class, this field is
     *    redundant with the type_spec_class enum, and is only used for error
     *    reporting in older binaries that do not know the tupe_spec_class enum.
     * </pre>
     *
     * <code>string type_spec_class_name = 3;</code>
     */
    public com.google.protobuf.ByteString
        getTypeSpecClassNameBytes() {
      java.lang.Object ref = typeSpecClassName_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b = 
            com.google.protobuf.ByteString.copyFromUtf8(
                (java.lang.String) ref);
        typeSpecClassName_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     * <pre>
     * The name of the TypeSpec class.
     *  * If type_spec_class == REGISTERED_TYPE_SPEC, the TypeSpec class is
     *    the one registered under this name. For types registered outside
     *    core TensorFlow by an add-on library, that library must be loaded
     *    before this value can be deserialized by StructureCoder.
     *  * If type_spec_class specifies a particular TypeSpec class, this field is
     *    redundant with the type_spec_class enum, and is only used for error
     *    reporting in older binaries that do not know the tupe_spec_class enum.
     * </pre>
     *
     * <code>string type_spec_class_name = 3;</code>
     */
    public Builder setTypeSpecClassName(
        java.lang.String value) {
      if (value == null) {
    throw new NullPointerException();
  }
  
      typeSpecClassName_ = value;
      onChanged();
      return this;
    }
    /**
     * <pre>
     * The name of the TypeSpec class.
     *  * If type_spec_class == REGISTERED_TYPE_SPEC, the TypeSpec class is
     *    the one registered under this name. For types registered outside
     *    core TensorFlow by an add-on library, that library must be loaded
     *    before this value can be deserialized by StructureCoder.
     *  * If type_spec_class specifies a particular TypeSpec class, this field is
     *    redundant with the type_spec_class enum, and is only used for error
     *    reporting in older binaries that do not know the tupe_spec_class enum.
     * </pre>
     *
     * <code>string type_spec_class_name = 3;</code>
     */
    public Builder clearTypeSpecClassName() {
      
      typeSpecClassName_ = getDefaultInstance().getTypeSpecClassName();
      onChanged();
      return this;
    }
    /**
     * <pre>
     * The name of the TypeSpec class.
     *  * If type_spec_class == REGISTERED_TYPE_SPEC, the TypeSpec class is
     *    the one registered under this name. For types registered outside
     *    core TensorFlow by an add-on library, that library must be loaded
     *    before this value can be deserialized by StructureCoder.
     *  * If type_spec_class specifies a particular TypeSpec class, this field is
     *    redundant with the type_spec_class enum, and is only used for error
     *    reporting in older binaries that do not know the tupe_spec_class enum.
     * </pre>
     *
     * <code>string type_spec_class_name = 3;</code>
     */
    public Builder setTypeSpecClassNameBytes(
        com.google.protobuf.ByteString value) {
      if (value == null) {
    throw new NullPointerException();
  }
  checkByteStringIsUtf8(value);
      
      typeSpecClassName_ = value;
      onChanged();
      return this;
    }

    private int numFlatComponents_ ;
    /**
     * <pre>
     * The number of flat tensor components required by this TypeSpec.
     * </pre>
     *
     * <code>int32 num_flat_components = 4;</code>
     */
    public int getNumFlatComponents() {
      return numFlatComponents_;
    }
    /**
     * <pre>
     * The number of flat tensor components required by this TypeSpec.
     * </pre>
     *
     * <code>int32 num_flat_components = 4;</code>
     */
    public Builder setNumFlatComponents(int value) {
      
      numFlatComponents_ = value;
      onChanged();
      return this;
    }
    /**
     * <pre>
     * The number of flat tensor components required by this TypeSpec.
     * </pre>
     *
     * <code>int32 num_flat_components = 4;</code>
     */
    public Builder clearNumFlatComponents() {
      
      numFlatComponents_ = 0;
      onChanged();
      return this;
    }
    @java.lang.Override
    public final Builder setUnknownFields(
        final com.google.protobuf.UnknownFieldSet unknownFields) {
      return super.setUnknownFields(unknownFields);
    }

    @java.lang.Override
    public final Builder mergeUnknownFields(
        final com.google.protobuf.UnknownFieldSet unknownFields) {
      return super.mergeUnknownFields(unknownFields);
    }


    // @@protoc_insertion_point(builder_scope:tensorflow.TypeSpecProto)
  }

  // @@protoc_insertion_point(class_scope:tensorflow.TypeSpecProto)
  private static final org.tensorflow.proto.framework.TypeSpecProto DEFAULT_INSTANCE;
  static {
    DEFAULT_INSTANCE = new org.tensorflow.proto.framework.TypeSpecProto();
  }

  public static org.tensorflow.proto.framework.TypeSpecProto getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

  private static final com.google.protobuf.Parser<TypeSpecProto>
      PARSER = new com.google.protobuf.AbstractParser<TypeSpecProto>() {
    @java.lang.Override
    public TypeSpecProto parsePartialFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return new TypeSpecProto(input, extensionRegistry);
    }
  };

  public static com.google.protobuf.Parser<TypeSpecProto> parser() {
    return PARSER;
  }

  @java.lang.Override
  public com.google.protobuf.Parser<TypeSpecProto> getParserForType() {
    return PARSER;
  }

  @java.lang.Override
  public org.tensorflow.proto.framework.TypeSpecProto getDefaultInstanceForType() {
    return DEFAULT_INSTANCE;
  }

}

