/**
 * Autogenerated by Thrift Compiler (0.9.2)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package com.xiaojukeji.carrera.thrift;

import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;

import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import org.apache.thrift.async.AsyncMethodCallback;
import org.apache.thrift.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import javax.annotation.Generated;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

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

  private static final org.apache.thrift.protocol.TField TIMESTAMP_FIELD_DESC = new org.apache.thrift.protocol.TField("timestamp", org.apache.thrift.protocol.TType.I64, (short)1);
  private static final org.apache.thrift.protocol.TField DMSGTYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("dmsgtype", org.apache.thrift.protocol.TType.I32, (short)2);
  private static final org.apache.thrift.protocol.TField INTERVAL_FIELD_DESC = new org.apache.thrift.protocol.TField("interval", org.apache.thrift.protocol.TType.I64, (short)3);
  private static final org.apache.thrift.protocol.TField EXPIRE_FIELD_DESC = new org.apache.thrift.protocol.TField("expire", org.apache.thrift.protocol.TType.I64, (short)4);
  private static final org.apache.thrift.protocol.TField TIMES_FIELD_DESC = new org.apache.thrift.protocol.TField("times", org.apache.thrift.protocol.TType.I64, (short)5);
  private static final org.apache.thrift.protocol.TField PROPERTIES_FIELD_DESC = new org.apache.thrift.protocol.TField("properties", org.apache.thrift.protocol.TType.MAP, (short)7);

  private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
  static {
    schemes.put(StandardScheme.class, new DelayMetaStandardSchemeFactory());
    schemes.put(TupleScheme.class, new DelayMetaTupleSchemeFactory());
  }

  public long timestamp; // required
  public int dmsgtype; // optional
  public long interval; // optional
  public long expire; // optional
  public long times; // optional
  public Map<String,String> properties; // 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 {
    TIMESTAMP((short)1, "timestamp"),
    DMSGTYPE((short)2, "dmsgtype"),
    INTERVAL((short)3, "interval"),
    EXPIRE((short)4, "expire"),
    TIMES((short)5, "times"),
    PROPERTIES((short)7, "properties");

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

    static {
      for (_Fields field : 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 1: // TIMESTAMP
          return TIMESTAMP;
        case 2: // DMSGTYPE
          return DMSGTYPE;
        case 3: // INTERVAL
          return INTERVAL;
        case 4: // EXPIRE
          return EXPIRE;
        case 5: // TIMES
          return TIMES;
        case 7: // PROPERTIES
          return PROPERTIES;
        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 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(String name) {
      return byName.get(name);
    }

    private final short _thriftId;
    private final String _fieldName;

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

    public short getThriftFieldId() {
      return _thriftId;
    }

    public String getFieldName() {
      return _fieldName;
    }
  }

  // isset id assignments
  private static final int __TIMESTAMP_ISSET_ID = 0;
  private static final int __DMSGTYPE_ISSET_ID = 1;
  private static final int __INTERVAL_ISSET_ID = 2;
  private static final int __EXPIRE_ISSET_ID = 3;
  private static final int __TIMES_ISSET_ID = 4;
  private byte __isset_bitfield = 0;
  private static final _Fields optionals[] = {_Fields.DMSGTYPE,_Fields.INTERVAL,_Fields.EXPIRE,_Fields.TIMES,_Fields.PROPERTIES};
  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
  static {
    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
    tmpMap.put(_Fields.TIMESTAMP, new org.apache.thrift.meta_data.FieldMetaData("timestamp", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.DMSGTYPE, new org.apache.thrift.meta_data.FieldMetaData("dmsgtype", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.INTERVAL, new org.apache.thrift.meta_data.FieldMetaData("interval", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.EXPIRE, new org.apache.thrift.meta_data.FieldMetaData("expire", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.TIMES, new org.apache.thrift.meta_data.FieldMetaData("times", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.PROPERTIES, new org.apache.thrift.meta_data.FieldMetaData("properties", 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.STRING))));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(DelayMeta.class, metaDataMap);
  }

  public DelayMeta() {
  }

  public DelayMeta(
    long timestamp)
  {
    this();
    this.timestamp = timestamp;
    setTimestampIsSet(true);
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public DelayMeta(DelayMeta other) {
    __isset_bitfield = other.__isset_bitfield;
    this.timestamp = other.timestamp;
    this.dmsgtype = other.dmsgtype;
    this.interval = other.interval;
    this.expire = other.expire;
    this.times = other.times;
    if (other.isSetProperties()) {
      Map<String,String> __this__properties = new HashMap<String,String>(other.properties);
      this.properties = __this__properties;
    }
  }

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

  @Override
  public void clear() {
    setTimestampIsSet(false);
    this.timestamp = 0;
    setDmsgtypeIsSet(false);
    this.dmsgtype = 0;
    setIntervalIsSet(false);
    this.interval = 0;
    setExpireIsSet(false);
    this.expire = 0;
    setTimesIsSet(false);
    this.times = 0;
    this.properties = null;
  }

  public long getTimestamp() {
    return this.timestamp;
  }

  public DelayMeta setTimestamp(long timestamp) {
    this.timestamp = timestamp;
    setTimestampIsSet(true);
    return this;
  }

  public void unsetTimestamp() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __TIMESTAMP_ISSET_ID);
  }

  /** Returns true if field timestamp is set (has been assigned a value) and false otherwise */
  public boolean isSetTimestamp() {
    return EncodingUtils.testBit(__isset_bitfield, __TIMESTAMP_ISSET_ID);
  }

  public void setTimestampIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __TIMESTAMP_ISSET_ID, value);
  }

  public int getDmsgtype() {
    return this.dmsgtype;
  }

  public DelayMeta setDmsgtype(int dmsgtype) {
    this.dmsgtype = dmsgtype;
    setDmsgtypeIsSet(true);
    return this;
  }

  public void unsetDmsgtype() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __DMSGTYPE_ISSET_ID);
  }

  /** Returns true if field dmsgtype is set (has been assigned a value) and false otherwise */
  public boolean isSetDmsgtype() {
    return EncodingUtils.testBit(__isset_bitfield, __DMSGTYPE_ISSET_ID);
  }

  public void setDmsgtypeIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __DMSGTYPE_ISSET_ID, value);
  }

  public long getInterval() {
    return this.interval;
  }

  public DelayMeta setInterval(long interval) {
    this.interval = interval;
    setIntervalIsSet(true);
    return this;
  }

  public void unsetInterval() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __INTERVAL_ISSET_ID);
  }

  /** Returns true if field interval is set (has been assigned a value) and false otherwise */
  public boolean isSetInterval() {
    return EncodingUtils.testBit(__isset_bitfield, __INTERVAL_ISSET_ID);
  }

  public void setIntervalIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __INTERVAL_ISSET_ID, value);
  }

  public long getExpire() {
    return this.expire;
  }

  public DelayMeta setExpire(long expire) {
    this.expire = expire;
    setExpireIsSet(true);
    return this;
  }

  public void unsetExpire() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __EXPIRE_ISSET_ID);
  }

  /** Returns true if field expire is set (has been assigned a value) and false otherwise */
  public boolean isSetExpire() {
    return EncodingUtils.testBit(__isset_bitfield, __EXPIRE_ISSET_ID);
  }

  public void setExpireIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __EXPIRE_ISSET_ID, value);
  }

  public long getTimes() {
    return this.times;
  }

  public DelayMeta setTimes(long times) {
    this.times = times;
    setTimesIsSet(true);
    return this;
  }

  public void unsetTimes() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __TIMES_ISSET_ID);
  }

  /** Returns true if field times is set (has been assigned a value) and false otherwise */
  public boolean isSetTimes() {
    return EncodingUtils.testBit(__isset_bitfield, __TIMES_ISSET_ID);
  }

  public void setTimesIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __TIMES_ISSET_ID, value);
  }

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

  public void putToProperties(String key, String val) {
    if (this.properties == null) {
      this.properties = new HashMap<String,String>();
    }
    this.properties.put(key, val);
  }

  public Map<String,String> getProperties() {
    return this.properties;
  }

  public DelayMeta setProperties(Map<String,String> properties) {
    this.properties = properties;
    return this;
  }

  public void unsetProperties() {
    this.properties = null;
  }

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

  public void setPropertiesIsSet(boolean value) {
    if (!value) {
      this.properties = null;
    }
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case TIMESTAMP:
      if (value == null) {
        unsetTimestamp();
      } else {
        setTimestamp((Long)value);
      }
      break;

    case DMSGTYPE:
      if (value == null) {
        unsetDmsgtype();
      } else {
        setDmsgtype((Integer)value);
      }
      break;

    case INTERVAL:
      if (value == null) {
        unsetInterval();
      } else {
        setInterval((Long)value);
      }
      break;

    case EXPIRE:
      if (value == null) {
        unsetExpire();
      } else {
        setExpire((Long)value);
      }
      break;

    case TIMES:
      if (value == null) {
        unsetTimes();
      } else {
        setTimes((Long)value);
      }
      break;

    case PROPERTIES:
      if (value == null) {
        unsetProperties();
      } else {
        setProperties((Map<String,String>)value);
      }
      break;

    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case TIMESTAMP:
      return Long.valueOf(getTimestamp());

    case DMSGTYPE:
      return Integer.valueOf(getDmsgtype());

    case INTERVAL:
      return Long.valueOf(getInterval());

    case EXPIRE:
      return Long.valueOf(getExpire());

    case TIMES:
      return Long.valueOf(getTimes());

    case PROPERTIES:
      return getProperties();

    }
    throw new 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 IllegalArgumentException();
    }

    switch (field) {
    case TIMESTAMP:
      return isSetTimestamp();
    case DMSGTYPE:
      return isSetDmsgtype();
    case INTERVAL:
      return isSetInterval();
    case EXPIRE:
      return isSetExpire();
    case TIMES:
      return isSetTimes();
    case PROPERTIES:
      return isSetProperties();
    }
    throw new IllegalStateException();
  }

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

  public boolean equals(DelayMeta that) {
    if (that == null)
      return false;

    boolean this_present_timestamp = true;
    boolean that_present_timestamp = true;
    if (this_present_timestamp || that_present_timestamp) {
      if (!(this_present_timestamp && that_present_timestamp))
        return false;
      if (this.timestamp != that.timestamp)
        return false;
    }

    boolean this_present_dmsgtype = true && this.isSetDmsgtype();
    boolean that_present_dmsgtype = true && that.isSetDmsgtype();
    if (this_present_dmsgtype || that_present_dmsgtype) {
      if (!(this_present_dmsgtype && that_present_dmsgtype))
        return false;
      if (this.dmsgtype != that.dmsgtype)
        return false;
    }

    boolean this_present_interval = true && this.isSetInterval();
    boolean that_present_interval = true && that.isSetInterval();
    if (this_present_interval || that_present_interval) {
      if (!(this_present_interval && that_present_interval))
        return false;
      if (this.interval != that.interval)
        return false;
    }

    boolean this_present_expire = true && this.isSetExpire();
    boolean that_present_expire = true && that.isSetExpire();
    if (this_present_expire || that_present_expire) {
      if (!(this_present_expire && that_present_expire))
        return false;
      if (this.expire != that.expire)
        return false;
    }

    boolean this_present_times = true && this.isSetTimes();
    boolean that_present_times = true && that.isSetTimes();
    if (this_present_times || that_present_times) {
      if (!(this_present_times && that_present_times))
        return false;
      if (this.times != that.times)
        return false;
    }

    boolean this_present_properties = true && this.isSetProperties();
    boolean that_present_properties = true && that.isSetProperties();
    if (this_present_properties || that_present_properties) {
      if (!(this_present_properties && that_present_properties))
        return false;
      if (!this.properties.equals(that.properties))
        return false;
    }

    return true;
  }

  @Override
  public int hashCode() {
    List<Object> list = new ArrayList<Object>();

    boolean present_timestamp = true;
    list.add(present_timestamp);
    if (present_timestamp)
      list.add(timestamp);

    boolean present_dmsgtype = true && (isSetDmsgtype());
    list.add(present_dmsgtype);
    if (present_dmsgtype)
      list.add(dmsgtype);

    boolean present_interval = true && (isSetInterval());
    list.add(present_interval);
    if (present_interval)
      list.add(interval);

    boolean present_expire = true && (isSetExpire());
    list.add(present_expire);
    if (present_expire)
      list.add(expire);

    boolean present_times = true && (isSetTimes());
    list.add(present_times);
    if (present_times)
      list.add(times);

    boolean present_properties = true && (isSetProperties());
    list.add(present_properties);
    if (present_properties)
      list.add(properties);

    return list.hashCode();
  }

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

    int lastComparison = 0;

    lastComparison = Boolean.valueOf(isSetTimestamp()).compareTo(other.isSetTimestamp());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTimestamp()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.timestamp, other.timestamp);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetDmsgtype()).compareTo(other.isSetDmsgtype());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetDmsgtype()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.dmsgtype, other.dmsgtype);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetInterval()).compareTo(other.isSetInterval());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetInterval()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.interval, other.interval);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetExpire()).compareTo(other.isSetExpire());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetExpire()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.expire, other.expire);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetTimes()).compareTo(other.isSetTimes());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTimes()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.times, other.times);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetProperties()).compareTo(other.isSetProperties());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetProperties()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.properties, other.properties);
      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 {
    schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
  }

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

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder("DelayMeta(");
    boolean first = true;

    sb.append("timestamp:");
    sb.append(this.timestamp);
    first = false;
    if (isSetDmsgtype()) {
      if (!first) sb.append(", ");
      sb.append("dmsgtype:");
      sb.append(this.dmsgtype);
      first = false;
    }
    if (isSetInterval()) {
      if (!first) sb.append(", ");
      sb.append("interval:");
      sb.append(this.interval);
      first = false;
    }
    if (isSetExpire()) {
      if (!first) sb.append(", ");
      sb.append("expire:");
      sb.append(this.expire);
      first = false;
    }
    if (isSetTimes()) {
      if (!first) sb.append(", ");
      sb.append("times:");
      sb.append(this.times);
      first = false;
    }
    if (isSetProperties()) {
      if (!first) sb.append(", ");
      sb.append("properties:");
      if (this.properties == null) {
        sb.append("null");
      } else {
        sb.append(this.properties);
      }
      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, 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 DelayMetaStandardSchemeFactory implements SchemeFactory {
    public DelayMetaStandardScheme getScheme() {
      return new DelayMetaStandardScheme();
    }
  }

  private static class DelayMetaStandardScheme extends StandardScheme<DelayMeta> {

    public void read(org.apache.thrift.protocol.TProtocol iprot, DelayMeta 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: // TIMESTAMP
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.timestamp = iprot.readI64();
              struct.setTimestampIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // DMSGTYPE
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.dmsgtype = iprot.readI32();
              struct.setDmsgtypeIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // INTERVAL
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.interval = iprot.readI64();
              struct.setIntervalIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // EXPIRE
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.expire = iprot.readI64();
              struct.setExpireIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // TIMES
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.times = iprot.readI64();
              struct.setTimesIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 7: // PROPERTIES
            if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
              {
                org.apache.thrift.protocol.TMap _map40 = iprot.readMapBegin();
                struct.properties = new HashMap<String,String>(2*_map40.size);
                String _key41;
                String _val42;
                for (int _i43 = 0; _i43 < _map40.size; ++_i43)
                {
                  _key41 = iprot.readString();
                  _val42 = iprot.readString();
                  struct.properties.put(_key41, _val42);
                }
                iprot.readMapEnd();
              }
              struct.setPropertiesIsSet(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();

      // check for required fields of primitive type, which can't be checked in the validate method
      struct.validate();
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldBegin(TIMESTAMP_FIELD_DESC);
      oprot.writeI64(struct.timestamp);
      oprot.writeFieldEnd();
      if (struct.isSetDmsgtype()) {
        oprot.writeFieldBegin(DMSGTYPE_FIELD_DESC);
        oprot.writeI32(struct.dmsgtype);
        oprot.writeFieldEnd();
      }
      if (struct.isSetInterval()) {
        oprot.writeFieldBegin(INTERVAL_FIELD_DESC);
        oprot.writeI64(struct.interval);
        oprot.writeFieldEnd();
      }
      if (struct.isSetExpire()) {
        oprot.writeFieldBegin(EXPIRE_FIELD_DESC);
        oprot.writeI64(struct.expire);
        oprot.writeFieldEnd();
      }
      if (struct.isSetTimes()) {
        oprot.writeFieldBegin(TIMES_FIELD_DESC);
        oprot.writeI64(struct.times);
        oprot.writeFieldEnd();
      }
      if (struct.properties != null) {
        if (struct.isSetProperties()) {
          oprot.writeFieldBegin(PROPERTIES_FIELD_DESC);
          {
            oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.properties.size()));
            for (Map.Entry<String, String> _iter44 : struct.properties.entrySet())
            {
              oprot.writeString(_iter44.getKey());
              oprot.writeString(_iter44.getValue());
            }
            oprot.writeMapEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class DelayMetaTupleSchemeFactory implements SchemeFactory {
    public DelayMetaTupleScheme getScheme() {
      return new DelayMetaTupleScheme();
    }
  }

  private static class DelayMetaTupleScheme extends TupleScheme<DelayMeta> {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, DelayMeta struct) throws org.apache.thrift.TException {
      TTupleProtocol oprot = (TTupleProtocol) prot;
      BitSet optionals = new BitSet();
      if (struct.isSetTimestamp()) {
        optionals.set(0);
      }
      if (struct.isSetDmsgtype()) {
        optionals.set(1);
      }
      if (struct.isSetInterval()) {
        optionals.set(2);
      }
      if (struct.isSetExpire()) {
        optionals.set(3);
      }
      if (struct.isSetTimes()) {
        optionals.set(4);
      }
      if (struct.isSetProperties()) {
        optionals.set(5);
      }
      oprot.writeBitSet(optionals, 6);
      if (struct.isSetTimestamp()) {
        oprot.writeI64(struct.timestamp);
      }
      if (struct.isSetDmsgtype()) {
        oprot.writeI32(struct.dmsgtype);
      }
      if (struct.isSetInterval()) {
        oprot.writeI64(struct.interval);
      }
      if (struct.isSetExpire()) {
        oprot.writeI64(struct.expire);
      }
      if (struct.isSetTimes()) {
        oprot.writeI64(struct.times);
      }
      if (struct.isSetProperties()) {
        {
          oprot.writeI32(struct.properties.size());
          for (Map.Entry<String, String> _iter45 : struct.properties.entrySet())
          {
            oprot.writeString(_iter45.getKey());
            oprot.writeString(_iter45.getValue());
          }
        }
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, DelayMeta struct) throws org.apache.thrift.TException {
      TTupleProtocol iprot = (TTupleProtocol) prot;
      BitSet incoming = iprot.readBitSet(6);
      if (incoming.get(0)) {
        struct.timestamp = iprot.readI64();
        struct.setTimestampIsSet(true);
      }
      if (incoming.get(1)) {
        struct.dmsgtype = iprot.readI32();
        struct.setDmsgtypeIsSet(true);
      }
      if (incoming.get(2)) {
        struct.interval = iprot.readI64();
        struct.setIntervalIsSet(true);
      }
      if (incoming.get(3)) {
        struct.expire = iprot.readI64();
        struct.setExpireIsSet(true);
      }
      if (incoming.get(4)) {
        struct.times = iprot.readI64();
        struct.setTimesIsSet(true);
      }
      if (incoming.get(5)) {
        {
          org.apache.thrift.protocol.TMap _map46 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32());
          struct.properties = new HashMap<String,String>(2*_map46.size);
          String _key47;
          String _val48;
          for (int _i49 = 0; _i49 < _map46.size; ++_i49)
          {
            _key47 = iprot.readString();
            _val48 = iprot.readString();
            struct.properties.put(_key47, _val48);
          }
        }
        struct.setPropertiesIsSet(true);
      }
    }
  }

}

