Subversion Repositories SmartDukaan

Rev

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

Rev 4490 Rev 4506
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);
28
 
29
 
29
  private long id; // required
30
  private long id; // required
30
  private Map<Long,Long> availability; // required
31
  private Map<Long,Long> availability; // required
-
 
32
  private Map<Long,Long> reserved; // required
31
 
33
 
32
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
34
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
33
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
35
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
34
    ID((short)1, "id"),
36
    ID((short)1, "id"),
35
    AVAILABILITY((short)2, "availability");
37
    AVAILABILITY((short)2, "availability"),
-
 
38
    RESERVED((short)3, "reserved");
36
 
39
 
37
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
40
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
38
 
41
 
39
    static {
42
    static {
40
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
43
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
Line 49... Line 52...
49
      switch(fieldId) {
52
      switch(fieldId) {
50
        case 1: // ID
53
        case 1: // ID
51
          return ID;
54
          return ID;
52
        case 2: // AVAILABILITY
55
        case 2: // AVAILABILITY
53
          return AVAILABILITY;
56
          return AVAILABILITY;
-
 
57
        case 3: // RESERVED
-
 
58
          return RESERVED;
54
        default:
59
        default:
55
          return null;
60
          return null;
56
      }
61
      }
57
    }
62
    }
58
 
63
 
Line 101... Line 106...
101
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
106
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
102
    tmpMap.put(_Fields.AVAILABILITY, new org.apache.thrift.meta_data.FieldMetaData("availability", org.apache.thrift.TFieldRequirementType.DEFAULT, 
107
    tmpMap.put(_Fields.AVAILABILITY, new org.apache.thrift.meta_data.FieldMetaData("availability", org.apache.thrift.TFieldRequirementType.DEFAULT, 
103
        new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP, 
108
        new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP, 
104
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64), 
109
            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))));
110
            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))));
106
    metaDataMap = Collections.unmodifiableMap(tmpMap);
115
    metaDataMap = Collections.unmodifiableMap(tmpMap);
107
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ItemInventory.class, metaDataMap);
116
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ItemInventory.class, metaDataMap);
108
  }
117
  }
109
 
118
 
110
  public ItemInventory() {
119
  public ItemInventory() {
111
  }
120
  }
112
 
121
 
113
  public ItemInventory(
122
  public ItemInventory(
114
    long id,
123
    long id,
115
    Map<Long,Long> availability)
124
    Map<Long,Long> availability,
-
 
125
    Map<Long,Long> reserved)
116
  {
126
  {
117
    this();
127
    this();
118
    this.id = id;
128
    this.id = id;
119
    setIdIsSet(true);
129
    setIdIsSet(true);
120
    this.availability = availability;
130
    this.availability = availability;
-
 
131
    this.reserved = reserved;
121
  }
132
  }
122
 
133
 
123
  /**
134
  /**
124
   * Performs a deep copy on <i>other</i>.
135
   * Performs a deep copy on <i>other</i>.
125
   */
136
   */
Line 140... Line 151...
140
 
151
 
141
        __this__availability.put(__this__availability_copy_key, __this__availability_copy_value);
152
        __this__availability.put(__this__availability_copy_key, __this__availability_copy_value);
142
      }
153
      }
143
      this.availability = __this__availability;
154
      this.availability = __this__availability;
144
    }
155
    }
-
 
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
    }
145
  }
171
  }
146
 
172
 
147
  public ItemInventory deepCopy() {
173
  public ItemInventory deepCopy() {
148
    return new ItemInventory(this);
174
    return new ItemInventory(this);
149
  }
175
  }
Line 151... Line 177...
151
  @Override
177
  @Override
152
  public void clear() {
178
  public void clear() {
153
    setIdIsSet(false);
179
    setIdIsSet(false);
154
    this.id = 0;
180
    this.id = 0;
155
    this.availability = null;
181
    this.availability = null;
-
 
182
    this.reserved = null;
156
  }
183
  }
157
 
184
 
158
  public long getId() {
185
  public long getId() {
159
    return this.id;
186
    return this.id;
160
  }
187
  }
Line 209... Line 236...
209
    if (!value) {
236
    if (!value) {
210
      this.availability = null;
237
      this.availability = null;
211
    }
238
    }
212
  }
239
  }
213
 
240
 
-
 
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
 
214
  public void setFieldValue(_Fields field, Object value) {
275
  public void setFieldValue(_Fields field, Object value) {
215
    switch (field) {
276
    switch (field) {
216
    case ID:
277
    case ID:
217
      if (value == null) {
278
      if (value == null) {
218
        unsetId();
279
        unsetId();
Line 227... Line 288...
227
      } else {
288
      } else {
228
        setAvailability((Map<Long,Long>)value);
289
        setAvailability((Map<Long,Long>)value);
229
      }
290
      }
230
      break;
291
      break;
231
 
292
 
-
 
293
    case RESERVED:
-
 
294
      if (value == null) {
-
 
295
        unsetReserved();
-
 
296
      } else {
-
 
297
        setReserved((Map<Long,Long>)value);
-
 
298
      }
-
 
299
      break;
-
 
300
 
232
    }
301
    }
233
  }
302
  }
234
 
303
 
235
  public Object getFieldValue(_Fields field) {
304
  public Object getFieldValue(_Fields field) {
236
    switch (field) {
305
    switch (field) {
Line 238... Line 307...
238
      return Long.valueOf(getId());
307
      return Long.valueOf(getId());
239
 
308
 
240
    case AVAILABILITY:
309
    case AVAILABILITY:
241
      return getAvailability();
310
      return getAvailability();
242
 
311
 
-
 
312
    case RESERVED:
-
 
313
      return getReserved();
-
 
314
 
243
    }
315
    }
244
    throw new IllegalStateException();
316
    throw new IllegalStateException();
245
  }
317
  }
246
 
318
 
247
  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
319
  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
Line 253... Line 325...
253
    switch (field) {
325
    switch (field) {
254
    case ID:
326
    case ID:
255
      return isSetId();
327
      return isSetId();
256
    case AVAILABILITY:
328
    case AVAILABILITY:
257
      return isSetAvailability();
329
      return isSetAvailability();
-
 
330
    case RESERVED:
-
 
331
      return isSetReserved();
258
    }
332
    }
259
    throw new IllegalStateException();
333
    throw new IllegalStateException();
260
  }
334
  }
261
 
335
 
262
  @Override
336
  @Override
Line 288... Line 362...
288
        return false;
362
        return false;
289
      if (!this.availability.equals(that.availability))
363
      if (!this.availability.equals(that.availability))
290
        return false;
364
        return false;
291
    }
365
    }
292
 
366
 
-
 
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
 
293
    return true;
376
    return true;
294
  }
377
  }
295
 
378
 
296
  @Override
379
  @Override
297
  public int hashCode() {
380
  public int hashCode() {
Line 324... Line 407...
324
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.availability, typedOther.availability);
407
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.availability, typedOther.availability);
325
      if (lastComparison != 0) {
408
      if (lastComparison != 0) {
326
        return lastComparison;
409
        return lastComparison;
327
      }
410
      }
328
    }
411
    }
-
 
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
    }
329
    return 0;
422
    return 0;
330
  }
423
  }
331
 
424
 
332
  public _Fields fieldForId(int fieldId) {
425
  public _Fields fieldForId(int fieldId) {
333
    return _Fields.findByThriftId(fieldId);
426
    return _Fields.findByThriftId(fieldId);
Line 368... Line 461...
368
            }
461
            }
369
          } else { 
462
          } else { 
370
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
463
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
371
          }
464
          }
372
          break;
465
          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;
373
        default:
485
        default:
374
          org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
486
          org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
375
      }
487
      }
376
      iprot.readFieldEnd();
488
      iprot.readFieldEnd();
377
    }
489
    }
Line 388... Line 500...
388
    oprot.writeFieldEnd();
500
    oprot.writeFieldEnd();
389
    if (this.availability != null) {
501
    if (this.availability != null) {
390
      oprot.writeFieldBegin(AVAILABILITY_FIELD_DESC);
502
      oprot.writeFieldBegin(AVAILABILITY_FIELD_DESC);
391
      {
503
      {
392
        oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.I64, org.apache.thrift.protocol.TType.I64, this.availability.size()));
504
        oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.I64, org.apache.thrift.protocol.TType.I64, this.availability.size()));
393
        for (Map.Entry<Long, Long> _iter4 : this.availability.entrySet())
505
        for (Map.Entry<Long, Long> _iter8 : 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())
394
        {
519
        {
395
          oprot.writeI64(_iter4.getKey());
520
          oprot.writeI64(_iter9.getKey());
396
          oprot.writeI64(_iter4.getValue());
521
          oprot.writeI64(_iter9.getValue());
397
        }
522
        }
398
        oprot.writeMapEnd();
523
        oprot.writeMapEnd();
399
      }
524
      }
400
      oprot.writeFieldEnd();
525
      oprot.writeFieldEnd();
401
    }
526
    }
Line 417... Line 542...
417
      sb.append("null");
542
      sb.append("null");
418
    } else {
543
    } else {
419
      sb.append(this.availability);
544
      sb.append(this.availability);
420
    }
545
    }
421
    first = false;
546
    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;
422
    sb.append(")");
555
    sb.append(")");
423
    return sb.toString();
556
    return sb.toString();
424
  }
557
  }
425
 
558
 
426
  public void validate() throws org.apache.thrift.TException {
559
  public void validate() throws org.apache.thrift.TException {