示例#1
0
 @Override
 public void write(org.apache.thrift.protocol.TProtocol prot, ConditionalUpdates struct)
     throws org.apache.thrift.TException {
   TTupleProtocol oprot = (TTupleProtocol) prot;
   BitSet optionals = new BitSet();
   if (struct.isSetConditions()) {
     optionals.set(0);
   }
   if (struct.isSetUpdates()) {
     optionals.set(1);
   }
   oprot.writeBitSet(optionals, 2);
   if (struct.isSetConditions()) {
     {
       oprot.writeI32(struct.conditions.size());
       for (Condition _iter98 : struct.conditions) {
         _iter98.write(oprot);
       }
     }
   }
   if (struct.isSetUpdates()) {
     {
       oprot.writeI32(struct.updates.size());
       for (ColumnUpdate _iter99 : struct.updates) {
         _iter99.write(oprot);
       }
     }
   }
 }
示例#2
0
  @Override
  public int compareTo(ConditionalUpdates other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;

    lastComparison = Boolean.valueOf(isSetConditions()).compareTo(other.isSetConditions());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetConditions()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.conditions, other.conditions);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetUpdates()).compareTo(other.isSetUpdates());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetUpdates()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.updates, other.updates);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }
示例#3
0
    public void read(org.apache.thrift.protocol.TProtocol iprot, ConditionalUpdates 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 2: // CONDITIONS
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list90 = iprot.readListBegin();
                struct.conditions = new ArrayList<Condition>(_list90.size);
                Condition _elem91;
                for (int _i92 = 0; _i92 < _list90.size; ++_i92) {
                  _elem91 = new Condition();
                  _elem91.read(iprot);
                  struct.conditions.add(_elem91);
                }
                iprot.readListEnd();
              }
              struct.setConditionsIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // UPDATES
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list93 = iprot.readListBegin();
                struct.updates = new ArrayList<ColumnUpdate>(_list93.size);
                ColumnUpdate _elem94;
                for (int _i95 = 0; _i95 < _list93.size; ++_i95) {
                  _elem94 = new ColumnUpdate();
                  _elem94.read(iprot);
                  struct.updates.add(_elem94);
                }
                iprot.readListEnd();
              }
              struct.setUpdatesIsSet(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();
    }
示例#4
0
    public void write(org.apache.thrift.protocol.TProtocol oprot, ConditionalUpdates struct)
        throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.conditions != null) {
        oprot.writeFieldBegin(CONDITIONS_FIELD_DESC);
        {
          oprot.writeListBegin(
              new org.apache.thrift.protocol.TList(
                  org.apache.thrift.protocol.TType.STRUCT, struct.conditions.size()));
          for (Condition _iter96 : struct.conditions) {
            _iter96.write(oprot);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      }
      if (struct.updates != null) {
        oprot.writeFieldBegin(UPDATES_FIELD_DESC);
        {
          oprot.writeListBegin(
              new org.apache.thrift.protocol.TList(
                  org.apache.thrift.protocol.TType.STRUCT, struct.updates.size()));
          for (ColumnUpdate _iter97 : struct.updates) {
            _iter97.write(oprot);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }
示例#5
0
 /** Performs a deep copy on <i>other</i>. */
 public ConditionalUpdates(ConditionalUpdates other) {
   if (other.isSetConditions()) {
     List<Condition> __this__conditions = new ArrayList<Condition>(other.conditions.size());
     for (Condition other_element : other.conditions) {
       __this__conditions.add(new Condition(other_element));
     }
     this.conditions = __this__conditions;
   }
   if (other.isSetUpdates()) {
     List<ColumnUpdate> __this__updates = new ArrayList<ColumnUpdate>(other.updates.size());
     for (ColumnUpdate other_element : other.updates) {
       __this__updates.add(new ColumnUpdate(other_element));
     }
     this.updates = __this__updates;
   }
 }
示例#6
0
  public boolean equals(ConditionalUpdates that) {
    if (that == null) return false;

    boolean this_present_conditions = true && this.isSetConditions();
    boolean that_present_conditions = true && that.isSetConditions();
    if (this_present_conditions || that_present_conditions) {
      if (!(this_present_conditions && that_present_conditions)) return false;
      if (!this.conditions.equals(that.conditions)) return false;
    }

    boolean this_present_updates = true && this.isSetUpdates();
    boolean that_present_updates = true && that.isSetUpdates();
    if (this_present_updates || that_present_updates) {
      if (!(this_present_updates && that_present_updates)) return false;
      if (!this.updates.equals(that.updates)) return false;
    }

    return true;
  }
示例#7
0
 @Override
 public void read(org.apache.thrift.protocol.TProtocol prot, ConditionalUpdates struct)
     throws org.apache.thrift.TException {
   TTupleProtocol iprot = (TTupleProtocol) prot;
   BitSet incoming = iprot.readBitSet(2);
   if (incoming.get(0)) {
     {
       org.apache.thrift.protocol.TList _list100 =
           new org.apache.thrift.protocol.TList(
               org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
       struct.conditions = new ArrayList<Condition>(_list100.size);
       Condition _elem101;
       for (int _i102 = 0; _i102 < _list100.size; ++_i102) {
         _elem101 = new Condition();
         _elem101.read(iprot);
         struct.conditions.add(_elem101);
       }
     }
     struct.setConditionsIsSet(true);
   }
   if (incoming.get(1)) {
     {
       org.apache.thrift.protocol.TList _list103 =
           new org.apache.thrift.protocol.TList(
               org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
       struct.updates = new ArrayList<ColumnUpdate>(_list103.size);
       ColumnUpdate _elem104;
       for (int _i105 = 0; _i105 < _list103.size; ++_i105) {
         _elem104 = new ColumnUpdate();
         _elem104.read(iprot);
         struct.updates.add(_elem104);
       }
     }
     struct.setUpdatesIsSet(true);
   }
 }