/*
 * Copyright 2018 NAVER Corp.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * Autogenerated by Thrift Compiler (0.10.0)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package com.navercorp.pinpoint.thrift.dto;

@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.10.0)", date = "2018-09-28")
public class TSpanEvent implements org.apache.thrift.TBase<TSpanEvent, TSpanEvent._Fields>, java.io.Serializable, Cloneable, Comparable<TSpanEvent> {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TSpanEvent");

  private static final org.apache.thrift.protocol.TField SPAN_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("spanId", org.apache.thrift.protocol.TType.I64, (short)7);
  private static final org.apache.thrift.protocol.TField SEQUENCE_FIELD_DESC = new org.apache.thrift.protocol.TField("sequence", org.apache.thrift.protocol.TType.I16, (short)8);
  private static final org.apache.thrift.protocol.TField START_ELAPSED_FIELD_DESC = new org.apache.thrift.protocol.TField("startElapsed", org.apache.thrift.protocol.TType.I32, (short)9);
  private static final org.apache.thrift.protocol.TField END_ELAPSED_FIELD_DESC = new org.apache.thrift.protocol.TField("endElapsed", org.apache.thrift.protocol.TType.I32, (short)10);
  private static final org.apache.thrift.protocol.TField RPC_FIELD_DESC = new org.apache.thrift.protocol.TField("rpc", org.apache.thrift.protocol.TType.STRING, (short)11);
  private static final org.apache.thrift.protocol.TField SERVICE_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("serviceType", org.apache.thrift.protocol.TType.I16, (short)12);
  private static final org.apache.thrift.protocol.TField END_POINT_FIELD_DESC = new org.apache.thrift.protocol.TField("endPoint", org.apache.thrift.protocol.TType.STRING, (short)13);
  private static final org.apache.thrift.protocol.TField ANNOTATIONS_FIELD_DESC = new org.apache.thrift.protocol.TField("annotations", org.apache.thrift.protocol.TType.LIST, (short)14);
  private static final org.apache.thrift.protocol.TField DEPTH_FIELD_DESC = new org.apache.thrift.protocol.TField("depth", org.apache.thrift.protocol.TType.I32, (short)15);
  private static final org.apache.thrift.protocol.TField NEXT_SPAN_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("nextSpanId", org.apache.thrift.protocol.TType.I64, (short)16);
  private static final org.apache.thrift.protocol.TField DESTINATION_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("destinationId", org.apache.thrift.protocol.TType.STRING, (short)20);
  private static final org.apache.thrift.protocol.TField API_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("apiId", org.apache.thrift.protocol.TType.I32, (short)25);
  private static final org.apache.thrift.protocol.TField EXCEPTION_INFO_FIELD_DESC = new org.apache.thrift.protocol.TField("exceptionInfo", org.apache.thrift.protocol.TType.STRUCT, (short)26);
  private static final org.apache.thrift.protocol.TField ASYNC_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("asyncId", org.apache.thrift.protocol.TType.I32, (short)30);
  private static final org.apache.thrift.protocol.TField NEXT_ASYNC_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("nextAsyncId", org.apache.thrift.protocol.TType.I32, (short)31);
  private static final org.apache.thrift.protocol.TField ASYNC_SEQUENCE_FIELD_DESC = new org.apache.thrift.protocol.TField("asyncSequence", org.apache.thrift.protocol.TType.I16, (short)32);

  private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new TSpanEventStandardSchemeFactory();
  private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new TSpanEventTupleSchemeFactory();

  private long spanId; // optional
  private short sequence; // required
  private int startElapsed; // required
  private int endElapsed; // optional
  private java.lang.String rpc; // optional
  private short serviceType; // required
  private java.lang.String endPoint; // optional
  private java.util.List<TAnnotation> annotations; // optional
  private int depth; // optional
  private long nextSpanId; // optional
  private java.lang.String destinationId; // optional
  private int apiId; // optional
  private TIntStringValue exceptionInfo; // optional
  private int asyncId; // optional
  private int nextAsyncId; // optional
  private short asyncSequence; // optional

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
    SPAN_ID((short)7, "spanId"),
    SEQUENCE((short)8, "sequence"),
    START_ELAPSED((short)9, "startElapsed"),
    END_ELAPSED((short)10, "endElapsed"),
    RPC((short)11, "rpc"),
    SERVICE_TYPE((short)12, "serviceType"),
    END_POINT((short)13, "endPoint"),
    ANNOTATIONS((short)14, "annotations"),
    DEPTH((short)15, "depth"),
    NEXT_SPAN_ID((short)16, "nextSpanId"),
    DESTINATION_ID((short)20, "destinationId"),
    API_ID((short)25, "apiId"),
    EXCEPTION_INFO((short)26, "exceptionInfo"),
    ASYNC_ID((short)30, "asyncId"),
    NEXT_ASYNC_ID((short)31, "nextAsyncId"),
    ASYNC_SEQUENCE((short)32, "asyncSequence");

    private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>();

    static {
      for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) {
        byName.put(field.getFieldName(), field);
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, or null if its not found.
     */
    public static _Fields findByThriftId(int fieldId) {
      switch(fieldId) {
        case 7: // SPAN_ID
          return SPAN_ID;
        case 8: // SEQUENCE
          return SEQUENCE;
        case 9: // START_ELAPSED
          return START_ELAPSED;
        case 10: // END_ELAPSED
          return END_ELAPSED;
        case 11: // RPC
          return RPC;
        case 12: // SERVICE_TYPE
          return SERVICE_TYPE;
        case 13: // END_POINT
          return END_POINT;
        case 14: // ANNOTATIONS
          return ANNOTATIONS;
        case 15: // DEPTH
          return DEPTH;
        case 16: // NEXT_SPAN_ID
          return NEXT_SPAN_ID;
        case 20: // DESTINATION_ID
          return DESTINATION_ID;
        case 25: // API_ID
          return API_ID;
        case 26: // EXCEPTION_INFO
          return EXCEPTION_INFO;
        case 30: // ASYNC_ID
          return ASYNC_ID;
        case 31: // NEXT_ASYNC_ID
          return NEXT_ASYNC_ID;
        case 32: // ASYNC_SEQUENCE
          return ASYNC_SEQUENCE;
        default:
          return null;
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, throwing an exception
     * if it is not found.
     */
    public static _Fields findByThriftIdOrThrow(int fieldId) {
      _Fields fields = findByThriftId(fieldId);
      if (fields == null) throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!");
      return fields;
    }

    /**
     * Find the _Fields constant that matches name, or null if its not found.
     */
    public static _Fields findByName(java.lang.String name) {
      return byName.get(name);
    }

    private final short _thriftId;
    private final java.lang.String _fieldName;

    _Fields(short thriftId, java.lang.String fieldName) {
      _thriftId = thriftId;
      _fieldName = fieldName;
    }

    public short getThriftFieldId() {
      return _thriftId;
    }

    public java.lang.String getFieldName() {
      return _fieldName;
    }
  }

  // isset id assignments
  private static final int __SPANID_ISSET_ID = 0;
  private static final int __SEQUENCE_ISSET_ID = 1;
  private static final int __STARTELAPSED_ISSET_ID = 2;
  private static final int __ENDELAPSED_ISSET_ID = 3;
  private static final int __SERVICETYPE_ISSET_ID = 4;
  private static final int __DEPTH_ISSET_ID = 5;
  private static final int __NEXTSPANID_ISSET_ID = 6;
  private static final int __APIID_ISSET_ID = 7;
  private static final int __ASYNCID_ISSET_ID = 8;
  private static final int __NEXTASYNCID_ISSET_ID = 9;
  private static final int __ASYNCSEQUENCE_ISSET_ID = 10;
  private short __isset_bitfield = 0;
  private static final _Fields optionals[] = {_Fields.SPAN_ID,_Fields.END_ELAPSED,_Fields.RPC,_Fields.END_POINT,_Fields.ANNOTATIONS,_Fields.DEPTH,_Fields.NEXT_SPAN_ID,_Fields.DESTINATION_ID,_Fields.API_ID,_Fields.EXCEPTION_INFO,_Fields.ASYNC_ID,_Fields.NEXT_ASYNC_ID,_Fields.ASYNC_SEQUENCE};
  public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
  static {
    java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
    tmpMap.put(_Fields.SPAN_ID, new org.apache.thrift.meta_data.FieldMetaData("spanId", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.SEQUENCE, new org.apache.thrift.meta_data.FieldMetaData("sequence", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I16)));
    tmpMap.put(_Fields.START_ELAPSED, new org.apache.thrift.meta_data.FieldMetaData("startElapsed", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.END_ELAPSED, new org.apache.thrift.meta_data.FieldMetaData("endElapsed", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.RPC, new org.apache.thrift.meta_data.FieldMetaData("rpc", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.SERVICE_TYPE, new org.apache.thrift.meta_data.FieldMetaData("serviceType", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I16)));
    tmpMap.put(_Fields.END_POINT, new org.apache.thrift.meta_data.FieldMetaData("endPoint", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.ANNOTATIONS, new org.apache.thrift.meta_data.FieldMetaData("annotations", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
            new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TAnnotation.class))));
    tmpMap.put(_Fields.DEPTH, new org.apache.thrift.meta_data.FieldMetaData("depth", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.NEXT_SPAN_ID, new org.apache.thrift.meta_data.FieldMetaData("nextSpanId", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.DESTINATION_ID, new org.apache.thrift.meta_data.FieldMetaData("destinationId", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.API_ID, new org.apache.thrift.meta_data.FieldMetaData("apiId", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.EXCEPTION_INFO, new org.apache.thrift.meta_data.FieldMetaData("exceptionInfo", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TIntStringValue.class)));
    tmpMap.put(_Fields.ASYNC_ID, new org.apache.thrift.meta_data.FieldMetaData("asyncId", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.NEXT_ASYNC_ID, new org.apache.thrift.meta_data.FieldMetaData("nextAsyncId", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.ASYNC_SEQUENCE, new org.apache.thrift.meta_data.FieldMetaData("asyncSequence", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I16)));
    metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TSpanEvent.class, metaDataMap);
  }

  public TSpanEvent() {
    this.startElapsed = 0;

    this.endElapsed = 0;

    this.depth = -1;

    this.nextSpanId = -1L;

  }

  public TSpanEvent(
    short sequence,
    int startElapsed,
    short serviceType)
  {
    this();
    this.sequence = sequence;
    setSequenceIsSet(true);
    this.startElapsed = startElapsed;
    setStartElapsedIsSet(true);
    this.serviceType = serviceType;
    setServiceTypeIsSet(true);
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public TSpanEvent(TSpanEvent other) {
    __isset_bitfield = other.__isset_bitfield;
    this.spanId = other.spanId;
    this.sequence = other.sequence;
    this.startElapsed = other.startElapsed;
    this.endElapsed = other.endElapsed;
    if (other.isSetRpc()) {
      this.rpc = other.rpc;
    }
    this.serviceType = other.serviceType;
    if (other.isSetEndPoint()) {
      this.endPoint = other.endPoint;
    }
    if (other.isSetAnnotations()) {
      java.util.List<TAnnotation> __this__annotations = new java.util.ArrayList<TAnnotation>(other.annotations.size());
      for (TAnnotation other_element : other.annotations) {
        __this__annotations.add(new TAnnotation(other_element));
      }
      this.annotations = __this__annotations;
    }
    this.depth = other.depth;
    this.nextSpanId = other.nextSpanId;
    if (other.isSetDestinationId()) {
      this.destinationId = other.destinationId;
    }
    this.apiId = other.apiId;
    if (other.isSetExceptionInfo()) {
      this.exceptionInfo = new TIntStringValue(other.exceptionInfo);
    }
    this.asyncId = other.asyncId;
    this.nextAsyncId = other.nextAsyncId;
    this.asyncSequence = other.asyncSequence;
  }

  public TSpanEvent deepCopy() {
    return new TSpanEvent(this);
  }

  @Override
  public void clear() {
    setSpanIdIsSet(false);
    this.spanId = 0;
    setSequenceIsSet(false);
    this.sequence = 0;
    this.startElapsed = 0;

    this.endElapsed = 0;

    this.rpc = null;
    setServiceTypeIsSet(false);
    this.serviceType = 0;
    this.endPoint = null;
    this.annotations = null;
    this.depth = -1;

    this.nextSpanId = -1L;

    this.destinationId = null;
    setApiIdIsSet(false);
    this.apiId = 0;
    this.exceptionInfo = null;
    setAsyncIdIsSet(false);
    this.asyncId = 0;
    setNextAsyncIdIsSet(false);
    this.nextAsyncId = 0;
    setAsyncSequenceIsSet(false);
    this.asyncSequence = 0;
  }

  public long getSpanId() {
    return this.spanId;
  }

  public void setSpanId(long spanId) {
    this.spanId = spanId;
    setSpanIdIsSet(true);
  }

  public void unsetSpanId() {
    __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __SPANID_ISSET_ID);
  }

  /** Returns true if field spanId is set (has been assigned a value) and false otherwise */
  public boolean isSetSpanId() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __SPANID_ISSET_ID);
  }

  public void setSpanIdIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __SPANID_ISSET_ID, value);
  }

  public short getSequence() {
    return this.sequence;
  }

  public void setSequence(short sequence) {
    this.sequence = sequence;
    setSequenceIsSet(true);
  }

  public void unsetSequence() {
    __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __SEQUENCE_ISSET_ID);
  }

  /** Returns true if field sequence is set (has been assigned a value) and false otherwise */
  public boolean isSetSequence() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __SEQUENCE_ISSET_ID);
  }

  public void setSequenceIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __SEQUENCE_ISSET_ID, value);
  }

  public int getStartElapsed() {
    return this.startElapsed;
  }

  public void setStartElapsed(int startElapsed) {
    this.startElapsed = startElapsed;
    setStartElapsedIsSet(true);
  }

  public void unsetStartElapsed() {
    __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __STARTELAPSED_ISSET_ID);
  }

  /** Returns true if field startElapsed is set (has been assigned a value) and false otherwise */
  public boolean isSetStartElapsed() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __STARTELAPSED_ISSET_ID);
  }

  public void setStartElapsedIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __STARTELAPSED_ISSET_ID, value);
  }

  public int getEndElapsed() {
    return this.endElapsed;
  }

  public void setEndElapsed(int endElapsed) {
    this.endElapsed = endElapsed;
    setEndElapsedIsSet(true);
  }

  public void unsetEndElapsed() {
    __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __ENDELAPSED_ISSET_ID);
  }

  /** Returns true if field endElapsed is set (has been assigned a value) and false otherwise */
  public boolean isSetEndElapsed() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __ENDELAPSED_ISSET_ID);
  }

  public void setEndElapsedIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __ENDELAPSED_ISSET_ID, value);
  }

  @Deprecated
  public java.lang.String getRpc() {
    return this.rpc;
  }

  @Deprecated
  public void setRpc(java.lang.String rpc) {
    this.rpc = rpc;
  }

  @Deprecated
  public void unsetRpc() {
    this.rpc = null;
  }

  /** Returns true if field rpc is set (has been assigned a value) and false otherwise */
  @Deprecated
  public boolean isSetRpc() {
    return this.rpc != null;
  }

  @Deprecated
  public void setRpcIsSet(boolean value) {
    if (!value) {
      this.rpc = null;
    }
  }

  public short getServiceType() {
    return this.serviceType;
  }

  public void setServiceType(short serviceType) {
    this.serviceType = serviceType;
    setServiceTypeIsSet(true);
  }

  public void unsetServiceType() {
    __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __SERVICETYPE_ISSET_ID);
  }

  /** Returns true if field serviceType is set (has been assigned a value) and false otherwise */
  public boolean isSetServiceType() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __SERVICETYPE_ISSET_ID);
  }

  public void setServiceTypeIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __SERVICETYPE_ISSET_ID, value);
  }

  public java.lang.String getEndPoint() {
    return this.endPoint;
  }

  public void setEndPoint(java.lang.String endPoint) {
    this.endPoint = endPoint;
  }

  public void unsetEndPoint() {
    this.endPoint = null;
  }

  /** Returns true if field endPoint is set (has been assigned a value) and false otherwise */
  public boolean isSetEndPoint() {
    return this.endPoint != null;
  }

  public void setEndPointIsSet(boolean value) {
    if (!value) {
      this.endPoint = null;
    }
  }

  public int getAnnotationsSize() {
    return (this.annotations == null) ? 0 : this.annotations.size();
  }

  public java.util.Iterator<TAnnotation> getAnnotationsIterator() {
    return (this.annotations == null) ? null : this.annotations.iterator();
  }

  public void addToAnnotations(TAnnotation elem) {
    if (this.annotations == null) {
      this.annotations = new java.util.ArrayList<TAnnotation>();
    }
    this.annotations.add(elem);
  }

  public java.util.List<TAnnotation> getAnnotations() {
    return this.annotations;
  }

  public void setAnnotations(java.util.List<TAnnotation> annotations) {
    this.annotations = annotations;
  }

  public void unsetAnnotations() {
    this.annotations = null;
  }

  /** Returns true if field annotations is set (has been assigned a value) and false otherwise */
  public boolean isSetAnnotations() {
    return this.annotations != null;
  }

  public void setAnnotationsIsSet(boolean value) {
    if (!value) {
      this.annotations = null;
    }
  }

  public int getDepth() {
    return this.depth;
  }

  public void setDepth(int depth) {
    this.depth = depth;
    setDepthIsSet(true);
  }

  public void unsetDepth() {
    __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __DEPTH_ISSET_ID);
  }

  /** Returns true if field depth is set (has been assigned a value) and false otherwise */
  public boolean isSetDepth() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __DEPTH_ISSET_ID);
  }

  public void setDepthIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __DEPTH_ISSET_ID, value);
  }

  public long getNextSpanId() {
    return this.nextSpanId;
  }

  public void setNextSpanId(long nextSpanId) {
    this.nextSpanId = nextSpanId;
    setNextSpanIdIsSet(true);
  }

  public void unsetNextSpanId() {
    __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __NEXTSPANID_ISSET_ID);
  }

  /** Returns true if field nextSpanId is set (has been assigned a value) and false otherwise */
  public boolean isSetNextSpanId() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __NEXTSPANID_ISSET_ID);
  }

  public void setNextSpanIdIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __NEXTSPANID_ISSET_ID, value);
  }

  public java.lang.String getDestinationId() {
    return this.destinationId;
  }

  public void setDestinationId(java.lang.String destinationId) {
    this.destinationId = destinationId;
  }

  public void unsetDestinationId() {
    this.destinationId = null;
  }

  /** Returns true if field destinationId is set (has been assigned a value) and false otherwise */
  public boolean isSetDestinationId() {
    return this.destinationId != null;
  }

  public void setDestinationIdIsSet(boolean value) {
    if (!value) {
      this.destinationId = null;
    }
  }

  public int getApiId() {
    return this.apiId;
  }

  public void setApiId(int apiId) {
    this.apiId = apiId;
    setApiIdIsSet(true);
  }

  public void unsetApiId() {
    __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __APIID_ISSET_ID);
  }

  /** Returns true if field apiId is set (has been assigned a value) and false otherwise */
  public boolean isSetApiId() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __APIID_ISSET_ID);
  }

  public void setApiIdIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __APIID_ISSET_ID, value);
  }

  public TIntStringValue getExceptionInfo() {
    return this.exceptionInfo;
  }

  public void setExceptionInfo(TIntStringValue exceptionInfo) {
    this.exceptionInfo = exceptionInfo;
  }

  public void unsetExceptionInfo() {
    this.exceptionInfo = null;
  }

  /** Returns true if field exceptionInfo is set (has been assigned a value) and false otherwise */
  public boolean isSetExceptionInfo() {
    return this.exceptionInfo != null;
  }

  public void setExceptionInfoIsSet(boolean value) {
    if (!value) {
      this.exceptionInfo = null;
    }
  }

  public int getAsyncId() {
    return this.asyncId;
  }

  public void setAsyncId(int asyncId) {
    this.asyncId = asyncId;
    setAsyncIdIsSet(true);
  }

  public void unsetAsyncId() {
    __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __ASYNCID_ISSET_ID);
  }

  /** Returns true if field asyncId is set (has been assigned a value) and false otherwise */
  public boolean isSetAsyncId() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __ASYNCID_ISSET_ID);
  }

  public void setAsyncIdIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __ASYNCID_ISSET_ID, value);
  }

  public int getNextAsyncId() {
    return this.nextAsyncId;
  }

  public void setNextAsyncId(int nextAsyncId) {
    this.nextAsyncId = nextAsyncId;
    setNextAsyncIdIsSet(true);
  }

  public void unsetNextAsyncId() {
    __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __NEXTASYNCID_ISSET_ID);
  }

  /** Returns true if field nextAsyncId is set (has been assigned a value) and false otherwise */
  public boolean isSetNextAsyncId() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __NEXTASYNCID_ISSET_ID);
  }

  public void setNextAsyncIdIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __NEXTASYNCID_ISSET_ID, value);
  }

  public short getAsyncSequence() {
    return this.asyncSequence;
  }

  public void setAsyncSequence(short asyncSequence) {
    this.asyncSequence = asyncSequence;
    setAsyncSequenceIsSet(true);
  }

  public void unsetAsyncSequence() {
    __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __ASYNCSEQUENCE_ISSET_ID);
  }

  /** Returns true if field asyncSequence is set (has been assigned a value) and false otherwise */
  public boolean isSetAsyncSequence() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __ASYNCSEQUENCE_ISSET_ID);
  }

  public void setAsyncSequenceIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __ASYNCSEQUENCE_ISSET_ID, value);
  }

  public void setFieldValue(_Fields field, java.lang.Object value) {
    switch (field) {
    case SPAN_ID:
      if (value == null) {
        unsetSpanId();
      } else {
        setSpanId((java.lang.Long)value);
      }
      break;

    case SEQUENCE:
      if (value == null) {
        unsetSequence();
      } else {
        setSequence((java.lang.Short)value);
      }
      break;

    case START_ELAPSED:
      if (value == null) {
        unsetStartElapsed();
      } else {
        setStartElapsed((java.lang.Integer)value);
      }
      break;

    case END_ELAPSED:
      if (value == null) {
        unsetEndElapsed();
      } else {
        setEndElapsed((java.lang.Integer)value);
      }
      break;

    case RPC:
      if (value == null) {
        unsetRpc();
      } else {
        setRpc((java.lang.String)value);
      }
      break;

    case SERVICE_TYPE:
      if (value == null) {
        unsetServiceType();
      } else {
        setServiceType((java.lang.Short)value);
      }
      break;

    case END_POINT:
      if (value == null) {
        unsetEndPoint();
      } else {
        setEndPoint((java.lang.String)value);
      }
      break;

    case ANNOTATIONS:
      if (value == null) {
        unsetAnnotations();
      } else {
        setAnnotations((java.util.List<TAnnotation>)value);
      }
      break;

    case DEPTH:
      if (value == null) {
        unsetDepth();
      } else {
        setDepth((java.lang.Integer)value);
      }
      break;

    case NEXT_SPAN_ID:
      if (value == null) {
        unsetNextSpanId();
      } else {
        setNextSpanId((java.lang.Long)value);
      }
      break;

    case DESTINATION_ID:
      if (value == null) {
        unsetDestinationId();
      } else {
        setDestinationId((java.lang.String)value);
      }
      break;

    case API_ID:
      if (value == null) {
        unsetApiId();
      } else {
        setApiId((java.lang.Integer)value);
      }
      break;

    case EXCEPTION_INFO:
      if (value == null) {
        unsetExceptionInfo();
      } else {
        setExceptionInfo((TIntStringValue)value);
      }
      break;

    case ASYNC_ID:
      if (value == null) {
        unsetAsyncId();
      } else {
        setAsyncId((java.lang.Integer)value);
      }
      break;

    case NEXT_ASYNC_ID:
      if (value == null) {
        unsetNextAsyncId();
      } else {
        setNextAsyncId((java.lang.Integer)value);
      }
      break;

    case ASYNC_SEQUENCE:
      if (value == null) {
        unsetAsyncSequence();
      } else {
        setAsyncSequence((java.lang.Short)value);
      }
      break;

    }
  }

  public java.lang.Object getFieldValue(_Fields field) {
    switch (field) {
    case SPAN_ID:
      return getSpanId();

    case SEQUENCE:
      return getSequence();

    case START_ELAPSED:
      return getStartElapsed();

    case END_ELAPSED:
      return getEndElapsed();

    case RPC:
      return getRpc();

    case SERVICE_TYPE:
      return getServiceType();

    case END_POINT:
      return getEndPoint();

    case ANNOTATIONS:
      return getAnnotations();

    case DEPTH:
      return getDepth();

    case NEXT_SPAN_ID:
      return getNextSpanId();

    case DESTINATION_ID:
      return getDestinationId();

    case API_ID:
      return getApiId();

    case EXCEPTION_INFO:
      return getExceptionInfo();

    case ASYNC_ID:
      return getAsyncId();

    case NEXT_ASYNC_ID:
      return getNextAsyncId();

    case ASYNC_SEQUENCE:
      return getAsyncSequence();

    }
    throw new java.lang.IllegalStateException();
  }

  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
  public boolean isSet(_Fields field) {
    if (field == null) {
      throw new java.lang.IllegalArgumentException();
    }

    switch (field) {
    case SPAN_ID:
      return isSetSpanId();
    case SEQUENCE:
      return isSetSequence();
    case START_ELAPSED:
      return isSetStartElapsed();
    case END_ELAPSED:
      return isSetEndElapsed();
    case RPC:
      return isSetRpc();
    case SERVICE_TYPE:
      return isSetServiceType();
    case END_POINT:
      return isSetEndPoint();
    case ANNOTATIONS:
      return isSetAnnotations();
    case DEPTH:
      return isSetDepth();
    case NEXT_SPAN_ID:
      return isSetNextSpanId();
    case DESTINATION_ID:
      return isSetDestinationId();
    case API_ID:
      return isSetApiId();
    case EXCEPTION_INFO:
      return isSetExceptionInfo();
    case ASYNC_ID:
      return isSetAsyncId();
    case NEXT_ASYNC_ID:
      return isSetNextAsyncId();
    case ASYNC_SEQUENCE:
      return isSetAsyncSequence();
    }
    throw new java.lang.IllegalStateException();
  }

  @Override
  public boolean equals(java.lang.Object that) {
    if (that == null)
      return false;
    if (that instanceof TSpanEvent)
      return this.equals((TSpanEvent)that);
    return false;
  }

  public boolean equals(TSpanEvent that) {
    if (that == null)
      return false;
    if (this == that)
      return true;

    boolean this_present_spanId = true && this.isSetSpanId();
    boolean that_present_spanId = true && that.isSetSpanId();
    if (this_present_spanId || that_present_spanId) {
      if (!(this_present_spanId && that_present_spanId))
        return false;
      if (this.spanId != that.spanId)
        return false;
    }

    boolean this_present_sequence = true;
    boolean that_present_sequence = true;
    if (this_present_sequence || that_present_sequence) {
      if (!(this_present_sequence && that_present_sequence))
        return false;
      if (this.sequence != that.sequence)
        return false;
    }

    boolean this_present_startElapsed = true;
    boolean that_present_startElapsed = true;
    if (this_present_startElapsed || that_present_startElapsed) {
      if (!(this_present_startElapsed && that_present_startElapsed))
        return false;
      if (this.startElapsed != that.startElapsed)
        return false;
    }

    boolean this_present_endElapsed = true && this.isSetEndElapsed();
    boolean that_present_endElapsed = true && that.isSetEndElapsed();
    if (this_present_endElapsed || that_present_endElapsed) {
      if (!(this_present_endElapsed && that_present_endElapsed))
        return false;
      if (this.endElapsed != that.endElapsed)
        return false;
    }

    boolean this_present_rpc = true && this.isSetRpc();
    boolean that_present_rpc = true && that.isSetRpc();
    if (this_present_rpc || that_present_rpc) {
      if (!(this_present_rpc && that_present_rpc))
        return false;
      if (!this.rpc.equals(that.rpc))
        return false;
    }

    boolean this_present_serviceType = true;
    boolean that_present_serviceType = true;
    if (this_present_serviceType || that_present_serviceType) {
      if (!(this_present_serviceType && that_present_serviceType))
        return false;
      if (this.serviceType != that.serviceType)
        return false;
    }

    boolean this_present_endPoint = true && this.isSetEndPoint();
    boolean that_present_endPoint = true && that.isSetEndPoint();
    if (this_present_endPoint || that_present_endPoint) {
      if (!(this_present_endPoint && that_present_endPoint))
        return false;
      if (!this.endPoint.equals(that.endPoint))
        return false;
    }

    boolean this_present_annotations = true && this.isSetAnnotations();
    boolean that_present_annotations = true && that.isSetAnnotations();
    if (this_present_annotations || that_present_annotations) {
      if (!(this_present_annotations && that_present_annotations))
        return false;
      if (!this.annotations.equals(that.annotations))
        return false;
    }

    boolean this_present_depth = true && this.isSetDepth();
    boolean that_present_depth = true && that.isSetDepth();
    if (this_present_depth || that_present_depth) {
      if (!(this_present_depth && that_present_depth))
        return false;
      if (this.depth != that.depth)
        return false;
    }

    boolean this_present_nextSpanId = true && this.isSetNextSpanId();
    boolean that_present_nextSpanId = true && that.isSetNextSpanId();
    if (this_present_nextSpanId || that_present_nextSpanId) {
      if (!(this_present_nextSpanId && that_present_nextSpanId))
        return false;
      if (this.nextSpanId != that.nextSpanId)
        return false;
    }

    boolean this_present_destinationId = true && this.isSetDestinationId();
    boolean that_present_destinationId = true && that.isSetDestinationId();
    if (this_present_destinationId || that_present_destinationId) {
      if (!(this_present_destinationId && that_present_destinationId))
        return false;
      if (!this.destinationId.equals(that.destinationId))
        return false;
    }

    boolean this_present_apiId = true && this.isSetApiId();
    boolean that_present_apiId = true && that.isSetApiId();
    if (this_present_apiId || that_present_apiId) {
      if (!(this_present_apiId && that_present_apiId))
        return false;
      if (this.apiId != that.apiId)
        return false;
    }

    boolean this_present_exceptionInfo = true && this.isSetExceptionInfo();
    boolean that_present_exceptionInfo = true && that.isSetExceptionInfo();
    if (this_present_exceptionInfo || that_present_exceptionInfo) {
      if (!(this_present_exceptionInfo && that_present_exceptionInfo))
        return false;
      if (!this.exceptionInfo.equals(that.exceptionInfo))
        return false;
    }

    boolean this_present_asyncId = true && this.isSetAsyncId();
    boolean that_present_asyncId = true && that.isSetAsyncId();
    if (this_present_asyncId || that_present_asyncId) {
      if (!(this_present_asyncId && that_present_asyncId))
        return false;
      if (this.asyncId != that.asyncId)
        return false;
    }

    boolean this_present_nextAsyncId = true && this.isSetNextAsyncId();
    boolean that_present_nextAsyncId = true && that.isSetNextAsyncId();
    if (this_present_nextAsyncId || that_present_nextAsyncId) {
      if (!(this_present_nextAsyncId && that_present_nextAsyncId))
        return false;
      if (this.nextAsyncId != that.nextAsyncId)
        return false;
    }

    boolean this_present_asyncSequence = true && this.isSetAsyncSequence();
    boolean that_present_asyncSequence = true && that.isSetAsyncSequence();
    if (this_present_asyncSequence || that_present_asyncSequence) {
      if (!(this_present_asyncSequence && that_present_asyncSequence))
        return false;
      if (this.asyncSequence != that.asyncSequence)
        return false;
    }

    return true;
  }

  @Override
  public int hashCode() {
    int hashCode = 1;

    hashCode = hashCode * 8191 + ((isSetSpanId()) ? 131071 : 524287);
    if (isSetSpanId())
      hashCode = hashCode * 8191 + org.apache.thrift.TBaseHelper.hashCode(spanId);

    hashCode = hashCode * 8191 + sequence;

    hashCode = hashCode * 8191 + startElapsed;

    hashCode = hashCode * 8191 + ((isSetEndElapsed()) ? 131071 : 524287);
    if (isSetEndElapsed())
      hashCode = hashCode * 8191 + endElapsed;

    hashCode = hashCode * 8191 + ((isSetRpc()) ? 131071 : 524287);
    if (isSetRpc())
      hashCode = hashCode * 8191 + rpc.hashCode();

    hashCode = hashCode * 8191 + serviceType;

    hashCode = hashCode * 8191 + ((isSetEndPoint()) ? 131071 : 524287);
    if (isSetEndPoint())
      hashCode = hashCode * 8191 + endPoint.hashCode();

    hashCode = hashCode * 8191 + ((isSetAnnotations()) ? 131071 : 524287);
    if (isSetAnnotations())
      hashCode = hashCode * 8191 + annotations.hashCode();

    hashCode = hashCode * 8191 + ((isSetDepth()) ? 131071 : 524287);
    if (isSetDepth())
      hashCode = hashCode * 8191 + depth;

    hashCode = hashCode * 8191 + ((isSetNextSpanId()) ? 131071 : 524287);
    if (isSetNextSpanId())
      hashCode = hashCode * 8191 + org.apache.thrift.TBaseHelper.hashCode(nextSpanId);

    hashCode = hashCode * 8191 + ((isSetDestinationId()) ? 131071 : 524287);
    if (isSetDestinationId())
      hashCode = hashCode * 8191 + destinationId.hashCode();

    hashCode = hashCode * 8191 + ((isSetApiId()) ? 131071 : 524287);
    if (isSetApiId())
      hashCode = hashCode * 8191 + apiId;

    hashCode = hashCode * 8191 + ((isSetExceptionInfo()) ? 131071 : 524287);
    if (isSetExceptionInfo())
      hashCode = hashCode * 8191 + exceptionInfo.hashCode();

    hashCode = hashCode * 8191 + ((isSetAsyncId()) ? 131071 : 524287);
    if (isSetAsyncId())
      hashCode = hashCode * 8191 + asyncId;

    hashCode = hashCode * 8191 + ((isSetNextAsyncId()) ? 131071 : 524287);
    if (isSetNextAsyncId())
      hashCode = hashCode * 8191 + nextAsyncId;

    hashCode = hashCode * 8191 + ((isSetAsyncSequence()) ? 131071 : 524287);
    if (isSetAsyncSequence())
      hashCode = hashCode * 8191 + asyncSequence;

    return hashCode;
  }

  @Override
  public int compareTo(TSpanEvent other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;

    lastComparison = java.lang.Boolean.valueOf(isSetSpanId()).compareTo(other.isSetSpanId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetSpanId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.spanId, other.spanId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetSequence()).compareTo(other.isSetSequence());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetSequence()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.sequence, other.sequence);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetStartElapsed()).compareTo(other.isSetStartElapsed());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetStartElapsed()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.startElapsed, other.startElapsed);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetEndElapsed()).compareTo(other.isSetEndElapsed());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetEndElapsed()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.endElapsed, other.endElapsed);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetRpc()).compareTo(other.isSetRpc());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetRpc()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.rpc, other.rpc);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetServiceType()).compareTo(other.isSetServiceType());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetServiceType()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.serviceType, other.serviceType);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetEndPoint()).compareTo(other.isSetEndPoint());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetEndPoint()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.endPoint, other.endPoint);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetAnnotations()).compareTo(other.isSetAnnotations());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetAnnotations()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.annotations, other.annotations);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetDepth()).compareTo(other.isSetDepth());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetDepth()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.depth, other.depth);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetNextSpanId()).compareTo(other.isSetNextSpanId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetNextSpanId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.nextSpanId, other.nextSpanId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetDestinationId()).compareTo(other.isSetDestinationId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetDestinationId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.destinationId, other.destinationId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetApiId()).compareTo(other.isSetApiId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetApiId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.apiId, other.apiId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetExceptionInfo()).compareTo(other.isSetExceptionInfo());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetExceptionInfo()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.exceptionInfo, other.exceptionInfo);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetAsyncId()).compareTo(other.isSetAsyncId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetAsyncId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.asyncId, other.asyncId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetNextAsyncId()).compareTo(other.isSetNextAsyncId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetNextAsyncId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.nextAsyncId, other.nextAsyncId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetAsyncSequence()).compareTo(other.isSetAsyncSequence());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetAsyncSequence()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.asyncSequence, other.asyncSequence);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }

  public _Fields fieldForId(int fieldId) {
    return _Fields.findByThriftId(fieldId);
  }

  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
    scheme(iprot).read(iprot, this);
  }

  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
    scheme(oprot).write(oprot, this);
  }

  @Override
  public java.lang.String toString() {
    java.lang.StringBuilder sb = new java.lang.StringBuilder("TSpanEvent(");
    boolean first = true;

    if (isSetSpanId()) {
      sb.append("spanId:");
      sb.append(this.spanId);
      first = false;
    }
    if (!first) sb.append(", ");
    sb.append("sequence:");
    sb.append(this.sequence);
    first = false;
    if (!first) sb.append(", ");
    sb.append("startElapsed:");
    sb.append(this.startElapsed);
    first = false;
    if (isSetEndElapsed()) {
      if (!first) sb.append(", ");
      sb.append("endElapsed:");
      sb.append(this.endElapsed);
      first = false;
    }
    if (isSetRpc()) {
      if (!first) sb.append(", ");
      sb.append("rpc:");
      if (this.rpc == null) {
        sb.append("null");
      } else {
        sb.append(this.rpc);
      }
      first = false;
    }
    if (!first) sb.append(", ");
    sb.append("serviceType:");
    sb.append(this.serviceType);
    first = false;
    if (isSetEndPoint()) {
      if (!first) sb.append(", ");
      sb.append("endPoint:");
      if (this.endPoint == null) {
        sb.append("null");
      } else {
        sb.append(this.endPoint);
      }
      first = false;
    }
    if (isSetAnnotations()) {
      if (!first) sb.append(", ");
      sb.append("annotations:");
      if (this.annotations == null) {
        sb.append("null");
      } else {
        sb.append(this.annotations);
      }
      first = false;
    }
    if (isSetDepth()) {
      if (!first) sb.append(", ");
      sb.append("depth:");
      sb.append(this.depth);
      first = false;
    }
    if (isSetNextSpanId()) {
      if (!first) sb.append(", ");
      sb.append("nextSpanId:");
      sb.append(this.nextSpanId);
      first = false;
    }
    if (isSetDestinationId()) {
      if (!first) sb.append(", ");
      sb.append("destinationId:");
      if (this.destinationId == null) {
        sb.append("null");
      } else {
        sb.append(this.destinationId);
      }
      first = false;
    }
    if (isSetApiId()) {
      if (!first) sb.append(", ");
      sb.append("apiId:");
      sb.append(this.apiId);
      first = false;
    }
    if (isSetExceptionInfo()) {
      if (!first) sb.append(", ");
      sb.append("exceptionInfo:");
      if (this.exceptionInfo == null) {
        sb.append("null");
      } else {
        sb.append(this.exceptionInfo);
      }
      first = false;
    }
    if (isSetAsyncId()) {
      if (!first) sb.append(", ");
      sb.append("asyncId:");
      sb.append(this.asyncId);
      first = false;
    }
    if (isSetNextAsyncId()) {
      if (!first) sb.append(", ");
      sb.append("nextAsyncId:");
      sb.append(this.nextAsyncId);
      first = false;
    }
    if (isSetAsyncSequence()) {
      if (!first) sb.append(", ");
      sb.append("asyncSequence:");
      sb.append(this.asyncSequence);
      first = false;
    }
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    // check for sub-struct validity
    if (exceptionInfo != null) {
      exceptionInfo.validate();
    }
  }

  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
    try {
      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }

  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException {
    try {
      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
      __isset_bitfield = 0;
      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }

  private static class TSpanEventStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    public TSpanEventStandardScheme getScheme() {
      return new TSpanEventStandardScheme();
    }
  }

  private static class TSpanEventStandardScheme extends org.apache.thrift.scheme.StandardScheme<TSpanEvent> {

    public void read(org.apache.thrift.protocol.TProtocol iprot, TSpanEvent struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TField schemeField;
      iprot.readStructBegin();
      while (true)
      {
        schemeField = iprot.readFieldBegin();
        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
          break;
        }
        switch (schemeField.id) {
          case 7: // SPAN_ID
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.spanId = iprot.readI64();
              struct.setSpanIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 8: // SEQUENCE
            if (schemeField.type == org.apache.thrift.protocol.TType.I16) {
              struct.sequence = iprot.readI16();
              struct.setSequenceIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 9: // START_ELAPSED
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.startElapsed = iprot.readI32();
              struct.setStartElapsedIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 10: // END_ELAPSED
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.endElapsed = iprot.readI32();
              struct.setEndElapsedIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 11: // RPC
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.rpc = iprot.readString();
              struct.setRpcIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 12: // SERVICE_TYPE
            if (schemeField.type == org.apache.thrift.protocol.TType.I16) {
              struct.serviceType = iprot.readI16();
              struct.setServiceTypeIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 13: // END_POINT
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.endPoint = iprot.readString();
              struct.setEndPointIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 14: // ANNOTATIONS
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list0 = iprot.readListBegin();
                struct.annotations = new java.util.ArrayList<TAnnotation>(_list0.size);
                TAnnotation _elem1;
                for (int _i2 = 0; _i2 < _list0.size; ++_i2)
                {
                  _elem1 = new TAnnotation();
                  _elem1.read(iprot);
                  struct.annotations.add(_elem1);
                }
                iprot.readListEnd();
              }
              struct.setAnnotationsIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 15: // DEPTH
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.depth = iprot.readI32();
              struct.setDepthIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 16: // NEXT_SPAN_ID
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.nextSpanId = iprot.readI64();
              struct.setNextSpanIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 20: // DESTINATION_ID
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.destinationId = iprot.readString();
              struct.setDestinationIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 25: // API_ID
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.apiId = iprot.readI32();
              struct.setApiIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 26: // EXCEPTION_INFO
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.exceptionInfo = new TIntStringValue();
              struct.exceptionInfo.read(iprot);
              struct.setExceptionInfoIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 30: // ASYNC_ID
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.asyncId = iprot.readI32();
              struct.setAsyncIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 31: // NEXT_ASYNC_ID
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.nextAsyncId = iprot.readI32();
              struct.setNextAsyncIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 32: // ASYNC_SEQUENCE
            if (schemeField.type == org.apache.thrift.protocol.TType.I16) {
              struct.asyncSequence = iprot.readI16();
              struct.setAsyncSequenceIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          default:
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
        }
        iprot.readFieldEnd();
      }
      iprot.readStructEnd();
      struct.validate();
    }

    public void write(org.apache.thrift.protocol.TProtocol oprot, TSpanEvent struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.isSetSpanId()) {
        oprot.writeFieldBegin(SPAN_ID_FIELD_DESC);
        oprot.writeI64(struct.spanId);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldBegin(SEQUENCE_FIELD_DESC);
      oprot.writeI16(struct.sequence);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(START_ELAPSED_FIELD_DESC);
      oprot.writeI32(struct.startElapsed);
      oprot.writeFieldEnd();
      if (struct.isSetEndElapsed()) {
        oprot.writeFieldBegin(END_ELAPSED_FIELD_DESC);
        oprot.writeI32(struct.endElapsed);
        oprot.writeFieldEnd();
      }
      if (struct.rpc != null) {
        if (struct.isSetRpc()) {
          oprot.writeFieldBegin(RPC_FIELD_DESC);
          oprot.writeString(struct.rpc);
          oprot.writeFieldEnd();
        }
      }
      oprot.writeFieldBegin(SERVICE_TYPE_FIELD_DESC);
      oprot.writeI16(struct.serviceType);
      oprot.writeFieldEnd();
      if (struct.endPoint != null) {
        if (struct.isSetEndPoint()) {
          oprot.writeFieldBegin(END_POINT_FIELD_DESC);
          oprot.writeString(struct.endPoint);
          oprot.writeFieldEnd();
        }
      }
      if (struct.annotations != null) {
        if (struct.isSetAnnotations()) {
          oprot.writeFieldBegin(ANNOTATIONS_FIELD_DESC);
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.annotations.size()));
            for (TAnnotation _iter3 : struct.annotations)
            {
              _iter3.write(oprot);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      if (struct.isSetDepth()) {
        oprot.writeFieldBegin(DEPTH_FIELD_DESC);
        oprot.writeI32(struct.depth);
        oprot.writeFieldEnd();
      }
      if (struct.isSetNextSpanId()) {
        oprot.writeFieldBegin(NEXT_SPAN_ID_FIELD_DESC);
        oprot.writeI64(struct.nextSpanId);
        oprot.writeFieldEnd();
      }
      if (struct.destinationId != null) {
        if (struct.isSetDestinationId()) {
          oprot.writeFieldBegin(DESTINATION_ID_FIELD_DESC);
          oprot.writeString(struct.destinationId);
          oprot.writeFieldEnd();
        }
      }
      if (struct.isSetApiId()) {
        oprot.writeFieldBegin(API_ID_FIELD_DESC);
        oprot.writeI32(struct.apiId);
        oprot.writeFieldEnd();
      }
      if (struct.exceptionInfo != null) {
        if (struct.isSetExceptionInfo()) {
          oprot.writeFieldBegin(EXCEPTION_INFO_FIELD_DESC);
          struct.exceptionInfo.write(oprot);
          oprot.writeFieldEnd();
        }
      }
      if (struct.isSetAsyncId()) {
        oprot.writeFieldBegin(ASYNC_ID_FIELD_DESC);
        oprot.writeI32(struct.asyncId);
        oprot.writeFieldEnd();
      }
      if (struct.isSetNextAsyncId()) {
        oprot.writeFieldBegin(NEXT_ASYNC_ID_FIELD_DESC);
        oprot.writeI32(struct.nextAsyncId);
        oprot.writeFieldEnd();
      }
      if (struct.isSetAsyncSequence()) {
        oprot.writeFieldBegin(ASYNC_SEQUENCE_FIELD_DESC);
        oprot.writeI16(struct.asyncSequence);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class TSpanEventTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    public TSpanEventTupleScheme getScheme() {
      return new TSpanEventTupleScheme();
    }
  }

  private static class TSpanEventTupleScheme extends org.apache.thrift.scheme.TupleScheme<TSpanEvent> {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, TSpanEvent struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      java.util.BitSet optionals = new java.util.BitSet();
      if (struct.isSetSpanId()) {
        optionals.set(0);
      }
      if (struct.isSetSequence()) {
        optionals.set(1);
      }
      if (struct.isSetStartElapsed()) {
        optionals.set(2);
      }
      if (struct.isSetEndElapsed()) {
        optionals.set(3);
      }
      if (struct.isSetRpc()) {
        optionals.set(4);
      }
      if (struct.isSetServiceType()) {
        optionals.set(5);
      }
      if (struct.isSetEndPoint()) {
        optionals.set(6);
      }
      if (struct.isSetAnnotations()) {
        optionals.set(7);
      }
      if (struct.isSetDepth()) {
        optionals.set(8);
      }
      if (struct.isSetNextSpanId()) {
        optionals.set(9);
      }
      if (struct.isSetDestinationId()) {
        optionals.set(10);
      }
      if (struct.isSetApiId()) {
        optionals.set(11);
      }
      if (struct.isSetExceptionInfo()) {
        optionals.set(12);
      }
      if (struct.isSetAsyncId()) {
        optionals.set(13);
      }
      if (struct.isSetNextAsyncId()) {
        optionals.set(14);
      }
      if (struct.isSetAsyncSequence()) {
        optionals.set(15);
      }
      oprot.writeBitSet(optionals, 16);
      if (struct.isSetSpanId()) {
        oprot.writeI64(struct.spanId);
      }
      if (struct.isSetSequence()) {
        oprot.writeI16(struct.sequence);
      }
      if (struct.isSetStartElapsed()) {
        oprot.writeI32(struct.startElapsed);
      }
      if (struct.isSetEndElapsed()) {
        oprot.writeI32(struct.endElapsed);
      }
      if (struct.isSetRpc()) {
        oprot.writeString(struct.rpc);
      }
      if (struct.isSetServiceType()) {
        oprot.writeI16(struct.serviceType);
      }
      if (struct.isSetEndPoint()) {
        oprot.writeString(struct.endPoint);
      }
      if (struct.isSetAnnotations()) {
        {
          oprot.writeI32(struct.annotations.size());
          for (TAnnotation _iter4 : struct.annotations)
          {
            _iter4.write(oprot);
          }
        }
      }
      if (struct.isSetDepth()) {
        oprot.writeI32(struct.depth);
      }
      if (struct.isSetNextSpanId()) {
        oprot.writeI64(struct.nextSpanId);
      }
      if (struct.isSetDestinationId()) {
        oprot.writeString(struct.destinationId);
      }
      if (struct.isSetApiId()) {
        oprot.writeI32(struct.apiId);
      }
      if (struct.isSetExceptionInfo()) {
        struct.exceptionInfo.write(oprot);
      }
      if (struct.isSetAsyncId()) {
        oprot.writeI32(struct.asyncId);
      }
      if (struct.isSetNextAsyncId()) {
        oprot.writeI32(struct.nextAsyncId);
      }
      if (struct.isSetAsyncSequence()) {
        oprot.writeI16(struct.asyncSequence);
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, TSpanEvent struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      java.util.BitSet incoming = iprot.readBitSet(16);
      if (incoming.get(0)) {
        struct.spanId = iprot.readI64();
        struct.setSpanIdIsSet(true);
      }
      if (incoming.get(1)) {
        struct.sequence = iprot.readI16();
        struct.setSequenceIsSet(true);
      }
      if (incoming.get(2)) {
        struct.startElapsed = iprot.readI32();
        struct.setStartElapsedIsSet(true);
      }
      if (incoming.get(3)) {
        struct.endElapsed = iprot.readI32();
        struct.setEndElapsedIsSet(true);
      }
      if (incoming.get(4)) {
        struct.rpc = iprot.readString();
        struct.setRpcIsSet(true);
      }
      if (incoming.get(5)) {
        struct.serviceType = iprot.readI16();
        struct.setServiceTypeIsSet(true);
      }
      if (incoming.get(6)) {
        struct.endPoint = iprot.readString();
        struct.setEndPointIsSet(true);
      }
      if (incoming.get(7)) {
        {
          org.apache.thrift.protocol.TList _list5 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
          struct.annotations = new java.util.ArrayList<TAnnotation>(_list5.size);
          TAnnotation _elem6;
          for (int _i7 = 0; _i7 < _list5.size; ++_i7)
          {
            _elem6 = new TAnnotation();
            _elem6.read(iprot);
            struct.annotations.add(_elem6);
          }
        }
        struct.setAnnotationsIsSet(true);
      }
      if (incoming.get(8)) {
        struct.depth = iprot.readI32();
        struct.setDepthIsSet(true);
      }
      if (incoming.get(9)) {
        struct.nextSpanId = iprot.readI64();
        struct.setNextSpanIdIsSet(true);
      }
      if (incoming.get(10)) {
        struct.destinationId = iprot.readString();
        struct.setDestinationIdIsSet(true);
      }
      if (incoming.get(11)) {
        struct.apiId = iprot.readI32();
        struct.setApiIdIsSet(true);
      }
      if (incoming.get(12)) {
        struct.exceptionInfo = new TIntStringValue();
        struct.exceptionInfo.read(iprot);
        struct.setExceptionInfoIsSet(true);
      }
      if (incoming.get(13)) {
        struct.asyncId = iprot.readI32();
        struct.setAsyncIdIsSet(true);
      }
      if (incoming.get(14)) {
        struct.nextAsyncId = iprot.readI32();
        struct.setNextAsyncIdIsSet(true);
      }
      if (incoming.get(15)) {
        struct.asyncSequence = iprot.readI16();
        struct.setAsyncSequenceIsSet(true);
      }
    }
  }

  private static <S extends org.apache.thrift.scheme.IScheme> S scheme(org.apache.thrift.protocol.TProtocol proto) {
    return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
  }
}

