/*
 * 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.17.0)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package org.apache.fluo.core.thrift;

@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
public class OracleService {

  public interface Iface {

    public Stamps getTimestamps(java.lang.String id, int num) throws org.apache.thrift.TException;

    public boolean isLeader() throws org.apache.thrift.TException;

  }

  public interface AsyncIface {

    public void getTimestamps(java.lang.String id, int num,
        org.apache.thrift.async.AsyncMethodCallback<Stamps> resultHandler)
        throws org.apache.thrift.TException;

    public void isLeader(
        org.apache.thrift.async.AsyncMethodCallback<java.lang.Boolean> resultHandler)
        throws org.apache.thrift.TException;

  }

  public static class Client extends org.apache.thrift.TServiceClient implements Iface {
    public static class Factory implements org.apache.thrift.TServiceClientFactory<Client> {
      public Factory() {}

      @Override
      public Client getClient(org.apache.thrift.protocol.TProtocol prot) {
        return new Client(prot);
      }

      @Override
      public Client getClient(org.apache.thrift.protocol.TProtocol iprot,
          org.apache.thrift.protocol.TProtocol oprot) {
        return new Client(iprot, oprot);
      }
    }

    public Client(org.apache.thrift.protocol.TProtocol prot) {
      super(prot, prot);
    }

    public Client(org.apache.thrift.protocol.TProtocol iprot,
        org.apache.thrift.protocol.TProtocol oprot) {
      super(iprot, oprot);
    }

    @Override
    public Stamps getTimestamps(java.lang.String id, int num) throws org.apache.thrift.TException {
      send_getTimestamps(id, num);
      return recv_getTimestamps();
    }

    public void send_getTimestamps(java.lang.String id, int num)
        throws org.apache.thrift.TException {
      getTimestamps_args args = new getTimestamps_args();
      args.setId(id);
      args.setNum(num);
      sendBase("getTimestamps", args);
    }

    public Stamps recv_getTimestamps() throws org.apache.thrift.TException {
      getTimestamps_result result = new getTimestamps_result();
      receiveBase(result, "getTimestamps");
      if (result.isSetSuccess()) {
        return result.success;
      }
      throw new org.apache.thrift.TApplicationException(
          org.apache.thrift.TApplicationException.MISSING_RESULT,
          "getTimestamps failed: unknown result");
    }

    @Override
    public boolean isLeader() throws org.apache.thrift.TException {
      send_isLeader();
      return recv_isLeader();
    }

    public void send_isLeader() throws org.apache.thrift.TException {
      isLeader_args args = new isLeader_args();
      sendBase("isLeader", args);
    }

    public boolean recv_isLeader() throws org.apache.thrift.TException {
      isLeader_result result = new isLeader_result();
      receiveBase(result, "isLeader");
      if (result.isSetSuccess()) {
        return result.success;
      }
      throw new org.apache.thrift.TApplicationException(
          org.apache.thrift.TApplicationException.MISSING_RESULT,
          "isLeader failed: unknown result");
    }

  }
  public static class AsyncClient extends org.apache.thrift.async.TAsyncClient
      implements AsyncIface {
    public static class Factory
        implements org.apache.thrift.async.TAsyncClientFactory<AsyncClient> {
      private org.apache.thrift.async.TAsyncClientManager clientManager;
      private org.apache.thrift.protocol.TProtocolFactory protocolFactory;

      public Factory(org.apache.thrift.async.TAsyncClientManager clientManager,
          org.apache.thrift.protocol.TProtocolFactory protocolFactory) {
        this.clientManager = clientManager;
        this.protocolFactory = protocolFactory;
      }

      @Override
      public AsyncClient getAsyncClient(
          org.apache.thrift.transport.TNonblockingTransport transport) {
        return new AsyncClient(protocolFactory, clientManager, transport);
      }
    }

    public AsyncClient(org.apache.thrift.protocol.TProtocolFactory protocolFactory,
        org.apache.thrift.async.TAsyncClientManager clientManager,
        org.apache.thrift.transport.TNonblockingTransport transport) {
      super(protocolFactory, clientManager, transport);
    }

    @Override
    public void getTimestamps(java.lang.String id, int num,
        org.apache.thrift.async.AsyncMethodCallback<Stamps> resultHandler)
        throws org.apache.thrift.TException {
      checkReady();
      getTimestamps_call method_call =
          new getTimestamps_call(id, num, resultHandler, this, ___protocolFactory, ___transport);
      this.___currentMethod = method_call;
      ___manager.call(method_call);
    }

    public static class getTimestamps_call
        extends org.apache.thrift.async.TAsyncMethodCall<Stamps> {
      private java.lang.String id;
      private int num;

      public getTimestamps_call(java.lang.String id, int num,
          org.apache.thrift.async.AsyncMethodCallback<Stamps> resultHandler,
          org.apache.thrift.async.TAsyncClient client,
          org.apache.thrift.protocol.TProtocolFactory protocolFactory,
          org.apache.thrift.transport.TNonblockingTransport transport)
          throws org.apache.thrift.TException {
        super(client, protocolFactory, transport, resultHandler, false);
        this.id = id;
        this.num = num;
      }

      @Override
      public void write_args(org.apache.thrift.protocol.TProtocol prot)
          throws org.apache.thrift.TException {
        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getTimestamps",
            org.apache.thrift.protocol.TMessageType.CALL, 0));
        getTimestamps_args args = new getTimestamps_args();
        args.setId(id);
        args.setNum(num);
        args.write(prot);
        prot.writeMessageEnd();
      }

      @Override
      public Stamps getResult() throws org.apache.thrift.TException {
        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
          throw new java.lang.IllegalStateException("Method call not finished!");
        }
        org.apache.thrift.transport.TMemoryInputTransport memoryTransport =
            new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
        org.apache.thrift.protocol.TProtocol prot =
            client.getProtocolFactory().getProtocol(memoryTransport);
        return (new Client(prot)).recv_getTimestamps();
      }
    }

    @Override
    public void isLeader(
        org.apache.thrift.async.AsyncMethodCallback<java.lang.Boolean> resultHandler)
        throws org.apache.thrift.TException {
      checkReady();
      isLeader_call method_call =
          new isLeader_call(resultHandler, this, ___protocolFactory, ___transport);
      this.___currentMethod = method_call;
      ___manager.call(method_call);
    }

    public static class isLeader_call
        extends org.apache.thrift.async.TAsyncMethodCall<java.lang.Boolean> {
      public isLeader_call(
          org.apache.thrift.async.AsyncMethodCallback<java.lang.Boolean> resultHandler,
          org.apache.thrift.async.TAsyncClient client,
          org.apache.thrift.protocol.TProtocolFactory protocolFactory,
          org.apache.thrift.transport.TNonblockingTransport transport)
          throws org.apache.thrift.TException {
        super(client, protocolFactory, transport, resultHandler, false);
      }

      @Override
      public void write_args(org.apache.thrift.protocol.TProtocol prot)
          throws org.apache.thrift.TException {
        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("isLeader",
            org.apache.thrift.protocol.TMessageType.CALL, 0));
        isLeader_args args = new isLeader_args();
        args.write(prot);
        prot.writeMessageEnd();
      }

      @Override
      public java.lang.Boolean getResult() throws org.apache.thrift.TException {
        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
          throw new java.lang.IllegalStateException("Method call not finished!");
        }
        org.apache.thrift.transport.TMemoryInputTransport memoryTransport =
            new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
        org.apache.thrift.protocol.TProtocol prot =
            client.getProtocolFactory().getProtocol(memoryTransport);
        return (new Client(prot)).recv_isLeader();
      }
    }

  }

  public static class Processor<I extends Iface> extends org.apache.thrift.TBaseProcessor<I>
      implements org.apache.thrift.TProcessor {
    private static final org.slf4j.Logger _LOGGER =
        org.slf4j.LoggerFactory.getLogger(Processor.class.getName());

    public Processor(I iface) {
      super(iface, getProcessMap(
          new java.util.HashMap<java.lang.String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>>()));
    }

    protected Processor(I iface,
        java.util.Map<java.lang.String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> processMap) {
      super(iface, getProcessMap(processMap));
    }

    private static <I extends Iface> java.util.Map<java.lang.String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> getProcessMap(
        java.util.Map<java.lang.String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> processMap) {
      processMap.put("getTimestamps", new getTimestamps());
      processMap.put("isLeader", new isLeader());
      return processMap;
    }

    public static class getTimestamps<I extends Iface>
        extends org.apache.thrift.ProcessFunction<I, getTimestamps_args> {
      public getTimestamps() {
        super("getTimestamps");
      }

      @Override
      public getTimestamps_args getEmptyArgsInstance() {
        return new getTimestamps_args();
      }

      @Override
      protected boolean isOneway() {
        return false;
      }

      @Override
      protected boolean rethrowUnhandledExceptions() {
        return false;
      }

      @Override
      public getTimestamps_result getResult(I iface, getTimestamps_args args)
          throws org.apache.thrift.TException {
        getTimestamps_result result = new getTimestamps_result();
        result.success = iface.getTimestamps(args.id, args.num);
        return result;
      }
    }

    public static class isLeader<I extends Iface>
        extends org.apache.thrift.ProcessFunction<I, isLeader_args> {
      public isLeader() {
        super("isLeader");
      }

      @Override
      public isLeader_args getEmptyArgsInstance() {
        return new isLeader_args();
      }

      @Override
      protected boolean isOneway() {
        return false;
      }

      @Override
      protected boolean rethrowUnhandledExceptions() {
        return false;
      }

      @Override
      public isLeader_result getResult(I iface, isLeader_args args)
          throws org.apache.thrift.TException {
        isLeader_result result = new isLeader_result();
        result.success = iface.isLeader();
        result.setSuccessIsSet(true);
        return result;
      }
    }

  }

  public static class AsyncProcessor<I extends AsyncIface>
      extends org.apache.thrift.TBaseAsyncProcessor<I> {
    private static final org.slf4j.Logger _LOGGER =
        org.slf4j.LoggerFactory.getLogger(AsyncProcessor.class.getName());

    public AsyncProcessor(I iface) {
      super(iface, getProcessMap(
          new java.util.HashMap<java.lang.String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>>()));
    }

    protected AsyncProcessor(I iface,
        java.util.Map<java.lang.String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>> processMap) {
      super(iface, getProcessMap(processMap));
    }

    private static <I extends AsyncIface> java.util.Map<java.lang.String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>> getProcessMap(
        java.util.Map<java.lang.String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>> processMap) {
      processMap.put("getTimestamps", new getTimestamps());
      processMap.put("isLeader", new isLeader());
      return processMap;
    }

    public static class getTimestamps<I extends AsyncIface>
        extends org.apache.thrift.AsyncProcessFunction<I, getTimestamps_args, Stamps> {
      public getTimestamps() {
        super("getTimestamps");
      }

      @Override
      public getTimestamps_args getEmptyArgsInstance() {
        return new getTimestamps_args();
      }

      @Override
      public org.apache.thrift.async.AsyncMethodCallback<Stamps> getResultHandler(
          final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb,
          final int seqid) {
        final org.apache.thrift.AsyncProcessFunction fcall = this;
        return new org.apache.thrift.async.AsyncMethodCallback<Stamps>() {
          @Override
          public void onComplete(Stamps o) {
            getTimestamps_result result = new getTimestamps_result();
            result.success = o;
            try {
              fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid);
            } catch (org.apache.thrift.transport.TTransportException e) {
              _LOGGER.error("TTransportException writing to internal frame buffer", e);
              fb.close();
            } catch (java.lang.Exception e) {
              _LOGGER.error("Exception writing to internal frame buffer", e);
              onError(e);
            }
          }

          @Override
          public void onError(java.lang.Exception e) {
            byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
            org.apache.thrift.TSerializable msg;
            getTimestamps_result result = new getTimestamps_result();
            if (e instanceof org.apache.thrift.transport.TTransportException) {
              _LOGGER.error("TTransportException inside handler", e);
              fb.close();
              return;
            } else if (e instanceof org.apache.thrift.TApplicationException) {
              _LOGGER.error("TApplicationException inside handler", e);
              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
              msg = (org.apache.thrift.TApplicationException) e;
            } else {
              _LOGGER.error("Exception inside handler", e);
              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
              msg = new org.apache.thrift.TApplicationException(
                  org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
            }
            try {
              fcall.sendResponse(fb, msg, msgType, seqid);
            } catch (java.lang.Exception ex) {
              _LOGGER.error("Exception writing to internal frame buffer", ex);
              fb.close();
            }
          }
        };
      }

      @Override
      protected boolean isOneway() {
        return false;
      }

      @Override
      public void start(I iface, getTimestamps_args args,
          org.apache.thrift.async.AsyncMethodCallback<Stamps> resultHandler)
          throws org.apache.thrift.TException {
        iface.getTimestamps(args.id, args.num, resultHandler);
      }
    }

    public static class isLeader<I extends AsyncIface>
        extends org.apache.thrift.AsyncProcessFunction<I, isLeader_args, java.lang.Boolean> {
      public isLeader() {
        super("isLeader");
      }

      @Override
      public isLeader_args getEmptyArgsInstance() {
        return new isLeader_args();
      }

      @Override
      public org.apache.thrift.async.AsyncMethodCallback<java.lang.Boolean> getResultHandler(
          final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb,
          final int seqid) {
        final org.apache.thrift.AsyncProcessFunction fcall = this;
        return new org.apache.thrift.async.AsyncMethodCallback<java.lang.Boolean>() {
          @Override
          public void onComplete(java.lang.Boolean o) {
            isLeader_result result = new isLeader_result();
            result.success = o;
            result.setSuccessIsSet(true);
            try {
              fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid);
            } catch (org.apache.thrift.transport.TTransportException e) {
              _LOGGER.error("TTransportException writing to internal frame buffer", e);
              fb.close();
            } catch (java.lang.Exception e) {
              _LOGGER.error("Exception writing to internal frame buffer", e);
              onError(e);
            }
          }

          @Override
          public void onError(java.lang.Exception e) {
            byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
            org.apache.thrift.TSerializable msg;
            isLeader_result result = new isLeader_result();
            if (e instanceof org.apache.thrift.transport.TTransportException) {
              _LOGGER.error("TTransportException inside handler", e);
              fb.close();
              return;
            } else if (e instanceof org.apache.thrift.TApplicationException) {
              _LOGGER.error("TApplicationException inside handler", e);
              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
              msg = (org.apache.thrift.TApplicationException) e;
            } else {
              _LOGGER.error("Exception inside handler", e);
              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
              msg = new org.apache.thrift.TApplicationException(
                  org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
            }
            try {
              fcall.sendResponse(fb, msg, msgType, seqid);
            } catch (java.lang.Exception ex) {
              _LOGGER.error("Exception writing to internal frame buffer", ex);
              fb.close();
            }
          }
        };
      }

      @Override
      protected boolean isOneway() {
        return false;
      }

      @Override
      public void start(I iface, isLeader_args args,
          org.apache.thrift.async.AsyncMethodCallback<java.lang.Boolean> resultHandler)
          throws org.apache.thrift.TException {
        iface.isLeader(resultHandler);
      }
    }

  }

  @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
  public static class getTimestamps_args
      implements org.apache.thrift.TBase<getTimestamps_args, getTimestamps_args._Fields>,
      java.io.Serializable, Cloneable, Comparable<getTimestamps_args> {
    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC =
        new org.apache.thrift.protocol.TStruct("getTimestamps_args");

    private static final org.apache.thrift.protocol.TField ID_FIELD_DESC =
        new org.apache.thrift.protocol.TField("id", org.apache.thrift.protocol.TType.STRING,
            (short) 1);
    private static final org.apache.thrift.protocol.TField NUM_FIELD_DESC =
        new org.apache.thrift.protocol.TField("num", org.apache.thrift.protocol.TType.I32,
            (short) 2);

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

    public @org.apache.thrift.annotation.Nullable java.lang.String id; // required
    public int num; // required

    /**
     * The set of fields this struct contains, along with convenience methods for finding and
     * manipulating them.
     */
    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
      ID((short) 1, "id"), NUM((short) 2, "num");

      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: // ID
            return ID;
          case 2: // NUM
            return NUM;
          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;
      }

      @Override
      public short getThriftFieldId() {
        return _thriftId;
      }

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

    // isset id assignments
    private static final int __NUM_ISSET_ID = 0;
    private byte __isset_bitfield = 0;
    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.ID,
          new org.apache.thrift.meta_data.FieldMetaData("id",
              org.apache.thrift.TFieldRequirementType.DEFAULT,
              new org.apache.thrift.meta_data.FieldValueMetaData(
                  org.apache.thrift.protocol.TType.STRING)));
      tmpMap.put(_Fields.NUM,
          new org.apache.thrift.meta_data.FieldMetaData("num",
              org.apache.thrift.TFieldRequirementType.DEFAULT,
              new org.apache.thrift.meta_data.FieldValueMetaData(
                  org.apache.thrift.protocol.TType.I32)));
      metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getTimestamps_args.class,
          metaDataMap);
    }

    public getTimestamps_args() {}

    public getTimestamps_args(java.lang.String id, int num) {
      this();
      this.id = id;
      this.num = num;
      setNumIsSet(true);
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getTimestamps_args(getTimestamps_args other) {
      __isset_bitfield = other.__isset_bitfield;
      if (other.isSetId()) {
        this.id = other.id;
      }
      this.num = other.num;
    }

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

    @Override
    public void clear() {
      this.id = null;
      setNumIsSet(false);
      this.num = 0;
    }

    @org.apache.thrift.annotation.Nullable
    public java.lang.String getId() {
      return this.id;
    }

    public getTimestamps_args setId(@org.apache.thrift.annotation.Nullable java.lang.String id) {
      this.id = id;
      return this;
    }

    public void unsetId() {
      this.id = null;
    }

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

    public void setIdIsSet(boolean value) {
      if (!value) {
        this.id = null;
      }
    }

    public int getNum() {
      return this.num;
    }

    public getTimestamps_args setNum(int num) {
      this.num = num;
      setNumIsSet(true);
      return this;
    }

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

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

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

    @Override
    public void setFieldValue(_Fields field,
        @org.apache.thrift.annotation.Nullable java.lang.Object value) {
      switch (field) {
        case ID:
          if (value == null) {
            unsetId();
          } else {
            setId((java.lang.String) value);
          }
          break;

        case NUM:
          if (value == null) {
            unsetNum();
          } else {
            setNum((java.lang.Integer) value);
          }
          break;

      }
    }

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

        case NUM:
          return getNum();

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

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

      switch (field) {
        case ID:
          return isSetId();
        case NUM:
          return isSetNum();
      }
      throw new java.lang.IllegalStateException();
    }

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

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

      boolean this_present_id = true && this.isSetId();
      boolean that_present_id = true && that.isSetId();
      if (this_present_id || that_present_id) {
        if (!(this_present_id && that_present_id))
          return false;
        if (!this.id.equals(that.id))
          return false;
      }

      boolean this_present_num = true;
      boolean that_present_num = true;
      if (this_present_num || that_present_num) {
        if (!(this_present_num && that_present_num))
          return false;
        if (this.num != that.num)
          return false;
      }

      return true;
    }

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

      hashCode = hashCode * 8191 + ((isSetId()) ? 131071 : 524287);
      if (isSetId())
        hashCode = hashCode * 8191 + id.hashCode();

      hashCode = hashCode * 8191 + num;

      return hashCode;
    }

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

      int lastComparison = 0;

      lastComparison = java.lang.Boolean.compare(isSetId(), other.isSetId());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetId()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.id, other.id);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = java.lang.Boolean.compare(isSetNum(), other.isSetNum());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetNum()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.num, other.num);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      return 0;
    }

    @org.apache.thrift.annotation.Nullable
    @Override
    public _Fields fieldForId(int fieldId) {
      return _Fields.findByThriftId(fieldId);
    }

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

    @Override
    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("getTimestamps_args(");
      boolean first = true;

      sb.append("id:");
      if (this.id == null) {
        sb.append("null");
      } else {
        sb.append(this.id);
      }
      first = false;
      if (!first)
        sb.append(", ");
      sb.append("num:");
      sb.append(this.num);
      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 {
        // 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 getTimestamps_argsStandardSchemeFactory
        implements org.apache.thrift.scheme.SchemeFactory {
      @Override
      public getTimestamps_argsStandardScheme getScheme() {
        return new getTimestamps_argsStandardScheme();
      }
    }

    private static class getTimestamps_argsStandardScheme
        extends org.apache.thrift.scheme.StandardScheme<getTimestamps_args> {

      @Override
      public void read(org.apache.thrift.protocol.TProtocol iprot, getTimestamps_args 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: // ID
              if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
                struct.id = iprot.readString();
                struct.setIdIsSet(true);
              } else {
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            case 2: // NUM
              if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
                struct.num = iprot.readI32();
                struct.setNumIsSet(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();
      }

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

        oprot.writeStructBegin(STRUCT_DESC);
        if (struct.id != null) {
          oprot.writeFieldBegin(ID_FIELD_DESC);
          oprot.writeString(struct.id);
          oprot.writeFieldEnd();
        }
        oprot.writeFieldBegin(NUM_FIELD_DESC);
        oprot.writeI32(struct.num);
        oprot.writeFieldEnd();
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class getTimestamps_argsTupleSchemeFactory
        implements org.apache.thrift.scheme.SchemeFactory {
      @Override
      public getTimestamps_argsTupleScheme getScheme() {
        return new getTimestamps_argsTupleScheme();
      }
    }

    private static class getTimestamps_argsTupleScheme
        extends org.apache.thrift.scheme.TupleScheme<getTimestamps_args> {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, getTimestamps_args 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.isSetId()) {
          optionals.set(0);
        }
        if (struct.isSetNum()) {
          optionals.set(1);
        }
        oprot.writeBitSet(optionals, 2);
        if (struct.isSetId()) {
          oprot.writeString(struct.id);
        }
        if (struct.isSetNum()) {
          oprot.writeI32(struct.num);
        }
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, getTimestamps_args struct)
          throws org.apache.thrift.TException {
        org.apache.thrift.protocol.TTupleProtocol iprot =
            (org.apache.thrift.protocol.TTupleProtocol) prot;
        java.util.BitSet incoming = iprot.readBitSet(2);
        if (incoming.get(0)) {
          struct.id = iprot.readString();
          struct.setIdIsSet(true);
        }
        if (incoming.get(1)) {
          struct.num = iprot.readI32();
          struct.setNumIsSet(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();
    }
  }

  @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
  public static class getTimestamps_result
      implements org.apache.thrift.TBase<getTimestamps_result, getTimestamps_result._Fields>,
      java.io.Serializable, Cloneable, Comparable<getTimestamps_result> {
    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC =
        new org.apache.thrift.protocol.TStruct("getTimestamps_result");

    private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC =
        new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRUCT,
            (short) 0);

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

    public @org.apache.thrift.annotation.Nullable Stamps success; // required

    /**
     * The set of fields this struct contains, along with convenience methods for finding and
     * manipulating them.
     */
    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
      SUCCESS((short) 0, "success");

      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 0: // SUCCESS
            return SUCCESS;
          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;
      }

      @Override
      public short getThriftFieldId() {
        return _thriftId;
      }

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

    // isset id assignments
    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.SUCCESS,
          new org.apache.thrift.meta_data.FieldMetaData("success",
              org.apache.thrift.TFieldRequirementType.DEFAULT,
              new org.apache.thrift.meta_data.StructMetaData(
                  org.apache.thrift.protocol.TType.STRUCT, Stamps.class)));
      metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getTimestamps_result.class,
          metaDataMap);
    }

    public getTimestamps_result() {}

    public getTimestamps_result(Stamps success) {
      this();
      this.success = success;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getTimestamps_result(getTimestamps_result other) {
      if (other.isSetSuccess()) {
        this.success = new Stamps(other.success);
      }
    }

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

    @Override
    public void clear() {
      this.success = null;
    }

    @org.apache.thrift.annotation.Nullable
    public Stamps getSuccess() {
      return this.success;
    }

    public getTimestamps_result setSuccess(@org.apache.thrift.annotation.Nullable Stamps success) {
      this.success = success;
      return this;
    }

    public void unsetSuccess() {
      this.success = null;
    }

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

    public void setSuccessIsSet(boolean value) {
      if (!value) {
        this.success = null;
      }
    }

    @Override
    public void setFieldValue(_Fields field,
        @org.apache.thrift.annotation.Nullable java.lang.Object value) {
      switch (field) {
        case SUCCESS:
          if (value == null) {
            unsetSuccess();
          } else {
            setSuccess((Stamps) value);
          }
          break;

      }
    }

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

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

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

      switch (field) {
        case SUCCESS:
          return isSetSuccess();
      }
      throw new java.lang.IllegalStateException();
    }

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

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

      boolean this_present_success = true && this.isSetSuccess();
      boolean that_present_success = true && that.isSetSuccess();
      if (this_present_success || that_present_success) {
        if (!(this_present_success && that_present_success))
          return false;
        if (!this.success.equals(that.success))
          return false;
      }

      return true;
    }

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

      hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287);
      if (isSetSuccess())
        hashCode = hashCode * 8191 + success.hashCode();

      return hashCode;
    }

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

      int lastComparison = 0;

      lastComparison = java.lang.Boolean.compare(isSetSuccess(), other.isSetSuccess());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetSuccess()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      return 0;
    }

    @org.apache.thrift.annotation.Nullable
    @Override
    public _Fields fieldForId(int fieldId) {
      return _Fields.findByThriftId(fieldId);
    }

    @Override
    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("getTimestamps_result(");
      boolean first = true;

      sb.append("success:");
      if (this.success == null) {
        sb.append("null");
      } else {
        sb.append(this.success);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

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

    private void readObject(java.io.ObjectInputStream in)
        throws java.io.IOException, java.lang.ClassNotFoundException {
      try {
        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 getTimestamps_resultStandardSchemeFactory
        implements org.apache.thrift.scheme.SchemeFactory {
      @Override
      public getTimestamps_resultStandardScheme getScheme() {
        return new getTimestamps_resultStandardScheme();
      }
    }

    private static class getTimestamps_resultStandardScheme
        extends org.apache.thrift.scheme.StandardScheme<getTimestamps_result> {

      @Override
      public void read(org.apache.thrift.protocol.TProtocol iprot, getTimestamps_result 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 0: // SUCCESS
              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                struct.success = new Stamps();
                struct.success.read(iprot);
                struct.setSuccessIsSet(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();
      }

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

        oprot.writeStructBegin(STRUCT_DESC);
        if (struct.success != null) {
          oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
          struct.success.write(oprot);
          oprot.writeFieldEnd();
        }
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class getTimestamps_resultTupleSchemeFactory
        implements org.apache.thrift.scheme.SchemeFactory {
      @Override
      public getTimestamps_resultTupleScheme getScheme() {
        return new getTimestamps_resultTupleScheme();
      }
    }

    private static class getTimestamps_resultTupleScheme
        extends org.apache.thrift.scheme.TupleScheme<getTimestamps_result> {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, getTimestamps_result 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.isSetSuccess()) {
          optionals.set(0);
        }
        oprot.writeBitSet(optionals, 1);
        if (struct.isSetSuccess()) {
          struct.success.write(oprot);
        }
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, getTimestamps_result struct)
          throws org.apache.thrift.TException {
        org.apache.thrift.protocol.TTupleProtocol iprot =
            (org.apache.thrift.protocol.TTupleProtocol) prot;
        java.util.BitSet incoming = iprot.readBitSet(1);
        if (incoming.get(0)) {
          struct.success = new Stamps();
          struct.success.read(iprot);
          struct.setSuccessIsSet(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();
    }
  }

  @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
  public static class isLeader_args
      implements org.apache.thrift.TBase<isLeader_args, isLeader_args._Fields>,
      java.io.Serializable, Cloneable, Comparable<isLeader_args> {
    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC =
        new org.apache.thrift.protocol.TStruct("isLeader_args");


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


    /**
     * The set of fields this struct contains, along with convenience methods for finding and
     * manipulating them.
     */
    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
      ;

      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) {
          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;
      }

      @Override
      public short getThriftFieldId() {
        return _thriftId;
      }

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

    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);
      metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(isLeader_args.class,
          metaDataMap);
    }

    public isLeader_args() {}

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public isLeader_args(isLeader_args other) {}

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

    @Override
    public void clear() {}

    @Override
    public void setFieldValue(_Fields field,
        @org.apache.thrift.annotation.Nullable java.lang.Object value) {
      switch (field) {
      }
    }

    @org.apache.thrift.annotation.Nullable
    @Override
    public java.lang.Object getFieldValue(_Fields field) {
      switch (field) {
      }
      throw new java.lang.IllegalStateException();
    }

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

      switch (field) {
      }
      throw new java.lang.IllegalStateException();
    }

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

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

      return true;
    }

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

      return hashCode;
    }

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

      int lastComparison = 0;

      return 0;
    }

    @org.apache.thrift.annotation.Nullable
    @Override
    public _Fields fieldForId(int fieldId) {
      return _Fields.findByThriftId(fieldId);
    }

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

    @Override
    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("isLeader_args(");
      boolean first = true;

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

    private static class isLeader_argsStandardScheme
        extends org.apache.thrift.scheme.StandardScheme<isLeader_args> {

      @Override
      public void read(org.apache.thrift.protocol.TProtocol iprot, isLeader_args 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) {
            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();
      }

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

        oprot.writeStructBegin(STRUCT_DESC);
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class isLeader_argsTupleSchemeFactory
        implements org.apache.thrift.scheme.SchemeFactory {
      @Override
      public isLeader_argsTupleScheme getScheme() {
        return new isLeader_argsTupleScheme();
      }
    }

    private static class isLeader_argsTupleScheme
        extends org.apache.thrift.scheme.TupleScheme<isLeader_args> {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, isLeader_args struct)
          throws org.apache.thrift.TException {
        org.apache.thrift.protocol.TTupleProtocol oprot =
            (org.apache.thrift.protocol.TTupleProtocol) prot;
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, isLeader_args struct)
          throws org.apache.thrift.TException {
        org.apache.thrift.protocol.TTupleProtocol iprot =
            (org.apache.thrift.protocol.TTupleProtocol) prot;
      }
    }

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

  @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
  public static class isLeader_result
      implements org.apache.thrift.TBase<isLeader_result, isLeader_result._Fields>,
      java.io.Serializable, Cloneable, Comparable<isLeader_result> {
    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC =
        new org.apache.thrift.protocol.TStruct("isLeader_result");

    private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC =
        new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.BOOL,
            (short) 0);

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

    public boolean success; // required

    /**
     * The set of fields this struct contains, along with convenience methods for finding and
     * manipulating them.
     */
    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
      SUCCESS((short) 0, "success");

      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 0: // SUCCESS
            return SUCCESS;
          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;
      }

      @Override
      public short getThriftFieldId() {
        return _thriftId;
      }

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

    // isset id assignments
    private static final int __SUCCESS_ISSET_ID = 0;
    private byte __isset_bitfield = 0;
    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.SUCCESS,
          new org.apache.thrift.meta_data.FieldMetaData("success",
              org.apache.thrift.TFieldRequirementType.DEFAULT,
              new org.apache.thrift.meta_data.FieldValueMetaData(
                  org.apache.thrift.protocol.TType.BOOL)));
      metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(isLeader_result.class,
          metaDataMap);
    }

    public isLeader_result() {}

    public isLeader_result(boolean success) {
      this();
      this.success = success;
      setSuccessIsSet(true);
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public isLeader_result(isLeader_result other) {
      __isset_bitfield = other.__isset_bitfield;
      this.success = other.success;
    }

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

    @Override
    public void clear() {
      setSuccessIsSet(false);
      this.success = false;
    }

    public boolean isSuccess() {
      return this.success;
    }

    public isLeader_result setSuccess(boolean success) {
      this.success = success;
      setSuccessIsSet(true);
      return this;
    }

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

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

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

    @Override
    public void setFieldValue(_Fields field,
        @org.apache.thrift.annotation.Nullable java.lang.Object value) {
      switch (field) {
        case SUCCESS:
          if (value == null) {
            unsetSuccess();
          } else {
            setSuccess((java.lang.Boolean) value);
          }
          break;

      }
    }

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

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

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

      switch (field) {
        case SUCCESS:
          return isSetSuccess();
      }
      throw new java.lang.IllegalStateException();
    }

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

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

      boolean this_present_success = true;
      boolean that_present_success = true;
      if (this_present_success || that_present_success) {
        if (!(this_present_success && that_present_success))
          return false;
        if (this.success != that.success)
          return false;
      }

      return true;
    }

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

      hashCode = hashCode * 8191 + ((success) ? 131071 : 524287);

      return hashCode;
    }

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

      int lastComparison = 0;

      lastComparison = java.lang.Boolean.compare(isSetSuccess(), other.isSetSuccess());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetSuccess()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      return 0;
    }

    @org.apache.thrift.annotation.Nullable
    @Override
    public _Fields fieldForId(int fieldId) {
      return _Fields.findByThriftId(fieldId);
    }

    @Override
    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("isLeader_result(");
      boolean first = true;

      sb.append("success:");
      sb.append(this.success);
      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 {
        // 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 isLeader_resultStandardSchemeFactory
        implements org.apache.thrift.scheme.SchemeFactory {
      @Override
      public isLeader_resultStandardScheme getScheme() {
        return new isLeader_resultStandardScheme();
      }
    }

    private static class isLeader_resultStandardScheme
        extends org.apache.thrift.scheme.StandardScheme<isLeader_result> {

      @Override
      public void read(org.apache.thrift.protocol.TProtocol iprot, isLeader_result 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 0: // SUCCESS
              if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
                struct.success = iprot.readBool();
                struct.setSuccessIsSet(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();
      }

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

        oprot.writeStructBegin(STRUCT_DESC);
        if (struct.isSetSuccess()) {
          oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
          oprot.writeBool(struct.success);
          oprot.writeFieldEnd();
        }
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class isLeader_resultTupleSchemeFactory
        implements org.apache.thrift.scheme.SchemeFactory {
      @Override
      public isLeader_resultTupleScheme getScheme() {
        return new isLeader_resultTupleScheme();
      }
    }

    private static class isLeader_resultTupleScheme
        extends org.apache.thrift.scheme.TupleScheme<isLeader_result> {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, isLeader_result 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.isSetSuccess()) {
          optionals.set(0);
        }
        oprot.writeBitSet(optionals, 1);
        if (struct.isSetSuccess()) {
          oprot.writeBool(struct.success);
        }
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, isLeader_result struct)
          throws org.apache.thrift.TException {
        org.apache.thrift.protocol.TTupleProtocol iprot =
            (org.apache.thrift.protocol.TTupleProtocol) prot;
        java.util.BitSet incoming = iprot.readBitSet(1);
        if (incoming.get(0)) {
          struct.success = iprot.readBool();
          struct.setSuccessIsSet(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();
    }
  }

}
