/** * Autogenerated by Thrift Compiler (0.9.2) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated */ package edu.berkeley.cs.amplab.carat.thrift; import android.annotation.SuppressLint; import java.util.ArrayList; import java.util.BitSet; import java.util.Collections; import java.util.EnumMap; import java.util.EnumSet; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.annotation.Generated; import org.apache.thrift.protocol.TTupleProtocol; import org.apache.thrift.scheme.IScheme; import org.apache.thrift.scheme.SchemeFactory; import org.apache.thrift.scheme.StandardScheme; import org.apache.thrift.scheme.TupleScheme; @SuppressLint("NewApi") @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) @Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2014-12-19") public class HogBugReport implements org.apache.thrift.TBase<HogBugReport, HogBugReport._Fields>, java.io.Serializable, Cloneable, Comparable<HogBugReport> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("HogBugReport"); private static final org.apache.thrift.protocol.TField UU_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("uuId", org.apache.thrift.protocol.TType.STRING, (short)1); private static final org.apache.thrift.protocol.TField HB_LIST_FIELD_DESC = new org.apache.thrift.protocol.TField("hbList", org.apache.thrift.protocol.TType.LIST, (short)2); private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); static { schemes.put(StandardScheme.class, new HogBugReportStandardSchemeFactory()); schemes.put(TupleScheme.class, new HogBugReportTupleSchemeFactory()); } public String uuId; // required public List<HogsBugs> hbList; // optional /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.thrift.TFieldIdEnum { UU_ID((short)1, "uuId"), HB_LIST((short)2, "hbList"); 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: // UU_ID return UU_ID; case 2: // HB_LIST return HB_LIST; 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 _Fields optionals[] = {_Fields.HB_LIST}; 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.UU_ID, new org.apache.thrift.meta_data.FieldMetaData("uuId", org.apache.thrift.TFieldRequirementType.REQUIRED, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); tmpMap.put(_Fields.HB_LIST, new org.apache.thrift.meta_data.FieldMetaData("hbList", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.LIST , "HogsBugsList"))); metaDataMap = Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(HogBugReport.class, metaDataMap); } public HogBugReport() { } public HogBugReport( String uuId) { this(); this.uuId = uuId; } /** * Performs a deep copy on <i>other</i>. */ public HogBugReport(HogBugReport other) { if (other.isSetUuId()) { this.uuId = other.uuId; } if (other.isSetHbList()) { this.hbList = other.hbList; } } public HogBugReport deepCopy() { return new HogBugReport(this); } @Override public void clear() { this.uuId = null; this.hbList = null; } public String getUuId() { return this.uuId; } public HogBugReport setUuId(String uuId) { this.uuId = uuId; return this; } public void unsetUuId() { this.uuId = null; } /** Returns true if field uuId is set (has been assigned a value) and false otherwise */ public boolean isSetUuId() { return this.uuId != null; } public void setUuIdIsSet(boolean value) { if (!value) { this.uuId = null; } } public int getHbListSize() { return (this.hbList == null) ? 0 : this.hbList.size(); } public java.util.Iterator<HogsBugs> getHbListIterator() { return (this.hbList == null) ? null : this.hbList.iterator(); } public void addToHbList(HogsBugs elem) { if (this.hbList == null) { this.hbList = new ArrayList<HogsBugs>(); } this.hbList.add(elem); } public List<HogsBugs> getHbList() { return this.hbList; } public HogBugReport setHbList(List<HogsBugs> hbList) { this.hbList = hbList; return this; } public void unsetHbList() { this.hbList = null; } /** Returns true if field hbList is set (has been assigned a value) and false otherwise */ public boolean isSetHbList() { return this.hbList != null; } public void setHbListIsSet(boolean value) { if (!value) { this.hbList = null; } } public void setFieldValue(_Fields field, Object value) { switch (field) { case UU_ID: if (value == null) { unsetUuId(); } else { setUuId((String)value); } break; case HB_LIST: if (value == null) { unsetHbList(); } else { setHbList((List<HogsBugs>)value); } break; } } public Object getFieldValue(_Fields field) { switch (field) { case UU_ID: return getUuId(); case HB_LIST: return getHbList(); } 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 UU_ID: return isSetUuId(); case HB_LIST: return isSetHbList(); } throw new IllegalStateException(); } @Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof HogBugReport) return this.equals((HogBugReport)that); return false; } public boolean equals(HogBugReport that) { if (that == null) return false; boolean this_present_uuId = true && this.isSetUuId(); boolean that_present_uuId = true && that.isSetUuId(); if (this_present_uuId || that_present_uuId) { if (!(this_present_uuId && that_present_uuId)) return false; if (!this.uuId.equals(that.uuId)) return false; } boolean this_present_hbList = true && this.isSetHbList(); boolean that_present_hbList = true && that.isSetHbList(); if (this_present_hbList || that_present_hbList) { if (!(this_present_hbList && that_present_hbList)) return false; if (!this.hbList.equals(that.hbList)) return false; } return true; } @Override public int hashCode() { List<Object> list = new ArrayList<Object>(); boolean present_uuId = true && (isSetUuId()); list.add(present_uuId); if (present_uuId) list.add(uuId); boolean present_hbList = true && (isSetHbList()); list.add(present_hbList); if (present_hbList) list.add(hbList); return list.hashCode(); } @Override public int compareTo(HogBugReport other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; lastComparison = Boolean.valueOf(isSetUuId()).compareTo(other.isSetUuId()); if (lastComparison != 0) { return lastComparison; } if (isSetUuId()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.uuId, other.uuId); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetHbList()).compareTo(other.isSetHbList()); if (lastComparison != 0) { return lastComparison; } if (isSetHbList()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.hbList, other.hbList); 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("HogBugReport("); boolean first = true; sb.append("uuId:"); if (this.uuId == null) { sb.append("null"); } else { sb.append(this.uuId); } first = false; if (isSetHbList()) { if (!first) sb.append(", "); sb.append("hbList:"); if (this.hbList == null) { sb.append("null"); } else { sb.append(this.hbList); } first = false; } sb.append(")"); return sb.toString(); } public void validate() throws org.apache.thrift.TException { // check for required fields if (uuId == null) { throw new org.apache.thrift.protocol.TProtocolException("Required field 'uuId' was not present! Struct: " + toString()); } // 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 { 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 HogBugReportStandardSchemeFactory implements SchemeFactory { public HogBugReportStandardScheme getScheme() { return new HogBugReportStandardScheme(); } } private static class HogBugReportStandardScheme extends StandardScheme<HogBugReport> { public void read(org.apache.thrift.protocol.TProtocol iprot, HogBugReport 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: // UU_ID if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.uuId = iprot.readString(); struct.setUuIdIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 2: // HB_LIST if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { org.apache.thrift.protocol.TList _list80 = iprot.readListBegin(); struct.hbList = new ArrayList<HogsBugs>(_list80.size); HogsBugs _elem81; for (int _i82 = 0; _i82 < _list80.size; ++_i82) { _elem81 = new HogsBugs(); _elem81.read(iprot); struct.hbList.add(_elem81); } iprot.readListEnd(); } struct.setHbListIsSet(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, HogBugReport struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); if (struct.uuId != null) { oprot.writeFieldBegin(UU_ID_FIELD_DESC); oprot.writeString(struct.uuId); oprot.writeFieldEnd(); } if (struct.hbList != null) { if (struct.isSetHbList()) { oprot.writeFieldBegin(HB_LIST_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.hbList.size())); for (HogsBugs _iter83 : struct.hbList) { _iter83.write(oprot); } oprot.writeListEnd(); } oprot.writeFieldEnd(); } } oprot.writeFieldStop(); oprot.writeStructEnd(); } } private static class HogBugReportTupleSchemeFactory implements SchemeFactory { public HogBugReportTupleScheme getScheme() { return new HogBugReportTupleScheme(); } } private static class HogBugReportTupleScheme extends TupleScheme<HogBugReport> { @Override public void write(org.apache.thrift.protocol.TProtocol prot, HogBugReport struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; oprot.writeString(struct.uuId); BitSet optionals = new BitSet(); if (struct.isSetHbList()) { optionals.set(0); } oprot.writeBitSet(optionals, 1); if (struct.isSetHbList()) { { oprot.writeI32(struct.hbList.size()); for (HogsBugs _iter84 : struct.hbList) { _iter84.write(oprot); } } } } @Override public void read(org.apache.thrift.protocol.TProtocol prot, HogBugReport struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; struct.uuId = iprot.readString(); struct.setUuIdIsSet(true); BitSet incoming = iprot.readBitSet(1); if (incoming.get(0)) { { org.apache.thrift.protocol.TList _list85 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); struct.hbList = new ArrayList<HogsBugs>(_list85.size); HogsBugs _elem86; for (int _i87 = 0; _i87 < _list85.size; ++_i87) { _elem86 = new HogsBugs(); _elem86.read(iprot); struct.hbList.add(_elem86); } } struct.setHbListIsSet(true); } } } }