Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Licensed to the Apache Software Foundation (ASF) under one or more
0003  * contributor license agreements.  See the NOTICE file distributed with
0004  * this work for additional information regarding copyright ownership.
0005  * The ASF licenses this file to You under the Apache License, Version 2.0
0006  * (the "License"); you may not use this file except in compliance with
0007  * the License.  You may obtain a copy of the License at
0008  *
0009  *    http://www.apache.org/licenses/LICENSE-2.0
0010  *
0011  * Unless required by applicable law or agreed to in writing, software
0012  * distributed under the License is distributed on an "AS IS" BASIS,
0013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0014  * See the License for the specific language governing permissions and
0015  * limitations under the License.
0016  */
0017 package org.apache.spark.sql.hive.test;
0018 
0019 import org.apache.commons.lang.builder.HashCodeBuilder;
0020 import org.apache.thrift.scheme.IScheme;
0021 import org.apache.thrift.scheme.SchemeFactory;
0022 import org.apache.thrift.scheme.StandardScheme;
0023 
0024 import org.apache.hadoop.hive.serde2.thrift.test.IntString;
0025 import org.apache.thrift.scheme.TupleScheme;
0026 import org.apache.thrift.protocol.TTupleProtocol;
0027 import org.apache.thrift.EncodingUtils;
0028 import java.util.List;
0029 import java.util.ArrayList;
0030 import java.util.Map;
0031 import java.util.HashMap;
0032 import java.util.EnumMap;
0033 import java.util.EnumSet;
0034 import java.util.Collections;
0035 import java.util.BitSet;
0036 
0037 /**
0038  * This is a fork of Hive 0.13's org/apache/hadoop/hive/serde2/thrift/test/Complex.java, which
0039  * does not contain union fields that are not supported by Spark SQL.
0040  */
0041 
0042 @SuppressWarnings("all")
0043 public class Complex implements org.apache.thrift.TBase<Complex, Complex._Fields>, java.io.Serializable, Cloneable {
0044   private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Complex");
0045 
0046   private static final org.apache.thrift.protocol.TField AINT_FIELD_DESC = new org.apache.thrift.protocol.TField("aint", org.apache.thrift.protocol.TType.I32, (short)1);
0047   private static final org.apache.thrift.protocol.TField A_STRING_FIELD_DESC = new org.apache.thrift.protocol.TField("aString", org.apache.thrift.protocol.TType.STRING, (short)2);
0048   private static final org.apache.thrift.protocol.TField LINT_FIELD_DESC = new org.apache.thrift.protocol.TField("lint", org.apache.thrift.protocol.TType.LIST, (short)3);
0049   private static final org.apache.thrift.protocol.TField L_STRING_FIELD_DESC = new org.apache.thrift.protocol.TField("lString", org.apache.thrift.protocol.TType.LIST, (short)4);
0050   private static final org.apache.thrift.protocol.TField LINT_STRING_FIELD_DESC = new org.apache.thrift.protocol.TField("lintString", org.apache.thrift.protocol.TType.LIST, (short)5);
0051   private static final org.apache.thrift.protocol.TField M_STRING_STRING_FIELD_DESC = new org.apache.thrift.protocol.TField("mStringString", org.apache.thrift.protocol.TType.MAP, (short)6);
0052 
0053   private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<>();
0054   static {
0055     schemes.put(StandardScheme.class, new ComplexStandardSchemeFactory());
0056     schemes.put(TupleScheme.class, new ComplexTupleSchemeFactory());
0057   }
0058 
0059   private int aint; // required
0060   private String aString; // required
0061   private List<Integer> lint; // required
0062   private List<String> lString; // required
0063   private List<IntString> lintString; // required
0064   private Map<String,String> mStringString; // required
0065 
0066   /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
0067   public enum _Fields implements org.apache.thrift.TFieldIdEnum {
0068     AINT((short)1, "aint"),
0069     A_STRING((short)2, "aString"),
0070     LINT((short)3, "lint"),
0071     L_STRING((short)4, "lString"),
0072     LINT_STRING((short)5, "lintString"),
0073     M_STRING_STRING((short)6, "mStringString");
0074 
0075     private static final Map<String, _Fields> byName = new HashMap<>();
0076 
0077     static {
0078       for (_Fields field : EnumSet.allOf(_Fields.class)) {
0079         byName.put(field.getFieldName(), field);
0080       }
0081     }
0082 
0083     /**
0084      * Find the _Fields constant that matches fieldId, or null if its not found.
0085      */
0086     public static _Fields findByThriftId(int fieldId) {
0087       switch(fieldId) {
0088         case 1: // AINT
0089           return AINT;
0090         case 2: // A_STRING
0091           return A_STRING;
0092         case 3: // LINT
0093           return LINT;
0094         case 4: // L_STRING
0095           return L_STRING;
0096         case 5: // LINT_STRING
0097           return LINT_STRING;
0098         case 6: // M_STRING_STRING
0099           return M_STRING_STRING;
0100         default:
0101           return null;
0102       }
0103     }
0104 
0105     /**
0106      * Find the _Fields constant that matches fieldId, throwing an exception
0107      * if it is not found.
0108      */
0109     public static _Fields findByThriftIdOrThrow(int fieldId) {
0110       _Fields fields = findByThriftId(fieldId);
0111       if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
0112       return fields;
0113     }
0114 
0115     /**
0116      * Find the _Fields constant that matches name, or null if its not found.
0117      */
0118     public static _Fields findByName(String name) {
0119       return byName.get(name);
0120     }
0121 
0122     private final short _thriftId;
0123     private final String _fieldName;
0124 
0125     _Fields(short thriftId, String fieldName) {
0126       _thriftId = thriftId;
0127       _fieldName = fieldName;
0128     }
0129 
0130     public short getThriftFieldId() {
0131       return _thriftId;
0132     }
0133 
0134     public String getFieldName() {
0135       return _fieldName;
0136     }
0137   }
0138 
0139   // isset id assignments
0140   private static final int __AINT_ISSET_ID = 0;
0141   private byte __isset_bitfield = 0;
0142   public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
0143   static {
0144     Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<>(_Fields.class);
0145     tmpMap.put(_Fields.AINT, new org.apache.thrift.meta_data.FieldMetaData("aint", org.apache.thrift.TFieldRequirementType.DEFAULT,
0146         new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
0147     tmpMap.put(_Fields.A_STRING, new org.apache.thrift.meta_data.FieldMetaData("aString", org.apache.thrift.TFieldRequirementType.DEFAULT,
0148         new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
0149     tmpMap.put(_Fields.LINT, new org.apache.thrift.meta_data.FieldMetaData("lint", org.apache.thrift.TFieldRequirementType.DEFAULT,
0150         new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
0151             new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))));
0152     tmpMap.put(_Fields.L_STRING, new org.apache.thrift.meta_data.FieldMetaData("lString", org.apache.thrift.TFieldRequirementType.DEFAULT,
0153         new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
0154             new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
0155     tmpMap.put(_Fields.LINT_STRING, new org.apache.thrift.meta_data.FieldMetaData("lintString", org.apache.thrift.TFieldRequirementType.DEFAULT,
0156         new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
0157             new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, IntString.class))));
0158     tmpMap.put(_Fields.M_STRING_STRING, new org.apache.thrift.meta_data.FieldMetaData("mStringString", org.apache.thrift.TFieldRequirementType.DEFAULT,
0159         new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP,
0160             new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING),
0161             new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
0162     metaDataMap = Collections.unmodifiableMap(tmpMap);
0163     org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Complex.class, metaDataMap);
0164   }
0165 
0166   public Complex() {
0167   }
0168 
0169   public Complex(
0170     int aint,
0171     String aString,
0172     List<Integer> lint,
0173     List<String> lString,
0174     List<IntString> lintString,
0175     Map<String,String> mStringString)
0176   {
0177     this();
0178     this.aint = aint;
0179     setAintIsSet(true);
0180     this.aString = aString;
0181     this.lint = lint;
0182     this.lString = lString;
0183     this.lintString = lintString;
0184     this.mStringString = mStringString;
0185   }
0186 
0187   /**
0188    * Performs a deep copy on <i>other</i>.
0189    */
0190   public Complex(Complex other) {
0191     __isset_bitfield = other.__isset_bitfield;
0192     this.aint = other.aint;
0193     if (other.isSetAString()) {
0194       this.aString = other.aString;
0195     }
0196     if (other.isSetLint()) {
0197       List<Integer> __this__lint = new ArrayList<>();
0198       for (Integer other_element : other.lint) {
0199         __this__lint.add(other_element);
0200       }
0201       this.lint = __this__lint;
0202     }
0203     if (other.isSetLString()) {
0204       List<String> __this__lString = new ArrayList<>();
0205       for (String other_element : other.lString) {
0206         __this__lString.add(other_element);
0207       }
0208       this.lString = __this__lString;
0209     }
0210     if (other.isSetLintString()) {
0211       List<IntString> __this__lintString = new ArrayList<>();
0212       for (IntString other_element : other.lintString) {
0213         __this__lintString.add(new IntString(other_element));
0214       }
0215       this.lintString = __this__lintString;
0216     }
0217     if (other.isSetMStringString()) {
0218       Map<String,String> __this__mStringString = new HashMap<>();
0219       for (Map.Entry<String, String> other_element : other.mStringString.entrySet()) {
0220 
0221         String other_element_key = other_element.getKey();
0222         String other_element_value = other_element.getValue();
0223 
0224         String __this__mStringString_copy_key = other_element_key;
0225 
0226         String __this__mStringString_copy_value = other_element_value;
0227 
0228         __this__mStringString.put(__this__mStringString_copy_key, __this__mStringString_copy_value);
0229       }
0230       this.mStringString = __this__mStringString;
0231     }
0232   }
0233 
0234   public Complex deepCopy() {
0235     return new Complex(this);
0236   }
0237 
0238   @Override
0239   public void clear() {
0240     setAintIsSet(false);
0241     this.aint = 0;
0242     this.aString = null;
0243     this.lint = null;
0244     this.lString = null;
0245     this.lintString = null;
0246     this.mStringString = null;
0247   }
0248 
0249   public int getAint() {
0250     return this.aint;
0251   }
0252 
0253   public void setAint(int aint) {
0254     this.aint = aint;
0255     setAintIsSet(true);
0256   }
0257 
0258   public void unsetAint() {
0259     __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __AINT_ISSET_ID);
0260   }
0261 
0262   /** Returns true if field aint is set (has been assigned a value) and false otherwise */
0263   public boolean isSetAint() {
0264     return EncodingUtils.testBit(__isset_bitfield, __AINT_ISSET_ID);
0265   }
0266 
0267   public void setAintIsSet(boolean value) {
0268     __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __AINT_ISSET_ID, value);
0269   }
0270 
0271   public String getAString() {
0272     return this.aString;
0273   }
0274 
0275   public void setAString(String aString) {
0276     this.aString = aString;
0277   }
0278 
0279   public void unsetAString() {
0280     this.aString = null;
0281   }
0282 
0283   /** Returns true if field aString is set (has been assigned a value) and false otherwise */
0284   public boolean isSetAString() {
0285     return this.aString != null;
0286   }
0287 
0288   public void setAStringIsSet(boolean value) {
0289     if (!value) {
0290       this.aString = null;
0291     }
0292   }
0293 
0294   public int getLintSize() {
0295     return (this.lint == null) ? 0 : this.lint.size();
0296   }
0297 
0298   public java.util.Iterator<Integer> getLintIterator() {
0299     return (this.lint == null) ? null : this.lint.iterator();
0300   }
0301 
0302   public void addToLint(int elem) {
0303     if (this.lint == null) {
0304       this.lint = new ArrayList<>();
0305     }
0306     this.lint.add(elem);
0307   }
0308 
0309   public List<Integer> getLint() {
0310     return this.lint;
0311   }
0312 
0313   public void setLint(List<Integer> lint) {
0314     this.lint = lint;
0315   }
0316 
0317   public void unsetLint() {
0318     this.lint = null;
0319   }
0320 
0321   /** Returns true if field lint is set (has been assigned a value) and false otherwise */
0322   public boolean isSetLint() {
0323     return this.lint != null;
0324   }
0325 
0326   public void setLintIsSet(boolean value) {
0327     if (!value) {
0328       this.lint = null;
0329     }
0330   }
0331 
0332   public int getLStringSize() {
0333     return (this.lString == null) ? 0 : this.lString.size();
0334   }
0335 
0336   public java.util.Iterator<String> getLStringIterator() {
0337     return (this.lString == null) ? null : this.lString.iterator();
0338   }
0339 
0340   public void addToLString(String elem) {
0341     if (this.lString == null) {
0342       this.lString = new ArrayList<>();
0343     }
0344     this.lString.add(elem);
0345   }
0346 
0347   public List<String> getLString() {
0348     return this.lString;
0349   }
0350 
0351   public void setLString(List<String> lString) {
0352     this.lString = lString;
0353   }
0354 
0355   public void unsetLString() {
0356     this.lString = null;
0357   }
0358 
0359   /** Returns true if field lString is set (has been assigned a value) and false otherwise */
0360   public boolean isSetLString() {
0361     return this.lString != null;
0362   }
0363 
0364   public void setLStringIsSet(boolean value) {
0365     if (!value) {
0366       this.lString = null;
0367     }
0368   }
0369 
0370   public int getLintStringSize() {
0371     return (this.lintString == null) ? 0 : this.lintString.size();
0372   }
0373 
0374   public java.util.Iterator<IntString> getLintStringIterator() {
0375     return (this.lintString == null) ? null : this.lintString.iterator();
0376   }
0377 
0378   public void addToLintString(IntString elem) {
0379     if (this.lintString == null) {
0380       this.lintString = new ArrayList<>();
0381     }
0382     this.lintString.add(elem);
0383   }
0384 
0385   public List<IntString> getLintString() {
0386     return this.lintString;
0387   }
0388 
0389   public void setLintString(List<IntString> lintString) {
0390     this.lintString = lintString;
0391   }
0392 
0393   public void unsetLintString() {
0394     this.lintString = null;
0395   }
0396 
0397   /** Returns true if field lintString is set (has been assigned a value) and false otherwise */
0398   public boolean isSetLintString() {
0399     return this.lintString != null;
0400   }
0401 
0402   public void setLintStringIsSet(boolean value) {
0403     if (!value) {
0404       this.lintString = null;
0405     }
0406   }
0407 
0408   public int getMStringStringSize() {
0409     return (this.mStringString == null) ? 0 : this.mStringString.size();
0410   }
0411 
0412   public void putToMStringString(String key, String val) {
0413     if (this.mStringString == null) {
0414       this.mStringString = new HashMap<>();
0415     }
0416     this.mStringString.put(key, val);
0417   }
0418 
0419   public Map<String,String> getMStringString() {
0420     return this.mStringString;
0421   }
0422 
0423   public void setMStringString(Map<String,String> mStringString) {
0424     this.mStringString = mStringString;
0425   }
0426 
0427   public void unsetMStringString() {
0428     this.mStringString = null;
0429   }
0430 
0431   /** Returns true if field mStringString is set (has been assigned a value) and false otherwise */
0432   public boolean isSetMStringString() {
0433     return this.mStringString != null;
0434   }
0435 
0436   public void setMStringStringIsSet(boolean value) {
0437     if (!value) {
0438       this.mStringString = null;
0439     }
0440   }
0441 
0442   public void setFieldValue(_Fields field, Object value) {
0443     switch (field) {
0444     case AINT:
0445       if (value == null) {
0446         unsetAint();
0447       } else {
0448         setAint((Integer)value);
0449       }
0450       break;
0451 
0452     case A_STRING:
0453       if (value == null) {
0454         unsetAString();
0455       } else {
0456         setAString((String)value);
0457       }
0458       break;
0459 
0460     case LINT:
0461       if (value == null) {
0462         unsetLint();
0463       } else {
0464         setLint((List<Integer>)value);
0465       }
0466       break;
0467 
0468     case L_STRING:
0469       if (value == null) {
0470         unsetLString();
0471       } else {
0472         setLString((List<String>)value);
0473       }
0474       break;
0475 
0476     case LINT_STRING:
0477       if (value == null) {
0478         unsetLintString();
0479       } else {
0480         setLintString((List<IntString>)value);
0481       }
0482       break;
0483 
0484     case M_STRING_STRING:
0485       if (value == null) {
0486         unsetMStringString();
0487       } else {
0488         setMStringString((Map<String,String>)value);
0489       }
0490       break;
0491 
0492     default:
0493     }
0494   }
0495 
0496   public Object getFieldValue(_Fields field) {
0497     switch (field) {
0498     case AINT:
0499       return Integer.valueOf(getAint());
0500 
0501     case A_STRING:
0502       return getAString();
0503 
0504     case LINT:
0505       return getLint();
0506 
0507     case L_STRING:
0508       return getLString();
0509 
0510     case LINT_STRING:
0511       return getLintString();
0512 
0513     case M_STRING_STRING:
0514       return getMStringString();
0515 
0516     default:
0517     }
0518     throw new IllegalStateException();
0519   }
0520 
0521   /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
0522   public boolean isSet(_Fields field) {
0523     if (field == null) {
0524       throw new IllegalArgumentException();
0525     }
0526 
0527     switch (field) {
0528     case AINT:
0529       return isSetAint();
0530     case A_STRING:
0531       return isSetAString();
0532     case LINT:
0533       return isSetLint();
0534     case L_STRING:
0535       return isSetLString();
0536     case LINT_STRING:
0537       return isSetLintString();
0538     case M_STRING_STRING:
0539       return isSetMStringString();
0540     default:
0541     }
0542     throw new IllegalStateException();
0543   }
0544 
0545   @Override
0546   public boolean equals(Object that) {
0547     if (that == null) {
0548       return false;
0549     }
0550     if (that instanceof Complex) {
0551       return this.equals((Complex)that);
0552     }
0553     return false;
0554   }
0555 
0556   public boolean equals(Complex that) {
0557     if (that == null) {
0558       return false;
0559     }
0560 
0561     boolean this_present_aint = true;
0562     boolean that_present_aint = true;
0563     if (this_present_aint || that_present_aint) {
0564       if (!(this_present_aint && that_present_aint)) {
0565         return false;
0566       }
0567       if (this.aint != that.aint) {
0568         return false;
0569       }
0570     }
0571 
0572     boolean this_present_aString = true && this.isSetAString();
0573     boolean that_present_aString = true && that.isSetAString();
0574     if (this_present_aString || that_present_aString) {
0575       if (!(this_present_aString && that_present_aString)) {
0576         return false;
0577       }
0578       if (!this.aString.equals(that.aString)) {
0579         return false;
0580       }
0581     }
0582 
0583     boolean this_present_lint = true && this.isSetLint();
0584     boolean that_present_lint = true && that.isSetLint();
0585     if (this_present_lint || that_present_lint) {
0586       if (!(this_present_lint && that_present_lint)) {
0587         return false;
0588       }
0589       if (!this.lint.equals(that.lint)) {
0590         return false;
0591       }
0592     }
0593 
0594     boolean this_present_lString = true && this.isSetLString();
0595     boolean that_present_lString = true && that.isSetLString();
0596     if (this_present_lString || that_present_lString) {
0597       if (!(this_present_lString && that_present_lString)) {
0598         return false;
0599       }
0600       if (!this.lString.equals(that.lString)) {
0601         return false;
0602       }
0603     }
0604 
0605     boolean this_present_lintString = true && this.isSetLintString();
0606     boolean that_present_lintString = true && that.isSetLintString();
0607     if (this_present_lintString || that_present_lintString) {
0608       if (!(this_present_lintString && that_present_lintString)) {
0609         return false;
0610       }
0611       if (!this.lintString.equals(that.lintString)) {
0612         return false;
0613       }
0614     }
0615 
0616     boolean this_present_mStringString = true && this.isSetMStringString();
0617     boolean that_present_mStringString = true && that.isSetMStringString();
0618     if (this_present_mStringString || that_present_mStringString) {
0619       if (!(this_present_mStringString && that_present_mStringString)) {
0620         return false;
0621       }
0622       if (!this.mStringString.equals(that.mStringString)) {
0623         return false;
0624       }
0625     }
0626 
0627     return true;
0628   }
0629 
0630   @Override
0631   public int hashCode() {
0632     HashCodeBuilder builder = new HashCodeBuilder();
0633 
0634     boolean present_aint = true;
0635     builder.append(present_aint);
0636     if (present_aint) {
0637       builder.append(aint);
0638     }
0639 
0640     boolean present_aString = true && (isSetAString());
0641     builder.append(present_aString);
0642     if (present_aString) {
0643       builder.append(aString);
0644     }
0645 
0646     boolean present_lint = true && (isSetLint());
0647     builder.append(present_lint);
0648     if (present_lint) {
0649       builder.append(lint);
0650     }
0651 
0652     boolean present_lString = true && (isSetLString());
0653     builder.append(present_lString);
0654     if (present_lString) {
0655       builder.append(lString);
0656     }
0657 
0658     boolean present_lintString = true && (isSetLintString());
0659     builder.append(present_lintString);
0660     if (present_lintString) {
0661       builder.append(lintString);
0662     }
0663 
0664     boolean present_mStringString = true && (isSetMStringString());
0665     builder.append(present_mStringString);
0666     if (present_mStringString) {
0667       builder.append(mStringString);
0668     }
0669 
0670     return builder.toHashCode();
0671   }
0672 
0673   public int compareTo(Complex other) {
0674     if (!getClass().equals(other.getClass())) {
0675       return getClass().getName().compareTo(other.getClass().getName());
0676     }
0677 
0678     int lastComparison = 0;
0679     Complex typedOther = other;
0680 
0681     lastComparison = Boolean.valueOf(isSetAint()).compareTo(typedOther.isSetAint());
0682     if (lastComparison != 0) {
0683       return lastComparison;
0684     }
0685     if (isSetAint()) {
0686       lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.aint, typedOther.aint);
0687       if (lastComparison != 0) {
0688         return lastComparison;
0689       }
0690     }
0691     lastComparison = Boolean.valueOf(isSetAString()).compareTo(typedOther.isSetAString());
0692     if (lastComparison != 0) {
0693       return lastComparison;
0694     }
0695     if (isSetAString()) {
0696       lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.aString, typedOther.aString);
0697       if (lastComparison != 0) {
0698         return lastComparison;
0699       }
0700     }
0701     lastComparison = Boolean.valueOf(isSetLint()).compareTo(typedOther.isSetLint());
0702     if (lastComparison != 0) {
0703       return lastComparison;
0704     }
0705     if (isSetLint()) {
0706       lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.lint, typedOther.lint);
0707       if (lastComparison != 0) {
0708         return lastComparison;
0709       }
0710     }
0711     lastComparison = Boolean.valueOf(isSetLString()).compareTo(typedOther.isSetLString());
0712     if (lastComparison != 0) {
0713       return lastComparison;
0714     }
0715     if (isSetLString()) {
0716       lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.lString, typedOther.lString);
0717       if (lastComparison != 0) {
0718         return lastComparison;
0719       }
0720     }
0721     lastComparison = Boolean.valueOf(isSetLintString()).compareTo(typedOther.isSetLintString());
0722     if (lastComparison != 0) {
0723       return lastComparison;
0724     }
0725     if (isSetLintString()) {
0726       lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.lintString, typedOther.lintString);
0727       if (lastComparison != 0) {
0728         return lastComparison;
0729       }
0730     }
0731     lastComparison = Boolean.valueOf(isSetMStringString()).compareTo(typedOther.isSetMStringString());
0732     if (lastComparison != 0) {
0733       return lastComparison;
0734     }
0735     if (isSetMStringString()) {
0736       lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.mStringString, typedOther.mStringString);
0737       if (lastComparison != 0) {
0738         return lastComparison;
0739       }
0740     }
0741     return 0;
0742   }
0743 
0744   public _Fields fieldForId(int fieldId) {
0745     return _Fields.findByThriftId(fieldId);
0746   }
0747 
0748   public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
0749     schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
0750   }
0751 
0752   public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
0753     schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
0754   }
0755 
0756   @Override
0757   public String toString() {
0758     StringBuilder sb = new StringBuilder("Complex(");
0759     boolean first = true;
0760 
0761     sb.append("aint:");
0762     sb.append(this.aint);
0763     first = false;
0764     if (!first) {
0765       sb.append(", ");
0766     }
0767     sb.append("aString:");
0768     if (this.aString == null) {
0769       sb.append("null");
0770     } else {
0771       sb.append(this.aString);
0772     }
0773     first = false;
0774     if (!first) {
0775       sb.append(", ");
0776     }
0777     sb.append("lint:");
0778     if (this.lint == null) {
0779       sb.append("null");
0780     } else {
0781       sb.append(this.lint);
0782     }
0783     first = false;
0784     if (!first) {
0785       sb.append(", ");
0786     }
0787     sb.append("lString:");
0788     if (this.lString == null) {
0789       sb.append("null");
0790     } else {
0791       sb.append(this.lString);
0792     }
0793     first = false;
0794     if (!first) {
0795       sb.append(", ");
0796     }
0797     sb.append("lintString:");
0798     if (this.lintString == null) {
0799       sb.append("null");
0800     } else {
0801       sb.append(this.lintString);
0802     }
0803     first = false;
0804     if (!first) {
0805       sb.append(", ");
0806     }
0807     sb.append("mStringString:");
0808     if (this.mStringString == null) {
0809       sb.append("null");
0810     } else {
0811       sb.append(this.mStringString);
0812     }
0813     first = false;
0814     sb.append(")");
0815     return sb.toString();
0816   }
0817 
0818   public void validate() throws org.apache.thrift.TException {
0819     // check for required fields
0820     // check for sub-struct validity
0821   }
0822 
0823   private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
0824     try {
0825       write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
0826     } catch (org.apache.thrift.TException te) {
0827       throw new java.io.IOException(te);
0828     }
0829   }
0830 
0831   private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
0832     try {
0833       // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
0834       __isset_bitfield = 0;
0835       read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
0836     } catch (org.apache.thrift.TException te) {
0837       throw new java.io.IOException(te);
0838     }
0839   }
0840 
0841   private static class ComplexStandardSchemeFactory implements SchemeFactory {
0842     public ComplexStandardScheme getScheme() {
0843       return new ComplexStandardScheme();
0844     }
0845   }
0846 
0847   private static class ComplexStandardScheme extends StandardScheme<Complex> {
0848 
0849     public void read(org.apache.thrift.protocol.TProtocol iprot, Complex struct) throws org.apache.thrift.TException {
0850       org.apache.thrift.protocol.TField schemeField;
0851       iprot.readStructBegin();
0852       while (true)
0853       {
0854         schemeField = iprot.readFieldBegin();
0855         if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
0856           break;
0857         }
0858         switch (schemeField.id) {
0859           case 1: // AINT
0860             if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
0861               struct.aint = iprot.readI32();
0862               struct.setAintIsSet(true);
0863             } else {
0864               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
0865             }
0866             break;
0867           case 2: // A_STRING
0868             if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
0869               struct.aString = iprot.readString();
0870               struct.setAStringIsSet(true);
0871             } else {
0872               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
0873             }
0874             break;
0875           case 3: // LINT
0876             if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
0877               {
0878                 org.apache.thrift.protocol.TList _list0 = iprot.readListBegin();
0879                 struct.lint = new ArrayList<>(_list0.size);
0880                 for (int _i1 = 0; _i1 < _list0.size; ++_i1)
0881                 {
0882                   int _elem2; // required
0883                   _elem2 = iprot.readI32();
0884                   struct.lint.add(_elem2);
0885                 }
0886                 iprot.readListEnd();
0887               }
0888               struct.setLintIsSet(true);
0889             } else {
0890               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
0891             }
0892             break;
0893           case 4: // L_STRING
0894             if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
0895               {
0896                 org.apache.thrift.protocol.TList _list3 = iprot.readListBegin();
0897                 struct.lString = new ArrayList<>(_list3.size);
0898                 for (int _i4 = 0; _i4 < _list3.size; ++_i4)
0899                 {
0900                   String _elem5; // required
0901                   _elem5 = iprot.readString();
0902                   struct.lString.add(_elem5);
0903                 }
0904                 iprot.readListEnd();
0905               }
0906               struct.setLStringIsSet(true);
0907             } else {
0908               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
0909             }
0910             break;
0911           case 5: // LINT_STRING
0912             if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
0913               {
0914                 org.apache.thrift.protocol.TList _list6 = iprot.readListBegin();
0915                 struct.lintString = new ArrayList<>(_list6.size);
0916                 for (int _i7 = 0; _i7 < _list6.size; ++_i7)
0917                 {
0918                   IntString _elem8; // required
0919                   _elem8 = new IntString();
0920                   _elem8.read(iprot);
0921                   struct.lintString.add(_elem8);
0922                 }
0923                 iprot.readListEnd();
0924               }
0925               struct.setLintStringIsSet(true);
0926             } else {
0927               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
0928             }
0929             break;
0930           case 6: // M_STRING_STRING
0931             if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
0932               {
0933                 org.apache.thrift.protocol.TMap _map9 = iprot.readMapBegin();
0934                 struct.mStringString = new HashMap<String,String>(2*_map9.size);
0935                 for (int _i10 = 0; _i10 < _map9.size; ++_i10)
0936                 {
0937                   String _key11; // required
0938                   String _val12; // required
0939                   _key11 = iprot.readString();
0940                   _val12 = iprot.readString();
0941                   struct.mStringString.put(_key11, _val12);
0942                 }
0943                 iprot.readMapEnd();
0944               }
0945               struct.setMStringStringIsSet(true);
0946             } else {
0947               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
0948             }
0949             break;
0950           default:
0951             org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
0952         }
0953         iprot.readFieldEnd();
0954       }
0955       iprot.readStructEnd();
0956       struct.validate();
0957     }
0958 
0959     public void write(org.apache.thrift.protocol.TProtocol oprot, Complex struct) throws org.apache.thrift.TException {
0960       struct.validate();
0961 
0962       oprot.writeStructBegin(STRUCT_DESC);
0963       oprot.writeFieldBegin(AINT_FIELD_DESC);
0964       oprot.writeI32(struct.aint);
0965       oprot.writeFieldEnd();
0966       if (struct.aString != null) {
0967         oprot.writeFieldBegin(A_STRING_FIELD_DESC);
0968         oprot.writeString(struct.aString);
0969         oprot.writeFieldEnd();
0970       }
0971       if (struct.lint != null) {
0972         oprot.writeFieldBegin(LINT_FIELD_DESC);
0973         {
0974           oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.I32, struct.lint.size()));
0975           for (int _iter13 : struct.lint)
0976           {
0977             oprot.writeI32(_iter13);
0978           }
0979           oprot.writeListEnd();
0980         }
0981         oprot.writeFieldEnd();
0982       }
0983       if (struct.lString != null) {
0984         oprot.writeFieldBegin(L_STRING_FIELD_DESC);
0985         {
0986           oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.lString.size()));
0987           for (String _iter14 : struct.lString)
0988           {
0989             oprot.writeString(_iter14);
0990           }
0991           oprot.writeListEnd();
0992         }
0993         oprot.writeFieldEnd();
0994       }
0995       if (struct.lintString != null) {
0996         oprot.writeFieldBegin(LINT_STRING_FIELD_DESC);
0997         {
0998           oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.lintString.size()));
0999           for (IntString _iter15 : struct.lintString)
1000           {
1001             _iter15.write(oprot);
1002           }
1003           oprot.writeListEnd();
1004         }
1005         oprot.writeFieldEnd();
1006       }
1007       if (struct.mStringString != null) {
1008         oprot.writeFieldBegin(M_STRING_STRING_FIELD_DESC);
1009         {
1010           oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.mStringString.size()));
1011           for (Map.Entry<String, String> _iter16 : struct.mStringString.entrySet())
1012           {
1013             oprot.writeString(_iter16.getKey());
1014             oprot.writeString(_iter16.getValue());
1015           }
1016           oprot.writeMapEnd();
1017         }
1018         oprot.writeFieldEnd();
1019       }
1020       oprot.writeFieldStop();
1021       oprot.writeStructEnd();
1022     }
1023 
1024   }
1025 
1026   private static class ComplexTupleSchemeFactory implements SchemeFactory {
1027     public ComplexTupleScheme getScheme() {
1028       return new ComplexTupleScheme();
1029     }
1030   }
1031 
1032   private static class ComplexTupleScheme extends TupleScheme<Complex> {
1033 
1034     @Override
1035     public void write(org.apache.thrift.protocol.TProtocol prot, Complex struct) throws org.apache.thrift.TException {
1036       TTupleProtocol oprot = (TTupleProtocol) prot;
1037       BitSet optionals = new BitSet();
1038       if (struct.isSetAint()) {
1039         optionals.set(0);
1040       }
1041       if (struct.isSetAString()) {
1042         optionals.set(1);
1043       }
1044       if (struct.isSetLint()) {
1045         optionals.set(2);
1046       }
1047       if (struct.isSetLString()) {
1048         optionals.set(3);
1049       }
1050       if (struct.isSetLintString()) {
1051         optionals.set(4);
1052       }
1053       if (struct.isSetMStringString()) {
1054         optionals.set(5);
1055       }
1056       oprot.writeBitSet(optionals, 6);
1057       if (struct.isSetAint()) {
1058         oprot.writeI32(struct.aint);
1059       }
1060       if (struct.isSetAString()) {
1061         oprot.writeString(struct.aString);
1062       }
1063       if (struct.isSetLint()) {
1064         {
1065           oprot.writeI32(struct.lint.size());
1066           for (int _iter17 : struct.lint)
1067           {
1068             oprot.writeI32(_iter17);
1069           }
1070         }
1071       }
1072       if (struct.isSetLString()) {
1073         {
1074           oprot.writeI32(struct.lString.size());
1075           for (String _iter18 : struct.lString)
1076           {
1077             oprot.writeString(_iter18);
1078           }
1079         }
1080       }
1081       if (struct.isSetLintString()) {
1082         {
1083           oprot.writeI32(struct.lintString.size());
1084           for (IntString _iter19 : struct.lintString)
1085           {
1086             _iter19.write(oprot);
1087           }
1088         }
1089       }
1090       if (struct.isSetMStringString()) {
1091         {
1092           oprot.writeI32(struct.mStringString.size());
1093           for (Map.Entry<String, String> _iter20 : struct.mStringString.entrySet())
1094           {
1095             oprot.writeString(_iter20.getKey());
1096             oprot.writeString(_iter20.getValue());
1097           }
1098         }
1099       }
1100     }
1101 
1102     @Override
1103     public void read(org.apache.thrift.protocol.TProtocol prot, Complex struct) throws org.apache.thrift.TException {
1104       TTupleProtocol iprot = (TTupleProtocol) prot;
1105       BitSet incoming = iprot.readBitSet(6);
1106       if (incoming.get(0)) {
1107         struct.aint = iprot.readI32();
1108         struct.setAintIsSet(true);
1109       }
1110       if (incoming.get(1)) {
1111         struct.aString = iprot.readString();
1112         struct.setAStringIsSet(true);
1113       }
1114       if (incoming.get(2)) {
1115         {
1116           org.apache.thrift.protocol.TList _list21 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.I32, iprot.readI32());
1117           struct.lint = new ArrayList<>(_list21.size);
1118           for (int _i22 = 0; _i22 < _list21.size; ++_i22)
1119           {
1120             int _elem23; // required
1121             _elem23 = iprot.readI32();
1122             struct.lint.add(_elem23);
1123           }
1124         }
1125         struct.setLintIsSet(true);
1126       }
1127       if (incoming.get(3)) {
1128         {
1129           org.apache.thrift.protocol.TList _list24 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
1130           struct.lString = new ArrayList<>(_list24.size);
1131           for (int _i25 = 0; _i25 < _list24.size; ++_i25)
1132           {
1133             String _elem26; // required
1134             _elem26 = iprot.readString();
1135             struct.lString.add(_elem26);
1136           }
1137         }
1138         struct.setLStringIsSet(true);
1139       }
1140       if (incoming.get(4)) {
1141         {
1142           org.apache.thrift.protocol.TList _list27 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
1143           struct.lintString = new ArrayList<>(_list27.size);
1144           for (int _i28 = 0; _i28 < _list27.size; ++_i28)
1145           {
1146             IntString _elem29; // required
1147             _elem29 = new IntString();
1148             _elem29.read(iprot);
1149             struct.lintString.add(_elem29);
1150           }
1151         }
1152         struct.setLintStringIsSet(true);
1153       }
1154       if (incoming.get(5)) {
1155         {
1156           org.apache.thrift.protocol.TMap _map30 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32());
1157           struct.mStringString = new HashMap<>(2*_map30.size);
1158           for (int _i31 = 0; _i31 < _map30.size; ++_i31)
1159           {
1160             String _key32; // required
1161             String _val33; // required
1162             _key32 = iprot.readString();
1163             _val33 = iprot.readString();
1164             struct.mStringString.put(_key32, _val33);
1165           }
1166         }
1167         struct.setMStringStringIsSet(true);
1168       }
1169     }
1170   }
1171 
1172 }
1173