Example #1
0
  @Override
  public int compareTo(PersistFile other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;

    lastComparison = Boolean.valueOf(isSetFileId()).compareTo(other.isSetFileId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetFileId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.fileId, other.fileId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetBlockIds()).compareTo(other.isSetBlockIds());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetBlockIds()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.blockIds, other.blockIds);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }
Example #2
0
 /** Performs a deep copy on <i>other</i>. */
 public PersistFile(PersistFile other) {
   __isset_bitfield = other.__isset_bitfield;
   this.fileId = other.fileId;
   if (other.isSetBlockIds()) {
     List<Long> __this__blockIds = new ArrayList<Long>(other.blockIds);
     this.blockIds = __this__blockIds;
   }
 }
Example #3
0
    public void read(org.apache.thrift.protocol.TProtocol iprot, PersistFile 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_ID
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.fileId = iprot.readI64();
              struct.setFileIdIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // BLOCK_IDS
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list16 = iprot.readListBegin();
                struct.blockIds = new ArrayList<Long>(_list16.size);
                long _elem17;
                for (int _i18 = 0; _i18 < _list16.size; ++_i18) {
                  _elem17 = iprot.readI64();
                  struct.blockIds.add(_elem17);
                }
                iprot.readListEnd();
              }
              struct.setBlockIdsIsSet(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();
    }
Example #4
0
 @Override
 public void read(org.apache.thrift.protocol.TProtocol prot, PersistFile struct)
     throws org.apache.thrift.TException {
   TTupleProtocol iprot = (TTupleProtocol) prot;
   BitSet incoming = iprot.readBitSet(2);
   if (incoming.get(0)) {
     struct.fileId = iprot.readI64();
     struct.setFileIdIsSet(true);
   }
   if (incoming.get(1)) {
     {
       org.apache.thrift.protocol.TList _list21 =
           new org.apache.thrift.protocol.TList(
               org.apache.thrift.protocol.TType.I64, iprot.readI32());
       struct.blockIds = new ArrayList<Long>(_list21.size);
       long _elem22;
       for (int _i23 = 0; _i23 < _list21.size; ++_i23) {
         _elem22 = iprot.readI64();
         struct.blockIds.add(_elem22);
       }
     }
     struct.setBlockIdsIsSet(true);
   }
 }
Example #5
0
 @Override
 public void write(org.apache.thrift.protocol.TProtocol prot, PersistFile struct)
     throws org.apache.thrift.TException {
   TTupleProtocol oprot = (TTupleProtocol) prot;
   BitSet optionals = new BitSet();
   if (struct.isSetFileId()) {
     optionals.set(0);
   }
   if (struct.isSetBlockIds()) {
     optionals.set(1);
   }
   oprot.writeBitSet(optionals, 2);
   if (struct.isSetFileId()) {
     oprot.writeI64(struct.fileId);
   }
   if (struct.isSetBlockIds()) {
     {
       oprot.writeI32(struct.blockIds.size());
       for (long _iter20 : struct.blockIds) {
         oprot.writeI64(_iter20);
       }
     }
   }
 }
Example #6
0
  public boolean equals(PersistFile that) {
    if (that == null) return false;

    boolean this_present_fileId = true;
    boolean that_present_fileId = true;
    if (this_present_fileId || that_present_fileId) {
      if (!(this_present_fileId && that_present_fileId)) return false;
      if (this.fileId != that.fileId) return false;
    }

    boolean this_present_blockIds = true && this.isSetBlockIds();
    boolean that_present_blockIds = true && that.isSetBlockIds();
    if (this_present_blockIds || that_present_blockIds) {
      if (!(this_present_blockIds && that_present_blockIds)) return false;
      if (!this.blockIds.equals(that.blockIds)) return false;
    }

    return true;
  }
Example #7
0
    public void write(org.apache.thrift.protocol.TProtocol oprot, PersistFile struct)
        throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldBegin(FILE_ID_FIELD_DESC);
      oprot.writeI64(struct.fileId);
      oprot.writeFieldEnd();
      if (struct.blockIds != null) {
        oprot.writeFieldBegin(BLOCK_IDS_FIELD_DESC);
        {
          oprot.writeListBegin(
              new org.apache.thrift.protocol.TList(
                  org.apache.thrift.protocol.TType.I64, struct.blockIds.size()));
          for (long _iter19 : struct.blockIds) {
            oprot.writeI64(_iter19);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }