Subversion Repositories SmartDukaan

Rev

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

Rev 1342 Rev 1350
Line 21... Line 21...
21
 
21
 
22
import org.apache.thrift.*;
22
import org.apache.thrift.*;
23
import org.apache.thrift.meta_data.*;
23
import org.apache.thrift.meta_data.*;
24
import org.apache.thrift.protocol.*;
24
import org.apache.thrift.protocol.*;
25
 
25
 
26
public class VendorItemPricing implements TBase<VendorItemPricing._Fields>, java.io.Serializable, Cloneable {
26
public class VendorItemPricing implements TBase<VendorItemPricing._Fields>, java.io.Serializable, Cloneable, Comparable<VendorItemPricing> {
27
  private static final TStruct STRUCT_DESC = new TStruct("VendorItemPricing");
27
  private static final TStruct STRUCT_DESC = new TStruct("VendorItemPricing");
28
 
28
 
29
  private static final TField VENDOR_FIELD_DESC = new TField("vendor", TType.STRUCT, (short)1);
29
  private static final TField VENDOR_ID_FIELD_DESC = new TField("vendorId", TType.I64, (short)1);
30
  private static final TField ITEM_FIELD_DESC = new TField("item", TType.STRUCT, (short)2);
30
  private static final TField ITEM_ID_FIELD_DESC = new TField("itemId", TType.I64, (short)2);
31
  private static final TField TRANSFER_PRICE_FIELD_DESC = new TField("transferPrice", TType.DOUBLE, (short)3);
31
  private static final TField TRANSFER_PRICE_FIELD_DESC = new TField("transferPrice", TType.DOUBLE, (short)3);
32
  private static final TField MOP_FIELD_DESC = new TField("mop", TType.DOUBLE, (short)4);
32
  private static final TField MOP_FIELD_DESC = new TField("mop", TType.DOUBLE, (short)4);
33
  private static final TField DEALER_PRICE_FIELD_DESC = new TField("dealerPrice", TType.DOUBLE, (short)5);
33
  private static final TField DEALER_PRICE_FIELD_DESC = new TField("dealerPrice", TType.DOUBLE, (short)5);
34
 
34
 
35
  private Vendor vendor;
35
  private long vendorId;
36
  private Item item;
36
  private long itemId;
37
  private double transferPrice;
37
  private double transferPrice;
38
  private double mop;
38
  private double mop;
39
  private double dealerPrice;
39
  private double dealerPrice;
40
 
40
 
41
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
41
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
42
  public enum _Fields implements TFieldIdEnum {
42
  public enum _Fields implements TFieldIdEnum {
43
    VENDOR((short)1, "vendor"),
43
    VENDOR_ID((short)1, "vendorId"),
44
    ITEM((short)2, "item"),
44
    ITEM_ID((short)2, "itemId"),
45
    TRANSFER_PRICE((short)3, "transferPrice"),
45
    TRANSFER_PRICE((short)3, "transferPrice"),
46
    MOP((short)4, "mop"),
46
    MOP((short)4, "mop"),
47
    DEALER_PRICE((short)5, "dealerPrice");
47
    DEALER_PRICE((short)5, "dealerPrice");
48
 
48
 
49
    private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
49
    private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
Line 96... Line 96...
96
      return _fieldName;
96
      return _fieldName;
97
    }
97
    }
98
  }
98
  }
99
 
99
 
100
  // isset id assignments
100
  // isset id assignments
-
 
101
  private static final int __VENDORID_ISSET_ID = 0;
-
 
102
  private static final int __ITEMID_ISSET_ID = 1;
101
  private static final int __TRANSFERPRICE_ISSET_ID = 0;
103
  private static final int __TRANSFERPRICE_ISSET_ID = 2;
102
  private static final int __MOP_ISSET_ID = 1;
104
  private static final int __MOP_ISSET_ID = 3;
103
  private static final int __DEALERPRICE_ISSET_ID = 2;
105
  private static final int __DEALERPRICE_ISSET_ID = 4;
104
  private BitSet __isset_bit_vector = new BitSet(3);
106
  private BitSet __isset_bit_vector = new BitSet(5);
105
 
107
 
106
  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
108
  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
107
    put(_Fields.VENDOR, new FieldMetaData("vendor", TFieldRequirementType.DEFAULT, 
109
    put(_Fields.VENDOR_ID, new FieldMetaData("vendorId", TFieldRequirementType.DEFAULT, 
108
        new StructMetaData(TType.STRUCT, Vendor.class)));
110
        new FieldValueMetaData(TType.I64)));
109
    put(_Fields.ITEM, new FieldMetaData("item", TFieldRequirementType.DEFAULT, 
111
    put(_Fields.ITEM_ID, new FieldMetaData("itemId", TFieldRequirementType.DEFAULT, 
110
        new StructMetaData(TType.STRUCT, Item.class)));
112
        new FieldValueMetaData(TType.I64)));
111
    put(_Fields.TRANSFER_PRICE, new FieldMetaData("transferPrice", TFieldRequirementType.DEFAULT, 
113
    put(_Fields.TRANSFER_PRICE, new FieldMetaData("transferPrice", TFieldRequirementType.DEFAULT, 
112
        new FieldValueMetaData(TType.DOUBLE)));
114
        new FieldValueMetaData(TType.DOUBLE)));
113
    put(_Fields.MOP, new FieldMetaData("mop", TFieldRequirementType.DEFAULT, 
115
    put(_Fields.MOP, new FieldMetaData("mop", TFieldRequirementType.DEFAULT, 
114
        new FieldValueMetaData(TType.DOUBLE)));
116
        new FieldValueMetaData(TType.DOUBLE)));
115
    put(_Fields.DEALER_PRICE, new FieldMetaData("dealerPrice", TFieldRequirementType.DEFAULT, 
117
    put(_Fields.DEALER_PRICE, new FieldMetaData("dealerPrice", TFieldRequirementType.DEFAULT, 
Line 122... Line 124...
122
 
124
 
123
  public VendorItemPricing() {
125
  public VendorItemPricing() {
124
  }
126
  }
125
 
127
 
126
  public VendorItemPricing(
128
  public VendorItemPricing(
127
    Vendor vendor,
129
    long vendorId,
128
    Item item,
130
    long itemId,
129
    double transferPrice,
131
    double transferPrice,
130
    double mop,
132
    double mop,
131
    double dealerPrice)
133
    double dealerPrice)
132
  {
134
  {
133
    this();
135
    this();
134
    this.vendor = vendor;
136
    this.vendorId = vendorId;
-
 
137
    setVendorIdIsSet(true);
135
    this.item = item;
138
    this.itemId = itemId;
-
 
139
    setItemIdIsSet(true);
136
    this.transferPrice = transferPrice;
140
    this.transferPrice = transferPrice;
137
    setTransferPriceIsSet(true);
141
    setTransferPriceIsSet(true);
138
    this.mop = mop;
142
    this.mop = mop;
139
    setMopIsSet(true);
143
    setMopIsSet(true);
140
    this.dealerPrice = dealerPrice;
144
    this.dealerPrice = dealerPrice;
Line 145... Line 149...
145
   * Performs a deep copy on <i>other</i>.
149
   * Performs a deep copy on <i>other</i>.
146
   */
150
   */
147
  public VendorItemPricing(VendorItemPricing other) {
151
  public VendorItemPricing(VendorItemPricing other) {
148
    __isset_bit_vector.clear();
152
    __isset_bit_vector.clear();
149
    __isset_bit_vector.or(other.__isset_bit_vector);
153
    __isset_bit_vector.or(other.__isset_bit_vector);
150
    if (other.isSetVendor()) {
-
 
151
      this.vendor = new Vendor(other.vendor);
154
    this.vendorId = other.vendorId;
152
    }
-
 
153
    if (other.isSetItem()) {
-
 
154
      this.item = new Item(other.item);
155
    this.itemId = other.itemId;
155
    }
-
 
156
    this.transferPrice = other.transferPrice;
156
    this.transferPrice = other.transferPrice;
157
    this.mop = other.mop;
157
    this.mop = other.mop;
158
    this.dealerPrice = other.dealerPrice;
158
    this.dealerPrice = other.dealerPrice;
159
  }
159
  }
160
 
160
 
Line 165... Line 165...
165
  @Deprecated
165
  @Deprecated
166
  public VendorItemPricing clone() {
166
  public VendorItemPricing clone() {
167
    return new VendorItemPricing(this);
167
    return new VendorItemPricing(this);
168
  }
168
  }
169
 
169
 
170
  public Vendor getVendor() {
170
  public long getVendorId() {
171
    return this.vendor;
171
    return this.vendorId;
172
  }
172
  }
173
 
173
 
174
  public VendorItemPricing setVendor(Vendor vendor) {
174
  public VendorItemPricing setVendorId(long vendorId) {
175
    this.vendor = vendor;
175
    this.vendorId = vendorId;
-
 
176
    setVendorIdIsSet(true);
176
    return this;
177
    return this;
177
  }
178
  }
178
 
179
 
179
  public void unsetVendor() {
180
  public void unsetVendorId() {
180
    this.vendor = null;
181
    __isset_bit_vector.clear(__VENDORID_ISSET_ID);
181
  }
182
  }
182
 
183
 
183
  /** Returns true if field vendor is set (has been asigned a value) and false otherwise */
184
  /** Returns true if field vendorId is set (has been asigned a value) and false otherwise */
184
  public boolean isSetVendor() {
185
  public boolean isSetVendorId() {
185
    return this.vendor != null;
186
    return __isset_bit_vector.get(__VENDORID_ISSET_ID);
186
  }
187
  }
187
 
188
 
188
  public void setVendorIsSet(boolean value) {
189
  public void setVendorIdIsSet(boolean value) {
189
    if (!value) {
-
 
190
      this.vendor = null;
190
    __isset_bit_vector.set(__VENDORID_ISSET_ID, value);
191
    }
-
 
192
  }
191
  }
193
 
192
 
194
  public Item getItem() {
193
  public long getItemId() {
195
    return this.item;
194
    return this.itemId;
196
  }
195
  }
197
 
196
 
198
  public VendorItemPricing setItem(Item item) {
197
  public VendorItemPricing setItemId(long itemId) {
199
    this.item = item;
198
    this.itemId = itemId;
-
 
199
    setItemIdIsSet(true);
200
    return this;
200
    return this;
201
  }
201
  }
202
 
202
 
203
  public void unsetItem() {
203
  public void unsetItemId() {
204
    this.item = null;
204
    __isset_bit_vector.clear(__ITEMID_ISSET_ID);
205
  }
205
  }
206
 
206
 
207
  /** Returns true if field item is set (has been asigned a value) and false otherwise */
207
  /** Returns true if field itemId is set (has been asigned a value) and false otherwise */
208
  public boolean isSetItem() {
208
  public boolean isSetItemId() {
209
    return this.item != null;
209
    return __isset_bit_vector.get(__ITEMID_ISSET_ID);
210
  }
210
  }
211
 
211
 
212
  public void setItemIsSet(boolean value) {
212
  public void setItemIdIsSet(boolean value) {
213
    if (!value) {
-
 
214
      this.item = null;
213
    __isset_bit_vector.set(__ITEMID_ISSET_ID, value);
215
    }
-
 
216
  }
214
  }
217
 
215
 
218
  public double getTransferPrice() {
216
  public double getTransferPrice() {
219
    return this.transferPrice;
217
    return this.transferPrice;
220
  }
218
  }
Line 284... Line 282...
284
    __isset_bit_vector.set(__DEALERPRICE_ISSET_ID, value);
282
    __isset_bit_vector.set(__DEALERPRICE_ISSET_ID, value);
285
  }
283
  }
286
 
284
 
287
  public void setFieldValue(_Fields field, Object value) {
285
  public void setFieldValue(_Fields field, Object value) {
288
    switch (field) {
286
    switch (field) {
289
    case VENDOR:
287
    case VENDOR_ID:
290
      if (value == null) {
288
      if (value == null) {
291
        unsetVendor();
289
        unsetVendorId();
292
      } else {
290
      } else {
293
        setVendor((Vendor)value);
291
        setVendorId((Long)value);
294
      }
292
      }
295
      break;
293
      break;
296
 
294
 
297
    case ITEM:
295
    case ITEM_ID:
298
      if (value == null) {
296
      if (value == null) {
299
        unsetItem();
297
        unsetItemId();
300
      } else {
298
      } else {
301
        setItem((Item)value);
299
        setItemId((Long)value);
302
      }
300
      }
303
      break;
301
      break;
304
 
302
 
305
    case TRANSFER_PRICE:
303
    case TRANSFER_PRICE:
306
      if (value == null) {
304
      if (value == null) {
Line 333... Line 331...
333
    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
331
    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
334
  }
332
  }
335
 
333
 
336
  public Object getFieldValue(_Fields field) {
334
  public Object getFieldValue(_Fields field) {
337
    switch (field) {
335
    switch (field) {
338
    case VENDOR:
336
    case VENDOR_ID:
339
      return getVendor();
337
      return new Long(getVendorId());
340
 
338
 
341
    case ITEM:
339
    case ITEM_ID:
342
      return getItem();
340
      return new Long(getItemId());
343
 
341
 
344
    case TRANSFER_PRICE:
342
    case TRANSFER_PRICE:
345
      return new Double(getTransferPrice());
343
      return new Double(getTransferPrice());
346
 
344
 
347
    case MOP:
345
    case MOP:
Line 359... Line 357...
359
  }
357
  }
360
 
358
 
361
  /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
359
  /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
362
  public boolean isSet(_Fields field) {
360
  public boolean isSet(_Fields field) {
363
    switch (field) {
361
    switch (field) {
364
    case VENDOR:
362
    case VENDOR_ID:
365
      return isSetVendor();
363
      return isSetVendorId();
366
    case ITEM:
364
    case ITEM_ID:
367
      return isSetItem();
365
      return isSetItemId();
368
    case TRANSFER_PRICE:
366
    case TRANSFER_PRICE:
369
      return isSetTransferPrice();
367
      return isSetTransferPrice();
370
    case MOP:
368
    case MOP:
371
      return isSetMop();
369
      return isSetMop();
372
    case DEALER_PRICE:
370
    case DEALER_PRICE:
Line 390... Line 388...
390
 
388
 
391
  public boolean equals(VendorItemPricing that) {
389
  public boolean equals(VendorItemPricing that) {
392
    if (that == null)
390
    if (that == null)
393
      return false;
391
      return false;
394
 
392
 
395
    boolean this_present_vendor = true && this.isSetVendor();
393
    boolean this_present_vendorId = true;
396
    boolean that_present_vendor = true && that.isSetVendor();
394
    boolean that_present_vendorId = true;
397
    if (this_present_vendor || that_present_vendor) {
395
    if (this_present_vendorId || that_present_vendorId) {
398
      if (!(this_present_vendor && that_present_vendor))
396
      if (!(this_present_vendorId && that_present_vendorId))
399
        return false;
397
        return false;
400
      if (!this.vendor.equals(that.vendor))
398
      if (this.vendorId != that.vendorId)
401
        return false;
399
        return false;
402
    }
400
    }
403
 
401
 
404
    boolean this_present_item = true && this.isSetItem();
402
    boolean this_present_itemId = true;
405
    boolean that_present_item = true && that.isSetItem();
403
    boolean that_present_itemId = true;
406
    if (this_present_item || that_present_item) {
404
    if (this_present_itemId || that_present_itemId) {
407
      if (!(this_present_item && that_present_item))
405
      if (!(this_present_itemId && that_present_itemId))
408
        return false;
406
        return false;
409
      if (!this.item.equals(that.item))
407
      if (this.itemId != that.itemId)
410
        return false;
408
        return false;
411
    }
409
    }
412
 
410
 
413
    boolean this_present_transferPrice = true;
411
    boolean this_present_transferPrice = true;
414
    boolean that_present_transferPrice = true;
412
    boolean that_present_transferPrice = true;
Line 443... Line 441...
443
  @Override
441
  @Override
444
  public int hashCode() {
442
  public int hashCode() {
445
    return 0;
443
    return 0;
446
  }
444
  }
447
 
445
 
-
 
446
  public int compareTo(VendorItemPricing other) {
-
 
447
    if (!getClass().equals(other.getClass())) {
-
 
448
      return getClass().getName().compareTo(other.getClass().getName());
-
 
449
    }
-
 
450
 
-
 
451
    int lastComparison = 0;
-
 
452
    VendorItemPricing typedOther = (VendorItemPricing)other;
-
 
453
 
-
 
454
    lastComparison = Boolean.valueOf(isSetVendorId()).compareTo(isSetVendorId());
-
 
455
    if (lastComparison != 0) {
-
 
456
      return lastComparison;
-
 
457
    }
-
 
458
    lastComparison = TBaseHelper.compareTo(vendorId, typedOther.vendorId);
-
 
459
    if (lastComparison != 0) {
-
 
460
      return lastComparison;
-
 
461
    }
-
 
462
    lastComparison = Boolean.valueOf(isSetItemId()).compareTo(isSetItemId());
-
 
463
    if (lastComparison != 0) {
-
 
464
      return lastComparison;
-
 
465
    }
-
 
466
    lastComparison = TBaseHelper.compareTo(itemId, typedOther.itemId);
-
 
467
    if (lastComparison != 0) {
-
 
468
      return lastComparison;
-
 
469
    }
-
 
470
    lastComparison = Boolean.valueOf(isSetTransferPrice()).compareTo(isSetTransferPrice());
-
 
471
    if (lastComparison != 0) {
-
 
472
      return lastComparison;
-
 
473
    }
-
 
474
    lastComparison = TBaseHelper.compareTo(transferPrice, typedOther.transferPrice);
-
 
475
    if (lastComparison != 0) {
-
 
476
      return lastComparison;
-
 
477
    }
-
 
478
    lastComparison = Boolean.valueOf(isSetMop()).compareTo(isSetMop());
-
 
479
    if (lastComparison != 0) {
-
 
480
      return lastComparison;
-
 
481
    }
-
 
482
    lastComparison = TBaseHelper.compareTo(mop, typedOther.mop);
-
 
483
    if (lastComparison != 0) {
-
 
484
      return lastComparison;
-
 
485
    }
-
 
486
    lastComparison = Boolean.valueOf(isSetDealerPrice()).compareTo(isSetDealerPrice());
-
 
487
    if (lastComparison != 0) {
-
 
488
      return lastComparison;
-
 
489
    }
-
 
490
    lastComparison = TBaseHelper.compareTo(dealerPrice, typedOther.dealerPrice);
-
 
491
    if (lastComparison != 0) {
-
 
492
      return lastComparison;
-
 
493
    }
-
 
494
    return 0;
-
 
495
  }
-
 
496
 
448
  public void read(TProtocol iprot) throws TException {
497
  public void read(TProtocol iprot) throws TException {
449
    TField field;
498
    TField field;
450
    iprot.readStructBegin();
499
    iprot.readStructBegin();
451
    while (true)
500
    while (true)
452
    {
501
    {
Line 457... Line 506...
457
      _Fields fieldId = _Fields.findByThriftId(field.id);
506
      _Fields fieldId = _Fields.findByThriftId(field.id);
458
      if (fieldId == null) {
507
      if (fieldId == null) {
459
        TProtocolUtil.skip(iprot, field.type);
508
        TProtocolUtil.skip(iprot, field.type);
460
      } else {
509
      } else {
461
        switch (fieldId) {
510
        switch (fieldId) {
462
          case VENDOR:
511
          case VENDOR_ID:
463
            if (field.type == TType.STRUCT) {
512
            if (field.type == TType.I64) {
464
              this.vendor = new Vendor();
513
              this.vendorId = iprot.readI64();
465
              this.vendor.read(iprot);
514
              setVendorIdIsSet(true);
466
            } else { 
515
            } else { 
467
              TProtocolUtil.skip(iprot, field.type);
516
              TProtocolUtil.skip(iprot, field.type);
468
            }
517
            }
469
            break;
518
            break;
470
          case ITEM:
519
          case ITEM_ID:
471
            if (field.type == TType.STRUCT) {
520
            if (field.type == TType.I64) {
472
              this.item = new Item();
521
              this.itemId = iprot.readI64();
473
              this.item.read(iprot);
522
              setItemIdIsSet(true);
474
            } else { 
523
            } else { 
475
              TProtocolUtil.skip(iprot, field.type);
524
              TProtocolUtil.skip(iprot, field.type);
476
            }
525
            }
477
            break;
526
            break;
478
          case TRANSFER_PRICE:
527
          case TRANSFER_PRICE:
Line 509... Line 558...
509
 
558
 
510
  public void write(TProtocol oprot) throws TException {
559
  public void write(TProtocol oprot) throws TException {
511
    validate();
560
    validate();
512
 
561
 
513
    oprot.writeStructBegin(STRUCT_DESC);
562
    oprot.writeStructBegin(STRUCT_DESC);
514
    if (this.vendor != null) {
-
 
515
      oprot.writeFieldBegin(VENDOR_FIELD_DESC);
563
    oprot.writeFieldBegin(VENDOR_ID_FIELD_DESC);
516
      this.vendor.write(oprot);
564
    oprot.writeI64(this.vendorId);
517
      oprot.writeFieldEnd();
565
    oprot.writeFieldEnd();
518
    }
-
 
519
    if (this.item != null) {
-
 
520
      oprot.writeFieldBegin(ITEM_FIELD_DESC);
566
    oprot.writeFieldBegin(ITEM_ID_FIELD_DESC);
521
      this.item.write(oprot);
567
    oprot.writeI64(this.itemId);
522
      oprot.writeFieldEnd();
568
    oprot.writeFieldEnd();
523
    }
-
 
524
    oprot.writeFieldBegin(TRANSFER_PRICE_FIELD_DESC);
569
    oprot.writeFieldBegin(TRANSFER_PRICE_FIELD_DESC);
525
    oprot.writeDouble(this.transferPrice);
570
    oprot.writeDouble(this.transferPrice);
526
    oprot.writeFieldEnd();
571
    oprot.writeFieldEnd();
527
    oprot.writeFieldBegin(MOP_FIELD_DESC);
572
    oprot.writeFieldBegin(MOP_FIELD_DESC);
528
    oprot.writeDouble(this.mop);
573
    oprot.writeDouble(this.mop);
Line 537... Line 582...
537
  @Override
582
  @Override
538
  public String toString() {
583
  public String toString() {
539
    StringBuilder sb = new StringBuilder("VendorItemPricing(");
584
    StringBuilder sb = new StringBuilder("VendorItemPricing(");
540
    boolean first = true;
585
    boolean first = true;
541
 
586
 
542
    sb.append("vendor:");
587
    sb.append("vendorId:");
543
    if (this.vendor == null) {
-
 
544
      sb.append("null");
-
 
545
    } else {
-
 
546
      sb.append(this.vendor);
588
    sb.append(this.vendorId);
547
    }
-
 
548
    first = false;
589
    first = false;
549
    if (!first) sb.append(", ");
590
    if (!first) sb.append(", ");
550
    sb.append("item:");
591
    sb.append("itemId:");
551
    if (this.item == null) {
-
 
552
      sb.append("null");
-
 
553
    } else {
-
 
554
      sb.append(this.item);
592
    sb.append(this.itemId);
555
    }
-
 
556
    first = false;
593
    first = false;
557
    if (!first) sb.append(", ");
594
    if (!first) sb.append(", ");
558
    sb.append("transferPrice:");
595
    sb.append("transferPrice:");
559
    sb.append(this.transferPrice);
596
    sb.append(this.transferPrice);
560
    first = false;
597
    first = false;