/**
 * Autogenerated by Thrift
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.Set;
import java.util.HashSet;
import java.util.Collections;
import java.util.BitSet;
import java.util.Arrays;
import com.facebook.thrift.*;
import com.facebook.thrift.annotations.*;
import com.facebook.thrift.async.*;
import com.facebook.thrift.meta_data.*;
import com.facebook.thrift.server.*;
import com.facebook.thrift.transport.*;
import com.facebook.thrift.protocol.*;

@SuppressWarnings({ "unused", "serial" })
public class SendSnapshotRequest implements TBase, java.io.Serializable, Cloneable, Comparable<SendSnapshotRequest> {
  private static final TStruct STRUCT_DESC = new TStruct("SendSnapshotRequest");
  private static final TField SPACE_FIELD_DESC = new TField("space", TType.I32, (short)1);
  private static final TField PART_FIELD_DESC = new TField("part", TType.I32, (short)2);
  private static final TField CURRENT_TERM_FIELD_DESC = new TField("current_term", TType.I64, (short)3);
  private static final TField COMMITTED_LOG_ID_FIELD_DESC = new TField("committed_log_id", TType.I64, (short)4);
  private static final TField COMMITTED_LOG_TERM_FIELD_DESC = new TField("committed_log_term", TType.I64, (short)5);
  private static final TField LEADER_ADDR_FIELD_DESC = new TField("leader_addr", TType.STRING, (short)6);
  private static final TField LEADER_PORT_FIELD_DESC = new TField("leader_port", TType.I32, (short)7);
  private static final TField ROWS_FIELD_DESC = new TField("rows", TType.LIST, (short)8);
  private static final TField TOTAL_SIZE_FIELD_DESC = new TField("total_size", TType.I64, (short)9);
  private static final TField TOTAL_COUNT_FIELD_DESC = new TField("total_count", TType.I64, (short)10);
  private static final TField DONE_FIELD_DESC = new TField("done", TType.BOOL, (short)11);

  public int space;
  public int part;
  public long current_term;
  public long committed_log_id;
  public long committed_log_term;
  public String leader_addr;
  public int leader_port;
  public List<byte[]> rows;
  public long total_size;
  public long total_count;
  public boolean done;
  public static final int SPACE = 1;
  public static final int PART = 2;
  public static final int CURRENT_TERM = 3;
  public static final int COMMITTED_LOG_ID = 4;
  public static final int COMMITTED_LOG_TERM = 5;
  public static final int LEADER_ADDR = 6;
  public static final int LEADER_PORT = 7;
  public static final int ROWS = 8;
  public static final int TOTAL_SIZE = 9;
  public static final int TOTAL_COUNT = 10;
  public static final int DONE = 11;

  // isset id assignments
  private static final int __SPACE_ISSET_ID = 0;
  private static final int __PART_ISSET_ID = 1;
  private static final int __CURRENT_TERM_ISSET_ID = 2;
  private static final int __COMMITTED_LOG_ID_ISSET_ID = 3;
  private static final int __COMMITTED_LOG_TERM_ISSET_ID = 4;
  private static final int __LEADER_PORT_ISSET_ID = 5;
  private static final int __TOTAL_SIZE_ISSET_ID = 6;
  private static final int __TOTAL_COUNT_ISSET_ID = 7;
  private static final int __DONE_ISSET_ID = 8;
  private BitSet __isset_bit_vector = new BitSet(9);

  public static final Map<Integer, FieldMetaData> metaDataMap;

  static {
    Map<Integer, FieldMetaData> tmpMetaDataMap = new HashMap<Integer, FieldMetaData>();
    tmpMetaDataMap.put(SPACE, new FieldMetaData("space", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I32)));
    tmpMetaDataMap.put(PART, new FieldMetaData("part", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I32)));
    tmpMetaDataMap.put(CURRENT_TERM, new FieldMetaData("current_term", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
    tmpMetaDataMap.put(COMMITTED_LOG_ID, new FieldMetaData("committed_log_id", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
    tmpMetaDataMap.put(COMMITTED_LOG_TERM, new FieldMetaData("committed_log_term", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
    tmpMetaDataMap.put(LEADER_ADDR, new FieldMetaData("leader_addr", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    tmpMetaDataMap.put(LEADER_PORT, new FieldMetaData("leader_port", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I32)));
    tmpMetaDataMap.put(ROWS, new FieldMetaData("rows", TFieldRequirementType.DEFAULT, 
        new ListMetaData(TType.LIST, 
            new FieldValueMetaData(TType.STRING))));
    tmpMetaDataMap.put(TOTAL_SIZE, new FieldMetaData("total_size", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
    tmpMetaDataMap.put(TOTAL_COUNT, new FieldMetaData("total_count", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
    tmpMetaDataMap.put(DONE, new FieldMetaData("done", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.BOOL)));
    metaDataMap = Collections.unmodifiableMap(tmpMetaDataMap);
  }

  static {
    FieldMetaData.addStructMetaDataMap(SendSnapshotRequest.class, metaDataMap);
  }

  public SendSnapshotRequest() {
  }

  public SendSnapshotRequest(
      int space,
      int part,
      long current_term,
      long committed_log_id,
      long committed_log_term,
      String leader_addr,
      int leader_port,
      List<byte[]> rows,
      long total_size,
      long total_count,
      boolean done) {
    this();
    this.space = space;
    setSpaceIsSet(true);
    this.part = part;
    setPartIsSet(true);
    this.current_term = current_term;
    setCurrent_termIsSet(true);
    this.committed_log_id = committed_log_id;
    setCommitted_log_idIsSet(true);
    this.committed_log_term = committed_log_term;
    setCommitted_log_termIsSet(true);
    this.leader_addr = leader_addr;
    this.leader_port = leader_port;
    setLeader_portIsSet(true);
    this.rows = rows;
    this.total_size = total_size;
    setTotal_sizeIsSet(true);
    this.total_count = total_count;
    setTotal_countIsSet(true);
    this.done = done;
    setDoneIsSet(true);
  }

  public static class Builder {
    private int space;
    private int part;
    private long current_term;
    private long committed_log_id;
    private long committed_log_term;
    private String leader_addr;
    private int leader_port;
    private List<byte[]> rows;
    private long total_size;
    private long total_count;
    private boolean done;

    BitSet __optional_isset = new BitSet(9);

    public Builder() {
    }

    public Builder setSpace(final int space) {
      this.space = space;
      __optional_isset.set(__SPACE_ISSET_ID, true);
      return this;
    }

    public Builder setPart(final int part) {
      this.part = part;
      __optional_isset.set(__PART_ISSET_ID, true);
      return this;
    }

    public Builder setCurrent_term(final long current_term) {
      this.current_term = current_term;
      __optional_isset.set(__CURRENT_TERM_ISSET_ID, true);
      return this;
    }

    public Builder setCommitted_log_id(final long committed_log_id) {
      this.committed_log_id = committed_log_id;
      __optional_isset.set(__COMMITTED_LOG_ID_ISSET_ID, true);
      return this;
    }

    public Builder setCommitted_log_term(final long committed_log_term) {
      this.committed_log_term = committed_log_term;
      __optional_isset.set(__COMMITTED_LOG_TERM_ISSET_ID, true);
      return this;
    }

    public Builder setLeader_addr(final String leader_addr) {
      this.leader_addr = leader_addr;
      return this;
    }

    public Builder setLeader_port(final int leader_port) {
      this.leader_port = leader_port;
      __optional_isset.set(__LEADER_PORT_ISSET_ID, true);
      return this;
    }

    public Builder setRows(final List<byte[]> rows) {
      this.rows = rows;
      return this;
    }

    public Builder setTotal_size(final long total_size) {
      this.total_size = total_size;
      __optional_isset.set(__TOTAL_SIZE_ISSET_ID, true);
      return this;
    }

    public Builder setTotal_count(final long total_count) {
      this.total_count = total_count;
      __optional_isset.set(__TOTAL_COUNT_ISSET_ID, true);
      return this;
    }

    public Builder setDone(final boolean done) {
      this.done = done;
      __optional_isset.set(__DONE_ISSET_ID, true);
      return this;
    }

    public SendSnapshotRequest build() {
      SendSnapshotRequest result = new SendSnapshotRequest();
      if (__optional_isset.get(__SPACE_ISSET_ID)) {
        result.setSpace(this.space);
      }
      if (__optional_isset.get(__PART_ISSET_ID)) {
        result.setPart(this.part);
      }
      if (__optional_isset.get(__CURRENT_TERM_ISSET_ID)) {
        result.setCurrent_term(this.current_term);
      }
      if (__optional_isset.get(__COMMITTED_LOG_ID_ISSET_ID)) {
        result.setCommitted_log_id(this.committed_log_id);
      }
      if (__optional_isset.get(__COMMITTED_LOG_TERM_ISSET_ID)) {
        result.setCommitted_log_term(this.committed_log_term);
      }
      result.setLeader_addr(this.leader_addr);
      if (__optional_isset.get(__LEADER_PORT_ISSET_ID)) {
        result.setLeader_port(this.leader_port);
      }
      result.setRows(this.rows);
      if (__optional_isset.get(__TOTAL_SIZE_ISSET_ID)) {
        result.setTotal_size(this.total_size);
      }
      if (__optional_isset.get(__TOTAL_COUNT_ISSET_ID)) {
        result.setTotal_count(this.total_count);
      }
      if (__optional_isset.get(__DONE_ISSET_ID)) {
        result.setDone(this.done);
      }
      return result;
    }
  }

  public static Builder builder() {
    return new Builder();
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public SendSnapshotRequest(SendSnapshotRequest other) {
    __isset_bit_vector.clear();
    __isset_bit_vector.or(other.__isset_bit_vector);
    this.space = TBaseHelper.deepCopy(other.space);
    this.part = TBaseHelper.deepCopy(other.part);
    this.current_term = TBaseHelper.deepCopy(other.current_term);
    this.committed_log_id = TBaseHelper.deepCopy(other.committed_log_id);
    this.committed_log_term = TBaseHelper.deepCopy(other.committed_log_term);
    if (other.isSetLeader_addr()) {
      this.leader_addr = TBaseHelper.deepCopy(other.leader_addr);
    }
    this.leader_port = TBaseHelper.deepCopy(other.leader_port);
    if (other.isSetRows()) {
      this.rows = TBaseHelper.deepCopy(other.rows);
    }
    this.total_size = TBaseHelper.deepCopy(other.total_size);
    this.total_count = TBaseHelper.deepCopy(other.total_count);
    this.done = TBaseHelper.deepCopy(other.done);
  }

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

  public int getSpace() {
    return this.space;
  }

  public SendSnapshotRequest setSpace(int space) {
    this.space = space;
    setSpaceIsSet(true);
    return this;
  }

  public void unsetSpace() {
    __isset_bit_vector.clear(__SPACE_ISSET_ID);
  }

  // Returns true if field space is set (has been assigned a value) and false otherwise
  public boolean isSetSpace() {
    return __isset_bit_vector.get(__SPACE_ISSET_ID);
  }

  public void setSpaceIsSet(boolean __value) {
    __isset_bit_vector.set(__SPACE_ISSET_ID, __value);
  }

  public int getPart() {
    return this.part;
  }

  public SendSnapshotRequest setPart(int part) {
    this.part = part;
    setPartIsSet(true);
    return this;
  }

  public void unsetPart() {
    __isset_bit_vector.clear(__PART_ISSET_ID);
  }

  // Returns true if field part is set (has been assigned a value) and false otherwise
  public boolean isSetPart() {
    return __isset_bit_vector.get(__PART_ISSET_ID);
  }

  public void setPartIsSet(boolean __value) {
    __isset_bit_vector.set(__PART_ISSET_ID, __value);
  }

  public long getCurrent_term() {
    return this.current_term;
  }

  public SendSnapshotRequest setCurrent_term(long current_term) {
    this.current_term = current_term;
    setCurrent_termIsSet(true);
    return this;
  }

  public void unsetCurrent_term() {
    __isset_bit_vector.clear(__CURRENT_TERM_ISSET_ID);
  }

  // Returns true if field current_term is set (has been assigned a value) and false otherwise
  public boolean isSetCurrent_term() {
    return __isset_bit_vector.get(__CURRENT_TERM_ISSET_ID);
  }

  public void setCurrent_termIsSet(boolean __value) {
    __isset_bit_vector.set(__CURRENT_TERM_ISSET_ID, __value);
  }

  public long getCommitted_log_id() {
    return this.committed_log_id;
  }

  public SendSnapshotRequest setCommitted_log_id(long committed_log_id) {
    this.committed_log_id = committed_log_id;
    setCommitted_log_idIsSet(true);
    return this;
  }

  public void unsetCommitted_log_id() {
    __isset_bit_vector.clear(__COMMITTED_LOG_ID_ISSET_ID);
  }

  // Returns true if field committed_log_id is set (has been assigned a value) and false otherwise
  public boolean isSetCommitted_log_id() {
    return __isset_bit_vector.get(__COMMITTED_LOG_ID_ISSET_ID);
  }

  public void setCommitted_log_idIsSet(boolean __value) {
    __isset_bit_vector.set(__COMMITTED_LOG_ID_ISSET_ID, __value);
  }

  public long getCommitted_log_term() {
    return this.committed_log_term;
  }

  public SendSnapshotRequest setCommitted_log_term(long committed_log_term) {
    this.committed_log_term = committed_log_term;
    setCommitted_log_termIsSet(true);
    return this;
  }

  public void unsetCommitted_log_term() {
    __isset_bit_vector.clear(__COMMITTED_LOG_TERM_ISSET_ID);
  }

  // Returns true if field committed_log_term is set (has been assigned a value) and false otherwise
  public boolean isSetCommitted_log_term() {
    return __isset_bit_vector.get(__COMMITTED_LOG_TERM_ISSET_ID);
  }

  public void setCommitted_log_termIsSet(boolean __value) {
    __isset_bit_vector.set(__COMMITTED_LOG_TERM_ISSET_ID, __value);
  }

  public String getLeader_addr() {
    return this.leader_addr;
  }

  public SendSnapshotRequest setLeader_addr(String leader_addr) {
    this.leader_addr = leader_addr;
    return this;
  }

  public void unsetLeader_addr() {
    this.leader_addr = null;
  }

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

  public void setLeader_addrIsSet(boolean __value) {
    if (!__value) {
      this.leader_addr = null;
    }
  }

  public int getLeader_port() {
    return this.leader_port;
  }

  public SendSnapshotRequest setLeader_port(int leader_port) {
    this.leader_port = leader_port;
    setLeader_portIsSet(true);
    return this;
  }

  public void unsetLeader_port() {
    __isset_bit_vector.clear(__LEADER_PORT_ISSET_ID);
  }

  // Returns true if field leader_port is set (has been assigned a value) and false otherwise
  public boolean isSetLeader_port() {
    return __isset_bit_vector.get(__LEADER_PORT_ISSET_ID);
  }

  public void setLeader_portIsSet(boolean __value) {
    __isset_bit_vector.set(__LEADER_PORT_ISSET_ID, __value);
  }

  public List<byte[]> getRows() {
    return this.rows;
  }

  public SendSnapshotRequest setRows(List<byte[]> rows) {
    this.rows = rows;
    return this;
  }

  public void unsetRows() {
    this.rows = null;
  }

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

  public void setRowsIsSet(boolean __value) {
    if (!__value) {
      this.rows = null;
    }
  }

  public long getTotal_size() {
    return this.total_size;
  }

  public SendSnapshotRequest setTotal_size(long total_size) {
    this.total_size = total_size;
    setTotal_sizeIsSet(true);
    return this;
  }

  public void unsetTotal_size() {
    __isset_bit_vector.clear(__TOTAL_SIZE_ISSET_ID);
  }

  // Returns true if field total_size is set (has been assigned a value) and false otherwise
  public boolean isSetTotal_size() {
    return __isset_bit_vector.get(__TOTAL_SIZE_ISSET_ID);
  }

  public void setTotal_sizeIsSet(boolean __value) {
    __isset_bit_vector.set(__TOTAL_SIZE_ISSET_ID, __value);
  }

  public long getTotal_count() {
    return this.total_count;
  }

  public SendSnapshotRequest setTotal_count(long total_count) {
    this.total_count = total_count;
    setTotal_countIsSet(true);
    return this;
  }

  public void unsetTotal_count() {
    __isset_bit_vector.clear(__TOTAL_COUNT_ISSET_ID);
  }

  // Returns true if field total_count is set (has been assigned a value) and false otherwise
  public boolean isSetTotal_count() {
    return __isset_bit_vector.get(__TOTAL_COUNT_ISSET_ID);
  }

  public void setTotal_countIsSet(boolean __value) {
    __isset_bit_vector.set(__TOTAL_COUNT_ISSET_ID, __value);
  }

  public boolean isDone() {
    return this.done;
  }

  public SendSnapshotRequest setDone(boolean done) {
    this.done = done;
    setDoneIsSet(true);
    return this;
  }

  public void unsetDone() {
    __isset_bit_vector.clear(__DONE_ISSET_ID);
  }

  // Returns true if field done is set (has been assigned a value) and false otherwise
  public boolean isSetDone() {
    return __isset_bit_vector.get(__DONE_ISSET_ID);
  }

  public void setDoneIsSet(boolean __value) {
    __isset_bit_vector.set(__DONE_ISSET_ID, __value);
  }

  @SuppressWarnings("unchecked")
  public void setFieldValue(int fieldID, Object __value) {
    switch (fieldID) {
    case SPACE:
      if (__value == null) {
        unsetSpace();
      } else {
        setSpace((Integer)__value);
      }
      break;

    case PART:
      if (__value == null) {
        unsetPart();
      } else {
        setPart((Integer)__value);
      }
      break;

    case CURRENT_TERM:
      if (__value == null) {
        unsetCurrent_term();
      } else {
        setCurrent_term((Long)__value);
      }
      break;

    case COMMITTED_LOG_ID:
      if (__value == null) {
        unsetCommitted_log_id();
      } else {
        setCommitted_log_id((Long)__value);
      }
      break;

    case COMMITTED_LOG_TERM:
      if (__value == null) {
        unsetCommitted_log_term();
      } else {
        setCommitted_log_term((Long)__value);
      }
      break;

    case LEADER_ADDR:
      if (__value == null) {
        unsetLeader_addr();
      } else {
        setLeader_addr((String)__value);
      }
      break;

    case LEADER_PORT:
      if (__value == null) {
        unsetLeader_port();
      } else {
        setLeader_port((Integer)__value);
      }
      break;

    case ROWS:
      if (__value == null) {
        unsetRows();
      } else {
        setRows((List<byte[]>)__value);
      }
      break;

    case TOTAL_SIZE:
      if (__value == null) {
        unsetTotal_size();
      } else {
        setTotal_size((Long)__value);
      }
      break;

    case TOTAL_COUNT:
      if (__value == null) {
        unsetTotal_count();
      } else {
        setTotal_count((Long)__value);
      }
      break;

    case DONE:
      if (__value == null) {
        unsetDone();
      } else {
        setDone((Boolean)__value);
      }
      break;

    default:
      throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
    }
  }

  public Object getFieldValue(int fieldID) {
    switch (fieldID) {
    case SPACE:
      return new Integer(getSpace());

    case PART:
      return new Integer(getPart());

    case CURRENT_TERM:
      return new Long(getCurrent_term());

    case COMMITTED_LOG_ID:
      return new Long(getCommitted_log_id());

    case COMMITTED_LOG_TERM:
      return new Long(getCommitted_log_term());

    case LEADER_ADDR:
      return getLeader_addr();

    case LEADER_PORT:
      return new Integer(getLeader_port());

    case ROWS:
      return getRows();

    case TOTAL_SIZE:
      return new Long(getTotal_size());

    case TOTAL_COUNT:
      return new Long(getTotal_count());

    case DONE:
      return new Boolean(isDone());

    default:
      throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
    }
  }

  @Override
  public boolean equals(Object _that) {
    if (_that == null)
      return false;
    if (this == _that)
      return true;
    if (!(_that instanceof SendSnapshotRequest))
      return false;
    SendSnapshotRequest that = (SendSnapshotRequest)_that;

    if (!TBaseHelper.equalsNobinary(this.space, that.space)) { return false; }

    if (!TBaseHelper.equalsNobinary(this.part, that.part)) { return false; }

    if (!TBaseHelper.equalsNobinary(this.current_term, that.current_term)) { return false; }

    if (!TBaseHelper.equalsNobinary(this.committed_log_id, that.committed_log_id)) { return false; }

    if (!TBaseHelper.equalsNobinary(this.committed_log_term, that.committed_log_term)) { return false; }

    if (!TBaseHelper.equalsNobinary(this.isSetLeader_addr(), that.isSetLeader_addr(), this.leader_addr, that.leader_addr)) { return false; }

    if (!TBaseHelper.equalsNobinary(this.leader_port, that.leader_port)) { return false; }

    if (!TBaseHelper.equalsSlow(this.isSetRows(), that.isSetRows(), this.rows, that.rows)) { return false; }

    if (!TBaseHelper.equalsNobinary(this.total_size, that.total_size)) { return false; }

    if (!TBaseHelper.equalsNobinary(this.total_count, that.total_count)) { return false; }

    if (!TBaseHelper.equalsNobinary(this.done, that.done)) { return false; }

    return true;
  }

  @Override
  public int hashCode() {
    return Arrays.deepHashCode(new Object[] {space, part, current_term, committed_log_id, committed_log_term, leader_addr, leader_port, rows, total_size, total_count, done});
  }

  @Override
  public int compareTo(SendSnapshotRequest other) {
    if (other == null) {
      // See java.lang.Comparable docs
      throw new NullPointerException();
    }

    if (other == this) {
      return 0;
    }
    int lastComparison = 0;

    lastComparison = Boolean.valueOf(isSetSpace()).compareTo(other.isSetSpace());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(space, other.space);
    if (lastComparison != 0) { 
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetPart()).compareTo(other.isSetPart());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(part, other.part);
    if (lastComparison != 0) { 
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetCurrent_term()).compareTo(other.isSetCurrent_term());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(current_term, other.current_term);
    if (lastComparison != 0) { 
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetCommitted_log_id()).compareTo(other.isSetCommitted_log_id());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(committed_log_id, other.committed_log_id);
    if (lastComparison != 0) { 
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetCommitted_log_term()).compareTo(other.isSetCommitted_log_term());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(committed_log_term, other.committed_log_term);
    if (lastComparison != 0) { 
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetLeader_addr()).compareTo(other.isSetLeader_addr());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(leader_addr, other.leader_addr);
    if (lastComparison != 0) { 
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetLeader_port()).compareTo(other.isSetLeader_port());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(leader_port, other.leader_port);
    if (lastComparison != 0) { 
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetRows()).compareTo(other.isSetRows());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(rows, other.rows);
    if (lastComparison != 0) { 
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetTotal_size()).compareTo(other.isSetTotal_size());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(total_size, other.total_size);
    if (lastComparison != 0) { 
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetTotal_count()).compareTo(other.isSetTotal_count());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(total_count, other.total_count);
    if (lastComparison != 0) { 
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetDone()).compareTo(other.isSetDone());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(done, other.done);
    if (lastComparison != 0) { 
      return lastComparison;
    }
    return 0;
  }

  public void read(TProtocol iprot) throws TException {
    TField __field;
    iprot.readStructBegin(metaDataMap);
    while (true)
    {
      __field = iprot.readFieldBegin();
      if (__field.type == TType.STOP) { 
        break;
      }
      switch (__field.id)
      {
        case SPACE:
          if (__field.type == TType.I32) {
            this.space = iprot.readI32();
            setSpaceIsSet(true);
          } else { 
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case PART:
          if (__field.type == TType.I32) {
            this.part = iprot.readI32();
            setPartIsSet(true);
          } else { 
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case CURRENT_TERM:
          if (__field.type == TType.I64) {
            this.current_term = iprot.readI64();
            setCurrent_termIsSet(true);
          } else { 
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case COMMITTED_LOG_ID:
          if (__field.type == TType.I64) {
            this.committed_log_id = iprot.readI64();
            setCommitted_log_idIsSet(true);
          } else { 
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case COMMITTED_LOG_TERM:
          if (__field.type == TType.I64) {
            this.committed_log_term = iprot.readI64();
            setCommitted_log_termIsSet(true);
          } else { 
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case LEADER_ADDR:
          if (__field.type == TType.STRING) {
            this.leader_addr = iprot.readString();
          } else { 
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case LEADER_PORT:
          if (__field.type == TType.I32) {
            this.leader_port = iprot.readI32();
            setLeader_portIsSet(true);
          } else { 
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case ROWS:
          if (__field.type == TType.LIST) {
            {
              TList _list4 = iprot.readListBegin();
              this.rows = new ArrayList<byte[]>(Math.max(0, _list4.size));
              for (int _i5 = 0; 
                   (_list4.size < 0) ? iprot.peekList() : (_i5 < _list4.size); 
                   ++_i5)
              {
                byte[] _elem6;
                _elem6 = iprot.readBinary();
                this.rows.add(_elem6);
              }
              iprot.readListEnd();
            }
          } else { 
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case TOTAL_SIZE:
          if (__field.type == TType.I64) {
            this.total_size = iprot.readI64();
            setTotal_sizeIsSet(true);
          } else { 
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case TOTAL_COUNT:
          if (__field.type == TType.I64) {
            this.total_count = iprot.readI64();
            setTotal_countIsSet(true);
          } else { 
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case DONE:
          if (__field.type == TType.BOOL) {
            this.done = iprot.readBool();
            setDoneIsSet(true);
          } else { 
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        default:
          TProtocolUtil.skip(iprot, __field.type);
          break;
      }
      iprot.readFieldEnd();
    }
    iprot.readStructEnd();


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

  public void write(TProtocol oprot) throws TException {
    validate();

    oprot.writeStructBegin(STRUCT_DESC);
    oprot.writeFieldBegin(SPACE_FIELD_DESC);
    oprot.writeI32(this.space);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(PART_FIELD_DESC);
    oprot.writeI32(this.part);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(CURRENT_TERM_FIELD_DESC);
    oprot.writeI64(this.current_term);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(COMMITTED_LOG_ID_FIELD_DESC);
    oprot.writeI64(this.committed_log_id);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(COMMITTED_LOG_TERM_FIELD_DESC);
    oprot.writeI64(this.committed_log_term);
    oprot.writeFieldEnd();
    if (this.leader_addr != null) {
      oprot.writeFieldBegin(LEADER_ADDR_FIELD_DESC);
      oprot.writeString(this.leader_addr);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(LEADER_PORT_FIELD_DESC);
    oprot.writeI32(this.leader_port);
    oprot.writeFieldEnd();
    if (this.rows != null) {
      oprot.writeFieldBegin(ROWS_FIELD_DESC);
      {
        oprot.writeListBegin(new TList(TType.STRING, this.rows.size()));
        for (byte[] _iter7 : this.rows)        {
          oprot.writeBinary(_iter7);
        }
        oprot.writeListEnd();
      }
      oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(TOTAL_SIZE_FIELD_DESC);
    oprot.writeI64(this.total_size);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(TOTAL_COUNT_FIELD_DESC);
    oprot.writeI64(this.total_count);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(DONE_FIELD_DESC);
    oprot.writeBool(this.done);
    oprot.writeFieldEnd();
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

  @Override
  public String toString() {
    return toString(1, true);
  }

  @Override
  public String toString(int indent, boolean prettyPrint) {
    String indentStr = prettyPrint ? TBaseHelper.getIndentedString(indent) : "";
    String newLine = prettyPrint ? "\n" : "";
    String space = prettyPrint ? " " : "";
    StringBuilder sb = new StringBuilder("SendSnapshotRequest");
    sb.append(space);
    sb.append("(");
    sb.append(newLine);
    boolean first = true;

    sb.append(indentStr);
    sb.append("space");
    sb.append(space);
    sb.append(":").append(space);
    sb.append(TBaseHelper.toString(this.getSpace(), indent + 1, prettyPrint));
    first = false;
    if (!first) sb.append("," + newLine);
    sb.append(indentStr);
    sb.append("part");
    sb.append(space);
    sb.append(":").append(space);
    sb.append(TBaseHelper.toString(this.getPart(), indent + 1, prettyPrint));
    first = false;
    if (!first) sb.append("," + newLine);
    sb.append(indentStr);
    sb.append("current_term");
    sb.append(space);
    sb.append(":").append(space);
    sb.append(TBaseHelper.toString(this.getCurrent_term(), indent + 1, prettyPrint));
    first = false;
    if (!first) sb.append("," + newLine);
    sb.append(indentStr);
    sb.append("committed_log_id");
    sb.append(space);
    sb.append(":").append(space);
    sb.append(TBaseHelper.toString(this.getCommitted_log_id(), indent + 1, prettyPrint));
    first = false;
    if (!first) sb.append("," + newLine);
    sb.append(indentStr);
    sb.append("committed_log_term");
    sb.append(space);
    sb.append(":").append(space);
    sb.append(TBaseHelper.toString(this.getCommitted_log_term(), indent + 1, prettyPrint));
    first = false;
    if (!first) sb.append("," + newLine);
    sb.append(indentStr);
    sb.append("leader_addr");
    sb.append(space);
    sb.append(":").append(space);
    if (this.getLeader_addr() == null) {
      sb.append("null");
    } else {
      sb.append(TBaseHelper.toString(this.getLeader_addr(), indent + 1, prettyPrint));
    }
    first = false;
    if (!first) sb.append("," + newLine);
    sb.append(indentStr);
    sb.append("leader_port");
    sb.append(space);
    sb.append(":").append(space);
    sb.append(TBaseHelper.toString(this.getLeader_port(), indent + 1, prettyPrint));
    first = false;
    if (!first) sb.append("," + newLine);
    sb.append(indentStr);
    sb.append("rows");
    sb.append(space);
    sb.append(":").append(space);
    if (this.getRows() == null) {
      sb.append("null");
    } else {
      sb.append(TBaseHelper.toString(this.getRows(), indent + 1, prettyPrint));
    }
    first = false;
    if (!first) sb.append("," + newLine);
    sb.append(indentStr);
    sb.append("total_size");
    sb.append(space);
    sb.append(":").append(space);
    sb.append(TBaseHelper.toString(this.getTotal_size(), indent + 1, prettyPrint));
    first = false;
    if (!first) sb.append("," + newLine);
    sb.append(indentStr);
    sb.append("total_count");
    sb.append(space);
    sb.append(":").append(space);
    sb.append(TBaseHelper.toString(this.getTotal_count(), indent + 1, prettyPrint));
    first = false;
    if (!first) sb.append("," + newLine);
    sb.append(indentStr);
    sb.append("done");
    sb.append(space);
    sb.append(":").append(space);
    sb.append(TBaseHelper.toString(this.isDone(), indent + 1, prettyPrint));
    first = false;
    sb.append(newLine + TBaseHelper.reduceIndent(indentStr));
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws TException {
    // check for required fields
  }

}

