/** * Autogenerated by Thrift Compiler (0.9.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated */ package com.yahoo.ycsb.db.tpcc.helper.rows; import org.apache.thrift.scheme.IScheme; import org.apache.thrift.scheme.SchemeFactory; import org.apache.thrift.scheme.StandardScheme; import org.apache.thrift.scheme.TupleScheme; import org.apache.thrift.protocol.TTupleProtocol; import org.apache.thrift.protocol.TProtocolException; import org.apache.thrift.EncodingUtils; import org.apache.thrift.TException; import java.util.List; import java.util.ArrayList; import java.util.Map; import java.util.HashMap; import java.util.EnumMap; import java.util.Set; import java.util.HashSet; import java.util.EnumSet; import java.util.Collections; import java.util.BitSet; import java.nio.ByteBuffer; import java.util.Arrays; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class OrderRow implements org.apache.thrift.TBase<OrderRow, OrderRow._Fields>, java.io.Serializable, Cloneable { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("OrderRow"); private static final org.apache.thrift.protocol.TField O_C_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("o_c_id", org.apache.thrift.protocol.TType.I32, (short)1); private static final org.apache.thrift.protocol.TField O_ENTRY_D_FIELD_DESC = new org.apache.thrift.protocol.TField("o_entry_d", org.apache.thrift.protocol.TType.STRING, (short)2); private static final org.apache.thrift.protocol.TField O_CARRIER_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("o_carrier_id", org.apache.thrift.protocol.TType.I32, (short)3); private static final org.apache.thrift.protocol.TField O_OL_CNT_FIELD_DESC = new org.apache.thrift.protocol.TField("o_ol_cnt", org.apache.thrift.protocol.TType.I32, (short)4); private static final org.apache.thrift.protocol.TField O_ALL_LOCAL_FIELD_DESC = new org.apache.thrift.protocol.TField("o_all_local", org.apache.thrift.protocol.TType.I16, (short)5); private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); static { schemes.put(StandardScheme.class, new OrderRowStandardSchemeFactory()); schemes.put(TupleScheme.class, new OrderRowTupleSchemeFactory()); } public int o_c_id; // required public String o_entry_d; // required public int o_carrier_id; // required public int o_ol_cnt; // required public short o_all_local; // required /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.thrift.TFieldIdEnum { O_C_ID((short)1, "o_c_id"), O_ENTRY_D((short)2, "o_entry_d"), O_CARRIER_ID((short)3, "o_carrier_id"), O_OL_CNT((short)4, "o_ol_cnt"), O_ALL_LOCAL((short)5, "o_all_local"); private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); static { for (_Fields field : EnumSet.allOf(_Fields.class)) { byName.put(field.getFieldName(), field); } } /** * Find the _Fields constant that matches fieldId, or null if its not found. */ public static _Fields findByThriftId(int fieldId) { switch(fieldId) { case 1: // O_C_ID return O_C_ID; case 2: // O_ENTRY_D return O_ENTRY_D; case 3: // O_CARRIER_ID return O_CARRIER_ID; case 4: // O_OL_CNT return O_OL_CNT; case 5: // O_ALL_LOCAL return O_ALL_LOCAL; default: return null; } } /** * Find the _Fields constant that matches fieldId, throwing an exception * if it is not found. */ public static _Fields findByThriftIdOrThrow(int fieldId) { _Fields fields = findByThriftId(fieldId); if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); return fields; } /** * Find the _Fields constant that matches name, or null if its not found. */ public static _Fields findByName(String name) { return byName.get(name); } private final short _thriftId; private final String _fieldName; _Fields(short thriftId, String fieldName) { _thriftId = thriftId; _fieldName = fieldName; } public short getThriftFieldId() { return _thriftId; } public String getFieldName() { return _fieldName; } } // isset id assignments private static final int __O_C_ID_ISSET_ID = 0; private static final int __O_CARRIER_ID_ISSET_ID = 1; private static final int __O_OL_CNT_ISSET_ID = 2; private static final int __O_ALL_LOCAL_ISSET_ID = 3; private byte __isset_bitfield = 0; public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; static { Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); tmpMap.put(_Fields.O_C_ID, new org.apache.thrift.meta_data.FieldMetaData("o_c_id", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); tmpMap.put(_Fields.O_ENTRY_D, new org.apache.thrift.meta_data.FieldMetaData("o_entry_d", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); tmpMap.put(_Fields.O_CARRIER_ID, new org.apache.thrift.meta_data.FieldMetaData("o_carrier_id", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); tmpMap.put(_Fields.O_OL_CNT, new org.apache.thrift.meta_data.FieldMetaData("o_ol_cnt", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); tmpMap.put(_Fields.O_ALL_LOCAL, new org.apache.thrift.meta_data.FieldMetaData("o_all_local", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I16))); metaDataMap = Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(OrderRow.class, metaDataMap); } public OrderRow() { } public OrderRow( int o_c_id, String o_entry_d, int o_carrier_id, int o_ol_cnt, short o_all_local) { this(); this.o_c_id = o_c_id; setO_c_idIsSet(true); this.o_entry_d = o_entry_d; this.o_carrier_id = o_carrier_id; setO_carrier_idIsSet(true); this.o_ol_cnt = o_ol_cnt; setO_ol_cntIsSet(true); this.o_all_local = o_all_local; setO_all_localIsSet(true); } /** * Performs a deep copy on <i>other</i>. */ public OrderRow(OrderRow other) { __isset_bitfield = other.__isset_bitfield; this.o_c_id = other.o_c_id; if (other.isSetO_entry_d()) { this.o_entry_d = other.o_entry_d; } this.o_carrier_id = other.o_carrier_id; this.o_ol_cnt = other.o_ol_cnt; this.o_all_local = other.o_all_local; } public OrderRow deepCopy() { return new OrderRow(this); } @Override public void clear() { setO_c_idIsSet(false); this.o_c_id = 0; this.o_entry_d = null; setO_carrier_idIsSet(false); this.o_carrier_id = 0; setO_ol_cntIsSet(false); this.o_ol_cnt = 0; setO_all_localIsSet(false); this.o_all_local = 0; } public int getO_c_id() { return this.o_c_id; } public OrderRow setO_c_id(int o_c_id) { this.o_c_id = o_c_id; setO_c_idIsSet(true); return this; } public void unsetO_c_id() { __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __O_C_ID_ISSET_ID); } /** Returns true if field o_c_id is set (has been assigned a value) and false otherwise */ public boolean isSetO_c_id() { return EncodingUtils.testBit(__isset_bitfield, __O_C_ID_ISSET_ID); } public void setO_c_idIsSet(boolean value) { __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __O_C_ID_ISSET_ID, value); } public String getO_entry_d() { return this.o_entry_d; } public OrderRow setO_entry_d(String o_entry_d) { this.o_entry_d = o_entry_d; return this; } public void unsetO_entry_d() { this.o_entry_d = null; } /** Returns true if field o_entry_d is set (has been assigned a value) and false otherwise */ public boolean isSetO_entry_d() { return this.o_entry_d != null; } public void setO_entry_dIsSet(boolean value) { if (!value) { this.o_entry_d = null; } } public int getO_carrier_id() { return this.o_carrier_id; } public OrderRow setO_carrier_id(int o_carrier_id) { this.o_carrier_id = o_carrier_id; setO_carrier_idIsSet(true); return this; } public void unsetO_carrier_id() { __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __O_CARRIER_ID_ISSET_ID); } /** Returns true if field o_carrier_id is set (has been assigned a value) and false otherwise */ public boolean isSetO_carrier_id() { return EncodingUtils.testBit(__isset_bitfield, __O_CARRIER_ID_ISSET_ID); } public void setO_carrier_idIsSet(boolean value) { __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __O_CARRIER_ID_ISSET_ID, value); } public int getO_ol_cnt() { return this.o_ol_cnt; } public OrderRow setO_ol_cnt(int o_ol_cnt) { this.o_ol_cnt = o_ol_cnt; setO_ol_cntIsSet(true); return this; } public void unsetO_ol_cnt() { __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __O_OL_CNT_ISSET_ID); } /** Returns true if field o_ol_cnt is set (has been assigned a value) and false otherwise */ public boolean isSetO_ol_cnt() { return EncodingUtils.testBit(__isset_bitfield, __O_OL_CNT_ISSET_ID); } public void setO_ol_cntIsSet(boolean value) { __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __O_OL_CNT_ISSET_ID, value); } public short getO_all_local() { return this.o_all_local; } public OrderRow setO_all_local(short o_all_local) { this.o_all_local = o_all_local; setO_all_localIsSet(true); return this; } public void unsetO_all_local() { __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __O_ALL_LOCAL_ISSET_ID); } /** Returns true if field o_all_local is set (has been assigned a value) and false otherwise */ public boolean isSetO_all_local() { return EncodingUtils.testBit(__isset_bitfield, __O_ALL_LOCAL_ISSET_ID); } public void setO_all_localIsSet(boolean value) { __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __O_ALL_LOCAL_ISSET_ID, value); } public void setFieldValue(_Fields field, Object value) { switch (field) { case O_C_ID: if (value == null) { unsetO_c_id(); } else { setO_c_id((Integer)value); } break; case O_ENTRY_D: if (value == null) { unsetO_entry_d(); } else { setO_entry_d((String)value); } break; case O_CARRIER_ID: if (value == null) { unsetO_carrier_id(); } else { setO_carrier_id((Integer)value); } break; case O_OL_CNT: if (value == null) { unsetO_ol_cnt(); } else { setO_ol_cnt((Integer)value); } break; case O_ALL_LOCAL: if (value == null) { unsetO_all_local(); } else { setO_all_local((Short)value); } break; } } public Object getFieldValue(_Fields field) { switch (field) { case O_C_ID: return Integer.valueOf(getO_c_id()); case O_ENTRY_D: return getO_entry_d(); case O_CARRIER_ID: return Integer.valueOf(getO_carrier_id()); case O_OL_CNT: return Integer.valueOf(getO_ol_cnt()); case O_ALL_LOCAL: return Short.valueOf(getO_all_local()); } throw new IllegalStateException(); } /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ public boolean isSet(_Fields field) { if (field == null) { throw new IllegalArgumentException(); } switch (field) { case O_C_ID: return isSetO_c_id(); case O_ENTRY_D: return isSetO_entry_d(); case O_CARRIER_ID: return isSetO_carrier_id(); case O_OL_CNT: return isSetO_ol_cnt(); case O_ALL_LOCAL: return isSetO_all_local(); } throw new IllegalStateException(); } @Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof OrderRow) return this.equals((OrderRow)that); return false; } public boolean equals(OrderRow that) { if (that == null) return false; boolean this_present_o_c_id = true; boolean that_present_o_c_id = true; if (this_present_o_c_id || that_present_o_c_id) { if (!(this_present_o_c_id && that_present_o_c_id)) return false; if (this.o_c_id != that.o_c_id) return false; } boolean this_present_o_entry_d = true && this.isSetO_entry_d(); boolean that_present_o_entry_d = true && that.isSetO_entry_d(); if (this_present_o_entry_d || that_present_o_entry_d) { if (!(this_present_o_entry_d && that_present_o_entry_d)) return false; if (!this.o_entry_d.equals(that.o_entry_d)) return false; } boolean this_present_o_carrier_id = true; boolean that_present_o_carrier_id = true; if (this_present_o_carrier_id || that_present_o_carrier_id) { if (!(this_present_o_carrier_id && that_present_o_carrier_id)) return false; if (this.o_carrier_id != that.o_carrier_id) return false; } boolean this_present_o_ol_cnt = true; boolean that_present_o_ol_cnt = true; if (this_present_o_ol_cnt || that_present_o_ol_cnt) { if (!(this_present_o_ol_cnt && that_present_o_ol_cnt)) return false; if (this.o_ol_cnt != that.o_ol_cnt) return false; } boolean this_present_o_all_local = true; boolean that_present_o_all_local = true; if (this_present_o_all_local || that_present_o_all_local) { if (!(this_present_o_all_local && that_present_o_all_local)) return false; if (this.o_all_local != that.o_all_local) return false; } return true; } @Override public int hashCode() { return 0; } public int compareTo(OrderRow other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; OrderRow typedOther = (OrderRow)other; lastComparison = Boolean.valueOf(isSetO_c_id()).compareTo(typedOther.isSetO_c_id()); if (lastComparison != 0) { return lastComparison; } if (isSetO_c_id()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.o_c_id, typedOther.o_c_id); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetO_entry_d()).compareTo(typedOther.isSetO_entry_d()); if (lastComparison != 0) { return lastComparison; } if (isSetO_entry_d()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.o_entry_d, typedOther.o_entry_d); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetO_carrier_id()).compareTo(typedOther.isSetO_carrier_id()); if (lastComparison != 0) { return lastComparison; } if (isSetO_carrier_id()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.o_carrier_id, typedOther.o_carrier_id); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetO_ol_cnt()).compareTo(typedOther.isSetO_ol_cnt()); if (lastComparison != 0) { return lastComparison; } if (isSetO_ol_cnt()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.o_ol_cnt, typedOther.o_ol_cnt); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetO_all_local()).compareTo(typedOther.isSetO_all_local()); if (lastComparison != 0) { return lastComparison; } if (isSetO_all_local()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.o_all_local, typedOther.o_all_local); if (lastComparison != 0) { return lastComparison; } } return 0; } public _Fields fieldForId(int fieldId) { return _Fields.findByThriftId(fieldId); } public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { schemes.get(iprot.getScheme()).getScheme().read(iprot, this); } public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { schemes.get(oprot.getScheme()).getScheme().write(oprot, this); } @Override public String toString() { StringBuilder sb = new StringBuilder("OrderRow("); boolean first = true; sb.append("o_c_id:"); sb.append(this.o_c_id); first = false; if (!first) sb.append(", "); sb.append("o_entry_d:"); if (this.o_entry_d == null) { sb.append("null"); } else { sb.append(this.o_entry_d); } first = false; if (!first) sb.append(", "); sb.append("o_carrier_id:"); sb.append(this.o_carrier_id); first = false; if (!first) sb.append(", "); sb.append("o_ol_cnt:"); sb.append(this.o_ol_cnt); first = false; if (!first) sb.append(", "); sb.append("o_all_local:"); sb.append(this.o_all_local); first = false; sb.append(")"); return sb.toString(); } public void validate() throws org.apache.thrift.TException { // check for required fields // check for sub-struct validity } private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { try { write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); } catch (org.apache.thrift.TException te) { throw new java.io.IOException(te); } } private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { try { // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor. __isset_bitfield = 0; read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); } catch (org.apache.thrift.TException te) { throw new java.io.IOException(te); } } private static class OrderRowStandardSchemeFactory implements SchemeFactory { public OrderRowStandardScheme getScheme() { return new OrderRowStandardScheme(); } } private static class OrderRowStandardScheme extends StandardScheme<OrderRow> { public void read(org.apache.thrift.protocol.TProtocol iprot, OrderRow 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: // O_C_ID if (schemeField.type == org.apache.thrift.protocol.TType.I32) { struct.o_c_id = iprot.readI32(); struct.setO_c_idIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 2: // O_ENTRY_D if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.o_entry_d = iprot.readString(); struct.setO_entry_dIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 3: // O_CARRIER_ID if (schemeField.type == org.apache.thrift.protocol.TType.I32) { struct.o_carrier_id = iprot.readI32(); struct.setO_carrier_idIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 4: // O_OL_CNT if (schemeField.type == org.apache.thrift.protocol.TType.I32) { struct.o_ol_cnt = iprot.readI32(); struct.setO_ol_cntIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 5: // O_ALL_LOCAL if (schemeField.type == org.apache.thrift.protocol.TType.I16) { struct.o_all_local = iprot.readI16(); struct.setO_all_localIsSet(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(); } public void write(org.apache.thrift.protocol.TProtocol oprot, OrderRow struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); oprot.writeFieldBegin(O_C_ID_FIELD_DESC); oprot.writeI32(struct.o_c_id); oprot.writeFieldEnd(); if (struct.o_entry_d != null) { oprot.writeFieldBegin(O_ENTRY_D_FIELD_DESC); oprot.writeString(struct.o_entry_d); oprot.writeFieldEnd(); } oprot.writeFieldBegin(O_CARRIER_ID_FIELD_DESC); oprot.writeI32(struct.o_carrier_id); oprot.writeFieldEnd(); oprot.writeFieldBegin(O_OL_CNT_FIELD_DESC); oprot.writeI32(struct.o_ol_cnt); oprot.writeFieldEnd(); oprot.writeFieldBegin(O_ALL_LOCAL_FIELD_DESC); oprot.writeI16(struct.o_all_local); oprot.writeFieldEnd(); oprot.writeFieldStop(); oprot.writeStructEnd(); } } private static class OrderRowTupleSchemeFactory implements SchemeFactory { public OrderRowTupleScheme getScheme() { return new OrderRowTupleScheme(); } } private static class OrderRowTupleScheme extends TupleScheme<OrderRow> { @Override public void write(org.apache.thrift.protocol.TProtocol prot, OrderRow struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; BitSet optionals = new BitSet(); if (struct.isSetO_c_id()) { optionals.set(0); } if (struct.isSetO_entry_d()) { optionals.set(1); } if (struct.isSetO_carrier_id()) { optionals.set(2); } if (struct.isSetO_ol_cnt()) { optionals.set(3); } if (struct.isSetO_all_local()) { optionals.set(4); } oprot.writeBitSet(optionals, 5); if (struct.isSetO_c_id()) { oprot.writeI32(struct.o_c_id); } if (struct.isSetO_entry_d()) { oprot.writeString(struct.o_entry_d); } if (struct.isSetO_carrier_id()) { oprot.writeI32(struct.o_carrier_id); } if (struct.isSetO_ol_cnt()) { oprot.writeI32(struct.o_ol_cnt); } if (struct.isSetO_all_local()) { oprot.writeI16(struct.o_all_local); } } @Override public void read(org.apache.thrift.protocol.TProtocol prot, OrderRow struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; BitSet incoming = iprot.readBitSet(5); if (incoming.get(0)) { struct.o_c_id = iprot.readI32(); struct.setO_c_idIsSet(true); } if (incoming.get(1)) { struct.o_entry_d = iprot.readString(); struct.setO_entry_dIsSet(true); } if (incoming.get(2)) { struct.o_carrier_id = iprot.readI32(); struct.setO_carrier_idIsSet(true); } if (incoming.get(3)) { struct.o_ol_cnt = iprot.readI32(); struct.setO_ol_cntIsSet(true); } if (incoming.get(4)) { struct.o_all_local = iprot.readI16(); struct.setO_all_localIsSet(true); } } } }