R66Request.java

/*
 * This file is part of Waarp Project (named also Waarp or GG).
 *
 *  Copyright (c) 2019, Waarp SAS, and individual contributors by the @author
 *  tags. See the COPYRIGHT.txt in the distribution for a full listing of
 * individual contributors.
 *
 *  All Waarp Project is free software: you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or (at your
 * option) any later version.
 *
 * Waarp is distributed in the hope that it will be useful, but WITHOUT ANY
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License along with
 * Waarp . If not, see <http://www.gnu.org/licenses/>.
 */

/**
 * Autogenerated by Thrift Compiler (0.9.0)
 * <p>
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 */
package org.waarp.thrift.r66;

import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TBase;
import org.apache.thrift.TBaseHelper;
import org.apache.thrift.TException;
import org.apache.thrift.TFieldIdEnum;
import org.apache.thrift.TFieldRequirementType;
import org.apache.thrift.meta_data.EnumMetaData;
import org.apache.thrift.meta_data.FieldMetaData;
import org.apache.thrift.meta_data.FieldValueMetaData;
import org.apache.thrift.protocol.TCompactProtocol;
import org.apache.thrift.protocol.TField;
import org.apache.thrift.protocol.TProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.protocol.TProtocolUtil;
import org.apache.thrift.protocol.TStruct;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TType;
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.transport.TIOStreamTransport;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.BitSet;
import java.util.Collections;
import java.util.EnumMap;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;

public class R66Request
    implements TBase<R66Request, R66Request._Fields>, Cloneable {
  private static final String ACTION2 = "action";

  private static final String NOTRACE2 = "notrace";

  private static final String DELAY2 = "delay";

  private static final String START2 = "start";

  private static final String BLOCKSIZE2 = "blocksize";

  private static final String DESTUID2 = "destuid";

  private static final String FROMUID2 = "fromuid";

  /**
   *
   */
  private static final long serialVersionUID = 5084190194755640723L;

  private static final TStruct STRUCT_DESC = new TStruct("R66Request");

  private static final TField MODE_FIELD_DESC =
      new TField("mode", TType.I32, (short) 1);
  private static final TField FROMUID_FIELD_DESC =
      new TField(FROMUID2, TType.STRING, (short) 2);
  private static final TField DESTUID_FIELD_DESC =
      new TField(DESTUID2, TType.STRING, (short) 3);
  private static final TField FILE_FIELD_DESC =
      new TField("file", TType.STRING, (short) 4);
  private static final TField RULE_FIELD_DESC =
      new TField("rule", TType.STRING, (short) 5);
  private static final TField INFO_FIELD_DESC =
      new TField("info", TType.STRING, (short) 10);
  private static final TField MD5_FIELD_DESC =
      new TField("md5", TType.BOOL, (short) 11);
  private static final TField BLOCKSIZE_FIELD_DESC =
      new TField(BLOCKSIZE2, TType.I32, (short) 12);
  private static final TField START_FIELD_DESC =
      new TField(START2, TType.STRING, (short) 13);
  private static final TField DELAY_FIELD_DESC =
      new TField(DELAY2, TType.STRING, (short) 14);
  private static final TField NOTRACE_FIELD_DESC =
      new TField(NOTRACE2, TType.BOOL, (short) 15);
  private static final TField TID_FIELD_DESC =
      new TField("tid", TType.I64, (short) 20);
  private static final TField ACTION_FIELD_DESC =
      new TField(ACTION2, TType.I32, (short) 21);

  private static final Map<Class<? extends IScheme>, SchemeFactory> schemes =
      new HashMap<Class<? extends IScheme>, SchemeFactory>();

  static {
    schemes.put(StandardScheme.class, new R66RequestStandardSchemeFactory());
    schemes.put(TupleScheme.class, new R66RequestTupleSchemeFactory());
  }

  private RequestMode mode; // required
  private String fromuid; // optional
  private String destuid; // optional
  private String file; // optional
  private String rule; // optional
  private String info; // optional
  private boolean md5; // optional
  private int blocksize; // optional
  private String start; // optional
  private String delay; // optional
  private boolean notrace; // optional
  private long tid; // optional
  private Action action; // optional

  @Override
  public final R66Request clone() throws CloneNotSupportedException {
    return (R66Request) super.clone();
  }

  /**
   * The set of fields this struct contains, along with convenience methods
   * for
   * finding and manipulating them.
   */
  public enum _Fields implements TFieldIdEnum {
    /**
     * @see RequestMode
     */
    MODE((short) 1, "mode"), FROMUID((short) 2, FROMUID2),
    DESTUID((short) 3, DESTUID2), FILE((short) 4, "file"),
    RULE((short) 5, "rule"), INFO((short) 10, "info"), MD5((short) 11, "md5"),
    BLOCKSIZE((short) 12, BLOCKSIZE2), START((short) 13, START2),
    DELAY((short) 14, DELAY2), NOTRACE((short) 15, NOTRACE2),
    TID((short) 20, "tid"),
    /**
     * @see Action
     */
    ACTION((short) 21, ACTION2);

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

    static {
      for (final _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(final int fieldId) {
      switch (fieldId) {
        case 1: // MODE
          return MODE;
        case 2: // FROMUID
          return FROMUID;
        case 3: // DESTUID
          return DESTUID;
        case 4: // FILE
          return FILE;
        case 5: // RULE
          return RULE;
        case 10: // INFO
          return INFO;
        case 11: // MD5
          return MD5;
        case 12: // BLOCKSIZE
          return BLOCKSIZE;
        case 13: // START
          return START;
        case 14: // DELAY
          return DELAY;
        case 15: // NOTRACE
          return NOTRACE;
        case 20: // TID
          return TID;
        case 21: // ACTION
          return ACTION;
        default:
          return null;
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, throwing an exception
     * if
     * it is not found.
     */
    public static _Fields findByThriftIdOrThrow(final int fieldId) {
      final _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(final String name) {
      return byName.get(name);
    }

    private final short thriftId;
    private final String fieldName;

    _Fields(final short thriftId, final String fieldName) {
      this.thriftId = thriftId;
      this.fieldName = fieldName;
    }

    @Override
    public final short getThriftFieldId() {
      return thriftId;
    }

    @Override
    public final String getFieldName() {
      return fieldName;
    }
  }

  // isset id assignments
  private static final int MD_5_ISSET_ID = 0;
  private static final int BLOCKSIZE_ISSET_ID = 1;
  private static final int NOTRACE_ISSET_ID = 2;
  private static final int TID_ISSET_ID = 3;
  private byte issetBitfield;
  public static final Map<_Fields, FieldMetaData> metaDataMap;

  static {
    final Map<_Fields, FieldMetaData> tmpMap =
        new EnumMap<_Fields, FieldMetaData>(_Fields.class);
    tmpMap.put(_Fields.MODE,
               new FieldMetaData("mode", TFieldRequirementType.REQUIRED,
                                 new EnumMetaData(TType.ENUM,
                                                  RequestMode.class)));
    tmpMap.put(_Fields.FROMUID,
               new FieldMetaData(FROMUID2, TFieldRequirementType.OPTIONAL,
                                 new FieldValueMetaData(TType.STRING)));
    tmpMap.put(_Fields.DESTUID,
               new FieldMetaData(DESTUID2, TFieldRequirementType.OPTIONAL,
                                 new FieldValueMetaData(TType.STRING)));
    tmpMap.put(_Fields.FILE,
               new FieldMetaData("file", TFieldRequirementType.OPTIONAL,
                                 new FieldValueMetaData(TType.STRING)));
    tmpMap.put(_Fields.RULE,
               new FieldMetaData("rule", TFieldRequirementType.OPTIONAL,
                                 new FieldValueMetaData(TType.STRING)));
    tmpMap.put(_Fields.INFO,
               new FieldMetaData("info", TFieldRequirementType.OPTIONAL,
                                 new FieldValueMetaData(TType.STRING)));
    tmpMap.put(_Fields.MD5,
               new FieldMetaData("md5", TFieldRequirementType.OPTIONAL,
                                 new FieldValueMetaData(TType.BOOL)));
    tmpMap.put(_Fields.BLOCKSIZE,
               new FieldMetaData(BLOCKSIZE2, TFieldRequirementType.OPTIONAL,
                                 new FieldValueMetaData(TType.I32)));
    tmpMap.put(_Fields.START,
               new FieldMetaData(START2, TFieldRequirementType.OPTIONAL,
                                 new FieldValueMetaData(TType.STRING)));
    tmpMap.put(_Fields.DELAY,
               new FieldMetaData(DELAY2, TFieldRequirementType.OPTIONAL,
                                 new FieldValueMetaData(TType.STRING)));
    tmpMap.put(_Fields.NOTRACE,
               new FieldMetaData(NOTRACE2, TFieldRequirementType.OPTIONAL,
                                 new FieldValueMetaData(TType.BOOL)));
    tmpMap.put(_Fields.TID,
               new FieldMetaData("tid", TFieldRequirementType.OPTIONAL,
                                 new FieldValueMetaData(TType.I64)));
    tmpMap.put(_Fields.ACTION,
               new FieldMetaData(ACTION2, TFieldRequirementType.OPTIONAL,
                                 new EnumMetaData(TType.ENUM, Action.class)));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    FieldMetaData.addStructMetaDataMap(R66Request.class, metaDataMap);
  }

  public R66Request() {
    md5 = false;

    notrace = false;

  }

  public R66Request(final RequestMode mode) {
    this();
    this.mode = mode;
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public R66Request(final R66Request other) {
    issetBitfield = other.issetBitfield;
    if (other.isSetMode()) {
      mode = other.mode;
    }
    if (other.isSetFromuid()) {
      fromuid = other.fromuid;
    }
    if (other.isSetDestuid()) {
      destuid = other.destuid;
    }
    if (other.isSetFile()) {
      file = other.file;
    }
    if (other.isSetRule()) {
      rule = other.rule;
    }
    if (other.isSetInfo()) {
      info = other.info;
    }
    md5 = other.md5;
    blocksize = other.blocksize;
    if (other.isSetStart()) {
      start = other.start;
    }
    if (other.isSetDelay()) {
      delay = other.delay;
    }
    notrace = other.notrace;
    tid = other.tid;
    if (other.isSetAction()) {
      action = other.action;
    }
  }

  @Override
  public final R66Request deepCopy() {
    return new R66Request(this);
  }

  @Override
  public final void clear() {
    mode = null;
    fromuid = null;
    destuid = null;
    file = null;
    rule = null;
    info = null;
    md5 = false;

    setBlocksizeIsSet(false);
    blocksize = 0;
    start = null;
    delay = null;
    notrace = false;

    setTidIsSet(false);
    tid = 0;
    action = null;
  }

  /**
   * @see RequestMode
   */
  public final RequestMode getMode() {
    return mode;
  }

  /**
   * @see RequestMode
   */
  public final R66Request setMode(final RequestMode mode) {
    this.mode = mode;
    return this;
  }

  public final void unsetMode() {
    mode = null;
  }

  /**
   * Returns true if field mode is set (has been assigned a value) and false
   * otherwise
   */
  public final boolean isSetMode() {
    return mode != null;
  }

  public final void setModeIsSet(final boolean value) {
    if (!value) {
      mode = null;
    }
  }

  public final String getFromuid() {
    return fromuid;
  }

  public final R66Request setFromuid(final String fromuid) {
    this.fromuid = fromuid;
    return this;
  }

  public final void unsetFromuid() {
    fromuid = null;
  }

  /**
   * Returns true if field fromuid is set (has been assigned a value) and
   * false
   * otherwise
   */
  public final boolean isSetFromuid() {
    return fromuid != null;
  }

  public final void setFromuidIsSet(final boolean value) {
    if (!value) {
      fromuid = null;
    }
  }

  public final String getDestuid() {
    return destuid;
  }

  public final R66Request setDestuid(final String destuid) {
    this.destuid = destuid;
    return this;
  }

  public final void unsetDestuid() {
    destuid = null;
  }

  /**
   * Returns true if field destuid is set (has been assigned a value) and
   * false
   * otherwise
   */
  public final boolean isSetDestuid() {
    return destuid != null;
  }

  public final void setDestuidIsSet(final boolean value) {
    if (!value) {
      destuid = null;
    }
  }

  public String getFile() {
    return file;
  }

  public final R66Request setFile(final String file) {
    this.file = file;
    return this;
  }

  public final void unsetFile() {
    file = null;
  }

  /**
   * Returns true if field file is set (has been assigned a value) and false
   * otherwise
   */
  public final boolean isSetFile() {
    return file != null;
  }

  public final void setFileIsSet(final boolean value) {
    if (!value) {
      file = null;
    }
  }

  public final String getRule() {
    return rule;
  }

  public final R66Request setRule(final String rule) {
    this.rule = rule;
    return this;
  }

  public final void unsetRule() {
    rule = null;
  }

  /**
   * Returns true if field rule is set (has been assigned a value) and false
   * otherwise
   */
  public final boolean isSetRule() {
    return rule != null;
  }

  public final void setRuleIsSet(final boolean value) {
    if (!value) {
      rule = null;
    }
  }

  public final String getInfo() {
    return info;
  }

  public final R66Request setInfo(final String info) {
    this.info = info;
    return this;
  }

  public void unsetInfo() {
    info = null;
  }

  /**
   * Returns true if field info is set (has been assigned a value) and false
   * otherwise
   */
  public final boolean isSetInfo() {
    return info != null;
  }

  public final void setInfoIsSet(final boolean value) {
    if (!value) {
      info = null;
    }
  }

  public final boolean isMd5() {
    return md5;
  }

  public final R66Request setMd5(final boolean md5) {
    this.md5 = md5;
    setMd5IsSet(true);
    return this;
  }

  public final void unsetMd5() {
    issetBitfield = EncodingUtils.clearBit(issetBitfield, MD_5_ISSET_ID);
  }

  /**
   * Returns true if field md5 is set (has been assigned a value) and false
   * otherwise
   */
  public final boolean isSetMd5() {
    return EncodingUtils.testBit(issetBitfield, MD_5_ISSET_ID);
  }

  public final void setMd5IsSet(final boolean value) {
    issetBitfield = EncodingUtils.setBit(issetBitfield, MD_5_ISSET_ID, value);
  }

  public final int getBlocksize() {
    return blocksize;
  }

  public final R66Request setBlocksize(final int blocksize) {
    this.blocksize = blocksize;
    setBlocksizeIsSet(true);
    return this;
  }

  public final void unsetBlocksize() {
    issetBitfield = EncodingUtils.clearBit(issetBitfield, BLOCKSIZE_ISSET_ID);
  }

  /**
   * Returns true if field blocksize is set (has been assigned a value) and
   * false otherwise
   */
  public final boolean isSetBlocksize() {
    return EncodingUtils.testBit(issetBitfield, BLOCKSIZE_ISSET_ID);
  }

  public final void setBlocksizeIsSet(final boolean value) {
    issetBitfield =
        EncodingUtils.setBit(issetBitfield, BLOCKSIZE_ISSET_ID, value);
  }

  public final String getStart() {
    return start;
  }

  public final R66Request setStart(final String start) {
    this.start = start;
    return this;
  }

  public final void unsetStart() {
    start = null;
  }

  /**
   * Returns true if field start is set (has been assigned a value) and false
   * otherwise
   */
  public final boolean isSetStart() {
    return start != null;
  }

  public final void setStartIsSet(final boolean value) {
    if (!value) {
      start = null;
    }
  }

  public final String getDelay() {
    return delay;
  }

  public final R66Request setDelay(final String delay) {
    this.delay = delay;
    return this;
  }

  public final void unsetDelay() {
    delay = null;
  }

  /**
   * Returns true if field delay is set (has been assigned a value) and false
   * otherwise
   */
  public final boolean isSetDelay() {
    return delay != null;
  }

  public final void setDelayIsSet(final boolean value) {
    if (!value) {
      delay = null;
    }
  }

  public final boolean isNotrace() {
    return notrace;
  }

  public final R66Request setNotrace(final boolean notrace) {
    this.notrace = notrace;
    setNotraceIsSet(true);
    return this;
  }

  public final void unsetNotrace() {
    issetBitfield = EncodingUtils.clearBit(issetBitfield, NOTRACE_ISSET_ID);
  }

  /**
   * Returns true if field notrace is set (has been assigned a value) and
   * false
   * otherwise
   */
  public final boolean isSetNotrace() {
    return EncodingUtils.testBit(issetBitfield, NOTRACE_ISSET_ID);
  }

  public final void setNotraceIsSet(final boolean value) {
    issetBitfield =
        EncodingUtils.setBit(issetBitfield, NOTRACE_ISSET_ID, value);
  }

  public final long getTid() {
    return tid;
  }

  public final R66Request setTid(final long tid) {
    this.tid = tid;
    setTidIsSet(true);
    return this;
  }

  public final void unsetTid() {
    issetBitfield = EncodingUtils.clearBit(issetBitfield, TID_ISSET_ID);
  }

  /**
   * Returns true if field tid is set (has been assigned a value) and false
   * otherwise
   */
  public final boolean isSetTid() {
    return EncodingUtils.testBit(issetBitfield, TID_ISSET_ID);
  }

  public final void setTidIsSet(final boolean value) {
    issetBitfield = EncodingUtils.setBit(issetBitfield, TID_ISSET_ID, value);
  }

  /**
   * @see Action
   */
  public final Action getAction() {
    return action;
  }

  /**
   * @see Action
   */
  public final R66Request setAction(final Action action) {
    this.action = action;
    return this;
  }

  public final void unsetAction() {
    action = null;
  }

  /**
   * Returns true if field action is set (has been assigned a value) and false
   * otherwise
   */
  public final boolean isSetAction() {
    return action != null;
  }

  public final void setActionIsSet(final boolean value) {
    if (!value) {
      action = null;
    }
  }

  @Override
  public final void setFieldValue(final _Fields field, final Object value) {
    switch (field) {
      case MODE:
        if (value == null) {
          unsetMode();
        } else {
          setMode((RequestMode) value);
        }
        break;

      case FROMUID:
        if (value == null) {
          unsetFromuid();
        } else {
          setFromuid((String) value);
        }
        break;

      case DESTUID:
        if (value == null) {
          unsetDestuid();
        } else {
          setDestuid((String) value);
        }
        break;

      case FILE:
        if (value == null) {
          unsetFile();
        } else {
          setFile((String) value);
        }
        break;

      case RULE:
        if (value == null) {
          unsetRule();
        } else {
          setRule((String) value);
        }
        break;

      case INFO:
        if (value == null) {
          unsetInfo();
        } else {
          setInfo((String) value);
        }
        break;

      case MD5:
        if (value == null) {
          unsetMd5();
        } else {
          setMd5((Boolean) value);
        }
        break;

      case BLOCKSIZE:
        if (value == null) {
          unsetBlocksize();
        } else {
          setBlocksize((Integer) value);
        }
        break;

      case START:
        if (value == null) {
          unsetStart();
        } else {
          setStart((String) value);
        }
        break;

      case DELAY:
        if (value == null) {
          unsetDelay();
        } else {
          setDelay((String) value);
        }
        break;

      case NOTRACE:
        if (value == null) {
          unsetNotrace();
        } else {
          setNotrace((Boolean) value);
        }
        break;

      case TID:
        if (value == null) {
          unsetTid();
        } else {
          setTid((Long) value);
        }
        break;

      case ACTION:
        if (value == null) {
          unsetAction();
        } else {
          setAction((Action) value);
        }
        break;

    }
  }

  @Override
  public final Object getFieldValue(final _Fields field) {
    switch (field) {
      case MODE:
        return getMode();

      case FROMUID:
        return getFromuid();

      case DESTUID:
        return getDestuid();

      case FILE:
        return getFile();

      case RULE:
        return getRule();

      case INFO:
        return getInfo();

      case MD5:
        return Boolean.valueOf(isMd5());

      case BLOCKSIZE:
        return Integer.valueOf(getBlocksize());

      case START:
        return getStart();

      case DELAY:
        return getDelay();

      case NOTRACE:
        return Boolean.valueOf(isNotrace());

      case TID:
        return Long.valueOf(getTid());

      case ACTION:
        return getAction();

    }
    throw new IllegalStateException();
  }

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

    switch (field) {
      case MODE:
        return isSetMode();
      case FROMUID:
        return isSetFromuid();
      case DESTUID:
        return isSetDestuid();
      case FILE:
        return isSetFile();
      case RULE:
        return isSetRule();
      case INFO:
        return isSetInfo();
      case MD5:
        return isSetMd5();
      case BLOCKSIZE:
        return isSetBlocksize();
      case START:
        return isSetStart();
      case DELAY:
        return isSetDelay();
      case NOTRACE:
        return isSetNotrace();
      case TID:
        return isSetTid();
      case ACTION:
        return isSetAction();
    }
    throw new IllegalStateException();
  }

  @Override
  public final boolean equals(final Object that) {
    if (that == null) {
      return false;
    }
    if (that instanceof R66Request) {
      return equals((R66Request) that);
    }
    return false;
  }

  public final boolean equals(final R66Request that) {
    if (that == null) {
      return false;
    }

    final boolean this_present_mode = isSetMode();
    final boolean that_present_mode = that.isSetMode();
    if (this_present_mode || that_present_mode) {
      if (!(this_present_mode && that_present_mode)) {
        return false;
      }
      if (mode != that.mode) {
        return false;
      }
    }

    final boolean this_present_fromuid = isSetFromuid();
    final boolean that_present_fromuid = that.isSetFromuid();
    if (this_present_fromuid || that_present_fromuid) {
      if (!(this_present_fromuid && that_present_fromuid)) {
        return false;
      }
      if (!fromuid.equals(that.fromuid)) {
        return false;
      }
    }

    final boolean this_present_destuid = isSetDestuid();
    final boolean that_present_destuid = that.isSetDestuid();
    if (this_present_destuid || that_present_destuid) {
      if (!(this_present_destuid && that_present_destuid)) {
        return false;
      }
      if (!destuid.equals(that.destuid)) {
        return false;
      }
    }

    final boolean this_present_file = isSetFile();
    final boolean that_present_file = that.isSetFile();
    if (this_present_file || that_present_file) {
      if (!(this_present_file && that_present_file)) {
        return false;
      }
      if (!file.equals(that.file)) {
        return false;
      }
    }

    final boolean this_present_rule = isSetRule();
    final boolean that_present_rule = that.isSetRule();
    if (this_present_rule || that_present_rule) {
      if (!(this_present_rule && that_present_rule)) {
        return false;
      }
      if (!rule.equals(that.rule)) {
        return false;
      }
    }

    final boolean this_present_info = isSetInfo();
    final boolean that_present_info = that.isSetInfo();
    if (this_present_info || that_present_info) {
      if (!(this_present_info && that_present_info)) {
        return false;
      }
      if (!info.equals(that.info)) {
        return false;
      }
    }

    final boolean this_present_md5 = isSetMd5();
    final boolean that_present_md5 = that.isSetMd5();
    if (this_present_md5 || that_present_md5) {
      if (!(this_present_md5 && that_present_md5)) {
        return false;
      }
      if (md5 != that.md5) {
        return false;
      }
    }

    final boolean this_present_blocksize = isSetBlocksize();
    final boolean that_present_blocksize = that.isSetBlocksize();
    if (this_present_blocksize || that_present_blocksize) {
      if (!(this_present_blocksize && that_present_blocksize)) {
        return false;
      }
      if (blocksize != that.blocksize) {
        return false;
      }
    }

    final boolean this_present_start = isSetStart();
    final boolean that_present_start = that.isSetStart();
    if (this_present_start || that_present_start) {
      if (!(this_present_start && that_present_start)) {
        return false;
      }
      if (!start.equals(that.start)) {
        return false;
      }
    }

    final boolean this_present_delay = isSetDelay();
    final boolean that_present_delay = that.isSetDelay();
    if (this_present_delay || that_present_delay) {
      if (!(this_present_delay && that_present_delay)) {
        return false;
      }
      if (!delay.equals(that.delay)) {
        return false;
      }
    }

    final boolean this_present_notrace = isSetNotrace();
    final boolean that_present_notrace = that.isSetNotrace();
    if (this_present_notrace || that_present_notrace) {
      if (!(this_present_notrace && that_present_notrace)) {
        return false;
      }
      if (notrace != that.notrace) {
        return false;
      }
    }

    final boolean this_present_tid = isSetTid();
    final boolean that_present_tid = that.isSetTid();
    if (this_present_tid || that_present_tid) {
      if (!(this_present_tid && that_present_tid)) {
        return false;
      }
      if (tid != that.tid) {
        return false;
      }
    }

    final boolean this_present_action = isSetAction();
    final boolean that_present_action = that.isSetAction();
    if (this_present_action || that_present_action) {
      if (!(this_present_action && that_present_action)) {
        return false;
      }
      return action == that.action;
    }

    return true;
  }

  @Override
  public final int hashCode() {
    return 0;
  }

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

    int lastComparison;

    lastComparison = Boolean.valueOf(isSetMode()).compareTo(other.isSetMode());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetMode()) {
      lastComparison = TBaseHelper.compareTo(mode, other.mode);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison =
        Boolean.valueOf(isSetFromuid()).compareTo(other.isSetFromuid());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetFromuid()) {
      lastComparison = TBaseHelper.compareTo(fromuid, other.fromuid);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison =
        Boolean.valueOf(isSetDestuid()).compareTo(other.isSetDestuid());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetDestuid()) {
      lastComparison = TBaseHelper.compareTo(destuid, other.destuid);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetFile()).compareTo(other.isSetFile());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetFile()) {
      lastComparison = TBaseHelper.compareTo(file, other.file);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetRule()).compareTo(other.isSetRule());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetRule()) {
      lastComparison = TBaseHelper.compareTo(rule, other.rule);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetInfo()).compareTo(other.isSetInfo());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetInfo()) {
      lastComparison = TBaseHelper.compareTo(info, other.info);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetMd5()).compareTo(other.isSetMd5());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetMd5()) {
      lastComparison = TBaseHelper.compareTo(md5, other.md5);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison =
        Boolean.valueOf(isSetBlocksize()).compareTo(other.isSetBlocksize());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetBlocksize()) {
      lastComparison = TBaseHelper.compareTo(blocksize, other.blocksize);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison =
        Boolean.valueOf(isSetStart()).compareTo(other.isSetStart());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetStart()) {
      lastComparison = TBaseHelper.compareTo(start, other.start);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison =
        Boolean.valueOf(isSetDelay()).compareTo(other.isSetDelay());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetDelay()) {
      lastComparison = TBaseHelper.compareTo(delay, other.delay);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison =
        Boolean.valueOf(isSetNotrace()).compareTo(other.isSetNotrace());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetNotrace()) {
      lastComparison = TBaseHelper.compareTo(notrace, other.notrace);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetTid()).compareTo(other.isSetTid());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTid()) {
      lastComparison = TBaseHelper.compareTo(tid, other.tid);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison =
        Boolean.valueOf(isSetAction()).compareTo(other.isSetAction());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetAction()) {
      lastComparison = TBaseHelper.compareTo(action, other.action);
      return lastComparison;
    }
    return 0;
  }

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

  @Override
  public final void read(final TProtocol iprot) throws TException {
    schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
  }

  @Override
  public final void write(final TProtocol oprot) throws TException {
    schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
  }

  @Override
  public final String toString() {
    final StringBuilder sb = new StringBuilder("R66Request(");

    sb.append("mode:");
    if (mode == null) {
      sb.append("null");
    } else {
      sb.append(mode);
    }
    if (isSetFromuid()) {
      sb.append(", ");
      sb.append("fromuid:");
      if (fromuid == null) {
        sb.append("null");
      } else {
        sb.append(fromuid);
      }
    }
    if (isSetDestuid()) {
      sb.append(", ");
      sb.append("destuid:");
      if (destuid == null) {
        sb.append("null");
      } else {
        sb.append(destuid);
      }
    }
    if (isSetFile()) {
      sb.append(", ");
      sb.append("file:");
      if (file == null) {
        sb.append("null");
      } else {
        sb.append(file);
      }
    }
    if (isSetRule()) {
      sb.append(", ");
      sb.append("rule:");
      if (rule == null) {
        sb.append("null");
      } else {
        sb.append(rule);
      }
    }
    if (isSetInfo()) {
      sb.append(", ");
      sb.append("info:");
      if (info == null) {
        sb.append("null");
      } else {
        sb.append(info);
      }
    }
    if (isSetMd5()) {
      sb.append(", ");
      sb.append("md5:").append(md5);
    }
    if (isSetBlocksize()) {
      sb.append(", ");
      sb.append("blocksize:").append(blocksize);
    }
    if (isSetStart()) {
      sb.append(", ");
      sb.append("start:");
      if (start == null) {
        sb.append("null");
      } else {
        sb.append(start);
      }
    }
    if (isSetDelay()) {
      sb.append(", ");
      sb.append("delay:");
      if (delay == null) {
        sb.append("null");
      } else {
        sb.append(delay);
      }
    }
    if (isSetNotrace()) {
      sb.append(", ");
      sb.append("notrace:").append(notrace);
    }
    if (isSetTid()) {
      sb.append(", ");
      sb.append("tid:").append(tid);
    }
    if (isSetAction()) {
      sb.append(", ");
      sb.append("action:");
      if (action == null) {
        sb.append("null");
      } else {
        sb.append(action);
      }
    }
    sb.append(')');
    return sb.toString();
  }

  public final void validate() throws TException {
    // check for required fields
    if (mode == null) {
      throw new TProtocolException(
          "Required field 'mode' was not present! Struct: " + this);
    }
    // check for sub-struct validity
  }

  private void writeObject(final ObjectOutputStream out) throws IOException {
    try {
      write(new TCompactProtocol(new TIOStreamTransport(out)));
    } catch (final TException te) {
      throw new IOException(te);
    }
  }

  private void readObject(final ObjectInputStream in)
      throws 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.
      issetBitfield = 0;
      read(new TCompactProtocol(new TIOStreamTransport(in)));
    } catch (final TException te) {
      throw new IOException(te);
    }
  }

  private static class R66RequestStandardSchemeFactory
      implements SchemeFactory {
    @Override
    public R66RequestStandardScheme getScheme() {
      return new R66RequestStandardScheme();
    }
  }

  private static class R66RequestStandardScheme
      extends StandardScheme<R66Request> {

    @Override
    public final void read(final TProtocol iprot, final R66Request struct)
        throws TException {
      TField schemeField;
      iprot.readStructBegin();
      while (true) {
        schemeField = iprot.readFieldBegin();
        if (schemeField.type == TType.STOP) {
          break;
        }
        switch (schemeField.id) {
          case 1: // MODE
            if (schemeField.type == TType.I32) {
              struct.mode = RequestMode.findByValue(iprot.readI32());
              struct.setModeIsSet(true);
            } else {
              TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // FROMUID
            if (schemeField.type == TType.STRING) {
              struct.fromuid = iprot.readString();
              struct.setFromuidIsSet(true);
            } else {
              TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // DESTUID
            if (schemeField.type == TType.STRING) {
              struct.destuid = iprot.readString();
              struct.setDestuidIsSet(true);
            } else {
              TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // FILE
            if (schemeField.type == TType.STRING) {
              struct.file = iprot.readString();
              struct.setFileIsSet(true);
            } else {
              TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // RULE
            if (schemeField.type == TType.STRING) {
              struct.rule = iprot.readString();
              struct.setRuleIsSet(true);
            } else {
              TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 10: // INFO
            if (schemeField.type == TType.STRING) {
              struct.info = iprot.readString();
              struct.setInfoIsSet(true);
            } else {
              TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 11: // MD5
            if (schemeField.type == TType.BOOL) {
              struct.md5 = iprot.readBool();
              struct.setMd5IsSet(true);
            } else {
              TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 12: // BLOCKSIZE
            if (schemeField.type == TType.I32) {
              struct.blocksize = iprot.readI32();
              struct.setBlocksizeIsSet(true);
            } else {
              TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 13: // START
            if (schemeField.type == TType.STRING) {
              struct.start = iprot.readString();
              struct.setStartIsSet(true);
            } else {
              TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 14: // DELAY
            if (schemeField.type == TType.STRING) {
              struct.delay = iprot.readString();
              struct.setDelayIsSet(true);
            } else {
              TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 15: // NOTRACE
            if (schemeField.type == TType.BOOL) {
              struct.notrace = iprot.readBool();
              struct.setNotraceIsSet(true);
            } else {
              TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 20: // TID
            if (schemeField.type == TType.I64) {
              struct.tid = iprot.readI64();
              struct.setTidIsSet(true);
            } else {
              TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 21: // ACTION
            if (schemeField.type == TType.I32) {
              struct.action = Action.findByValue(iprot.readI32());
              struct.setActionIsSet(true);
            } else {
              TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          default:
            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();
    }

    @Override
    public final void write(final TProtocol oprot, final R66Request struct)
        throws TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.mode != null) {
        oprot.writeFieldBegin(MODE_FIELD_DESC);
        oprot.writeI32(struct.mode.getValue());
        oprot.writeFieldEnd();
      }
      if (struct.fromuid != null && struct.isSetFromuid()) {
        oprot.writeFieldBegin(FROMUID_FIELD_DESC);
        oprot.writeString(struct.fromuid);
        oprot.writeFieldEnd();
      }
      if (struct.destuid != null && struct.isSetDestuid()) {
        oprot.writeFieldBegin(DESTUID_FIELD_DESC);
        oprot.writeString(struct.destuid);
        oprot.writeFieldEnd();
      }
      if (struct.file != null && struct.isSetFile()) {
        oprot.writeFieldBegin(FILE_FIELD_DESC);
        oprot.writeString(struct.file);
        oprot.writeFieldEnd();
      }
      if (struct.rule != null && struct.isSetRule()) {
        oprot.writeFieldBegin(RULE_FIELD_DESC);
        oprot.writeString(struct.rule);
        oprot.writeFieldEnd();
      }
      if (struct.info != null && struct.isSetInfo()) {
        oprot.writeFieldBegin(INFO_FIELD_DESC);
        oprot.writeString(struct.info);
        oprot.writeFieldEnd();
      }
      if (struct.isSetMd5()) {
        oprot.writeFieldBegin(MD5_FIELD_DESC);
        oprot.writeBool(struct.md5);
        oprot.writeFieldEnd();
      }
      if (struct.isSetBlocksize()) {
        oprot.writeFieldBegin(BLOCKSIZE_FIELD_DESC);
        oprot.writeI32(struct.blocksize);
        oprot.writeFieldEnd();
      }
      if (struct.start != null && struct.isSetStart()) {
        oprot.writeFieldBegin(START_FIELD_DESC);
        oprot.writeString(struct.start);
        oprot.writeFieldEnd();
      }
      if (struct.delay != null && struct.isSetDelay()) {
        oprot.writeFieldBegin(DELAY_FIELD_DESC);
        oprot.writeString(struct.delay);
        oprot.writeFieldEnd();
      }
      if (struct.isSetNotrace()) {
        oprot.writeFieldBegin(NOTRACE_FIELD_DESC);
        oprot.writeBool(struct.notrace);
        oprot.writeFieldEnd();
      }
      if (struct.isSetTid()) {
        oprot.writeFieldBegin(TID_FIELD_DESC);
        oprot.writeI64(struct.tid);
        oprot.writeFieldEnd();
      }
      if (struct.action != null && struct.isSetAction()) {
        oprot.writeFieldBegin(ACTION_FIELD_DESC);
        oprot.writeI32(struct.action.getValue());
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class R66RequestTupleSchemeFactory implements SchemeFactory {
    @Override
    public final R66RequestTupleScheme getScheme() {
      return new R66RequestTupleScheme();
    }
  }

  private static class R66RequestTupleScheme extends TupleScheme<R66Request> {

    @Override
    public final void write(final TProtocol prot, final R66Request struct)
        throws TException {
      final TTupleProtocol oprot = (TTupleProtocol) prot;
      oprot.writeI32(struct.mode.getValue());
      final BitSet optionals = new BitSet();
      if (struct.isSetFromuid()) {
        optionals.set(0);
      }
      if (struct.isSetDestuid()) {
        optionals.set(1);
      }
      if (struct.isSetFile()) {
        optionals.set(2);
      }
      if (struct.isSetRule()) {
        optionals.set(3);
      }
      if (struct.isSetInfo()) {
        optionals.set(4);
      }
      if (struct.isSetMd5()) {
        optionals.set(5);
      }
      if (struct.isSetBlocksize()) {
        optionals.set(6);
      }
      if (struct.isSetStart()) {
        optionals.set(7);
      }
      if (struct.isSetDelay()) {
        optionals.set(8);
      }
      if (struct.isSetNotrace()) {
        optionals.set(9);
      }
      if (struct.isSetTid()) {
        optionals.set(10);
      }
      if (struct.isSetAction()) {
        optionals.set(11);
      }
      oprot.writeBitSet(optionals, 12);
      if (struct.isSetFromuid()) {
        oprot.writeString(struct.fromuid);
      }
      if (struct.isSetDestuid()) {
        oprot.writeString(struct.destuid);
      }
      if (struct.isSetFile()) {
        oprot.writeString(struct.file);
      }
      if (struct.isSetRule()) {
        oprot.writeString(struct.rule);
      }
      if (struct.isSetInfo()) {
        oprot.writeString(struct.info);
      }
      if (struct.isSetMd5()) {
        oprot.writeBool(struct.md5);
      }
      if (struct.isSetBlocksize()) {
        oprot.writeI32(struct.blocksize);
      }
      if (struct.isSetStart()) {
        oprot.writeString(struct.start);
      }
      if (struct.isSetDelay()) {
        oprot.writeString(struct.delay);
      }
      if (struct.isSetNotrace()) {
        oprot.writeBool(struct.notrace);
      }
      if (struct.isSetTid()) {
        oprot.writeI64(struct.tid);
      }
      if (struct.isSetAction()) {
        oprot.writeI32(struct.action.getValue());
      }
    }

    @Override
    public final void read(final TProtocol prot, final R66Request struct)
        throws TException {
      final TTupleProtocol iprot = (TTupleProtocol) prot;
      struct.mode = RequestMode.findByValue(iprot.readI32());
      struct.setModeIsSet(true);
      final BitSet incoming = iprot.readBitSet(12);
      if (incoming.get(0)) {
        struct.fromuid = iprot.readString();
        struct.setFromuidIsSet(true);
      }
      if (incoming.get(1)) {
        struct.destuid = iprot.readString();
        struct.setDestuidIsSet(true);
      }
      if (incoming.get(2)) {
        struct.file = iprot.readString();
        struct.setFileIsSet(true);
      }
      if (incoming.get(3)) {
        struct.rule = iprot.readString();
        struct.setRuleIsSet(true);
      }
      if (incoming.get(4)) {
        struct.info = iprot.readString();
        struct.setInfoIsSet(true);
      }
      if (incoming.get(5)) {
        struct.md5 = iprot.readBool();
        struct.setMd5IsSet(true);
      }
      if (incoming.get(6)) {
        struct.blocksize = iprot.readI32();
        struct.setBlocksizeIsSet(true);
      }
      if (incoming.get(7)) {
        struct.start = iprot.readString();
        struct.setStartIsSet(true);
      }
      if (incoming.get(8)) {
        struct.delay = iprot.readString();
        struct.setDelayIsSet(true);
      }
      if (incoming.get(9)) {
        struct.notrace = iprot.readBool();
        struct.setNotraceIsSet(true);
      }
      if (incoming.get(10)) {
        struct.tid = iprot.readI64();
        struct.setTidIsSet(true);
      }
      if (incoming.get(11)) {
        struct.action = Action.findByValue(iprot.readI32());
        struct.setActionIsSet(true);
      }
    }
  }

}