Subversion Repositories SmartDukaan

Rev

Rev 4431 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4431 Rev 4490
Line 23... Line 23...
23
public class ItemInventory implements org.apache.thrift.TBase<ItemInventory, ItemInventory._Fields>, java.io.Serializable, Cloneable {
23
public class ItemInventory implements org.apache.thrift.TBase<ItemInventory, ItemInventory._Fields>, java.io.Serializable, Cloneable {
24
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ItemInventory");
24
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ItemInventory");
25
 
25
 
26
  private static final org.apache.thrift.protocol.TField ID_FIELD_DESC = new org.apache.thrift.protocol.TField("id", org.apache.thrift.protocol.TType.I64, (short)1);
26
  private static final org.apache.thrift.protocol.TField ID_FIELD_DESC = new org.apache.thrift.protocol.TField("id", org.apache.thrift.protocol.TType.I64, (short)1);
27
  private static final org.apache.thrift.protocol.TField AVAILABILITY_FIELD_DESC = new org.apache.thrift.protocol.TField("availability", org.apache.thrift.protocol.TType.MAP, (short)2);
27
  private static final org.apache.thrift.protocol.TField AVAILABILITY_FIELD_DESC = new org.apache.thrift.protocol.TField("availability", org.apache.thrift.protocol.TType.MAP, (short)2);
28
  private static final org.apache.thrift.protocol.TField RESERVED_FIELD_DESC = new org.apache.thrift.protocol.TField("reserved", org.apache.thrift.protocol.TType.MAP, (short)3);
-
 
29
 
28
 
30
  private long id; // required
29
  private long id; // required
31
  private Map<Long,Long> availability; // required
30
  private Map<Long,Long> availability; // required
32
  private Map<Long,Long> reserved; // required
-
 
33
 
31
 
34
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
32
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
35
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
33
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
36
    ID((short)1, "id"),
34
    ID((short)1, "id"),
37
    AVAILABILITY((short)2, "availability"),
35
    AVAILABILITY((short)2, "availability");
38
    RESERVED((short)3, "reserved");
-
 
39
 
36
 
40
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
37
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
41
 
38
 
42
    static {
39
    static {
43
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
40
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
Line 52... Line 49...
52
      switch(fieldId) {
49
      switch(fieldId) {
53
        case 1: // ID
50
        case 1: // ID
54
          return ID;
51
          return ID;
55
        case 2: // AVAILABILITY
52
        case 2: // AVAILABILITY
56
          return AVAILABILITY;
53
          return AVAILABILITY;
57
        case 3: // RESERVED
-
 
58
          return RESERVED;
-
 
59
        default:
54
        default:
60
          return null;
55
          return null;
61
      }
56
      }
62
    }
57
    }
63
 
58
 
Line 106... Line 101...
106
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
101
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
107
    tmpMap.put(_Fields.AVAILABILITY, new org.apache.thrift.meta_data.FieldMetaData("availability", org.apache.thrift.TFieldRequirementType.DEFAULT, 
102
    tmpMap.put(_Fields.AVAILABILITY, new org.apache.thrift.meta_data.FieldMetaData("availability", org.apache.thrift.TFieldRequirementType.DEFAULT, 
108
        new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP, 
103
        new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP, 
109
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64), 
104
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64), 
110
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))));
105
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))));
111
    tmpMap.put(_Fields.RESERVED, new org.apache.thrift.meta_data.FieldMetaData("reserved", org.apache.thrift.TFieldRequirementType.DEFAULT, 
-
 
112
        new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP, 
-
 
113
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64), 
-
 
114
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))));
-
 
115
    metaDataMap = Collections.unmodifiableMap(tmpMap);
106
    metaDataMap = Collections.unmodifiableMap(tmpMap);
116
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ItemInventory.class, metaDataMap);
107
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ItemInventory.class, metaDataMap);
117
  }
108
  }
118
 
109
 
119
  public ItemInventory() {
110
  public ItemInventory() {
120
  }
111
  }
121
 
112
 
122
  public ItemInventory(
113
  public ItemInventory(
123
    long id,
114
    long id,
124
    Map<Long,Long> availability,
115
    Map<Long,Long> availability)
125
    Map<Long,Long> reserved)
-
 
126
  {
116
  {
127
    this();
117
    this();
128
    this.id = id;
118
    this.id = id;
129
    setIdIsSet(true);
119
    setIdIsSet(true);
130
    this.availability = availability;
120
    this.availability = availability;
131
    this.reserved = reserved;
-
 
132
  }
121
  }
133
 
122
 
134
  /**
123
  /**
135
   * Performs a deep copy on <i>other</i>.
124
   * Performs a deep copy on <i>other</i>.
136
   */
125
   */
Line 151... Line 140...
151
 
140
 
152
        __this__availability.put(__this__availability_copy_key, __this__availability_copy_value);
141
        __this__availability.put(__this__availability_copy_key, __this__availability_copy_value);
153
      }
142
      }
154
      this.availability = __this__availability;
143
      this.availability = __this__availability;
155
    }
144
    }
156
    if (other.isSetReserved()) {
-
 
157
      Map<Long,Long> __this__reserved = new HashMap<Long,Long>();
-
 
158
      for (Map.Entry<Long, Long> other_element : other.reserved.entrySet()) {
-
 
159
 
-
 
160
        Long other_element_key = other_element.getKey();
-
 
161
        Long other_element_value = other_element.getValue();
-
 
162
 
-
 
163
        Long __this__reserved_copy_key = other_element_key;
-
 
164
 
-
 
165
        Long __this__reserved_copy_value = other_element_value;
-
 
166
 
-
 
167
        __this__reserved.put(__this__reserved_copy_key, __this__reserved_copy_value);
-
 
168
      }
-
 
169
      this.reserved = __this__reserved;
-
 
170
    }
-
 
171
  }
145
  }
172
 
146
 
173
  public ItemInventory deepCopy() {
147
  public ItemInventory deepCopy() {
174
    return new ItemInventory(this);
148
    return new ItemInventory(this);
175
  }
149
  }
Line 177... Line 151...
177
  @Override
151
  @Override
178
  public void clear() {
152
  public void clear() {
179
    setIdIsSet(false);
153
    setIdIsSet(false);
180
    this.id = 0;
154
    this.id = 0;
181
    this.availability = null;
155
    this.availability = null;
182
    this.reserved = null;
-
 
183
  }
156
  }
184
 
157
 
185
  public long getId() {
158
  public long getId() {
186
    return this.id;
159
    return this.id;
187
  }
160
  }
Line 236... Line 209...
236
    if (!value) {
209
    if (!value) {
237
      this.availability = null;
210
      this.availability = null;
238
    }
211
    }
239
  }
212
  }
240
 
213
 
241
  public int getReservedSize() {
-
 
242
    return (this.reserved == null) ? 0 : this.reserved.size();
-
 
243
  }
-
 
244
 
-
 
245
  public void putToReserved(long key, long val) {
-
 
246
    if (this.reserved == null) {
-
 
247
      this.reserved = new HashMap<Long,Long>();
-
 
248
    }
-
 
249
    this.reserved.put(key, val);
-
 
250
  }
-
 
251
 
-
 
252
  public Map<Long,Long> getReserved() {
-
 
253
    return this.reserved;
-
 
254
  }
-
 
255
 
-
 
256
  public void setReserved(Map<Long,Long> reserved) {
-
 
257
    this.reserved = reserved;
-
 
258
  }
-
 
259
 
-
 
260
  public void unsetReserved() {
-
 
261
    this.reserved = null;
-
 
262
  }
-
 
263
 
-
 
264
  /** Returns true if field reserved is set (has been assigned a value) and false otherwise */
-
 
265
  public boolean isSetReserved() {
-
 
266
    return this.reserved != null;
-
 
267
  }
-
 
268
 
-
 
269
  public void setReservedIsSet(boolean value) {
-
 
270
    if (!value) {
-
 
271
      this.reserved = null;
-
 
272
    }
-
 
273
  }
-
 
274
 
-
 
275
  public void setFieldValue(_Fields field, Object value) {
214
  public void setFieldValue(_Fields field, Object value) {
276
    switch (field) {
215
    switch (field) {
277
    case ID:
216
    case ID:
278
      if (value == null) {
217
      if (value == null) {
279
        unsetId();
218
        unsetId();
Line 288... Line 227...
288
      } else {
227
      } else {
289
        setAvailability((Map<Long,Long>)value);
228
        setAvailability((Map<Long,Long>)value);
290
      }
229
      }
291
      break;
230
      break;
292
 
231
 
293
    case RESERVED:
-
 
294
      if (value == null) {
-
 
295
        unsetReserved();
-
 
296
      } else {
-
 
297
        setReserved((Map<Long,Long>)value);
-
 
298
      }
-
 
299
      break;
-
 
300
 
-
 
301
    }
232
    }
302
  }
233
  }
303
 
234
 
304
  public Object getFieldValue(_Fields field) {
235
  public Object getFieldValue(_Fields field) {
305
    switch (field) {
236
    switch (field) {
Line 307... Line 238...
307
      return Long.valueOf(getId());
238
      return Long.valueOf(getId());
308
 
239
 
309
    case AVAILABILITY:
240
    case AVAILABILITY:
310
      return getAvailability();
241
      return getAvailability();
311
 
242
 
312
    case RESERVED:
-
 
313
      return getReserved();
-
 
314
 
-
 
315
    }
243
    }
316
    throw new IllegalStateException();
244
    throw new IllegalStateException();
317
  }
245
  }
318
 
246
 
319
  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
247
  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
Line 325... Line 253...
325
    switch (field) {
253
    switch (field) {
326
    case ID:
254
    case ID:
327
      return isSetId();
255
      return isSetId();
328
    case AVAILABILITY:
256
    case AVAILABILITY:
329
      return isSetAvailability();
257
      return isSetAvailability();
330
    case RESERVED:
-
 
331
      return isSetReserved();
-
 
332
    }
258
    }
333
    throw new IllegalStateException();
259
    throw new IllegalStateException();
334
  }
260
  }
335
 
261
 
336
  @Override
262
  @Override
Line 362... Line 288...
362
        return false;
288
        return false;
363
      if (!this.availability.equals(that.availability))
289
      if (!this.availability.equals(that.availability))
364
        return false;
290
        return false;
365
    }
291
    }
366
 
292
 
367
    boolean this_present_reserved = true && this.isSetReserved();
-
 
368
    boolean that_present_reserved = true && that.isSetReserved();
-
 
369
    if (this_present_reserved || that_present_reserved) {
-
 
370
      if (!(this_present_reserved && that_present_reserved))
-
 
371
        return false;
-
 
372
      if (!this.reserved.equals(that.reserved))
-
 
373
        return false;
-
 
374
    }
-
 
375
 
-
 
376
    return true;
293
    return true;
377
  }
294
  }
378
 
295
 
379
  @Override
296
  @Override
380
  public int hashCode() {
297
  public int hashCode() {
Line 407... Line 324...
407
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.availability, typedOther.availability);
324
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.availability, typedOther.availability);
408
      if (lastComparison != 0) {
325
      if (lastComparison != 0) {
409
        return lastComparison;
326
        return lastComparison;
410
      }
327
      }
411
    }
328
    }
412
    lastComparison = Boolean.valueOf(isSetReserved()).compareTo(typedOther.isSetReserved());
-
 
413
    if (lastComparison != 0) {
-
 
414
      return lastComparison;
-
 
415
    }
-
 
416
    if (isSetReserved()) {
-
 
417
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.reserved, typedOther.reserved);
-
 
418
      if (lastComparison != 0) {
-
 
419
        return lastComparison;
-
 
420
      }
-
 
421
    }
-
 
422
    return 0;
329
    return 0;
423
  }
330
  }
424
 
331
 
425
  public _Fields fieldForId(int fieldId) {
332
  public _Fields fieldForId(int fieldId) {
426
    return _Fields.findByThriftId(fieldId);
333
    return _Fields.findByThriftId(fieldId);
Line 461... Line 368...
461
            }
368
            }
462
          } else { 
369
          } else { 
463
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
370
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
464
          }
371
          }
465
          break;
372
          break;
466
        case 3: // RESERVED
-
 
467
          if (field.type == org.apache.thrift.protocol.TType.MAP) {
-
 
468
            {
-
 
469
              org.apache.thrift.protocol.TMap _map4 = iprot.readMapBegin();
-
 
470
              this.reserved = new HashMap<Long,Long>(2*_map4.size);
-
 
471
              for (int _i5 = 0; _i5 < _map4.size; ++_i5)
-
 
472
              {
-
 
473
                long _key6; // required
-
 
474
                long _val7; // required
-
 
475
                _key6 = iprot.readI64();
-
 
476
                _val7 = iprot.readI64();
-
 
477
                this.reserved.put(_key6, _val7);
-
 
478
              }
-
 
479
              iprot.readMapEnd();
-
 
480
            }
-
 
481
          } else { 
-
 
482
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
-
 
483
          }
-
 
484
          break;
-
 
485
        default:
373
        default:
486
          org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
374
          org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
487
      }
375
      }
488
      iprot.readFieldEnd();
376
      iprot.readFieldEnd();
489
    }
377
    }
Line 500... Line 388...
500
    oprot.writeFieldEnd();
388
    oprot.writeFieldEnd();
501
    if (this.availability != null) {
389
    if (this.availability != null) {
502
      oprot.writeFieldBegin(AVAILABILITY_FIELD_DESC);
390
      oprot.writeFieldBegin(AVAILABILITY_FIELD_DESC);
503
      {
391
      {
504
        oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.I64, org.apache.thrift.protocol.TType.I64, this.availability.size()));
392
        oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.I64, org.apache.thrift.protocol.TType.I64, this.availability.size()));
505
        for (Map.Entry<Long, Long> _iter8 : this.availability.entrySet())
393
        for (Map.Entry<Long, Long> _iter4 : this.availability.entrySet())
506
        {
-
 
507
          oprot.writeI64(_iter8.getKey());
-
 
508
          oprot.writeI64(_iter8.getValue());
-
 
509
        }
-
 
510
        oprot.writeMapEnd();
-
 
511
      }
-
 
512
      oprot.writeFieldEnd();
-
 
513
    }
-
 
514
    if (this.reserved != null) {
-
 
515
      oprot.writeFieldBegin(RESERVED_FIELD_DESC);
-
 
516
      {
-
 
517
        oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.I64, org.apache.thrift.protocol.TType.I64, this.reserved.size()));
-
 
518
        for (Map.Entry<Long, Long> _iter9 : this.reserved.entrySet())
-
 
519
        {
394
        {
520
          oprot.writeI64(_iter9.getKey());
395
          oprot.writeI64(_iter4.getKey());
521
          oprot.writeI64(_iter9.getValue());
396
          oprot.writeI64(_iter4.getValue());
522
        }
397
        }
523
        oprot.writeMapEnd();
398
        oprot.writeMapEnd();
524
      }
399
      }
525
      oprot.writeFieldEnd();
400
      oprot.writeFieldEnd();
526
    }
401
    }
Line 542... Line 417...
542
      sb.append("null");
417
      sb.append("null");
543
    } else {
418
    } else {
544
      sb.append(this.availability);
419
      sb.append(this.availability);
545
    }
420
    }
546
    first = false;
421
    first = false;
547
    if (!first) sb.append(", ");
-
 
548
    sb.append("reserved:");
-
 
549
    if (this.reserved == null) {
-
 
550
      sb.append("null");
-
 
551
    } else {
-
 
552
      sb.append(this.reserved);
-
 
553
    }
-
 
554
    first = false;
-
 
555
    sb.append(")");
422
    sb.append(")");
556
    return sb.toString();
423
    return sb.toString();
557
  }
424
  }
558
 
425
 
559
  public void validate() throws org.apache.thrift.TException {
426
  public void validate() throws org.apache.thrift.TException {