/**
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you 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.12.0)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package org.apache.storm.generated;

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

  private static final org.apache.thrift.protocol.TField WINDOW_TO_EMITTED_FIELD_DESC = new org.apache.thrift.protocol.TField("window_to_emitted", org.apache.thrift.protocol.TType.MAP, (short)1);
  private static final org.apache.thrift.protocol.TField WINDOW_TO_TRANSFERRED_FIELD_DESC = new org.apache.thrift.protocol.TField("window_to_transferred", org.apache.thrift.protocol.TType.MAP, (short)2);
  private static final org.apache.thrift.protocol.TField WINDOW_TO_COMPLETE_LATENCIES_MS_FIELD_DESC = new org.apache.thrift.protocol.TField("window_to_complete_latencies_ms", org.apache.thrift.protocol.TType.MAP, (short)3);
  private static final org.apache.thrift.protocol.TField WINDOW_TO_ACKED_FIELD_DESC = new org.apache.thrift.protocol.TField("window_to_acked", org.apache.thrift.protocol.TType.MAP, (short)4);
  private static final org.apache.thrift.protocol.TField WINDOW_TO_FAILED_FIELD_DESC = new org.apache.thrift.protocol.TField("window_to_failed", org.apache.thrift.protocol.TType.MAP, (short)5);

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

  private @org.apache.thrift.annotation.Nullable java.util.Map<java.lang.String,java.lang.Long> window_to_emitted; // optional
  private @org.apache.thrift.annotation.Nullable java.util.Map<java.lang.String,java.lang.Long> window_to_transferred; // optional
  private @org.apache.thrift.annotation.Nullable java.util.Map<java.lang.String,java.lang.Double> window_to_complete_latencies_ms; // optional
  private @org.apache.thrift.annotation.Nullable java.util.Map<java.lang.String,java.lang.Long> window_to_acked; // optional
  private @org.apache.thrift.annotation.Nullable java.util.Map<java.lang.String,java.lang.Long> window_to_failed; // 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 {
    WINDOW_TO_EMITTED((short)1, "window_to_emitted"),
    WINDOW_TO_TRANSFERRED((short)2, "window_to_transferred"),
    WINDOW_TO_COMPLETE_LATENCIES_MS((short)3, "window_to_complete_latencies_ms"),
    WINDOW_TO_ACKED((short)4, "window_to_acked"),
    WINDOW_TO_FAILED((short)5, "window_to_failed");

    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.
     */
    @org.apache.thrift.annotation.Nullable
    public static _Fields findByThriftId(int fieldId) {
      switch(fieldId) {
        case 1: // WINDOW_TO_EMITTED
          return WINDOW_TO_EMITTED;
        case 2: // WINDOW_TO_TRANSFERRED
          return WINDOW_TO_TRANSFERRED;
        case 3: // WINDOW_TO_COMPLETE_LATENCIES_MS
          return WINDOW_TO_COMPLETE_LATENCIES_MS;
        case 4: // WINDOW_TO_ACKED
          return WINDOW_TO_ACKED;
        case 5: // WINDOW_TO_FAILED
          return WINDOW_TO_FAILED;
        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.
     */
    @org.apache.thrift.annotation.Nullable
    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 _Fields optionals[] = {_Fields.WINDOW_TO_EMITTED,_Fields.WINDOW_TO_TRANSFERRED,_Fields.WINDOW_TO_COMPLETE_LATENCIES_MS,_Fields.WINDOW_TO_ACKED,_Fields.WINDOW_TO_FAILED};
  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.WINDOW_TO_EMITTED, new org.apache.thrift.meta_data.FieldMetaData("window_to_emitted", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING), 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))));
    tmpMap.put(_Fields.WINDOW_TO_TRANSFERRED, new org.apache.thrift.meta_data.FieldMetaData("window_to_transferred", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING), 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))));
    tmpMap.put(_Fields.WINDOW_TO_COMPLETE_LATENCIES_MS, new org.apache.thrift.meta_data.FieldMetaData("window_to_complete_latencies_ms", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING), 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE))));
    tmpMap.put(_Fields.WINDOW_TO_ACKED, new org.apache.thrift.meta_data.FieldMetaData("window_to_acked", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING), 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))));
    tmpMap.put(_Fields.WINDOW_TO_FAILED, new org.apache.thrift.meta_data.FieldMetaData("window_to_failed", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING), 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))));
    metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TopologyStats.class, metaDataMap);
  }

  public TopologyStats() {
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public TopologyStats(TopologyStats other) {
    if (other.is_set_window_to_emitted()) {
      java.util.Map<java.lang.String,java.lang.Long> __this__window_to_emitted = new java.util.HashMap<java.lang.String,java.lang.Long>(other.window_to_emitted);
      this.window_to_emitted = __this__window_to_emitted;
    }
    if (other.is_set_window_to_transferred()) {
      java.util.Map<java.lang.String,java.lang.Long> __this__window_to_transferred = new java.util.HashMap<java.lang.String,java.lang.Long>(other.window_to_transferred);
      this.window_to_transferred = __this__window_to_transferred;
    }
    if (other.is_set_window_to_complete_latencies_ms()) {
      java.util.Map<java.lang.String,java.lang.Double> __this__window_to_complete_latencies_ms = new java.util.HashMap<java.lang.String,java.lang.Double>(other.window_to_complete_latencies_ms);
      this.window_to_complete_latencies_ms = __this__window_to_complete_latencies_ms;
    }
    if (other.is_set_window_to_acked()) {
      java.util.Map<java.lang.String,java.lang.Long> __this__window_to_acked = new java.util.HashMap<java.lang.String,java.lang.Long>(other.window_to_acked);
      this.window_to_acked = __this__window_to_acked;
    }
    if (other.is_set_window_to_failed()) {
      java.util.Map<java.lang.String,java.lang.Long> __this__window_to_failed = new java.util.HashMap<java.lang.String,java.lang.Long>(other.window_to_failed);
      this.window_to_failed = __this__window_to_failed;
    }
  }

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

  @Override
  public void clear() {
    this.window_to_emitted = null;
    this.window_to_transferred = null;
    this.window_to_complete_latencies_ms = null;
    this.window_to_acked = null;
    this.window_to_failed = null;
  }

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

  public void put_to_window_to_emitted(java.lang.String key, long val) {
    if (this.window_to_emitted == null) {
      this.window_to_emitted = new java.util.HashMap<java.lang.String,java.lang.Long>();
    }
    this.window_to_emitted.put(key, val);
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.Map<java.lang.String,java.lang.Long> get_window_to_emitted() {
    return this.window_to_emitted;
  }

  public void set_window_to_emitted(@org.apache.thrift.annotation.Nullable java.util.Map<java.lang.String,java.lang.Long> window_to_emitted) {
    this.window_to_emitted = window_to_emitted;
  }

  public void unset_window_to_emitted() {
    this.window_to_emitted = null;
  }

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

  public void set_window_to_emitted_isSet(boolean value) {
    if (!value) {
      this.window_to_emitted = null;
    }
  }

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

  public void put_to_window_to_transferred(java.lang.String key, long val) {
    if (this.window_to_transferred == null) {
      this.window_to_transferred = new java.util.HashMap<java.lang.String,java.lang.Long>();
    }
    this.window_to_transferred.put(key, val);
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.Map<java.lang.String,java.lang.Long> get_window_to_transferred() {
    return this.window_to_transferred;
  }

  public void set_window_to_transferred(@org.apache.thrift.annotation.Nullable java.util.Map<java.lang.String,java.lang.Long> window_to_transferred) {
    this.window_to_transferred = window_to_transferred;
  }

  public void unset_window_to_transferred() {
    this.window_to_transferred = null;
  }

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

  public void set_window_to_transferred_isSet(boolean value) {
    if (!value) {
      this.window_to_transferred = null;
    }
  }

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

  public void put_to_window_to_complete_latencies_ms(java.lang.String key, double val) {
    if (this.window_to_complete_latencies_ms == null) {
      this.window_to_complete_latencies_ms = new java.util.HashMap<java.lang.String,java.lang.Double>();
    }
    this.window_to_complete_latencies_ms.put(key, val);
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.Map<java.lang.String,java.lang.Double> get_window_to_complete_latencies_ms() {
    return this.window_to_complete_latencies_ms;
  }

  public void set_window_to_complete_latencies_ms(@org.apache.thrift.annotation.Nullable java.util.Map<java.lang.String,java.lang.Double> window_to_complete_latencies_ms) {
    this.window_to_complete_latencies_ms = window_to_complete_latencies_ms;
  }

  public void unset_window_to_complete_latencies_ms() {
    this.window_to_complete_latencies_ms = null;
  }

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

  public void set_window_to_complete_latencies_ms_isSet(boolean value) {
    if (!value) {
      this.window_to_complete_latencies_ms = null;
    }
  }

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

  public void put_to_window_to_acked(java.lang.String key, long val) {
    if (this.window_to_acked == null) {
      this.window_to_acked = new java.util.HashMap<java.lang.String,java.lang.Long>();
    }
    this.window_to_acked.put(key, val);
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.Map<java.lang.String,java.lang.Long> get_window_to_acked() {
    return this.window_to_acked;
  }

  public void set_window_to_acked(@org.apache.thrift.annotation.Nullable java.util.Map<java.lang.String,java.lang.Long> window_to_acked) {
    this.window_to_acked = window_to_acked;
  }

  public void unset_window_to_acked() {
    this.window_to_acked = null;
  }

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

  public void set_window_to_acked_isSet(boolean value) {
    if (!value) {
      this.window_to_acked = null;
    }
  }

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

  public void put_to_window_to_failed(java.lang.String key, long val) {
    if (this.window_to_failed == null) {
      this.window_to_failed = new java.util.HashMap<java.lang.String,java.lang.Long>();
    }
    this.window_to_failed.put(key, val);
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.Map<java.lang.String,java.lang.Long> get_window_to_failed() {
    return this.window_to_failed;
  }

  public void set_window_to_failed(@org.apache.thrift.annotation.Nullable java.util.Map<java.lang.String,java.lang.Long> window_to_failed) {
    this.window_to_failed = window_to_failed;
  }

  public void unset_window_to_failed() {
    this.window_to_failed = null;
  }

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

  public void set_window_to_failed_isSet(boolean value) {
    if (!value) {
      this.window_to_failed = null;
    }
  }

  public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
    switch (field) {
    case WINDOW_TO_EMITTED:
      if (value == null) {
        unset_window_to_emitted();
      } else {
        set_window_to_emitted((java.util.Map<java.lang.String,java.lang.Long>)value);
      }
      break;

    case WINDOW_TO_TRANSFERRED:
      if (value == null) {
        unset_window_to_transferred();
      } else {
        set_window_to_transferred((java.util.Map<java.lang.String,java.lang.Long>)value);
      }
      break;

    case WINDOW_TO_COMPLETE_LATENCIES_MS:
      if (value == null) {
        unset_window_to_complete_latencies_ms();
      } else {
        set_window_to_complete_latencies_ms((java.util.Map<java.lang.String,java.lang.Double>)value);
      }
      break;

    case WINDOW_TO_ACKED:
      if (value == null) {
        unset_window_to_acked();
      } else {
        set_window_to_acked((java.util.Map<java.lang.String,java.lang.Long>)value);
      }
      break;

    case WINDOW_TO_FAILED:
      if (value == null) {
        unset_window_to_failed();
      } else {
        set_window_to_failed((java.util.Map<java.lang.String,java.lang.Long>)value);
      }
      break;

    }
  }

  @org.apache.thrift.annotation.Nullable
  public java.lang.Object getFieldValue(_Fields field) {
    switch (field) {
    case WINDOW_TO_EMITTED:
      return get_window_to_emitted();

    case WINDOW_TO_TRANSFERRED:
      return get_window_to_transferred();

    case WINDOW_TO_COMPLETE_LATENCIES_MS:
      return get_window_to_complete_latencies_ms();

    case WINDOW_TO_ACKED:
      return get_window_to_acked();

    case WINDOW_TO_FAILED:
      return get_window_to_failed();

    }
    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 WINDOW_TO_EMITTED:
      return is_set_window_to_emitted();
    case WINDOW_TO_TRANSFERRED:
      return is_set_window_to_transferred();
    case WINDOW_TO_COMPLETE_LATENCIES_MS:
      return is_set_window_to_complete_latencies_ms();
    case WINDOW_TO_ACKED:
      return is_set_window_to_acked();
    case WINDOW_TO_FAILED:
      return is_set_window_to_failed();
    }
    throw new java.lang.IllegalStateException();
  }

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

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

    boolean this_present_window_to_emitted = true && this.is_set_window_to_emitted();
    boolean that_present_window_to_emitted = true && that.is_set_window_to_emitted();
    if (this_present_window_to_emitted || that_present_window_to_emitted) {
      if (!(this_present_window_to_emitted && that_present_window_to_emitted))
        return false;
      if (!this.window_to_emitted.equals(that.window_to_emitted))
        return false;
    }

    boolean this_present_window_to_transferred = true && this.is_set_window_to_transferred();
    boolean that_present_window_to_transferred = true && that.is_set_window_to_transferred();
    if (this_present_window_to_transferred || that_present_window_to_transferred) {
      if (!(this_present_window_to_transferred && that_present_window_to_transferred))
        return false;
      if (!this.window_to_transferred.equals(that.window_to_transferred))
        return false;
    }

    boolean this_present_window_to_complete_latencies_ms = true && this.is_set_window_to_complete_latencies_ms();
    boolean that_present_window_to_complete_latencies_ms = true && that.is_set_window_to_complete_latencies_ms();
    if (this_present_window_to_complete_latencies_ms || that_present_window_to_complete_latencies_ms) {
      if (!(this_present_window_to_complete_latencies_ms && that_present_window_to_complete_latencies_ms))
        return false;
      if (!this.window_to_complete_latencies_ms.equals(that.window_to_complete_latencies_ms))
        return false;
    }

    boolean this_present_window_to_acked = true && this.is_set_window_to_acked();
    boolean that_present_window_to_acked = true && that.is_set_window_to_acked();
    if (this_present_window_to_acked || that_present_window_to_acked) {
      if (!(this_present_window_to_acked && that_present_window_to_acked))
        return false;
      if (!this.window_to_acked.equals(that.window_to_acked))
        return false;
    }

    boolean this_present_window_to_failed = true && this.is_set_window_to_failed();
    boolean that_present_window_to_failed = true && that.is_set_window_to_failed();
    if (this_present_window_to_failed || that_present_window_to_failed) {
      if (!(this_present_window_to_failed && that_present_window_to_failed))
        return false;
      if (!this.window_to_failed.equals(that.window_to_failed))
        return false;
    }

    return true;
  }

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

    hashCode = hashCode * 8191 + ((is_set_window_to_emitted()) ? 131071 : 524287);
    if (is_set_window_to_emitted())
      hashCode = hashCode * 8191 + window_to_emitted.hashCode();

    hashCode = hashCode * 8191 + ((is_set_window_to_transferred()) ? 131071 : 524287);
    if (is_set_window_to_transferred())
      hashCode = hashCode * 8191 + window_to_transferred.hashCode();

    hashCode = hashCode * 8191 + ((is_set_window_to_complete_latencies_ms()) ? 131071 : 524287);
    if (is_set_window_to_complete_latencies_ms())
      hashCode = hashCode * 8191 + window_to_complete_latencies_ms.hashCode();

    hashCode = hashCode * 8191 + ((is_set_window_to_acked()) ? 131071 : 524287);
    if (is_set_window_to_acked())
      hashCode = hashCode * 8191 + window_to_acked.hashCode();

    hashCode = hashCode * 8191 + ((is_set_window_to_failed()) ? 131071 : 524287);
    if (is_set_window_to_failed())
      hashCode = hashCode * 8191 + window_to_failed.hashCode();

    return hashCode;
  }

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

    int lastComparison = 0;

    lastComparison = java.lang.Boolean.valueOf(is_set_window_to_emitted()).compareTo(other.is_set_window_to_emitted());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (is_set_window_to_emitted()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.window_to_emitted, other.window_to_emitted);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(is_set_window_to_transferred()).compareTo(other.is_set_window_to_transferred());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (is_set_window_to_transferred()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.window_to_transferred, other.window_to_transferred);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(is_set_window_to_complete_latencies_ms()).compareTo(other.is_set_window_to_complete_latencies_ms());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (is_set_window_to_complete_latencies_ms()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.window_to_complete_latencies_ms, other.window_to_complete_latencies_ms);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(is_set_window_to_acked()).compareTo(other.is_set_window_to_acked());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (is_set_window_to_acked()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.window_to_acked, other.window_to_acked);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(is_set_window_to_failed()).compareTo(other.is_set_window_to_failed());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (is_set_window_to_failed()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.window_to_failed, other.window_to_failed);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }

  @org.apache.thrift.annotation.Nullable
  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("TopologyStats(");
    boolean first = true;

    if (is_set_window_to_emitted()) {
      sb.append("window_to_emitted:");
      if (this.window_to_emitted == null) {
        sb.append("null");
      } else {
        sb.append(this.window_to_emitted);
      }
      first = false;
    }
    if (is_set_window_to_transferred()) {
      if (!first) sb.append(", ");
      sb.append("window_to_transferred:");
      if (this.window_to_transferred == null) {
        sb.append("null");
      } else {
        sb.append(this.window_to_transferred);
      }
      first = false;
    }
    if (is_set_window_to_complete_latencies_ms()) {
      if (!first) sb.append(", ");
      sb.append("window_to_complete_latencies_ms:");
      if (this.window_to_complete_latencies_ms == null) {
        sb.append("null");
      } else {
        sb.append(this.window_to_complete_latencies_ms);
      }
      first = false;
    }
    if (is_set_window_to_acked()) {
      if (!first) sb.append(", ");
      sb.append("window_to_acked:");
      if (this.window_to_acked == null) {
        sb.append("null");
      } else {
        sb.append(this.window_to_acked);
      }
      first = false;
    }
    if (is_set_window_to_failed()) {
      if (!first) sb.append(", ");
      sb.append("window_to_failed:");
      if (this.window_to_failed == null) {
        sb.append("null");
      } else {
        sb.append(this.window_to_failed);
      }
      first = false;
    }
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    // check for sub-struct validity
  }

  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 {
      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 TopologyStatsStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    public TopologyStatsStandardScheme getScheme() {
      return new TopologyStatsStandardScheme();
    }
  }

  private static class TopologyStatsStandardScheme extends org.apache.thrift.scheme.StandardScheme<TopologyStats> {

    public void read(org.apache.thrift.protocol.TProtocol iprot, TopologyStats 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 1: // WINDOW_TO_EMITTED
            if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
              {
                org.apache.thrift.protocol.TMap _map378 = iprot.readMapBegin();
                struct.window_to_emitted = new java.util.HashMap<java.lang.String,java.lang.Long>(2*_map378.size);
                @org.apache.thrift.annotation.Nullable java.lang.String _key379;
                long _val380;
                for (int _i381 = 0; _i381 < _map378.size; ++_i381)
                {
                  _key379 = iprot.readString();
                  _val380 = iprot.readI64();
                  struct.window_to_emitted.put(_key379, _val380);
                }
                iprot.readMapEnd();
              }
              struct.set_window_to_emitted_isSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // WINDOW_TO_TRANSFERRED
            if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
              {
                org.apache.thrift.protocol.TMap _map382 = iprot.readMapBegin();
                struct.window_to_transferred = new java.util.HashMap<java.lang.String,java.lang.Long>(2*_map382.size);
                @org.apache.thrift.annotation.Nullable java.lang.String _key383;
                long _val384;
                for (int _i385 = 0; _i385 < _map382.size; ++_i385)
                {
                  _key383 = iprot.readString();
                  _val384 = iprot.readI64();
                  struct.window_to_transferred.put(_key383, _val384);
                }
                iprot.readMapEnd();
              }
              struct.set_window_to_transferred_isSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // WINDOW_TO_COMPLETE_LATENCIES_MS
            if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
              {
                org.apache.thrift.protocol.TMap _map386 = iprot.readMapBegin();
                struct.window_to_complete_latencies_ms = new java.util.HashMap<java.lang.String,java.lang.Double>(2*_map386.size);
                @org.apache.thrift.annotation.Nullable java.lang.String _key387;
                double _val388;
                for (int _i389 = 0; _i389 < _map386.size; ++_i389)
                {
                  _key387 = iprot.readString();
                  _val388 = iprot.readDouble();
                  struct.window_to_complete_latencies_ms.put(_key387, _val388);
                }
                iprot.readMapEnd();
              }
              struct.set_window_to_complete_latencies_ms_isSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // WINDOW_TO_ACKED
            if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
              {
                org.apache.thrift.protocol.TMap _map390 = iprot.readMapBegin();
                struct.window_to_acked = new java.util.HashMap<java.lang.String,java.lang.Long>(2*_map390.size);
                @org.apache.thrift.annotation.Nullable java.lang.String _key391;
                long _val392;
                for (int _i393 = 0; _i393 < _map390.size; ++_i393)
                {
                  _key391 = iprot.readString();
                  _val392 = iprot.readI64();
                  struct.window_to_acked.put(_key391, _val392);
                }
                iprot.readMapEnd();
              }
              struct.set_window_to_acked_isSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // WINDOW_TO_FAILED
            if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
              {
                org.apache.thrift.protocol.TMap _map394 = iprot.readMapBegin();
                struct.window_to_failed = new java.util.HashMap<java.lang.String,java.lang.Long>(2*_map394.size);
                @org.apache.thrift.annotation.Nullable java.lang.String _key395;
                long _val396;
                for (int _i397 = 0; _i397 < _map394.size; ++_i397)
                {
                  _key395 = iprot.readString();
                  _val396 = iprot.readI64();
                  struct.window_to_failed.put(_key395, _val396);
                }
                iprot.readMapEnd();
              }
              struct.set_window_to_failed_isSet(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, TopologyStats struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.window_to_emitted != null) {
        if (struct.is_set_window_to_emitted()) {
          oprot.writeFieldBegin(WINDOW_TO_EMITTED_FIELD_DESC);
          {
            oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.I64, struct.window_to_emitted.size()));
            for (java.util.Map.Entry<java.lang.String, java.lang.Long> _iter398 : struct.window_to_emitted.entrySet())
            {
              oprot.writeString(_iter398.getKey());
              oprot.writeI64(_iter398.getValue());
            }
            oprot.writeMapEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      if (struct.window_to_transferred != null) {
        if (struct.is_set_window_to_transferred()) {
          oprot.writeFieldBegin(WINDOW_TO_TRANSFERRED_FIELD_DESC);
          {
            oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.I64, struct.window_to_transferred.size()));
            for (java.util.Map.Entry<java.lang.String, java.lang.Long> _iter399 : struct.window_to_transferred.entrySet())
            {
              oprot.writeString(_iter399.getKey());
              oprot.writeI64(_iter399.getValue());
            }
            oprot.writeMapEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      if (struct.window_to_complete_latencies_ms != null) {
        if (struct.is_set_window_to_complete_latencies_ms()) {
          oprot.writeFieldBegin(WINDOW_TO_COMPLETE_LATENCIES_MS_FIELD_DESC);
          {
            oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.DOUBLE, struct.window_to_complete_latencies_ms.size()));
            for (java.util.Map.Entry<java.lang.String, java.lang.Double> _iter400 : struct.window_to_complete_latencies_ms.entrySet())
            {
              oprot.writeString(_iter400.getKey());
              oprot.writeDouble(_iter400.getValue());
            }
            oprot.writeMapEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      if (struct.window_to_acked != null) {
        if (struct.is_set_window_to_acked()) {
          oprot.writeFieldBegin(WINDOW_TO_ACKED_FIELD_DESC);
          {
            oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.I64, struct.window_to_acked.size()));
            for (java.util.Map.Entry<java.lang.String, java.lang.Long> _iter401 : struct.window_to_acked.entrySet())
            {
              oprot.writeString(_iter401.getKey());
              oprot.writeI64(_iter401.getValue());
            }
            oprot.writeMapEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      if (struct.window_to_failed != null) {
        if (struct.is_set_window_to_failed()) {
          oprot.writeFieldBegin(WINDOW_TO_FAILED_FIELD_DESC);
          {
            oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.I64, struct.window_to_failed.size()));
            for (java.util.Map.Entry<java.lang.String, java.lang.Long> _iter402 : struct.window_to_failed.entrySet())
            {
              oprot.writeString(_iter402.getKey());
              oprot.writeI64(_iter402.getValue());
            }
            oprot.writeMapEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

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

  private static class TopologyStatsTupleScheme extends org.apache.thrift.scheme.TupleScheme<TopologyStats> {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, TopologyStats 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.is_set_window_to_emitted()) {
        optionals.set(0);
      }
      if (struct.is_set_window_to_transferred()) {
        optionals.set(1);
      }
      if (struct.is_set_window_to_complete_latencies_ms()) {
        optionals.set(2);
      }
      if (struct.is_set_window_to_acked()) {
        optionals.set(3);
      }
      if (struct.is_set_window_to_failed()) {
        optionals.set(4);
      }
      oprot.writeBitSet(optionals, 5);
      if (struct.is_set_window_to_emitted()) {
        {
          oprot.writeI32(struct.window_to_emitted.size());
          for (java.util.Map.Entry<java.lang.String, java.lang.Long> _iter403 : struct.window_to_emitted.entrySet())
          {
            oprot.writeString(_iter403.getKey());
            oprot.writeI64(_iter403.getValue());
          }
        }
      }
      if (struct.is_set_window_to_transferred()) {
        {
          oprot.writeI32(struct.window_to_transferred.size());
          for (java.util.Map.Entry<java.lang.String, java.lang.Long> _iter404 : struct.window_to_transferred.entrySet())
          {
            oprot.writeString(_iter404.getKey());
            oprot.writeI64(_iter404.getValue());
          }
        }
      }
      if (struct.is_set_window_to_complete_latencies_ms()) {
        {
          oprot.writeI32(struct.window_to_complete_latencies_ms.size());
          for (java.util.Map.Entry<java.lang.String, java.lang.Double> _iter405 : struct.window_to_complete_latencies_ms.entrySet())
          {
            oprot.writeString(_iter405.getKey());
            oprot.writeDouble(_iter405.getValue());
          }
        }
      }
      if (struct.is_set_window_to_acked()) {
        {
          oprot.writeI32(struct.window_to_acked.size());
          for (java.util.Map.Entry<java.lang.String, java.lang.Long> _iter406 : struct.window_to_acked.entrySet())
          {
            oprot.writeString(_iter406.getKey());
            oprot.writeI64(_iter406.getValue());
          }
        }
      }
      if (struct.is_set_window_to_failed()) {
        {
          oprot.writeI32(struct.window_to_failed.size());
          for (java.util.Map.Entry<java.lang.String, java.lang.Long> _iter407 : struct.window_to_failed.entrySet())
          {
            oprot.writeString(_iter407.getKey());
            oprot.writeI64(_iter407.getValue());
          }
        }
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, TopologyStats struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      java.util.BitSet incoming = iprot.readBitSet(5);
      if (incoming.get(0)) {
        {
          org.apache.thrift.protocol.TMap _map408 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.I64, iprot.readI32());
          struct.window_to_emitted = new java.util.HashMap<java.lang.String,java.lang.Long>(2*_map408.size);
          @org.apache.thrift.annotation.Nullable java.lang.String _key409;
          long _val410;
          for (int _i411 = 0; _i411 < _map408.size; ++_i411)
          {
            _key409 = iprot.readString();
            _val410 = iprot.readI64();
            struct.window_to_emitted.put(_key409, _val410);
          }
        }
        struct.set_window_to_emitted_isSet(true);
      }
      if (incoming.get(1)) {
        {
          org.apache.thrift.protocol.TMap _map412 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.I64, iprot.readI32());
          struct.window_to_transferred = new java.util.HashMap<java.lang.String,java.lang.Long>(2*_map412.size);
          @org.apache.thrift.annotation.Nullable java.lang.String _key413;
          long _val414;
          for (int _i415 = 0; _i415 < _map412.size; ++_i415)
          {
            _key413 = iprot.readString();
            _val414 = iprot.readI64();
            struct.window_to_transferred.put(_key413, _val414);
          }
        }
        struct.set_window_to_transferred_isSet(true);
      }
      if (incoming.get(2)) {
        {
          org.apache.thrift.protocol.TMap _map416 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.DOUBLE, iprot.readI32());
          struct.window_to_complete_latencies_ms = new java.util.HashMap<java.lang.String,java.lang.Double>(2*_map416.size);
          @org.apache.thrift.annotation.Nullable java.lang.String _key417;
          double _val418;
          for (int _i419 = 0; _i419 < _map416.size; ++_i419)
          {
            _key417 = iprot.readString();
            _val418 = iprot.readDouble();
            struct.window_to_complete_latencies_ms.put(_key417, _val418);
          }
        }
        struct.set_window_to_complete_latencies_ms_isSet(true);
      }
      if (incoming.get(3)) {
        {
          org.apache.thrift.protocol.TMap _map420 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.I64, iprot.readI32());
          struct.window_to_acked = new java.util.HashMap<java.lang.String,java.lang.Long>(2*_map420.size);
          @org.apache.thrift.annotation.Nullable java.lang.String _key421;
          long _val422;
          for (int _i423 = 0; _i423 < _map420.size; ++_i423)
          {
            _key421 = iprot.readString();
            _val422 = iprot.readI64();
            struct.window_to_acked.put(_key421, _val422);
          }
        }
        struct.set_window_to_acked_isSet(true);
      }
      if (incoming.get(4)) {
        {
          org.apache.thrift.protocol.TMap _map424 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.I64, iprot.readI32());
          struct.window_to_failed = new java.util.HashMap<java.lang.String,java.lang.Long>(2*_map424.size);
          @org.apache.thrift.annotation.Nullable java.lang.String _key425;
          long _val426;
          for (int _i427 = 0; _i427 < _map424.size; ++_i427)
          {
            _key425 = iprot.readString();
            _val426 = iprot.readI64();
            struct.window_to_failed.put(_key425, _val426);
          }
        }
        struct.set_window_to_failed_isSet(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();
  }
}

