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

package org.tensorflow.proto.profiler;

/**
 * <pre>
 * Metadata for an XEvent, corresponds to an event type and is shared by
 * all XEvents with the same metadata_id.
 * Next ID: 7
 * </pre>
 *
 * Protobuf type {@code tensorflow.profiler.XEventMetadata}
 */
public  final class XEventMetadata extends
    com.google.protobuf.GeneratedMessageV3 implements
    // @@protoc_insertion_point(message_implements:tensorflow.profiler.XEventMetadata)
    XEventMetadataOrBuilder {
private static final long serialVersionUID = 0L;
  // Use XEventMetadata.newBuilder() to construct.
  private XEventMetadata(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
    super(builder);
  }
  private XEventMetadata() {
    name_ = "";
    displayName_ = "";
    metadata_ = com.google.protobuf.ByteString.EMPTY;
    stats_ = java.util.Collections.emptyList();
    childId_ = emptyLongList();
  }

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

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

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

            name_ = s;
            break;
          }
          case 26: {

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

            displayName_ = s;
            break;
          }
          case 42: {
            if (!((mutable_bitField0_ & 0x00000001) != 0)) {
              stats_ = new java.util.ArrayList<org.tensorflow.proto.profiler.XStat>();
              mutable_bitField0_ |= 0x00000001;
            }
            stats_.add(
                input.readMessage(org.tensorflow.proto.profiler.XStat.parser(), extensionRegistry));
            break;
          }
          case 48: {
            if (!((mutable_bitField0_ & 0x00000002) != 0)) {
              childId_ = newLongList();
              mutable_bitField0_ |= 0x00000002;
            }
            childId_.addLong(input.readInt64());
            break;
          }
          case 50: {
            int length = input.readRawVarint32();
            int limit = input.pushLimit(length);
            if (!((mutable_bitField0_ & 0x00000002) != 0) && input.getBytesUntilLimit() > 0) {
              childId_ = newLongList();
              mutable_bitField0_ |= 0x00000002;
            }
            while (input.getBytesUntilLimit() > 0) {
              childId_.addLong(input.readInt64());
            }
            input.popLimit(limit);
            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 {
      if (((mutable_bitField0_ & 0x00000001) != 0)) {
        stats_ = java.util.Collections.unmodifiableList(stats_);
      }
      if (((mutable_bitField0_ & 0x00000002) != 0)) {
        childId_.makeImmutable(); // C
      }
      this.unknownFields = unknownFields.build();
      makeExtensionsImmutable();
    }
  }
  public static final com.google.protobuf.Descriptors.Descriptor
      getDescriptor() {
    return org.tensorflow.proto.profiler.XPlaneProtos.internal_static_tensorflow_profiler_XEventMetadata_descriptor;
  }

  @java.lang.Override
  protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return org.tensorflow.proto.profiler.XPlaneProtos.internal_static_tensorflow_profiler_XEventMetadata_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            org.tensorflow.proto.profiler.XEventMetadata.class, org.tensorflow.proto.profiler.XEventMetadata.Builder.class);
  }

  public static final int ID_FIELD_NUMBER = 1;
  private long id_;
  /**
   * <pre>
   * XPlane.event_metadata map key.
   * </pre>
   *
   * <code>int64 id = 1;</code>
   */
  public long getId() {
    return id_;
  }

  public static final int NAME_FIELD_NUMBER = 2;
  private volatile java.lang.Object name_;
  /**
   * <pre>
   * Name of the event.
   * </pre>
   *
   * <code>string name = 2;</code>
   */
  public java.lang.String getName() {
    java.lang.Object ref = name_;
    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();
      name_ = s;
      return s;
    }
  }
  /**
   * <pre>
   * Name of the event.
   * </pre>
   *
   * <code>string name = 2;</code>
   */
  public com.google.protobuf.ByteString
      getNameBytes() {
    java.lang.Object ref = name_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b = 
          com.google.protobuf.ByteString.copyFromUtf8(
              (java.lang.String) ref);
      name_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int DISPLAY_NAME_FIELD_NUMBER = 4;
  private volatile java.lang.Object displayName_;
  /**
   * <pre>
   * Name of the event shown in trace viewer.
   * </pre>
   *
   * <code>string display_name = 4;</code>
   */
  public java.lang.String getDisplayName() {
    java.lang.Object ref = displayName_;
    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();
      displayName_ = s;
      return s;
    }
  }
  /**
   * <pre>
   * Name of the event shown in trace viewer.
   * </pre>
   *
   * <code>string display_name = 4;</code>
   */
  public com.google.protobuf.ByteString
      getDisplayNameBytes() {
    java.lang.Object ref = displayName_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b = 
          com.google.protobuf.ByteString.copyFromUtf8(
              (java.lang.String) ref);
      displayName_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int METADATA_FIELD_NUMBER = 3;
  private com.google.protobuf.ByteString metadata_;
  /**
   * <pre>
   * Additional metadata in serialized format.
   * </pre>
   *
   * <code>bytes metadata = 3;</code>
   */
  public com.google.protobuf.ByteString getMetadata() {
    return metadata_;
  }

  public static final int STATS_FIELD_NUMBER = 5;
  private java.util.List<org.tensorflow.proto.profiler.XStat> stats_;
  /**
   * <pre>
   * XStats that are constant for all XEvents with the same metadata_id.
   * Each of these XStats should have a different metadata_id.
   * </pre>
   *
   * <code>repeated .tensorflow.profiler.XStat stats = 5;</code>
   */
  public java.util.List<org.tensorflow.proto.profiler.XStat> getStatsList() {
    return stats_;
  }
  /**
   * <pre>
   * XStats that are constant for all XEvents with the same metadata_id.
   * Each of these XStats should have a different metadata_id.
   * </pre>
   *
   * <code>repeated .tensorflow.profiler.XStat stats = 5;</code>
   */
  public java.util.List<? extends org.tensorflow.proto.profiler.XStatOrBuilder> 
      getStatsOrBuilderList() {
    return stats_;
  }
  /**
   * <pre>
   * XStats that are constant for all XEvents with the same metadata_id.
   * Each of these XStats should have a different metadata_id.
   * </pre>
   *
   * <code>repeated .tensorflow.profiler.XStat stats = 5;</code>
   */
  public int getStatsCount() {
    return stats_.size();
  }
  /**
   * <pre>
   * XStats that are constant for all XEvents with the same metadata_id.
   * Each of these XStats should have a different metadata_id.
   * </pre>
   *
   * <code>repeated .tensorflow.profiler.XStat stats = 5;</code>
   */
  public org.tensorflow.proto.profiler.XStat getStats(int index) {
    return stats_.get(index);
  }
  /**
   * <pre>
   * XStats that are constant for all XEvents with the same metadata_id.
   * Each of these XStats should have a different metadata_id.
   * </pre>
   *
   * <code>repeated .tensorflow.profiler.XStat stats = 5;</code>
   */
  public org.tensorflow.proto.profiler.XStatOrBuilder getStatsOrBuilder(
      int index) {
    return stats_.get(index);
  }

  public static final int CHILD_ID_FIELD_NUMBER = 6;
  private com.google.protobuf.Internal.LongList childId_;
  /**
   * <pre>
   * XPlane.event_metadata map key for children events.
   * </pre>
   *
   * <code>repeated int64 child_id = 6;</code>
   */
  public java.util.List<java.lang.Long>
      getChildIdList() {
    return childId_;
  }
  /**
   * <pre>
   * XPlane.event_metadata map key for children events.
   * </pre>
   *
   * <code>repeated int64 child_id = 6;</code>
   */
  public int getChildIdCount() {
    return childId_.size();
  }
  /**
   * <pre>
   * XPlane.event_metadata map key for children events.
   * </pre>
   *
   * <code>repeated int64 child_id = 6;</code>
   */
  public long getChildId(int index) {
    return childId_.getLong(index);
  }
  private int childIdMemoizedSerializedSize = -1;

  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 {
    getSerializedSize();
    if (id_ != 0L) {
      output.writeInt64(1, id_);
    }
    if (!getNameBytes().isEmpty()) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 2, name_);
    }
    if (!metadata_.isEmpty()) {
      output.writeBytes(3, metadata_);
    }
    if (!getDisplayNameBytes().isEmpty()) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 4, displayName_);
    }
    for (int i = 0; i < stats_.size(); i++) {
      output.writeMessage(5, stats_.get(i));
    }
    if (getChildIdList().size() > 0) {
      output.writeUInt32NoTag(50);
      output.writeUInt32NoTag(childIdMemoizedSerializedSize);
    }
    for (int i = 0; i < childId_.size(); i++) {
      output.writeInt64NoTag(childId_.getLong(i));
    }
    unknownFields.writeTo(output);
  }

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

    size = 0;
    if (id_ != 0L) {
      size += com.google.protobuf.CodedOutputStream
        .computeInt64Size(1, id_);
    }
    if (!getNameBytes().isEmpty()) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, name_);
    }
    if (!metadata_.isEmpty()) {
      size += com.google.protobuf.CodedOutputStream
        .computeBytesSize(3, metadata_);
    }
    if (!getDisplayNameBytes().isEmpty()) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, displayName_);
    }
    for (int i = 0; i < stats_.size(); i++) {
      size += com.google.protobuf.CodedOutputStream
        .computeMessageSize(5, stats_.get(i));
    }
    {
      int dataSize = 0;
      for (int i = 0; i < childId_.size(); i++) {
        dataSize += com.google.protobuf.CodedOutputStream
          .computeInt64SizeNoTag(childId_.getLong(i));
      }
      size += dataSize;
      if (!getChildIdList().isEmpty()) {
        size += 1;
        size += com.google.protobuf.CodedOutputStream
            .computeInt32SizeNoTag(dataSize);
      }
      childIdMemoizedSerializedSize = dataSize;
    }
    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.profiler.XEventMetadata)) {
      return super.equals(obj);
    }
    org.tensorflow.proto.profiler.XEventMetadata other = (org.tensorflow.proto.profiler.XEventMetadata) obj;

    if (getId()
        != other.getId()) return false;
    if (!getName()
        .equals(other.getName())) return false;
    if (!getDisplayName()
        .equals(other.getDisplayName())) return false;
    if (!getMetadata()
        .equals(other.getMetadata())) return false;
    if (!getStatsList()
        .equals(other.getStatsList())) return false;
    if (!getChildIdList()
        .equals(other.getChildIdList())) 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) + ID_FIELD_NUMBER;
    hash = (53 * hash) + com.google.protobuf.Internal.hashLong(
        getId());
    hash = (37 * hash) + NAME_FIELD_NUMBER;
    hash = (53 * hash) + getName().hashCode();
    hash = (37 * hash) + DISPLAY_NAME_FIELD_NUMBER;
    hash = (53 * hash) + getDisplayName().hashCode();
    hash = (37 * hash) + METADATA_FIELD_NUMBER;
    hash = (53 * hash) + getMetadata().hashCode();
    if (getStatsCount() > 0) {
      hash = (37 * hash) + STATS_FIELD_NUMBER;
      hash = (53 * hash) + getStatsList().hashCode();
    }
    if (getChildIdCount() > 0) {
      hash = (37 * hash) + CHILD_ID_FIELD_NUMBER;
      hash = (53 * hash) + getChildIdList().hashCode();
    }
    hash = (29 * hash) + unknownFields.hashCode();
    memoizedHashCode = hash;
    return hash;
  }

  public static org.tensorflow.proto.profiler.XEventMetadata parseFrom(
      java.nio.ByteBuffer data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static org.tensorflow.proto.profiler.XEventMetadata 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.profiler.XEventMetadata parseFrom(
      com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static org.tensorflow.proto.profiler.XEventMetadata 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.profiler.XEventMetadata parseFrom(byte[] data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static org.tensorflow.proto.profiler.XEventMetadata parseFrom(
      byte[] data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }
  public static org.tensorflow.proto.profiler.XEventMetadata parseFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input);
  }
  public static org.tensorflow.proto.profiler.XEventMetadata 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.profiler.XEventMetadata parseDelimitedFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseDelimitedWithIOException(PARSER, input);
  }
  public static org.tensorflow.proto.profiler.XEventMetadata 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.profiler.XEventMetadata parseFrom(
      com.google.protobuf.CodedInputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input);
  }
  public static org.tensorflow.proto.profiler.XEventMetadata 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.profiler.XEventMetadata 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>
   * Metadata for an XEvent, corresponds to an event type and is shared by
   * all XEvents with the same metadata_id.
   * Next ID: 7
   * </pre>
   *
   * Protobuf type {@code tensorflow.profiler.XEventMetadata}
   */
  public static final class Builder extends
      com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
      // @@protoc_insertion_point(builder_implements:tensorflow.profiler.XEventMetadata)
      org.tensorflow.proto.profiler.XEventMetadataOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor
        getDescriptor() {
      return org.tensorflow.proto.profiler.XPlaneProtos.internal_static_tensorflow_profiler_XEventMetadata_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return org.tensorflow.proto.profiler.XPlaneProtos.internal_static_tensorflow_profiler_XEventMetadata_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              org.tensorflow.proto.profiler.XEventMetadata.class, org.tensorflow.proto.profiler.XEventMetadata.Builder.class);
    }

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

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

      name_ = "";

      displayName_ = "";

      metadata_ = com.google.protobuf.ByteString.EMPTY;

      if (statsBuilder_ == null) {
        stats_ = java.util.Collections.emptyList();
        bitField0_ = (bitField0_ & ~0x00000001);
      } else {
        statsBuilder_.clear();
      }
      childId_ = emptyLongList();
      bitField0_ = (bitField0_ & ~0x00000002);
      return this;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.Descriptor
        getDescriptorForType() {
      return org.tensorflow.proto.profiler.XPlaneProtos.internal_static_tensorflow_profiler_XEventMetadata_descriptor;
    }

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

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

    @java.lang.Override
    public org.tensorflow.proto.profiler.XEventMetadata buildPartial() {
      org.tensorflow.proto.profiler.XEventMetadata result = new org.tensorflow.proto.profiler.XEventMetadata(this);
      int from_bitField0_ = bitField0_;
      result.id_ = id_;
      result.name_ = name_;
      result.displayName_ = displayName_;
      result.metadata_ = metadata_;
      if (statsBuilder_ == null) {
        if (((bitField0_ & 0x00000001) != 0)) {
          stats_ = java.util.Collections.unmodifiableList(stats_);
          bitField0_ = (bitField0_ & ~0x00000001);
        }
        result.stats_ = stats_;
      } else {
        result.stats_ = statsBuilder_.build();
      }
      if (((bitField0_ & 0x00000002) != 0)) {
        childId_.makeImmutable();
        bitField0_ = (bitField0_ & ~0x00000002);
      }
      result.childId_ = childId_;
      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.profiler.XEventMetadata) {
        return mergeFrom((org.tensorflow.proto.profiler.XEventMetadata)other);
      } else {
        super.mergeFrom(other);
        return this;
      }
    }

    public Builder mergeFrom(org.tensorflow.proto.profiler.XEventMetadata other) {
      if (other == org.tensorflow.proto.profiler.XEventMetadata.getDefaultInstance()) return this;
      if (other.getId() != 0L) {
        setId(other.getId());
      }
      if (!other.getName().isEmpty()) {
        name_ = other.name_;
        onChanged();
      }
      if (!other.getDisplayName().isEmpty()) {
        displayName_ = other.displayName_;
        onChanged();
      }
      if (other.getMetadata() != com.google.protobuf.ByteString.EMPTY) {
        setMetadata(other.getMetadata());
      }
      if (statsBuilder_ == null) {
        if (!other.stats_.isEmpty()) {
          if (stats_.isEmpty()) {
            stats_ = other.stats_;
            bitField0_ = (bitField0_ & ~0x00000001);
          } else {
            ensureStatsIsMutable();
            stats_.addAll(other.stats_);
          }
          onChanged();
        }
      } else {
        if (!other.stats_.isEmpty()) {
          if (statsBuilder_.isEmpty()) {
            statsBuilder_.dispose();
            statsBuilder_ = null;
            stats_ = other.stats_;
            bitField0_ = (bitField0_ & ~0x00000001);
            statsBuilder_ = 
              com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ?
                 getStatsFieldBuilder() : null;
          } else {
            statsBuilder_.addAllMessages(other.stats_);
          }
        }
      }
      if (!other.childId_.isEmpty()) {
        if (childId_.isEmpty()) {
          childId_ = other.childId_;
          bitField0_ = (bitField0_ & ~0x00000002);
        } else {
          ensureChildIdIsMutable();
          childId_.addAll(other.childId_);
        }
        onChanged();
      }
      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.profiler.XEventMetadata parsedMessage = null;
      try {
        parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        parsedMessage = (org.tensorflow.proto.profiler.XEventMetadata) e.getUnfinishedMessage();
        throw e.unwrapIOException();
      } finally {
        if (parsedMessage != null) {
          mergeFrom(parsedMessage);
        }
      }
      return this;
    }
    private int bitField0_;

    private long id_ ;
    /**
     * <pre>
     * XPlane.event_metadata map key.
     * </pre>
     *
     * <code>int64 id = 1;</code>
     */
    public long getId() {
      return id_;
    }
    /**
     * <pre>
     * XPlane.event_metadata map key.
     * </pre>
     *
     * <code>int64 id = 1;</code>
     */
    public Builder setId(long value) {
      
      id_ = value;
      onChanged();
      return this;
    }
    /**
     * <pre>
     * XPlane.event_metadata map key.
     * </pre>
     *
     * <code>int64 id = 1;</code>
     */
    public Builder clearId() {
      
      id_ = 0L;
      onChanged();
      return this;
    }

    private java.lang.Object name_ = "";
    /**
     * <pre>
     * Name of the event.
     * </pre>
     *
     * <code>string name = 2;</code>
     */
    public java.lang.String getName() {
      java.lang.Object ref = name_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs =
            (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        name_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     * <pre>
     * Name of the event.
     * </pre>
     *
     * <code>string name = 2;</code>
     */
    public com.google.protobuf.ByteString
        getNameBytes() {
      java.lang.Object ref = name_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b = 
            com.google.protobuf.ByteString.copyFromUtf8(
                (java.lang.String) ref);
        name_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     * <pre>
     * Name of the event.
     * </pre>
     *
     * <code>string name = 2;</code>
     */
    public Builder setName(
        java.lang.String value) {
      if (value == null) {
    throw new NullPointerException();
  }
  
      name_ = value;
      onChanged();
      return this;
    }
    /**
     * <pre>
     * Name of the event.
     * </pre>
     *
     * <code>string name = 2;</code>
     */
    public Builder clearName() {
      
      name_ = getDefaultInstance().getName();
      onChanged();
      return this;
    }
    /**
     * <pre>
     * Name of the event.
     * </pre>
     *
     * <code>string name = 2;</code>
     */
    public Builder setNameBytes(
        com.google.protobuf.ByteString value) {
      if (value == null) {
    throw new NullPointerException();
  }
  checkByteStringIsUtf8(value);
      
      name_ = value;
      onChanged();
      return this;
    }

    private java.lang.Object displayName_ = "";
    /**
     * <pre>
     * Name of the event shown in trace viewer.
     * </pre>
     *
     * <code>string display_name = 4;</code>
     */
    public java.lang.String getDisplayName() {
      java.lang.Object ref = displayName_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs =
            (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        displayName_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     * <pre>
     * Name of the event shown in trace viewer.
     * </pre>
     *
     * <code>string display_name = 4;</code>
     */
    public com.google.protobuf.ByteString
        getDisplayNameBytes() {
      java.lang.Object ref = displayName_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b = 
            com.google.protobuf.ByteString.copyFromUtf8(
                (java.lang.String) ref);
        displayName_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     * <pre>
     * Name of the event shown in trace viewer.
     * </pre>
     *
     * <code>string display_name = 4;</code>
     */
    public Builder setDisplayName(
        java.lang.String value) {
      if (value == null) {
    throw new NullPointerException();
  }
  
      displayName_ = value;
      onChanged();
      return this;
    }
    /**
     * <pre>
     * Name of the event shown in trace viewer.
     * </pre>
     *
     * <code>string display_name = 4;</code>
     */
    public Builder clearDisplayName() {
      
      displayName_ = getDefaultInstance().getDisplayName();
      onChanged();
      return this;
    }
    /**
     * <pre>
     * Name of the event shown in trace viewer.
     * </pre>
     *
     * <code>string display_name = 4;</code>
     */
    public Builder setDisplayNameBytes(
        com.google.protobuf.ByteString value) {
      if (value == null) {
    throw new NullPointerException();
  }
  checkByteStringIsUtf8(value);
      
      displayName_ = value;
      onChanged();
      return this;
    }

    private com.google.protobuf.ByteString metadata_ = com.google.protobuf.ByteString.EMPTY;
    /**
     * <pre>
     * Additional metadata in serialized format.
     * </pre>
     *
     * <code>bytes metadata = 3;</code>
     */
    public com.google.protobuf.ByteString getMetadata() {
      return metadata_;
    }
    /**
     * <pre>
     * Additional metadata in serialized format.
     * </pre>
     *
     * <code>bytes metadata = 3;</code>
     */
    public Builder setMetadata(com.google.protobuf.ByteString value) {
      if (value == null) {
    throw new NullPointerException();
  }
  
      metadata_ = value;
      onChanged();
      return this;
    }
    /**
     * <pre>
     * Additional metadata in serialized format.
     * </pre>
     *
     * <code>bytes metadata = 3;</code>
     */
    public Builder clearMetadata() {
      
      metadata_ = getDefaultInstance().getMetadata();
      onChanged();
      return this;
    }

    private java.util.List<org.tensorflow.proto.profiler.XStat> stats_ =
      java.util.Collections.emptyList();
    private void ensureStatsIsMutable() {
      if (!((bitField0_ & 0x00000001) != 0)) {
        stats_ = new java.util.ArrayList<org.tensorflow.proto.profiler.XStat>(stats_);
        bitField0_ |= 0x00000001;
       }
    }

    private com.google.protobuf.RepeatedFieldBuilderV3<
        org.tensorflow.proto.profiler.XStat, org.tensorflow.proto.profiler.XStat.Builder, org.tensorflow.proto.profiler.XStatOrBuilder> statsBuilder_;

    /**
     * <pre>
     * XStats that are constant for all XEvents with the same metadata_id.
     * Each of these XStats should have a different metadata_id.
     * </pre>
     *
     * <code>repeated .tensorflow.profiler.XStat stats = 5;</code>
     */
    public java.util.List<org.tensorflow.proto.profiler.XStat> getStatsList() {
      if (statsBuilder_ == null) {
        return java.util.Collections.unmodifiableList(stats_);
      } else {
        return statsBuilder_.getMessageList();
      }
    }
    /**
     * <pre>
     * XStats that are constant for all XEvents with the same metadata_id.
     * Each of these XStats should have a different metadata_id.
     * </pre>
     *
     * <code>repeated .tensorflow.profiler.XStat stats = 5;</code>
     */
    public int getStatsCount() {
      if (statsBuilder_ == null) {
        return stats_.size();
      } else {
        return statsBuilder_.getCount();
      }
    }
    /**
     * <pre>
     * XStats that are constant for all XEvents with the same metadata_id.
     * Each of these XStats should have a different metadata_id.
     * </pre>
     *
     * <code>repeated .tensorflow.profiler.XStat stats = 5;</code>
     */
    public org.tensorflow.proto.profiler.XStat getStats(int index) {
      if (statsBuilder_ == null) {
        return stats_.get(index);
      } else {
        return statsBuilder_.getMessage(index);
      }
    }
    /**
     * <pre>
     * XStats that are constant for all XEvents with the same metadata_id.
     * Each of these XStats should have a different metadata_id.
     * </pre>
     *
     * <code>repeated .tensorflow.profiler.XStat stats = 5;</code>
     */
    public Builder setStats(
        int index, org.tensorflow.proto.profiler.XStat value) {
      if (statsBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureStatsIsMutable();
        stats_.set(index, value);
        onChanged();
      } else {
        statsBuilder_.setMessage(index, value);
      }
      return this;
    }
    /**
     * <pre>
     * XStats that are constant for all XEvents with the same metadata_id.
     * Each of these XStats should have a different metadata_id.
     * </pre>
     *
     * <code>repeated .tensorflow.profiler.XStat stats = 5;</code>
     */
    public Builder setStats(
        int index, org.tensorflow.proto.profiler.XStat.Builder builderForValue) {
      if (statsBuilder_ == null) {
        ensureStatsIsMutable();
        stats_.set(index, builderForValue.build());
        onChanged();
      } else {
        statsBuilder_.setMessage(index, builderForValue.build());
      }
      return this;
    }
    /**
     * <pre>
     * XStats that are constant for all XEvents with the same metadata_id.
     * Each of these XStats should have a different metadata_id.
     * </pre>
     *
     * <code>repeated .tensorflow.profiler.XStat stats = 5;</code>
     */
    public Builder addStats(org.tensorflow.proto.profiler.XStat value) {
      if (statsBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureStatsIsMutable();
        stats_.add(value);
        onChanged();
      } else {
        statsBuilder_.addMessage(value);
      }
      return this;
    }
    /**
     * <pre>
     * XStats that are constant for all XEvents with the same metadata_id.
     * Each of these XStats should have a different metadata_id.
     * </pre>
     *
     * <code>repeated .tensorflow.profiler.XStat stats = 5;</code>
     */
    public Builder addStats(
        int index, org.tensorflow.proto.profiler.XStat value) {
      if (statsBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureStatsIsMutable();
        stats_.add(index, value);
        onChanged();
      } else {
        statsBuilder_.addMessage(index, value);
      }
      return this;
    }
    /**
     * <pre>
     * XStats that are constant for all XEvents with the same metadata_id.
     * Each of these XStats should have a different metadata_id.
     * </pre>
     *
     * <code>repeated .tensorflow.profiler.XStat stats = 5;</code>
     */
    public Builder addStats(
        org.tensorflow.proto.profiler.XStat.Builder builderForValue) {
      if (statsBuilder_ == null) {
        ensureStatsIsMutable();
        stats_.add(builderForValue.build());
        onChanged();
      } else {
        statsBuilder_.addMessage(builderForValue.build());
      }
      return this;
    }
    /**
     * <pre>
     * XStats that are constant for all XEvents with the same metadata_id.
     * Each of these XStats should have a different metadata_id.
     * </pre>
     *
     * <code>repeated .tensorflow.profiler.XStat stats = 5;</code>
     */
    public Builder addStats(
        int index, org.tensorflow.proto.profiler.XStat.Builder builderForValue) {
      if (statsBuilder_ == null) {
        ensureStatsIsMutable();
        stats_.add(index, builderForValue.build());
        onChanged();
      } else {
        statsBuilder_.addMessage(index, builderForValue.build());
      }
      return this;
    }
    /**
     * <pre>
     * XStats that are constant for all XEvents with the same metadata_id.
     * Each of these XStats should have a different metadata_id.
     * </pre>
     *
     * <code>repeated .tensorflow.profiler.XStat stats = 5;</code>
     */
    public Builder addAllStats(
        java.lang.Iterable<? extends org.tensorflow.proto.profiler.XStat> values) {
      if (statsBuilder_ == null) {
        ensureStatsIsMutable();
        com.google.protobuf.AbstractMessageLite.Builder.addAll(
            values, stats_);
        onChanged();
      } else {
        statsBuilder_.addAllMessages(values);
      }
      return this;
    }
    /**
     * <pre>
     * XStats that are constant for all XEvents with the same metadata_id.
     * Each of these XStats should have a different metadata_id.
     * </pre>
     *
     * <code>repeated .tensorflow.profiler.XStat stats = 5;</code>
     */
    public Builder clearStats() {
      if (statsBuilder_ == null) {
        stats_ = java.util.Collections.emptyList();
        bitField0_ = (bitField0_ & ~0x00000001);
        onChanged();
      } else {
        statsBuilder_.clear();
      }
      return this;
    }
    /**
     * <pre>
     * XStats that are constant for all XEvents with the same metadata_id.
     * Each of these XStats should have a different metadata_id.
     * </pre>
     *
     * <code>repeated .tensorflow.profiler.XStat stats = 5;</code>
     */
    public Builder removeStats(int index) {
      if (statsBuilder_ == null) {
        ensureStatsIsMutable();
        stats_.remove(index);
        onChanged();
      } else {
        statsBuilder_.remove(index);
      }
      return this;
    }
    /**
     * <pre>
     * XStats that are constant for all XEvents with the same metadata_id.
     * Each of these XStats should have a different metadata_id.
     * </pre>
     *
     * <code>repeated .tensorflow.profiler.XStat stats = 5;</code>
     */
    public org.tensorflow.proto.profiler.XStat.Builder getStatsBuilder(
        int index) {
      return getStatsFieldBuilder().getBuilder(index);
    }
    /**
     * <pre>
     * XStats that are constant for all XEvents with the same metadata_id.
     * Each of these XStats should have a different metadata_id.
     * </pre>
     *
     * <code>repeated .tensorflow.profiler.XStat stats = 5;</code>
     */
    public org.tensorflow.proto.profiler.XStatOrBuilder getStatsOrBuilder(
        int index) {
      if (statsBuilder_ == null) {
        return stats_.get(index);  } else {
        return statsBuilder_.getMessageOrBuilder(index);
      }
    }
    /**
     * <pre>
     * XStats that are constant for all XEvents with the same metadata_id.
     * Each of these XStats should have a different metadata_id.
     * </pre>
     *
     * <code>repeated .tensorflow.profiler.XStat stats = 5;</code>
     */
    public java.util.List<? extends org.tensorflow.proto.profiler.XStatOrBuilder> 
         getStatsOrBuilderList() {
      if (statsBuilder_ != null) {
        return statsBuilder_.getMessageOrBuilderList();
      } else {
        return java.util.Collections.unmodifiableList(stats_);
      }
    }
    /**
     * <pre>
     * XStats that are constant for all XEvents with the same metadata_id.
     * Each of these XStats should have a different metadata_id.
     * </pre>
     *
     * <code>repeated .tensorflow.profiler.XStat stats = 5;</code>
     */
    public org.tensorflow.proto.profiler.XStat.Builder addStatsBuilder() {
      return getStatsFieldBuilder().addBuilder(
          org.tensorflow.proto.profiler.XStat.getDefaultInstance());
    }
    /**
     * <pre>
     * XStats that are constant for all XEvents with the same metadata_id.
     * Each of these XStats should have a different metadata_id.
     * </pre>
     *
     * <code>repeated .tensorflow.profiler.XStat stats = 5;</code>
     */
    public org.tensorflow.proto.profiler.XStat.Builder addStatsBuilder(
        int index) {
      return getStatsFieldBuilder().addBuilder(
          index, org.tensorflow.proto.profiler.XStat.getDefaultInstance());
    }
    /**
     * <pre>
     * XStats that are constant for all XEvents with the same metadata_id.
     * Each of these XStats should have a different metadata_id.
     * </pre>
     *
     * <code>repeated .tensorflow.profiler.XStat stats = 5;</code>
     */
    public java.util.List<org.tensorflow.proto.profiler.XStat.Builder> 
         getStatsBuilderList() {
      return getStatsFieldBuilder().getBuilderList();
    }
    private com.google.protobuf.RepeatedFieldBuilderV3<
        org.tensorflow.proto.profiler.XStat, org.tensorflow.proto.profiler.XStat.Builder, org.tensorflow.proto.profiler.XStatOrBuilder> 
        getStatsFieldBuilder() {
      if (statsBuilder_ == null) {
        statsBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3<
            org.tensorflow.proto.profiler.XStat, org.tensorflow.proto.profiler.XStat.Builder, org.tensorflow.proto.profiler.XStatOrBuilder>(
                stats_,
                ((bitField0_ & 0x00000001) != 0),
                getParentForChildren(),
                isClean());
        stats_ = null;
      }
      return statsBuilder_;
    }

    private com.google.protobuf.Internal.LongList childId_ = emptyLongList();
    private void ensureChildIdIsMutable() {
      if (!((bitField0_ & 0x00000002) != 0)) {
        childId_ = mutableCopy(childId_);
        bitField0_ |= 0x00000002;
       }
    }
    /**
     * <pre>
     * XPlane.event_metadata map key for children events.
     * </pre>
     *
     * <code>repeated int64 child_id = 6;</code>
     */
    public java.util.List<java.lang.Long>
        getChildIdList() {
      return ((bitField0_ & 0x00000002) != 0) ?
               java.util.Collections.unmodifiableList(childId_) : childId_;
    }
    /**
     * <pre>
     * XPlane.event_metadata map key for children events.
     * </pre>
     *
     * <code>repeated int64 child_id = 6;</code>
     */
    public int getChildIdCount() {
      return childId_.size();
    }
    /**
     * <pre>
     * XPlane.event_metadata map key for children events.
     * </pre>
     *
     * <code>repeated int64 child_id = 6;</code>
     */
    public long getChildId(int index) {
      return childId_.getLong(index);
    }
    /**
     * <pre>
     * XPlane.event_metadata map key for children events.
     * </pre>
     *
     * <code>repeated int64 child_id = 6;</code>
     */
    public Builder setChildId(
        int index, long value) {
      ensureChildIdIsMutable();
      childId_.setLong(index, value);
      onChanged();
      return this;
    }
    /**
     * <pre>
     * XPlane.event_metadata map key for children events.
     * </pre>
     *
     * <code>repeated int64 child_id = 6;</code>
     */
    public Builder addChildId(long value) {
      ensureChildIdIsMutable();
      childId_.addLong(value);
      onChanged();
      return this;
    }
    /**
     * <pre>
     * XPlane.event_metadata map key for children events.
     * </pre>
     *
     * <code>repeated int64 child_id = 6;</code>
     */
    public Builder addAllChildId(
        java.lang.Iterable<? extends java.lang.Long> values) {
      ensureChildIdIsMutable();
      com.google.protobuf.AbstractMessageLite.Builder.addAll(
          values, childId_);
      onChanged();
      return this;
    }
    /**
     * <pre>
     * XPlane.event_metadata map key for children events.
     * </pre>
     *
     * <code>repeated int64 child_id = 6;</code>
     */
    public Builder clearChildId() {
      childId_ = emptyLongList();
      bitField0_ = (bitField0_ & ~0x00000002);
      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.profiler.XEventMetadata)
  }

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

  public static org.tensorflow.proto.profiler.XEventMetadata getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

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

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

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

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

}

