Java tutorial
/* * Copyright (c) Qatar Computing Research Institute, 2013. * Licensed under the MIT license <http://www.opensource.org/licenses/MIT>. */ /** * Autogenerated by Thrift Compiler (0.9.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated */ package qa.qcri.qnoise.external; import org.apache.thrift.EncodingUtils; 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; import java.util.*; public class TQnoiseSpec implements org.apache.thrift.TBase<TQnoiseSpec, TQnoiseSpec._Fields>, java.io.Serializable, Cloneable { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct( "TQnoiseSpec"); private static final org.apache.thrift.protocol.TField NOISE_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField( "noiseType", org.apache.thrift.protocol.TType.I32, (short) 1); private static final org.apache.thrift.protocol.TField PERCENTAGE_FIELD_DESC = new org.apache.thrift.protocol.TField( "percentage", org.apache.thrift.protocol.TType.DOUBLE, (short) 2); private static final org.apache.thrift.protocol.TField MODEL_FIELD_DESC = new org.apache.thrift.protocol.TField( "model", org.apache.thrift.protocol.TType.I32, (short) 3); private static final org.apache.thrift.protocol.TField IS_ON_CELL_FIELD_DESC = new org.apache.thrift.protocol.TField( "isOnCell", org.apache.thrift.protocol.TType.BOOL, (short) 4); private static final org.apache.thrift.protocol.TField FILTERED_COLUMNS_FIELD_DESC = new org.apache.thrift.protocol.TField( "filteredColumns", org.apache.thrift.protocol.TType.LIST, (short) 5); private static final org.apache.thrift.protocol.TField SEED_FIELD_DESC = new org.apache.thrift.protocol.TField( "seed", org.apache.thrift.protocol.TType.DOUBLE, (short) 6); private static final org.apache.thrift.protocol.TField DISTANCE_FIELD_DESC = new org.apache.thrift.protocol.TField( "distance", org.apache.thrift.protocol.TType.LIST, (short) 7); private static final org.apache.thrift.protocol.TField CONSTRAINT_FIELD_DESC = new org.apache.thrift.protocol.TField( "constraint", org.apache.thrift.protocol.TType.LIST, (short) 8); private static final org.apache.thrift.protocol.TField LOGFILE_FIELD_DESC = new org.apache.thrift.protocol.TField( "logfile", org.apache.thrift.protocol.TType.STRING, (short) 9); private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); static { schemes.put(StandardScheme.class, new TQnoiseSpecStandardSchemeFactory()); schemes.put(TupleScheme.class, new TQnoiseSpecTupleSchemeFactory()); } private TNoiseType noiseType; // required private double percentage; // required private TNoiseModel model; // optional private boolean isOnCell; // optional private List<String> filteredColumns; // optional private double seed; // optional private List<Double> distance; // optional private List<String> constraint; // optional private String logfile; // 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 { /** * * @see TNoiseType */ NOISE_TYPE((short) 1, "noiseType"), PERCENTAGE((short) 2, "percentage"), /** * * @see TNoiseModel */ MODEL((short) 3, "model"), IS_ON_CELL((short) 4, "isOnCell"), FILTERED_COLUMNS((short) 5, "filteredColumns"), SEED((short) 6, "seed"), DISTANCE((short) 7, "distance"), CONSTRAINT((short) 8, "constraint"), LOGFILE((short) 9, "logfile"); 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: // NOISE_TYPE return NOISE_TYPE; case 2: // PERCENTAGE return PERCENTAGE; case 3: // MODEL return MODEL; case 4: // IS_ON_CELL return IS_ON_CELL; case 5: // FILTERED_COLUMNS return FILTERED_COLUMNS; case 6: // SEED return SEED; case 7: // DISTANCE return DISTANCE; case 8: // CONSTRAINT return CONSTRAINT; case 9: // LOGFILE return LOGFILE; 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 __PERCENTAGE_ISSET_ID = 0; private static final int __ISONCELL_ISSET_ID = 1; private static final int __SEED_ISSET_ID = 2; private byte __isset_bitfield = 0; private _Fields optionals[] = { _Fields.MODEL, _Fields.IS_ON_CELL, _Fields.FILTERED_COLUMNS, _Fields.SEED, _Fields.DISTANCE, _Fields.CONSTRAINT, _Fields.LOGFILE }; 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.NOISE_TYPE, new org.apache.thrift.meta_data.FieldMetaData("noiseType", org.apache.thrift.TFieldRequirementType.REQUIRED, new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, TNoiseType.class))); tmpMap.put(_Fields.PERCENTAGE, new org.apache.thrift.meta_data.FieldMetaData("percentage", org.apache.thrift.TFieldRequirementType.REQUIRED, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE))); tmpMap.put(_Fields.MODEL, new org.apache.thrift.meta_data.FieldMetaData("model", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, TNoiseModel.class))); tmpMap.put(_Fields.IS_ON_CELL, new org.apache.thrift.meta_data.FieldMetaData("isOnCell", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL))); tmpMap.put(_Fields.FILTERED_COLUMNS, new org.apache.thrift.meta_data.FieldMetaData("filteredColumns", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, new org.apache.thrift.meta_data.FieldValueMetaData( org.apache.thrift.protocol.TType.STRING)))); tmpMap.put(_Fields.SEED, new org.apache.thrift.meta_data.FieldMetaData("seed", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE))); tmpMap.put(_Fields.DISTANCE, new org.apache.thrift.meta_data.FieldMetaData("distance", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, new org.apache.thrift.meta_data.FieldValueMetaData( org.apache.thrift.protocol.TType.DOUBLE)))); tmpMap.put(_Fields.CONSTRAINT, new org.apache.thrift.meta_data.FieldMetaData("constraint", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, new org.apache.thrift.meta_data.FieldValueMetaData( org.apache.thrift.protocol.TType.STRING)))); tmpMap.put(_Fields.LOGFILE, new org.apache.thrift.meta_data.FieldMetaData("logfile", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); metaDataMap = Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TQnoiseSpec.class, metaDataMap); } public TQnoiseSpec() { } public TQnoiseSpec(TNoiseType noiseType, double percentage) { this(); this.noiseType = noiseType; this.percentage = percentage; setPercentageIsSet(true); } /** * Performs a deep copy on <i>other</i>. */ public TQnoiseSpec(TQnoiseSpec other) { __isset_bitfield = other.__isset_bitfield; if (other.isSetNoiseType()) { this.noiseType = other.noiseType; } this.percentage = other.percentage; if (other.isSetModel()) { this.model = other.model; } this.isOnCell = other.isOnCell; if (other.isSetFilteredColumns()) { List<String> __this__filteredColumns = new ArrayList<String>(); for (String other_element : other.filteredColumns) { __this__filteredColumns.add(other_element); } this.filteredColumns = __this__filteredColumns; } this.seed = other.seed; if (other.isSetDistance()) { List<Double> __this__distance = new ArrayList<Double>(); for (Double other_element : other.distance) { __this__distance.add(other_element); } this.distance = __this__distance; } if (other.isSetConstraint()) { List<String> __this__constraint = new ArrayList<String>(); for (String other_element : other.constraint) { __this__constraint.add(other_element); } this.constraint = __this__constraint; } if (other.isSetLogfile()) { this.logfile = other.logfile; } } public TQnoiseSpec deepCopy() { return new TQnoiseSpec(this); } @Override public void clear() { this.noiseType = null; setPercentageIsSet(false); this.percentage = 0.0; this.model = null; setIsOnCellIsSet(false); this.isOnCell = false; this.filteredColumns = null; setSeedIsSet(false); this.seed = 0.0; this.distance = null; this.constraint = null; this.logfile = null; } /** * * @see TNoiseType */ public TNoiseType getNoiseType() { return this.noiseType; } /** * * @see TNoiseType */ public TQnoiseSpec setNoiseType(TNoiseType noiseType) { this.noiseType = noiseType; return this; } public void unsetNoiseType() { this.noiseType = null; } /** Returns true if field noiseType is set (has been assigned a value) and false otherwise */ public boolean isSetNoiseType() { return this.noiseType != null; } public void setNoiseTypeIsSet(boolean value) { if (!value) { this.noiseType = null; } } public double getPercentage() { return this.percentage; } public TQnoiseSpec setPercentage(double percentage) { this.percentage = percentage; setPercentageIsSet(true); return this; } public void unsetPercentage() { __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __PERCENTAGE_ISSET_ID); } /** Returns true if field percentage is set (has been assigned a value) and false otherwise */ public boolean isSetPercentage() { return EncodingUtils.testBit(__isset_bitfield, __PERCENTAGE_ISSET_ID); } public void setPercentageIsSet(boolean value) { __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __PERCENTAGE_ISSET_ID, value); } /** * * @see TNoiseModel */ public TNoiseModel getModel() { return this.model; } /** * * @see TNoiseModel */ public TQnoiseSpec setModel(TNoiseModel model) { this.model = model; return this; } public void unsetModel() { this.model = null; } /** Returns true if field model is set (has been assigned a value) and false otherwise */ public boolean isSetModel() { return this.model != null; } public void setModelIsSet(boolean value) { if (!value) { this.model = null; } } public boolean isIsOnCell() { return this.isOnCell; } public TQnoiseSpec setIsOnCell(boolean isOnCell) { this.isOnCell = isOnCell; setIsOnCellIsSet(true); return this; } public void unsetIsOnCell() { __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ISONCELL_ISSET_ID); } /** Returns true if field isOnCell is set (has been assigned a value) and false otherwise */ public boolean isSetIsOnCell() { return EncodingUtils.testBit(__isset_bitfield, __ISONCELL_ISSET_ID); } public void setIsOnCellIsSet(boolean value) { __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ISONCELL_ISSET_ID, value); } public int getFilteredColumnsSize() { return (this.filteredColumns == null) ? 0 : this.filteredColumns.size(); } public java.util.Iterator<String> getFilteredColumnsIterator() { return (this.filteredColumns == null) ? null : this.filteredColumns.iterator(); } public void addToFilteredColumns(String elem) { if (this.filteredColumns == null) { this.filteredColumns = new ArrayList<String>(); } this.filteredColumns.add(elem); } public List<String> getFilteredColumns() { return this.filteredColumns; } public TQnoiseSpec setFilteredColumns(List<String> filteredColumns) { this.filteredColumns = filteredColumns; return this; } public void unsetFilteredColumns() { this.filteredColumns = null; } /** Returns true if field filteredColumns is set (has been assigned a value) and false otherwise */ public boolean isSetFilteredColumns() { return this.filteredColumns != null; } public void setFilteredColumnsIsSet(boolean value) { if (!value) { this.filteredColumns = null; } } public double getSeed() { return this.seed; } public TQnoiseSpec setSeed(double seed) { this.seed = seed; setSeedIsSet(true); return this; } public void unsetSeed() { __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __SEED_ISSET_ID); } /** Returns true if field seed is set (has been assigned a value) and false otherwise */ public boolean isSetSeed() { return EncodingUtils.testBit(__isset_bitfield, __SEED_ISSET_ID); } public void setSeedIsSet(boolean value) { __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __SEED_ISSET_ID, value); } public int getDistanceSize() { return (this.distance == null) ? 0 : this.distance.size(); } public java.util.Iterator<Double> getDistanceIterator() { return (this.distance == null) ? null : this.distance.iterator(); } public void addToDistance(double elem) { if (this.distance == null) { this.distance = new ArrayList<Double>(); } this.distance.add(elem); } public List<Double> getDistance() { return this.distance; } public TQnoiseSpec setDistance(List<Double> distance) { this.distance = distance; return this; } public void unsetDistance() { this.distance = null; } /** Returns true if field distance is set (has been assigned a value) and false otherwise */ public boolean isSetDistance() { return this.distance != null; } public void setDistanceIsSet(boolean value) { if (!value) { this.distance = null; } } public int getConstraintSize() { return (this.constraint == null) ? 0 : this.constraint.size(); } public java.util.Iterator<String> getConstraintIterator() { return (this.constraint == null) ? null : this.constraint.iterator(); } public void addToConstraint(String elem) { if (this.constraint == null) { this.constraint = new ArrayList<String>(); } this.constraint.add(elem); } public List<String> getConstraint() { return this.constraint; } public TQnoiseSpec setConstraint(List<String> constraint) { this.constraint = constraint; return this; } public void unsetConstraint() { this.constraint = null; } /** Returns true if field constraint is set (has been assigned a value) and false otherwise */ public boolean isSetConstraint() { return this.constraint != null; } public void setConstraintIsSet(boolean value) { if (!value) { this.constraint = null; } } public String getLogfile() { return this.logfile; } public TQnoiseSpec setLogfile(String logfile) { this.logfile = logfile; return this; } public void unsetLogfile() { this.logfile = null; } /** Returns true if field logfile is set (has been assigned a value) and false otherwise */ public boolean isSetLogfile() { return this.logfile != null; } public void setLogfileIsSet(boolean value) { if (!value) { this.logfile = null; } } public void setFieldValue(_Fields field, Object value) { switch (field) { case NOISE_TYPE: if (value == null) { unsetNoiseType(); } else { setNoiseType((TNoiseType) value); } break; case PERCENTAGE: if (value == null) { unsetPercentage(); } else { setPercentage((Double) value); } break; case MODEL: if (value == null) { unsetModel(); } else { setModel((TNoiseModel) value); } break; case IS_ON_CELL: if (value == null) { unsetIsOnCell(); } else { setIsOnCell((Boolean) value); } break; case FILTERED_COLUMNS: if (value == null) { unsetFilteredColumns(); } else { setFilteredColumns((List<String>) value); } break; case SEED: if (value == null) { unsetSeed(); } else { setSeed((Double) value); } break; case DISTANCE: if (value == null) { unsetDistance(); } else { setDistance((List<Double>) value); } break; case CONSTRAINT: if (value == null) { unsetConstraint(); } else { setConstraint((List<String>) value); } break; case LOGFILE: if (value == null) { unsetLogfile(); } else { setLogfile((String) value); } break; } } public Object getFieldValue(_Fields field) { switch (field) { case NOISE_TYPE: return getNoiseType(); case PERCENTAGE: return Double.valueOf(getPercentage()); case MODEL: return getModel(); case IS_ON_CELL: return Boolean.valueOf(isIsOnCell()); case FILTERED_COLUMNS: return getFilteredColumns(); case SEED: return Double.valueOf(getSeed()); case DISTANCE: return getDistance(); case CONSTRAINT: return getConstraint(); case LOGFILE: return getLogfile(); } 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 NOISE_TYPE: return isSetNoiseType(); case PERCENTAGE: return isSetPercentage(); case MODEL: return isSetModel(); case IS_ON_CELL: return isSetIsOnCell(); case FILTERED_COLUMNS: return isSetFilteredColumns(); case SEED: return isSetSeed(); case DISTANCE: return isSetDistance(); case CONSTRAINT: return isSetConstraint(); case LOGFILE: return isSetLogfile(); } throw new IllegalStateException(); } @Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof TQnoiseSpec) return this.equals((TQnoiseSpec) that); return false; } public boolean equals(TQnoiseSpec that) { if (that == null) return false; boolean this_present_noiseType = true && this.isSetNoiseType(); boolean that_present_noiseType = true && that.isSetNoiseType(); if (this_present_noiseType || that_present_noiseType) { if (!(this_present_noiseType && that_present_noiseType)) return false; if (!this.noiseType.equals(that.noiseType)) return false; } boolean this_present_percentage = true; boolean that_present_percentage = true; if (this_present_percentage || that_present_percentage) { if (!(this_present_percentage && that_present_percentage)) return false; if (this.percentage != that.percentage) return false; } boolean this_present_model = true && this.isSetModel(); boolean that_present_model = true && that.isSetModel(); if (this_present_model || that_present_model) { if (!(this_present_model && that_present_model)) return false; if (!this.model.equals(that.model)) return false; } boolean this_present_isOnCell = true && this.isSetIsOnCell(); boolean that_present_isOnCell = true && that.isSetIsOnCell(); if (this_present_isOnCell || that_present_isOnCell) { if (!(this_present_isOnCell && that_present_isOnCell)) return false; if (this.isOnCell != that.isOnCell) return false; } boolean this_present_filteredColumns = true && this.isSetFilteredColumns(); boolean that_present_filteredColumns = true && that.isSetFilteredColumns(); if (this_present_filteredColumns || that_present_filteredColumns) { if (!(this_present_filteredColumns && that_present_filteredColumns)) return false; if (!this.filteredColumns.equals(that.filteredColumns)) return false; } boolean this_present_seed = true && this.isSetSeed(); boolean that_present_seed = true && that.isSetSeed(); if (this_present_seed || that_present_seed) { if (!(this_present_seed && that_present_seed)) return false; if (this.seed != that.seed) return false; } boolean this_present_distance = true && this.isSetDistance(); boolean that_present_distance = true && that.isSetDistance(); if (this_present_distance || that_present_distance) { if (!(this_present_distance && that_present_distance)) return false; if (!this.distance.equals(that.distance)) return false; } boolean this_present_constraint = true && this.isSetConstraint(); boolean that_present_constraint = true && that.isSetConstraint(); if (this_present_constraint || that_present_constraint) { if (!(this_present_constraint && that_present_constraint)) return false; if (!this.constraint.equals(that.constraint)) return false; } boolean this_present_logfile = true && this.isSetLogfile(); boolean that_present_logfile = true && that.isSetLogfile(); if (this_present_logfile || that_present_logfile) { if (!(this_present_logfile && that_present_logfile)) return false; if (!this.logfile.equals(that.logfile)) return false; } return true; } @Override public int hashCode() { return 0; } public int compareTo(TQnoiseSpec other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; TQnoiseSpec typedOther = (TQnoiseSpec) other; lastComparison = Boolean.valueOf(isSetNoiseType()).compareTo(typedOther.isSetNoiseType()); if (lastComparison != 0) { return lastComparison; } if (isSetNoiseType()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.noiseType, typedOther.noiseType); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetPercentage()).compareTo(typedOther.isSetPercentage()); if (lastComparison != 0) { return lastComparison; } if (isSetPercentage()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.percentage, typedOther.percentage); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetModel()).compareTo(typedOther.isSetModel()); if (lastComparison != 0) { return lastComparison; } if (isSetModel()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.model, typedOther.model); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetIsOnCell()).compareTo(typedOther.isSetIsOnCell()); if (lastComparison != 0) { return lastComparison; } if (isSetIsOnCell()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.isOnCell, typedOther.isOnCell); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetFilteredColumns()).compareTo(typedOther.isSetFilteredColumns()); if (lastComparison != 0) { return lastComparison; } if (isSetFilteredColumns()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.filteredColumns, typedOther.filteredColumns); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetSeed()).compareTo(typedOther.isSetSeed()); if (lastComparison != 0) { return lastComparison; } if (isSetSeed()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.seed, typedOther.seed); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetDistance()).compareTo(typedOther.isSetDistance()); if (lastComparison != 0) { return lastComparison; } if (isSetDistance()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.distance, typedOther.distance); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetConstraint()).compareTo(typedOther.isSetConstraint()); if (lastComparison != 0) { return lastComparison; } if (isSetConstraint()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.constraint, typedOther.constraint); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetLogfile()).compareTo(typedOther.isSetLogfile()); if (lastComparison != 0) { return lastComparison; } if (isSetLogfile()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.logfile, typedOther.logfile); 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("TQnoiseSpec("); boolean first = true; sb.append("noiseType:"); if (this.noiseType == null) { sb.append("null"); } else { sb.append(this.noiseType); } first = false; if (!first) sb.append(", "); sb.append("percentage:"); sb.append(this.percentage); first = false; if (isSetModel()) { if (!first) sb.append(", "); sb.append("model:"); if (this.model == null) { sb.append("null"); } else { sb.append(this.model); } first = false; } if (isSetIsOnCell()) { if (!first) sb.append(", "); sb.append("isOnCell:"); sb.append(this.isOnCell); first = false; } if (isSetFilteredColumns()) { if (!first) sb.append(", "); sb.append("filteredColumns:"); if (this.filteredColumns == null) { sb.append("null"); } else { sb.append(this.filteredColumns); } first = false; } if (isSetSeed()) { if (!first) sb.append(", "); sb.append("seed:"); sb.append(this.seed); first = false; } if (isSetDistance()) { if (!first) sb.append(", "); sb.append("distance:"); if (this.distance == null) { sb.append("null"); } else { sb.append(this.distance); } first = false; } if (isSetConstraint()) { if (!first) sb.append(", "); sb.append("constraint:"); if (this.constraint == null) { sb.append("null"); } else { sb.append(this.constraint); } first = false; } if (isSetLogfile()) { if (!first) sb.append(", "); sb.append("logfile:"); if (this.logfile == null) { sb.append("null"); } else { sb.append(this.logfile); } first = false; } sb.append(")"); return sb.toString(); } public void validate() throws org.apache.thrift.TException { // check for required fields if (noiseType == null) { throw new org.apache.thrift.protocol.TProtocolException( "Required field 'noiseType' was not present! Struct: " + toString()); } // alas, we cannot check 'percentage' because it's a primitive and you chose the non-beans generator. // 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 TQnoiseSpecStandardSchemeFactory implements SchemeFactory { public TQnoiseSpecStandardScheme getScheme() { return new TQnoiseSpecStandardScheme(); } } private static class TQnoiseSpecStandardScheme extends StandardScheme<TQnoiseSpec> { public void read(org.apache.thrift.protocol.TProtocol iprot, TQnoiseSpec 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: // NOISE_TYPE if (schemeField.type == org.apache.thrift.protocol.TType.I32) { struct.noiseType = TNoiseType.findByValue(iprot.readI32()); struct.setNoiseTypeIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 2: // PERCENTAGE if (schemeField.type == org.apache.thrift.protocol.TType.DOUBLE) { struct.percentage = iprot.readDouble(); struct.setPercentageIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 3: // MODEL if (schemeField.type == org.apache.thrift.protocol.TType.I32) { struct.model = TNoiseModel.findByValue(iprot.readI32()); struct.setModelIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 4: // IS_ON_CELL if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) { struct.isOnCell = iprot.readBool(); struct.setIsOnCellIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 5: // FILTERED_COLUMNS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { org.apache.thrift.protocol.TList _list0 = iprot.readListBegin(); struct.filteredColumns = new ArrayList<String>(_list0.size); for (int _i1 = 0; _i1 < _list0.size; ++_i1) { String _elem2; // required _elem2 = iprot.readString(); struct.filteredColumns.add(_elem2); } iprot.readListEnd(); } struct.setFilteredColumnsIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 6: // SEED if (schemeField.type == org.apache.thrift.protocol.TType.DOUBLE) { struct.seed = iprot.readDouble(); struct.setSeedIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 7: // DISTANCE if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { org.apache.thrift.protocol.TList _list3 = iprot.readListBegin(); struct.distance = new ArrayList<Double>(_list3.size); for (int _i4 = 0; _i4 < _list3.size; ++_i4) { double _elem5; // required _elem5 = iprot.readDouble(); struct.distance.add(_elem5); } iprot.readListEnd(); } struct.setDistanceIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 8: // CONSTRAINT if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { org.apache.thrift.protocol.TList _list6 = iprot.readListBegin(); struct.constraint = new ArrayList<String>(_list6.size); for (int _i7 = 0; _i7 < _list6.size; ++_i7) { String _elem8; // required _elem8 = iprot.readString(); struct.constraint.add(_elem8); } iprot.readListEnd(); } struct.setConstraintIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 9: // LOGFILE if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.logfile = iprot.readString(); struct.setLogfileIsSet(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 if (!struct.isSetPercentage()) { throw new org.apache.thrift.protocol.TProtocolException( "Required field 'percentage' was not found in serialized data! Struct: " + toString()); } struct.validate(); } public void write(org.apache.thrift.protocol.TProtocol oprot, TQnoiseSpec struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); if (struct.noiseType != null) { oprot.writeFieldBegin(NOISE_TYPE_FIELD_DESC); oprot.writeI32(struct.noiseType.getValue()); oprot.writeFieldEnd(); } oprot.writeFieldBegin(PERCENTAGE_FIELD_DESC); oprot.writeDouble(struct.percentage); oprot.writeFieldEnd(); if (struct.model != null) { if (struct.isSetModel()) { oprot.writeFieldBegin(MODEL_FIELD_DESC); oprot.writeI32(struct.model.getValue()); oprot.writeFieldEnd(); } } if (struct.isSetIsOnCell()) { oprot.writeFieldBegin(IS_ON_CELL_FIELD_DESC); oprot.writeBool(struct.isOnCell); oprot.writeFieldEnd(); } if (struct.filteredColumns != null) { if (struct.isSetFilteredColumns()) { oprot.writeFieldBegin(FILTERED_COLUMNS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList( org.apache.thrift.protocol.TType.STRING, struct.filteredColumns.size())); for (String _iter9 : struct.filteredColumns) { oprot.writeString(_iter9); } oprot.writeListEnd(); } oprot.writeFieldEnd(); } } if (struct.isSetSeed()) { oprot.writeFieldBegin(SEED_FIELD_DESC); oprot.writeDouble(struct.seed); oprot.writeFieldEnd(); } if (struct.distance != null) { if (struct.isSetDistance()) { oprot.writeFieldBegin(DISTANCE_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList( org.apache.thrift.protocol.TType.DOUBLE, struct.distance.size())); for (double _iter10 : struct.distance) { oprot.writeDouble(_iter10); } oprot.writeListEnd(); } oprot.writeFieldEnd(); } } if (struct.constraint != null) { if (struct.isSetConstraint()) { oprot.writeFieldBegin(CONSTRAINT_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList( org.apache.thrift.protocol.TType.STRING, struct.constraint.size())); for (String _iter11 : struct.constraint) { oprot.writeString(_iter11); } oprot.writeListEnd(); } oprot.writeFieldEnd(); } } if (struct.logfile != null) { if (struct.isSetLogfile()) { oprot.writeFieldBegin(LOGFILE_FIELD_DESC); oprot.writeString(struct.logfile); oprot.writeFieldEnd(); } } oprot.writeFieldStop(); oprot.writeStructEnd(); } } private static class TQnoiseSpecTupleSchemeFactory implements SchemeFactory { public TQnoiseSpecTupleScheme getScheme() { return new TQnoiseSpecTupleScheme(); } } private static class TQnoiseSpecTupleScheme extends TupleScheme<TQnoiseSpec> { @Override public void write(org.apache.thrift.protocol.TProtocol prot, TQnoiseSpec struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; oprot.writeI32(struct.noiseType.getValue()); oprot.writeDouble(struct.percentage); BitSet optionals = new BitSet(); if (struct.isSetModel()) { optionals.set(0); } if (struct.isSetIsOnCell()) { optionals.set(1); } if (struct.isSetFilteredColumns()) { optionals.set(2); } if (struct.isSetSeed()) { optionals.set(3); } if (struct.isSetDistance()) { optionals.set(4); } if (struct.isSetConstraint()) { optionals.set(5); } if (struct.isSetLogfile()) { optionals.set(6); } oprot.writeBitSet(optionals, 7); if (struct.isSetModel()) { oprot.writeI32(struct.model.getValue()); } if (struct.isSetIsOnCell()) { oprot.writeBool(struct.isOnCell); } if (struct.isSetFilteredColumns()) { { oprot.writeI32(struct.filteredColumns.size()); for (String _iter12 : struct.filteredColumns) { oprot.writeString(_iter12); } } } if (struct.isSetSeed()) { oprot.writeDouble(struct.seed); } if (struct.isSetDistance()) { { oprot.writeI32(struct.distance.size()); for (double _iter13 : struct.distance) { oprot.writeDouble(_iter13); } } } if (struct.isSetConstraint()) { { oprot.writeI32(struct.constraint.size()); for (String _iter14 : struct.constraint) { oprot.writeString(_iter14); } } } if (struct.isSetLogfile()) { oprot.writeString(struct.logfile); } } @Override public void read(org.apache.thrift.protocol.TProtocol prot, TQnoiseSpec struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; struct.noiseType = TNoiseType.findByValue(iprot.readI32()); struct.setNoiseTypeIsSet(true); struct.percentage = iprot.readDouble(); struct.setPercentageIsSet(true); BitSet incoming = iprot.readBitSet(7); if (incoming.get(0)) { struct.model = TNoiseModel.findByValue(iprot.readI32()); struct.setModelIsSet(true); } if (incoming.get(1)) { struct.isOnCell = iprot.readBool(); struct.setIsOnCellIsSet(true); } if (incoming.get(2)) { { org.apache.thrift.protocol.TList _list15 = new org.apache.thrift.protocol.TList( org.apache.thrift.protocol.TType.STRING, iprot.readI32()); struct.filteredColumns = new ArrayList<String>(_list15.size); for (int _i16 = 0; _i16 < _list15.size; ++_i16) { String _elem17; // required _elem17 = iprot.readString(); struct.filteredColumns.add(_elem17); } } struct.setFilteredColumnsIsSet(true); } if (incoming.get(3)) { struct.seed = iprot.readDouble(); struct.setSeedIsSet(true); } if (incoming.get(4)) { { org.apache.thrift.protocol.TList _list18 = new org.apache.thrift.protocol.TList( org.apache.thrift.protocol.TType.DOUBLE, iprot.readI32()); struct.distance = new ArrayList<Double>(_list18.size); for (int _i19 = 0; _i19 < _list18.size; ++_i19) { double _elem20; // required _elem20 = iprot.readDouble(); struct.distance.add(_elem20); } } struct.setDistanceIsSet(true); } if (incoming.get(5)) { { org.apache.thrift.protocol.TList _list21 = new org.apache.thrift.protocol.TList( org.apache.thrift.protocol.TType.STRING, iprot.readI32()); struct.constraint = new ArrayList<String>(_list21.size); for (int _i22 = 0; _i22 < _list21.size; ++_i22) { String _elem23; // required _elem23 = iprot.readString(); struct.constraint.add(_elem23); } } struct.setConstraintIsSet(true); } if (incoming.get(6)) { struct.logfile = iprot.readString(); struct.setLogfileIsSet(true); } } } }