/**
 * Autogenerated by Thrift Compiler (0.9.0)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package org.apache.hadoop.thriftfs.api;

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

import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Information about an entire subtree under a directory
 * Includes the information from org.apache.hadoop.fs.ContentSummary
 */
public class ContentSummary implements org.apache.thrift.TBase<ContentSummary, ContentSummary._Fields>, java.io.Serializable, Cloneable {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ContentSummary");

  private static final org.apache.thrift.protocol.TField FILE_COUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("fileCount", org.apache.thrift.protocol.TType.I64, (short)1);
  private static final org.apache.thrift.protocol.TField DIRECTORY_COUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("directoryCount", org.apache.thrift.protocol.TType.I64, (short)2);
  private static final org.apache.thrift.protocol.TField QUOTA_FIELD_DESC = new org.apache.thrift.protocol.TField("quota", org.apache.thrift.protocol.TType.I64, (short)3);
  private static final org.apache.thrift.protocol.TField SPACE_CONSUMED_FIELD_DESC = new org.apache.thrift.protocol.TField("spaceConsumed", org.apache.thrift.protocol.TType.I64, (short)4);
  private static final org.apache.thrift.protocol.TField SPACE_QUOTA_FIELD_DESC = new org.apache.thrift.protocol.TField("spaceQuota", org.apache.thrift.protocol.TType.I64, (short)5);
  private static final org.apache.thrift.protocol.TField PATH_FIELD_DESC = new org.apache.thrift.protocol.TField("path", org.apache.thrift.protocol.TType.STRING, (short)6);

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

  /**
   * Number of files in this directory
   */
  public long fileCount; // required
  /**
   * Number of directories in this directory
   */
  public long directoryCount; // required
  /**
   * Quota for this directory (number of files).
   */
  public long quota; // required
  /**
   * Space consumed in disk (in bytes).
   */
  public long spaceConsumed; // required
  /**
   * Quota consumed in disk (in bytes).
   */
  public long spaceQuota; // required
  /**
   * The path
   */
  public String path; // 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 {
    /**
     * Number of files in this directory
     */
    FILE_COUNT((short)1, "fileCount"),
    /**
     * Number of directories in this directory
     */
    DIRECTORY_COUNT((short)2, "directoryCount"),
    /**
     * Quota for this directory (number of files).
     */
    QUOTA((short)3, "quota"),
    /**
     * Space consumed in disk (in bytes).
     */
    SPACE_CONSUMED((short)4, "spaceConsumed"),
    /**
     * Quota consumed in disk (in bytes).
     */
    SPACE_QUOTA((short)5, "spaceQuota"),
    /**
     * The path
     */
    PATH((short)6, "path");

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

    static {
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
        byName.put(field.getFieldName(), field);
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, or null if its not found.
     */
    public static _Fields findByThriftId(int fieldId) {
      switch(fieldId) {
        case 1: // FILE_COUNT
          return FILE_COUNT;
        case 2: // DIRECTORY_COUNT
          return DIRECTORY_COUNT;
        case 3: // QUOTA
          return QUOTA;
        case 4: // SPACE_CONSUMED
          return SPACE_CONSUMED;
        case 5: // SPACE_QUOTA
          return SPACE_QUOTA;
        case 6: // PATH
          return PATH;
        default:
          return null;
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, throwing an exception
     * if it is not found.
     */
    public static _Fields findByThriftIdOrThrow(int fieldId) {
      _Fields fields = findByThriftId(fieldId);
      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
      return fields;
    }

    /**
     * Find the _Fields constant that matches name, or null if its not found.
     */
    public static _Fields findByName(String name) {
      return byName.get(name);
    }

    private final short _thriftId;
    private final String _fieldName;

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

    public short getThriftFieldId() {
      return _thriftId;
    }

    public String getFieldName() {
      return _fieldName;
    }
  }

  // isset id assignments
  private static final int __FILECOUNT_ISSET_ID = 0;
  private static final int __DIRECTORYCOUNT_ISSET_ID = 1;
  private static final int __QUOTA_ISSET_ID = 2;
  private static final int __SPACECONSUMED_ISSET_ID = 3;
  private static final int __SPACEQUOTA_ISSET_ID = 4;
  private byte __isset_bitfield = 0;
  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
  static {
    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
    tmpMap.put(_Fields.FILE_COUNT, new org.apache.thrift.meta_data.FieldMetaData("fileCount", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.DIRECTORY_COUNT, new org.apache.thrift.meta_data.FieldMetaData("directoryCount", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.QUOTA, new org.apache.thrift.meta_data.FieldMetaData("quota", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.SPACE_CONSUMED, new org.apache.thrift.meta_data.FieldMetaData("spaceConsumed", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.SPACE_QUOTA, new org.apache.thrift.meta_data.FieldMetaData("spaceQuota", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.PATH, new org.apache.thrift.meta_data.FieldMetaData("path", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ContentSummary.class, metaDataMap);
  }

  public ContentSummary() {
  }

  public ContentSummary(
    long fileCount,
    long directoryCount,
    long quota,
    long spaceConsumed,
    long spaceQuota,
    String path)
  {
    this();
    this.fileCount = fileCount;
    setFileCountIsSet(true);
    this.directoryCount = directoryCount;
    setDirectoryCountIsSet(true);
    this.quota = quota;
    setQuotaIsSet(true);
    this.spaceConsumed = spaceConsumed;
    setSpaceConsumedIsSet(true);
    this.spaceQuota = spaceQuota;
    setSpaceQuotaIsSet(true);
    this.path = path;
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public ContentSummary(ContentSummary other) {
    __isset_bitfield = other.__isset_bitfield;
    this.fileCount = other.fileCount;
    this.directoryCount = other.directoryCount;
    this.quota = other.quota;
    this.spaceConsumed = other.spaceConsumed;
    this.spaceQuota = other.spaceQuota;
    if (other.isSetPath()) {
      this.path = other.path;
    }
  }

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

  @Override
  public void clear() {
    setFileCountIsSet(false);
    this.fileCount = 0;
    setDirectoryCountIsSet(false);
    this.directoryCount = 0;
    setQuotaIsSet(false);
    this.quota = 0;
    setSpaceConsumedIsSet(false);
    this.spaceConsumed = 0;
    setSpaceQuotaIsSet(false);
    this.spaceQuota = 0;
    this.path = null;
  }

  /**
   * Number of files in this directory
   */
  public long getFileCount() {
    return this.fileCount;
  }

  /**
   * Number of files in this directory
   */
  public ContentSummary setFileCount(long fileCount) {
    this.fileCount = fileCount;
    setFileCountIsSet(true);
    return this;
  }

  public void unsetFileCount() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __FILECOUNT_ISSET_ID);
  }

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

  public void setFileCountIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __FILECOUNT_ISSET_ID, value);
  }

  /**
   * Number of directories in this directory
   */
  public long getDirectoryCount() {
    return this.directoryCount;
  }

  /**
   * Number of directories in this directory
   */
  public ContentSummary setDirectoryCount(long directoryCount) {
    this.directoryCount = directoryCount;
    setDirectoryCountIsSet(true);
    return this;
  }

  public void unsetDirectoryCount() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __DIRECTORYCOUNT_ISSET_ID);
  }

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

  public void setDirectoryCountIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __DIRECTORYCOUNT_ISSET_ID, value);
  }

  /**
   * Quota for this directory (number of files).
   */
  public long getQuota() {
    return this.quota;
  }

  /**
   * Quota for this directory (number of files).
   */
  public ContentSummary setQuota(long quota) {
    this.quota = quota;
    setQuotaIsSet(true);
    return this;
  }

  public void unsetQuota() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __QUOTA_ISSET_ID);
  }

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

  public void setQuotaIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __QUOTA_ISSET_ID, value);
  }

  /**
   * Space consumed in disk (in bytes).
   */
  public long getSpaceConsumed() {
    return this.spaceConsumed;
  }

  /**
   * Space consumed in disk (in bytes).
   */
  public ContentSummary setSpaceConsumed(long spaceConsumed) {
    this.spaceConsumed = spaceConsumed;
    setSpaceConsumedIsSet(true);
    return this;
  }

  public void unsetSpaceConsumed() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __SPACECONSUMED_ISSET_ID);
  }

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

  public void setSpaceConsumedIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __SPACECONSUMED_ISSET_ID, value);
  }

  /**
   * Quota consumed in disk (in bytes).
   */
  public long getSpaceQuota() {
    return this.spaceQuota;
  }

  /**
   * Quota consumed in disk (in bytes).
   */
  public ContentSummary setSpaceQuota(long spaceQuota) {
    this.spaceQuota = spaceQuota;
    setSpaceQuotaIsSet(true);
    return this;
  }

  public void unsetSpaceQuota() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __SPACEQUOTA_ISSET_ID);
  }

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

  public void setSpaceQuotaIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __SPACEQUOTA_ISSET_ID, value);
  }

  /**
   * The path
   */
  public String getPath() {
    return this.path;
  }

  /**
   * The path
   */
  public ContentSummary setPath(String path) {
    this.path = path;
    return this;
  }

  public void unsetPath() {
    this.path = null;
  }

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

  public void setPathIsSet(boolean value) {
    if (!value) {
      this.path = null;
    }
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case FILE_COUNT:
      if (value == null) {
        unsetFileCount();
      } else {
        setFileCount((Long)value);
      }
      break;

    case DIRECTORY_COUNT:
      if (value == null) {
        unsetDirectoryCount();
      } else {
        setDirectoryCount((Long)value);
      }
      break;

    case QUOTA:
      if (value == null) {
        unsetQuota();
      } else {
        setQuota((Long)value);
      }
      break;

    case SPACE_CONSUMED:
      if (value == null) {
        unsetSpaceConsumed();
      } else {
        setSpaceConsumed((Long)value);
      }
      break;

    case SPACE_QUOTA:
      if (value == null) {
        unsetSpaceQuota();
      } else {
        setSpaceQuota((Long)value);
      }
      break;

    case PATH:
      if (value == null) {
        unsetPath();
      } else {
        setPath((String)value);
      }
      break;

    }
  }

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

    case DIRECTORY_COUNT:
      return Long.valueOf(getDirectoryCount());

    case QUOTA:
      return Long.valueOf(getQuota());

    case SPACE_CONSUMED:
      return Long.valueOf(getSpaceConsumed());

    case SPACE_QUOTA:
      return Long.valueOf(getSpaceQuota());

    case PATH:
      return getPath();

    }
    throw new IllegalStateException();
  }

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

    switch (field) {
    case FILE_COUNT:
      return isSetFileCount();
    case DIRECTORY_COUNT:
      return isSetDirectoryCount();
    case QUOTA:
      return isSetQuota();
    case SPACE_CONSUMED:
      return isSetSpaceConsumed();
    case SPACE_QUOTA:
      return isSetSpaceQuota();
    case PATH:
      return isSetPath();
    }
    throw new IllegalStateException();
  }

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

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

    boolean this_present_fileCount = true;
    boolean that_present_fileCount = true;
    if (this_present_fileCount || that_present_fileCount) {
      if (!(this_present_fileCount && that_present_fileCount))
        return false;
      if (this.fileCount != that.fileCount)
        return false;
    }

    boolean this_present_directoryCount = true;
    boolean that_present_directoryCount = true;
    if (this_present_directoryCount || that_present_directoryCount) {
      if (!(this_present_directoryCount && that_present_directoryCount))
        return false;
      if (this.directoryCount != that.directoryCount)
        return false;
    }

    boolean this_present_quota = true;
    boolean that_present_quota = true;
    if (this_present_quota || that_present_quota) {
      if (!(this_present_quota && that_present_quota))
        return false;
      if (this.quota != that.quota)
        return false;
    }

    boolean this_present_spaceConsumed = true;
    boolean that_present_spaceConsumed = true;
    if (this_present_spaceConsumed || that_present_spaceConsumed) {
      if (!(this_present_spaceConsumed && that_present_spaceConsumed))
        return false;
      if (this.spaceConsumed != that.spaceConsumed)
        return false;
    }

    boolean this_present_spaceQuota = true;
    boolean that_present_spaceQuota = true;
    if (this_present_spaceQuota || that_present_spaceQuota) {
      if (!(this_present_spaceQuota && that_present_spaceQuota))
        return false;
      if (this.spaceQuota != that.spaceQuota)
        return false;
    }

    boolean this_present_path = true && this.isSetPath();
    boolean that_present_path = true && that.isSetPath();
    if (this_present_path || that_present_path) {
      if (!(this_present_path && that_present_path))
        return false;
      if (!this.path.equals(that.path))
        return false;
    }

    return true;
  }

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

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

    int lastComparison = 0;
    ContentSummary typedOther = (ContentSummary)other;

    lastComparison = Boolean.valueOf(isSetFileCount()).compareTo(typedOther.isSetFileCount());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetFileCount()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.fileCount, typedOther.fileCount);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetDirectoryCount()).compareTo(typedOther.isSetDirectoryCount());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetDirectoryCount()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.directoryCount, typedOther.directoryCount);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetQuota()).compareTo(typedOther.isSetQuota());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetQuota()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.quota, typedOther.quota);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetSpaceConsumed()).compareTo(typedOther.isSetSpaceConsumed());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetSpaceConsumed()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.spaceConsumed, typedOther.spaceConsumed);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetSpaceQuota()).compareTo(typedOther.isSetSpaceQuota());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetSpaceQuota()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.spaceQuota, typedOther.spaceQuota);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetPath()).compareTo(typedOther.isSetPath());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetPath()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.path, typedOther.path);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }

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

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

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

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

    sb.append("fileCount:");
    sb.append(this.fileCount);
    first = false;
    if (!first) sb.append(", ");
    sb.append("directoryCount:");
    sb.append(this.directoryCount);
    first = false;
    if (!first) sb.append(", ");
    sb.append("quota:");
    sb.append(this.quota);
    first = false;
    if (!first) sb.append(", ");
    sb.append("spaceConsumed:");
    sb.append(this.spaceConsumed);
    first = false;
    if (!first) sb.append(", ");
    sb.append("spaceQuota:");
    sb.append(this.spaceQuota);
    first = false;
    if (!first) sb.append(", ");
    sb.append("path:");
    if (this.path == null) {
      sb.append("null");
    } else {
      sb.append(this.path);
    }
    first = false;
    sb.append(")");
    return sb.toString();
  }

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

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

  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
    try {
      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
      __isset_bitfield = 0;
      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }

  private static class ContentSummaryStandardSchemeFactory implements SchemeFactory {
    public ContentSummaryStandardScheme getScheme() {
      return new ContentSummaryStandardScheme();
    }
  }

  private static class ContentSummaryStandardScheme extends StandardScheme<ContentSummary> {

    public void read(org.apache.thrift.protocol.TProtocol iprot, ContentSummary 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: // FILE_COUNT
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.fileCount = iprot.readI64();
              struct.setFileCountIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // DIRECTORY_COUNT
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.directoryCount = iprot.readI64();
              struct.setDirectoryCountIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // QUOTA
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.quota = iprot.readI64();
              struct.setQuotaIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // SPACE_CONSUMED
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.spaceConsumed = iprot.readI64();
              struct.setSpaceConsumedIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // SPACE_QUOTA
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.spaceQuota = iprot.readI64();
              struct.setSpaceQuotaIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 6: // PATH
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.path = iprot.readString();
              struct.setPathIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          default:
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
        }
        iprot.readFieldEnd();
      }
      iprot.readStructEnd();

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

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

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldBegin(FILE_COUNT_FIELD_DESC);
      oprot.writeI64(struct.fileCount);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(DIRECTORY_COUNT_FIELD_DESC);
      oprot.writeI64(struct.directoryCount);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(QUOTA_FIELD_DESC);
      oprot.writeI64(struct.quota);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(SPACE_CONSUMED_FIELD_DESC);
      oprot.writeI64(struct.spaceConsumed);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(SPACE_QUOTA_FIELD_DESC);
      oprot.writeI64(struct.spaceQuota);
      oprot.writeFieldEnd();
      if (struct.path != null) {
        oprot.writeFieldBegin(PATH_FIELD_DESC);
        oprot.writeString(struct.path);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class ContentSummaryTupleSchemeFactory implements SchemeFactory {
    public ContentSummaryTupleScheme getScheme() {
      return new ContentSummaryTupleScheme();
    }
  }

  private static class ContentSummaryTupleScheme extends TupleScheme<ContentSummary> {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, ContentSummary struct) throws org.apache.thrift.TException {
      TTupleProtocol oprot = (TTupleProtocol) prot;
      BitSet optionals = new BitSet();
      if (struct.isSetFileCount()) {
        optionals.set(0);
      }
      if (struct.isSetDirectoryCount()) {
        optionals.set(1);
      }
      if (struct.isSetQuota()) {
        optionals.set(2);
      }
      if (struct.isSetSpaceConsumed()) {
        optionals.set(3);
      }
      if (struct.isSetSpaceQuota()) {
        optionals.set(4);
      }
      if (struct.isSetPath()) {
        optionals.set(5);
      }
      oprot.writeBitSet(optionals, 6);
      if (struct.isSetFileCount()) {
        oprot.writeI64(struct.fileCount);
      }
      if (struct.isSetDirectoryCount()) {
        oprot.writeI64(struct.directoryCount);
      }
      if (struct.isSetQuota()) {
        oprot.writeI64(struct.quota);
      }
      if (struct.isSetSpaceConsumed()) {
        oprot.writeI64(struct.spaceConsumed);
      }
      if (struct.isSetSpaceQuota()) {
        oprot.writeI64(struct.spaceQuota);
      }
      if (struct.isSetPath()) {
        oprot.writeString(struct.path);
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, ContentSummary struct) throws org.apache.thrift.TException {
      TTupleProtocol iprot = (TTupleProtocol) prot;
      BitSet incoming = iprot.readBitSet(6);
      if (incoming.get(0)) {
        struct.fileCount = iprot.readI64();
        struct.setFileCountIsSet(true);
      }
      if (incoming.get(1)) {
        struct.directoryCount = iprot.readI64();
        struct.setDirectoryCountIsSet(true);
      }
      if (incoming.get(2)) {
        struct.quota = iprot.readI64();
        struct.setQuotaIsSet(true);
      }
      if (incoming.get(3)) {
        struct.spaceConsumed = iprot.readI64();
        struct.setSpaceConsumedIsSet(true);
      }
      if (incoming.get(4)) {
        struct.spaceQuota = iprot.readI64();
        struct.setSpaceQuotaIsSet(true);
      }
      if (incoming.get(5)) {
        struct.path = iprot.readString();
        struct.setPathIsSet(true);
      }
    }
  }

}

