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

package org.tensorflow.proto.profiler;

/**
 * <pre>
 * An XLine is a timeline of trace events (XEvents).
 * Next ID: 12
 * </pre>
 *
 * Protobuf type {@code tensorflow.profiler.XLine}
 */
public  final class XLine extends
    com.google.protobuf.GeneratedMessageV3 implements
    // @@protoc_insertion_point(message_implements:tensorflow.profiler.XLine)
    XLineOrBuilder {
private static final long serialVersionUID = 0L;
  // Use XLine.newBuilder() to construct.
  private XLine(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
    super(builder);
  }
  private XLine() {
    name_ = "";
    displayName_ = "";
    events_ = java.util.Collections.emptyList();
  }

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

  @java.lang.Override
  public final com.google.protobuf.UnknownFieldSet
  getUnknownFields() {
    return this.unknownFields;
  }
  private XLine(
      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 24: {

            timestampNs_ = input.readInt64();
            break;
          }
          case 34: {
            if (!((mutable_bitField0_ & 0x00000001) != 0)) {
              events_ = new java.util.ArrayList<org.tensorflow.proto.profiler.XEvent>();
              mutable_bitField0_ |= 0x00000001;
            }
            events_.add(
                input.readMessage(org.tensorflow.proto.profiler.XEvent.parser(), extensionRegistry));
            break;
          }
          case 72: {

            durationPs_ = input.readInt64();
            break;
          }
          case 80: {

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

            displayName_ = s;
            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)) {
        events_ = java.util.Collections.unmodifiableList(events_);
      }
      this.unknownFields = unknownFields.build();
      makeExtensionsImmutable();
    }
  }
  public static final com.google.protobuf.Descriptors.Descriptor
      getDescriptor() {
    return org.tensorflow.proto.profiler.XPlaneProtos.internal_static_tensorflow_profiler_XLine_descriptor;
  }

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

  public static final int ID_FIELD_NUMBER = 1;
  private long id_;
  /**
   * <pre>
   * Id of this line, can be repeated within an XPlane. All XLines with the
   * same id are effectively the same timeline.
   * </pre>
   *
   * <code>int64 id = 1;</code>
   */
  public long getId() {
    return id_;
  }

  public static final int DISPLAY_ID_FIELD_NUMBER = 10;
  private long displayId_;
  /**
   * <pre>
   * Display id of this line. Multiple lines with the same display_id are
   * grouped together in the same trace viewer row.
   * </pre>
   *
   * <code>int64 display_id = 10;</code>
   */
  public long getDisplayId() {
    return displayId_;
  }

  public static final int NAME_FIELD_NUMBER = 2;
  private volatile java.lang.Object name_;
  /**
   * <pre>
   * Name of this XLine.
   * </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 this XLine.
   * </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 = 11;
  private volatile java.lang.Object displayName_;
  /**
   * <pre>
   * Name of this XLine to display in trace viewer.
   * </pre>
   *
   * <code>string display_name = 11;</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 this XLine to display in trace viewer.
   * </pre>
   *
   * <code>string display_name = 11;</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 TIMESTAMP_NS_FIELD_NUMBER = 3;
  private long timestampNs_;
  /**
   * <pre>
   * Start time of this line in nanoseconds since the UNIX epoch.
   * XEvent.offset_ps is relative to this timestamp.
   * </pre>
   *
   * <code>int64 timestamp_ns = 3;</code>
   */
  public long getTimestampNs() {
    return timestampNs_;
  }

  public static final int DURATION_PS_FIELD_NUMBER = 9;
  private long durationPs_;
  /**
   * <pre>
   * Profiling duration for this line in picoseconds.
   * </pre>
   *
   * <code>int64 duration_ps = 9;</code>
   */
  public long getDurationPs() {
    return durationPs_;
  }

  public static final int EVENTS_FIELD_NUMBER = 4;
  private java.util.List<org.tensorflow.proto.profiler.XEvent> events_;
  /**
   * <pre>
   * XEvents within the same XLine should not overlap in time, but they can be
   * nested.
   * </pre>
   *
   * <code>repeated .tensorflow.profiler.XEvent events = 4;</code>
   */
  public java.util.List<org.tensorflow.proto.profiler.XEvent> getEventsList() {
    return events_;
  }
  /**
   * <pre>
   * XEvents within the same XLine should not overlap in time, but they can be
   * nested.
   * </pre>
   *
   * <code>repeated .tensorflow.profiler.XEvent events = 4;</code>
   */
  public java.util.List<? extends org.tensorflow.proto.profiler.XEventOrBuilder> 
      getEventsOrBuilderList() {
    return events_;
  }
  /**
   * <pre>
   * XEvents within the same XLine should not overlap in time, but they can be
   * nested.
   * </pre>
   *
   * <code>repeated .tensorflow.profiler.XEvent events = 4;</code>
   */
  public int getEventsCount() {
    return events_.size();
  }
  /**
   * <pre>
   * XEvents within the same XLine should not overlap in time, but they can be
   * nested.
   * </pre>
   *
   * <code>repeated .tensorflow.profiler.XEvent events = 4;</code>
   */
  public org.tensorflow.proto.profiler.XEvent getEvents(int index) {
    return events_.get(index);
  }
  /**
   * <pre>
   * XEvents within the same XLine should not overlap in time, but they can be
   * nested.
   * </pre>
   *
   * <code>repeated .tensorflow.profiler.XEvent events = 4;</code>
   */
  public org.tensorflow.proto.profiler.XEventOrBuilder getEventsOrBuilder(
      int index) {
    return events_.get(index);
  }

  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 (id_ != 0L) {
      output.writeInt64(1, id_);
    }
    if (!getNameBytes().isEmpty()) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 2, name_);
    }
    if (timestampNs_ != 0L) {
      output.writeInt64(3, timestampNs_);
    }
    for (int i = 0; i < events_.size(); i++) {
      output.writeMessage(4, events_.get(i));
    }
    if (durationPs_ != 0L) {
      output.writeInt64(9, durationPs_);
    }
    if (displayId_ != 0L) {
      output.writeInt64(10, displayId_);
    }
    if (!getDisplayNameBytes().isEmpty()) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 11, displayName_);
    }
    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 (timestampNs_ != 0L) {
      size += com.google.protobuf.CodedOutputStream
        .computeInt64Size(3, timestampNs_);
    }
    for (int i = 0; i < events_.size(); i++) {
      size += com.google.protobuf.CodedOutputStream
        .computeMessageSize(4, events_.get(i));
    }
    if (durationPs_ != 0L) {
      size += com.google.protobuf.CodedOutputStream
        .computeInt64Size(9, durationPs_);
    }
    if (displayId_ != 0L) {
      size += com.google.protobuf.CodedOutputStream
        .computeInt64Size(10, displayId_);
    }
    if (!getDisplayNameBytes().isEmpty()) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(11, displayName_);
    }
    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.XLine)) {
      return super.equals(obj);
    }
    org.tensorflow.proto.profiler.XLine other = (org.tensorflow.proto.profiler.XLine) obj;

    if (getId()
        != other.getId()) return false;
    if (getDisplayId()
        != other.getDisplayId()) return false;
    if (!getName()
        .equals(other.getName())) return false;
    if (!getDisplayName()
        .equals(other.getDisplayName())) return false;
    if (getTimestampNs()
        != other.getTimestampNs()) return false;
    if (getDurationPs()
        != other.getDurationPs()) return false;
    if (!getEventsList()
        .equals(other.getEventsList())) 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) + DISPLAY_ID_FIELD_NUMBER;
    hash = (53 * hash) + com.google.protobuf.Internal.hashLong(
        getDisplayId());
    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) + TIMESTAMP_NS_FIELD_NUMBER;
    hash = (53 * hash) + com.google.protobuf.Internal.hashLong(
        getTimestampNs());
    hash = (37 * hash) + DURATION_PS_FIELD_NUMBER;
    hash = (53 * hash) + com.google.protobuf.Internal.hashLong(
        getDurationPs());
    if (getEventsCount() > 0) {
      hash = (37 * hash) + EVENTS_FIELD_NUMBER;
      hash = (53 * hash) + getEventsList().hashCode();
    }
    hash = (29 * hash) + unknownFields.hashCode();
    memoizedHashCode = hash;
    return hash;
  }

  public static org.tensorflow.proto.profiler.XLine parseFrom(
      java.nio.ByteBuffer data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static org.tensorflow.proto.profiler.XLine 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.XLine parseFrom(
      com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static org.tensorflow.proto.profiler.XLine 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.XLine parseFrom(byte[] data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static org.tensorflow.proto.profiler.XLine parseFrom(
      byte[] data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }
  public static org.tensorflow.proto.profiler.XLine parseFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input);
  }
  public static org.tensorflow.proto.profiler.XLine 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.XLine parseDelimitedFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseDelimitedWithIOException(PARSER, input);
  }
  public static org.tensorflow.proto.profiler.XLine 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.XLine parseFrom(
      com.google.protobuf.CodedInputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input);
  }
  public static org.tensorflow.proto.profiler.XLine 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.XLine 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>
   * An XLine is a timeline of trace events (XEvents).
   * Next ID: 12
   * </pre>
   *
   * Protobuf type {@code tensorflow.profiler.XLine}
   */
  public static final class Builder extends
      com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
      // @@protoc_insertion_point(builder_implements:tensorflow.profiler.XLine)
      org.tensorflow.proto.profiler.XLineOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor
        getDescriptor() {
      return org.tensorflow.proto.profiler.XPlaneProtos.internal_static_tensorflow_profiler_XLine_descriptor;
    }

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

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

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

      displayId_ = 0L;

      name_ = "";

      displayName_ = "";

      timestampNs_ = 0L;

      durationPs_ = 0L;

      if (eventsBuilder_ == null) {
        events_ = java.util.Collections.emptyList();
        bitField0_ = (bitField0_ & ~0x00000001);
      } else {
        eventsBuilder_.clear();
      }
      return this;
    }

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

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

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

    @java.lang.Override
    public org.tensorflow.proto.profiler.XLine buildPartial() {
      org.tensorflow.proto.profiler.XLine result = new org.tensorflow.proto.profiler.XLine(this);
      int from_bitField0_ = bitField0_;
      result.id_ = id_;
      result.displayId_ = displayId_;
      result.name_ = name_;
      result.displayName_ = displayName_;
      result.timestampNs_ = timestampNs_;
      result.durationPs_ = durationPs_;
      if (eventsBuilder_ == null) {
        if (((bitField0_ & 0x00000001) != 0)) {
          events_ = java.util.Collections.unmodifiableList(events_);
          bitField0_ = (bitField0_ & ~0x00000001);
        }
        result.events_ = events_;
      } else {
        result.events_ = eventsBuilder_.build();
      }
      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.XLine) {
        return mergeFrom((org.tensorflow.proto.profiler.XLine)other);
      } else {
        super.mergeFrom(other);
        return this;
      }
    }

    public Builder mergeFrom(org.tensorflow.proto.profiler.XLine other) {
      if (other == org.tensorflow.proto.profiler.XLine.getDefaultInstance()) return this;
      if (other.getId() != 0L) {
        setId(other.getId());
      }
      if (other.getDisplayId() != 0L) {
        setDisplayId(other.getDisplayId());
      }
      if (!other.getName().isEmpty()) {
        name_ = other.name_;
        onChanged();
      }
      if (!other.getDisplayName().isEmpty()) {
        displayName_ = other.displayName_;
        onChanged();
      }
      if (other.getTimestampNs() != 0L) {
        setTimestampNs(other.getTimestampNs());
      }
      if (other.getDurationPs() != 0L) {
        setDurationPs(other.getDurationPs());
      }
      if (eventsBuilder_ == null) {
        if (!other.events_.isEmpty()) {
          if (events_.isEmpty()) {
            events_ = other.events_;
            bitField0_ = (bitField0_ & ~0x00000001);
          } else {
            ensureEventsIsMutable();
            events_.addAll(other.events_);
          }
          onChanged();
        }
      } else {
        if (!other.events_.isEmpty()) {
          if (eventsBuilder_.isEmpty()) {
            eventsBuilder_.dispose();
            eventsBuilder_ = null;
            events_ = other.events_;
            bitField0_ = (bitField0_ & ~0x00000001);
            eventsBuilder_ = 
              com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ?
                 getEventsFieldBuilder() : null;
          } else {
            eventsBuilder_.addAllMessages(other.events_);
          }
        }
      }
      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.XLine parsedMessage = null;
      try {
        parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        parsedMessage = (org.tensorflow.proto.profiler.XLine) e.getUnfinishedMessage();
        throw e.unwrapIOException();
      } finally {
        if (parsedMessage != null) {
          mergeFrom(parsedMessage);
        }
      }
      return this;
    }
    private int bitField0_;

    private long id_ ;
    /**
     * <pre>
     * Id of this line, can be repeated within an XPlane. All XLines with the
     * same id are effectively the same timeline.
     * </pre>
     *
     * <code>int64 id = 1;</code>
     */
    public long getId() {
      return id_;
    }
    /**
     * <pre>
     * Id of this line, can be repeated within an XPlane. All XLines with the
     * same id are effectively the same timeline.
     * </pre>
     *
     * <code>int64 id = 1;</code>
     */
    public Builder setId(long value) {
      
      id_ = value;
      onChanged();
      return this;
    }
    /**
     * <pre>
     * Id of this line, can be repeated within an XPlane. All XLines with the
     * same id are effectively the same timeline.
     * </pre>
     *
     * <code>int64 id = 1;</code>
     */
    public Builder clearId() {
      
      id_ = 0L;
      onChanged();
      return this;
    }

    private long displayId_ ;
    /**
     * <pre>
     * Display id of this line. Multiple lines with the same display_id are
     * grouped together in the same trace viewer row.
     * </pre>
     *
     * <code>int64 display_id = 10;</code>
     */
    public long getDisplayId() {
      return displayId_;
    }
    /**
     * <pre>
     * Display id of this line. Multiple lines with the same display_id are
     * grouped together in the same trace viewer row.
     * </pre>
     *
     * <code>int64 display_id = 10;</code>
     */
    public Builder setDisplayId(long value) {
      
      displayId_ = value;
      onChanged();
      return this;
    }
    /**
     * <pre>
     * Display id of this line. Multiple lines with the same display_id are
     * grouped together in the same trace viewer row.
     * </pre>
     *
     * <code>int64 display_id = 10;</code>
     */
    public Builder clearDisplayId() {
      
      displayId_ = 0L;
      onChanged();
      return this;
    }

    private java.lang.Object name_ = "";
    /**
     * <pre>
     * Name of this XLine.
     * </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 this XLine.
     * </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 this XLine.
     * </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 this XLine.
     * </pre>
     *
     * <code>string name = 2;</code>
     */
    public Builder clearName() {
      
      name_ = getDefaultInstance().getName();
      onChanged();
      return this;
    }
    /**
     * <pre>
     * Name of this XLine.
     * </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 this XLine to display in trace viewer.
     * </pre>
     *
     * <code>string display_name = 11;</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 this XLine to display in trace viewer.
     * </pre>
     *
     * <code>string display_name = 11;</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 this XLine to display in trace viewer.
     * </pre>
     *
     * <code>string display_name = 11;</code>
     */
    public Builder setDisplayName(
        java.lang.String value) {
      if (value == null) {
    throw new NullPointerException();
  }
  
      displayName_ = value;
      onChanged();
      return this;
    }
    /**
     * <pre>
     * Name of this XLine to display in trace viewer.
     * </pre>
     *
     * <code>string display_name = 11;</code>
     */
    public Builder clearDisplayName() {
      
      displayName_ = getDefaultInstance().getDisplayName();
      onChanged();
      return this;
    }
    /**
     * <pre>
     * Name of this XLine to display in trace viewer.
     * </pre>
     *
     * <code>string display_name = 11;</code>
     */
    public Builder setDisplayNameBytes(
        com.google.protobuf.ByteString value) {
      if (value == null) {
    throw new NullPointerException();
  }
  checkByteStringIsUtf8(value);
      
      displayName_ = value;
      onChanged();
      return this;
    }

    private long timestampNs_ ;
    /**
     * <pre>
     * Start time of this line in nanoseconds since the UNIX epoch.
     * XEvent.offset_ps is relative to this timestamp.
     * </pre>
     *
     * <code>int64 timestamp_ns = 3;</code>
     */
    public long getTimestampNs() {
      return timestampNs_;
    }
    /**
     * <pre>
     * Start time of this line in nanoseconds since the UNIX epoch.
     * XEvent.offset_ps is relative to this timestamp.
     * </pre>
     *
     * <code>int64 timestamp_ns = 3;</code>
     */
    public Builder setTimestampNs(long value) {
      
      timestampNs_ = value;
      onChanged();
      return this;
    }
    /**
     * <pre>
     * Start time of this line in nanoseconds since the UNIX epoch.
     * XEvent.offset_ps is relative to this timestamp.
     * </pre>
     *
     * <code>int64 timestamp_ns = 3;</code>
     */
    public Builder clearTimestampNs() {
      
      timestampNs_ = 0L;
      onChanged();
      return this;
    }

    private long durationPs_ ;
    /**
     * <pre>
     * Profiling duration for this line in picoseconds.
     * </pre>
     *
     * <code>int64 duration_ps = 9;</code>
     */
    public long getDurationPs() {
      return durationPs_;
    }
    /**
     * <pre>
     * Profiling duration for this line in picoseconds.
     * </pre>
     *
     * <code>int64 duration_ps = 9;</code>
     */
    public Builder setDurationPs(long value) {
      
      durationPs_ = value;
      onChanged();
      return this;
    }
    /**
     * <pre>
     * Profiling duration for this line in picoseconds.
     * </pre>
     *
     * <code>int64 duration_ps = 9;</code>
     */
    public Builder clearDurationPs() {
      
      durationPs_ = 0L;
      onChanged();
      return this;
    }

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

    private com.google.protobuf.RepeatedFieldBuilderV3<
        org.tensorflow.proto.profiler.XEvent, org.tensorflow.proto.profiler.XEvent.Builder, org.tensorflow.proto.profiler.XEventOrBuilder> eventsBuilder_;

    /**
     * <pre>
     * XEvents within the same XLine should not overlap in time, but they can be
     * nested.
     * </pre>
     *
     * <code>repeated .tensorflow.profiler.XEvent events = 4;</code>
     */
    public java.util.List<org.tensorflow.proto.profiler.XEvent> getEventsList() {
      if (eventsBuilder_ == null) {
        return java.util.Collections.unmodifiableList(events_);
      } else {
        return eventsBuilder_.getMessageList();
      }
    }
    /**
     * <pre>
     * XEvents within the same XLine should not overlap in time, but they can be
     * nested.
     * </pre>
     *
     * <code>repeated .tensorflow.profiler.XEvent events = 4;</code>
     */
    public int getEventsCount() {
      if (eventsBuilder_ == null) {
        return events_.size();
      } else {
        return eventsBuilder_.getCount();
      }
    }
    /**
     * <pre>
     * XEvents within the same XLine should not overlap in time, but they can be
     * nested.
     * </pre>
     *
     * <code>repeated .tensorflow.profiler.XEvent events = 4;</code>
     */
    public org.tensorflow.proto.profiler.XEvent getEvents(int index) {
      if (eventsBuilder_ == null) {
        return events_.get(index);
      } else {
        return eventsBuilder_.getMessage(index);
      }
    }
    /**
     * <pre>
     * XEvents within the same XLine should not overlap in time, but they can be
     * nested.
     * </pre>
     *
     * <code>repeated .tensorflow.profiler.XEvent events = 4;</code>
     */
    public Builder setEvents(
        int index, org.tensorflow.proto.profiler.XEvent value) {
      if (eventsBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureEventsIsMutable();
        events_.set(index, value);
        onChanged();
      } else {
        eventsBuilder_.setMessage(index, value);
      }
      return this;
    }
    /**
     * <pre>
     * XEvents within the same XLine should not overlap in time, but they can be
     * nested.
     * </pre>
     *
     * <code>repeated .tensorflow.profiler.XEvent events = 4;</code>
     */
    public Builder setEvents(
        int index, org.tensorflow.proto.profiler.XEvent.Builder builderForValue) {
      if (eventsBuilder_ == null) {
        ensureEventsIsMutable();
        events_.set(index, builderForValue.build());
        onChanged();
      } else {
        eventsBuilder_.setMessage(index, builderForValue.build());
      }
      return this;
    }
    /**
     * <pre>
     * XEvents within the same XLine should not overlap in time, but they can be
     * nested.
     * </pre>
     *
     * <code>repeated .tensorflow.profiler.XEvent events = 4;</code>
     */
    public Builder addEvents(org.tensorflow.proto.profiler.XEvent value) {
      if (eventsBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureEventsIsMutable();
        events_.add(value);
        onChanged();
      } else {
        eventsBuilder_.addMessage(value);
      }
      return this;
    }
    /**
     * <pre>
     * XEvents within the same XLine should not overlap in time, but they can be
     * nested.
     * </pre>
     *
     * <code>repeated .tensorflow.profiler.XEvent events = 4;</code>
     */
    public Builder addEvents(
        int index, org.tensorflow.proto.profiler.XEvent value) {
      if (eventsBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureEventsIsMutable();
        events_.add(index, value);
        onChanged();
      } else {
        eventsBuilder_.addMessage(index, value);
      }
      return this;
    }
    /**
     * <pre>
     * XEvents within the same XLine should not overlap in time, but they can be
     * nested.
     * </pre>
     *
     * <code>repeated .tensorflow.profiler.XEvent events = 4;</code>
     */
    public Builder addEvents(
        org.tensorflow.proto.profiler.XEvent.Builder builderForValue) {
      if (eventsBuilder_ == null) {
        ensureEventsIsMutable();
        events_.add(builderForValue.build());
        onChanged();
      } else {
        eventsBuilder_.addMessage(builderForValue.build());
      }
      return this;
    }
    /**
     * <pre>
     * XEvents within the same XLine should not overlap in time, but they can be
     * nested.
     * </pre>
     *
     * <code>repeated .tensorflow.profiler.XEvent events = 4;</code>
     */
    public Builder addEvents(
        int index, org.tensorflow.proto.profiler.XEvent.Builder builderForValue) {
      if (eventsBuilder_ == null) {
        ensureEventsIsMutable();
        events_.add(index, builderForValue.build());
        onChanged();
      } else {
        eventsBuilder_.addMessage(index, builderForValue.build());
      }
      return this;
    }
    /**
     * <pre>
     * XEvents within the same XLine should not overlap in time, but they can be
     * nested.
     * </pre>
     *
     * <code>repeated .tensorflow.profiler.XEvent events = 4;</code>
     */
    public Builder addAllEvents(
        java.lang.Iterable<? extends org.tensorflow.proto.profiler.XEvent> values) {
      if (eventsBuilder_ == null) {
        ensureEventsIsMutable();
        com.google.protobuf.AbstractMessageLite.Builder.addAll(
            values, events_);
        onChanged();
      } else {
        eventsBuilder_.addAllMessages(values);
      }
      return this;
    }
    /**
     * <pre>
     * XEvents within the same XLine should not overlap in time, but they can be
     * nested.
     * </pre>
     *
     * <code>repeated .tensorflow.profiler.XEvent events = 4;</code>
     */
    public Builder clearEvents() {
      if (eventsBuilder_ == null) {
        events_ = java.util.Collections.emptyList();
        bitField0_ = (bitField0_ & ~0x00000001);
        onChanged();
      } else {
        eventsBuilder_.clear();
      }
      return this;
    }
    /**
     * <pre>
     * XEvents within the same XLine should not overlap in time, but they can be
     * nested.
     * </pre>
     *
     * <code>repeated .tensorflow.profiler.XEvent events = 4;</code>
     */
    public Builder removeEvents(int index) {
      if (eventsBuilder_ == null) {
        ensureEventsIsMutable();
        events_.remove(index);
        onChanged();
      } else {
        eventsBuilder_.remove(index);
      }
      return this;
    }
    /**
     * <pre>
     * XEvents within the same XLine should not overlap in time, but they can be
     * nested.
     * </pre>
     *
     * <code>repeated .tensorflow.profiler.XEvent events = 4;</code>
     */
    public org.tensorflow.proto.profiler.XEvent.Builder getEventsBuilder(
        int index) {
      return getEventsFieldBuilder().getBuilder(index);
    }
    /**
     * <pre>
     * XEvents within the same XLine should not overlap in time, but they can be
     * nested.
     * </pre>
     *
     * <code>repeated .tensorflow.profiler.XEvent events = 4;</code>
     */
    public org.tensorflow.proto.profiler.XEventOrBuilder getEventsOrBuilder(
        int index) {
      if (eventsBuilder_ == null) {
        return events_.get(index);  } else {
        return eventsBuilder_.getMessageOrBuilder(index);
      }
    }
    /**
     * <pre>
     * XEvents within the same XLine should not overlap in time, but they can be
     * nested.
     * </pre>
     *
     * <code>repeated .tensorflow.profiler.XEvent events = 4;</code>
     */
    public java.util.List<? extends org.tensorflow.proto.profiler.XEventOrBuilder> 
         getEventsOrBuilderList() {
      if (eventsBuilder_ != null) {
        return eventsBuilder_.getMessageOrBuilderList();
      } else {
        return java.util.Collections.unmodifiableList(events_);
      }
    }
    /**
     * <pre>
     * XEvents within the same XLine should not overlap in time, but they can be
     * nested.
     * </pre>
     *
     * <code>repeated .tensorflow.profiler.XEvent events = 4;</code>
     */
    public org.tensorflow.proto.profiler.XEvent.Builder addEventsBuilder() {
      return getEventsFieldBuilder().addBuilder(
          org.tensorflow.proto.profiler.XEvent.getDefaultInstance());
    }
    /**
     * <pre>
     * XEvents within the same XLine should not overlap in time, but they can be
     * nested.
     * </pre>
     *
     * <code>repeated .tensorflow.profiler.XEvent events = 4;</code>
     */
    public org.tensorflow.proto.profiler.XEvent.Builder addEventsBuilder(
        int index) {
      return getEventsFieldBuilder().addBuilder(
          index, org.tensorflow.proto.profiler.XEvent.getDefaultInstance());
    }
    /**
     * <pre>
     * XEvents within the same XLine should not overlap in time, but they can be
     * nested.
     * </pre>
     *
     * <code>repeated .tensorflow.profiler.XEvent events = 4;</code>
     */
    public java.util.List<org.tensorflow.proto.profiler.XEvent.Builder> 
         getEventsBuilderList() {
      return getEventsFieldBuilder().getBuilderList();
    }
    private com.google.protobuf.RepeatedFieldBuilderV3<
        org.tensorflow.proto.profiler.XEvent, org.tensorflow.proto.profiler.XEvent.Builder, org.tensorflow.proto.profiler.XEventOrBuilder> 
        getEventsFieldBuilder() {
      if (eventsBuilder_ == null) {
        eventsBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3<
            org.tensorflow.proto.profiler.XEvent, org.tensorflow.proto.profiler.XEvent.Builder, org.tensorflow.proto.profiler.XEventOrBuilder>(
                events_,
                ((bitField0_ & 0x00000001) != 0),
                getParentForChildren(),
                isClean());
        events_ = null;
      }
      return eventsBuilder_;
    }
    @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.XLine)
  }

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

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

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

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

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

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

}

