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

    boolean this_present_result = true && this.isSetResult();
    boolean that_present_result = true && that.isSetResult();
    if (this_present_result || that_present_result) {
      if (!(this_present_result && that_present_result)) return false;
      if (!this.result.equals(that.result)) return false;
    }

    boolean this_present_token = true && this.isSetToken();
    boolean that_present_token = true && that.isSetToken();
    if (this_present_token || that_present_token) {
      if (!(this_present_token && that_present_token)) return false;
      if (!this.token.equals(that.token)) return false;
    }

    boolean this_present_space = true;
    boolean that_present_space = true;
    if (this_present_space || that_present_space) {
      if (!(this_present_space && that_present_space)) return false;
      if (this.space != that.space) return false;
    }

    boolean this_present_uspace = true;
    boolean that_present_uspace = true;
    if (this_present_uspace || that_present_uspace) {
      if (!(this_present_uspace && that_present_uspace)) return false;
      if (this.uspace != that.uspace) return false;
    }

    return true;
  }
 /** Performs a deep copy on <i>other</i>. */
 public loginResult(loginResult other) {
   __isset_bitfield = other.__isset_bitfield;
   if (other.isSetResult()) {
     this.result = new RetHead(other.result);
   }
   if (other.isSetToken()) {
     this.token = other.token;
   }
   this.space = other.space;
   this.uspace = other.uspace;
 }
 @Override
 public void write(org.apache.thrift.protocol.TProtocol prot, loginResult struct)
     throws org.apache.thrift.TException {
   TTupleProtocol oprot = (TTupleProtocol) prot;
   BitSet optionals = new BitSet();
   if (struct.isSetResult()) {
     optionals.set(0);
   }
   if (struct.isSetToken()) {
     optionals.set(1);
   }
   if (struct.isSetSpace()) {
     optionals.set(2);
   }
   if (struct.isSetUspace()) {
     optionals.set(3);
   }
   oprot.writeBitSet(optionals, 4);
   if (struct.isSetResult()) {
     struct.result.write(oprot);
   }
   if (struct.isSetToken()) {
     oprot.writeString(struct.token);
   }
   if (struct.isSetSpace()) {
     oprot.writeI32(struct.space);
   }
   if (struct.isSetUspace()) {
     oprot.writeI32(struct.uspace);
   }
 }
    public void read(org.apache.thrift.protocol.TProtocol iprot, loginResult 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: // RESULT
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.result = new RetHead();
              struct.result.read(iprot);
              struct.setResultIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // TOKEN
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.token = iprot.readString();
              struct.setTokenIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // SPACE
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.space = iprot.readI32();
              struct.setSpaceIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // USPACE
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.uspace = iprot.readI32();
              struct.setUspaceIsSet(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 int compareTo(loginResult other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;

    lastComparison = Boolean.valueOf(isSetResult()).compareTo(other.isSetResult());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetResult()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.result, other.result);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetToken()).compareTo(other.isSetToken());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetToken()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.token, other.token);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetSpace()).compareTo(other.isSetSpace());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetSpace()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.space, other.space);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetUspace()).compareTo(other.isSetUspace());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetUspace()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.uspace, other.uspace);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }
 @Override
 public void read(org.apache.thrift.protocol.TProtocol prot, loginResult struct)
     throws org.apache.thrift.TException {
   TTupleProtocol iprot = (TTupleProtocol) prot;
   BitSet incoming = iprot.readBitSet(4);
   if (incoming.get(0)) {
     struct.result = new RetHead();
     struct.result.read(iprot);
     struct.setResultIsSet(true);
   }
   if (incoming.get(1)) {
     struct.token = iprot.readString();
     struct.setTokenIsSet(true);
   }
   if (incoming.get(2)) {
     struct.space = iprot.readI32();
     struct.setSpaceIsSet(true);
   }
   if (incoming.get(3)) {
     struct.uspace = iprot.readI32();
     struct.setUspaceIsSet(true);
   }
 }
    public void write(org.apache.thrift.protocol.TProtocol oprot, loginResult struct)
        throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.result != null) {
        oprot.writeFieldBegin(RESULT_FIELD_DESC);
        struct.result.write(oprot);
        oprot.writeFieldEnd();
      }
      if (struct.token != null) {
        oprot.writeFieldBegin(TOKEN_FIELD_DESC);
        oprot.writeString(struct.token);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldBegin(SPACE_FIELD_DESC);
      oprot.writeI32(struct.space);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(USPACE_FIELD_DESC);
      oprot.writeI32(struct.uspace);
      oprot.writeFieldEnd();
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }