Back to home page

OSCL-LXR

 
 

    


0001 /**
0002  * Autogenerated by Thrift Compiler (0.9.3)
0003  *
0004  * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
0005  *  @generated
0006  */
0007 package org.apache.hive.service.rpc.thrift;
0008 
0009 import org.apache.thrift.scheme.IScheme;
0010 import org.apache.thrift.scheme.SchemeFactory;
0011 import org.apache.thrift.scheme.StandardScheme;
0012 
0013 import org.apache.thrift.scheme.TupleScheme;
0014 import org.apache.thrift.protocol.TTupleProtocol;
0015 import org.apache.thrift.protocol.TProtocolException;
0016 import org.apache.thrift.EncodingUtils;
0017 import org.apache.thrift.TException;
0018 import org.apache.thrift.async.AsyncMethodCallback;
0019 import org.apache.thrift.server.AbstractNonblockingServer.*;
0020 import java.util.List;
0021 import java.util.ArrayList;
0022 import java.util.Map;
0023 import java.util.HashMap;
0024 import java.util.EnumMap;
0025 import java.util.Set;
0026 import java.util.HashSet;
0027 import java.util.EnumSet;
0028 import java.util.Collections;
0029 import java.util.BitSet;
0030 import java.nio.ByteBuffer;
0031 import java.util.Arrays;
0032 import javax.annotation.Generated;
0033 import org.slf4j.Logger;
0034 import org.slf4j.LoggerFactory;
0035 
0036 @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
0037 @Generated(value = "Autogenerated by Thrift Compiler (0.9.3)")
0038 public class TMapTypeEntry implements org.apache.thrift.TBase<TMapTypeEntry, TMapTypeEntry._Fields>, java.io.Serializable, Cloneable, Comparable<TMapTypeEntry> {
0039   private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TMapTypeEntry");
0040 
0041   private static final org.apache.thrift.protocol.TField KEY_TYPE_PTR_FIELD_DESC = new org.apache.thrift.protocol.TField("keyTypePtr", org.apache.thrift.protocol.TType.I32, (short)1);
0042   private static final org.apache.thrift.protocol.TField VALUE_TYPE_PTR_FIELD_DESC = new org.apache.thrift.protocol.TField("valueTypePtr", org.apache.thrift.protocol.TType.I32, (short)2);
0043 
0044   private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
0045   static {
0046     schemes.put(StandardScheme.class, new TMapTypeEntryStandardSchemeFactory());
0047     schemes.put(TupleScheme.class, new TMapTypeEntryTupleSchemeFactory());
0048   }
0049 
0050   private int keyTypePtr; // required
0051   private int valueTypePtr; // required
0052 
0053   /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
0054   public enum _Fields implements org.apache.thrift.TFieldIdEnum {
0055     KEY_TYPE_PTR((short)1, "keyTypePtr"),
0056     VALUE_TYPE_PTR((short)2, "valueTypePtr");
0057 
0058     private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
0059 
0060     static {
0061       for (_Fields field : EnumSet.allOf(_Fields.class)) {
0062         byName.put(field.getFieldName(), field);
0063       }
0064     }
0065 
0066     /**
0067      * Find the _Fields constant that matches fieldId, or null if its not found.
0068      */
0069     public static _Fields findByThriftId(int fieldId) {
0070       switch(fieldId) {
0071         case 1: // KEY_TYPE_PTR
0072           return KEY_TYPE_PTR;
0073         case 2: // VALUE_TYPE_PTR
0074           return VALUE_TYPE_PTR;
0075         default:
0076           return null;
0077       }
0078     }
0079 
0080     /**
0081      * Find the _Fields constant that matches fieldId, throwing an exception
0082      * if it is not found.
0083      */
0084     public static _Fields findByThriftIdOrThrow(int fieldId) {
0085       _Fields fields = findByThriftId(fieldId);
0086       if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
0087       return fields;
0088     }
0089 
0090     /**
0091      * Find the _Fields constant that matches name, or null if its not found.
0092      */
0093     public static _Fields findByName(String name) {
0094       return byName.get(name);
0095     }
0096 
0097     private final short _thriftId;
0098     private final String _fieldName;
0099 
0100     _Fields(short thriftId, String fieldName) {
0101       _thriftId = thriftId;
0102       _fieldName = fieldName;
0103     }
0104 
0105     public short getThriftFieldId() {
0106       return _thriftId;
0107     }
0108 
0109     public String getFieldName() {
0110       return _fieldName;
0111     }
0112   }
0113 
0114   // isset id assignments
0115   private static final int __KEYTYPEPTR_ISSET_ID = 0;
0116   private static final int __VALUETYPEPTR_ISSET_ID = 1;
0117   private byte __isset_bitfield = 0;
0118   public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
0119   static {
0120     Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
0121     tmpMap.put(_Fields.KEY_TYPE_PTR, new org.apache.thrift.meta_data.FieldMetaData("keyTypePtr", org.apache.thrift.TFieldRequirementType.REQUIRED, 
0122         new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32        , "TTypeEntryPtr")));
0123     tmpMap.put(_Fields.VALUE_TYPE_PTR, new org.apache.thrift.meta_data.FieldMetaData("valueTypePtr", org.apache.thrift.TFieldRequirementType.REQUIRED, 
0124         new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32        , "TTypeEntryPtr")));
0125     metaDataMap = Collections.unmodifiableMap(tmpMap);
0126     org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TMapTypeEntry.class, metaDataMap);
0127   }
0128 
0129   public TMapTypeEntry() {
0130   }
0131 
0132   public TMapTypeEntry(
0133     int keyTypePtr,
0134     int valueTypePtr)
0135   {
0136     this();
0137     this.keyTypePtr = keyTypePtr;
0138     setKeyTypePtrIsSet(true);
0139     this.valueTypePtr = valueTypePtr;
0140     setValueTypePtrIsSet(true);
0141   }
0142 
0143   /**
0144    * Performs a deep copy on <i>other</i>.
0145    */
0146   public TMapTypeEntry(TMapTypeEntry other) {
0147     __isset_bitfield = other.__isset_bitfield;
0148     this.keyTypePtr = other.keyTypePtr;
0149     this.valueTypePtr = other.valueTypePtr;
0150   }
0151 
0152   public TMapTypeEntry deepCopy() {
0153     return new TMapTypeEntry(this);
0154   }
0155 
0156   @Override
0157   public void clear() {
0158     setKeyTypePtrIsSet(false);
0159     this.keyTypePtr = 0;
0160     setValueTypePtrIsSet(false);
0161     this.valueTypePtr = 0;
0162   }
0163 
0164   public int getKeyTypePtr() {
0165     return this.keyTypePtr;
0166   }
0167 
0168   public void setKeyTypePtr(int keyTypePtr) {
0169     this.keyTypePtr = keyTypePtr;
0170     setKeyTypePtrIsSet(true);
0171   }
0172 
0173   public void unsetKeyTypePtr() {
0174     __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __KEYTYPEPTR_ISSET_ID);
0175   }
0176 
0177   /** Returns true if field keyTypePtr is set (has been assigned a value) and false otherwise */
0178   public boolean isSetKeyTypePtr() {
0179     return EncodingUtils.testBit(__isset_bitfield, __KEYTYPEPTR_ISSET_ID);
0180   }
0181 
0182   public void setKeyTypePtrIsSet(boolean value) {
0183     __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __KEYTYPEPTR_ISSET_ID, value);
0184   }
0185 
0186   public int getValueTypePtr() {
0187     return this.valueTypePtr;
0188   }
0189 
0190   public void setValueTypePtr(int valueTypePtr) {
0191     this.valueTypePtr = valueTypePtr;
0192     setValueTypePtrIsSet(true);
0193   }
0194 
0195   public void unsetValueTypePtr() {
0196     __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __VALUETYPEPTR_ISSET_ID);
0197   }
0198 
0199   /** Returns true if field valueTypePtr is set (has been assigned a value) and false otherwise */
0200   public boolean isSetValueTypePtr() {
0201     return EncodingUtils.testBit(__isset_bitfield, __VALUETYPEPTR_ISSET_ID);
0202   }
0203 
0204   public void setValueTypePtrIsSet(boolean value) {
0205     __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __VALUETYPEPTR_ISSET_ID, value);
0206   }
0207 
0208   public void setFieldValue(_Fields field, Object value) {
0209     switch (field) {
0210     case KEY_TYPE_PTR:
0211       if (value == null) {
0212         unsetKeyTypePtr();
0213       } else {
0214         setKeyTypePtr((Integer)value);
0215       }
0216       break;
0217 
0218     case VALUE_TYPE_PTR:
0219       if (value == null) {
0220         unsetValueTypePtr();
0221       } else {
0222         setValueTypePtr((Integer)value);
0223       }
0224       break;
0225 
0226     }
0227   }
0228 
0229   public Object getFieldValue(_Fields field) {
0230     switch (field) {
0231     case KEY_TYPE_PTR:
0232       return getKeyTypePtr();
0233 
0234     case VALUE_TYPE_PTR:
0235       return getValueTypePtr();
0236 
0237     }
0238     throw new IllegalStateException();
0239   }
0240 
0241   /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
0242   public boolean isSet(_Fields field) {
0243     if (field == null) {
0244       throw new IllegalArgumentException();
0245     }
0246 
0247     switch (field) {
0248     case KEY_TYPE_PTR:
0249       return isSetKeyTypePtr();
0250     case VALUE_TYPE_PTR:
0251       return isSetValueTypePtr();
0252     }
0253     throw new IllegalStateException();
0254   }
0255 
0256   @Override
0257   public boolean equals(Object that) {
0258     if (that == null)
0259       return false;
0260     if (that instanceof TMapTypeEntry)
0261       return this.equals((TMapTypeEntry)that);
0262     return false;
0263   }
0264 
0265   public boolean equals(TMapTypeEntry that) {
0266     if (that == null)
0267       return false;
0268 
0269     boolean this_present_keyTypePtr = true;
0270     boolean that_present_keyTypePtr = true;
0271     if (this_present_keyTypePtr || that_present_keyTypePtr) {
0272       if (!(this_present_keyTypePtr && that_present_keyTypePtr))
0273         return false;
0274       if (this.keyTypePtr != that.keyTypePtr)
0275         return false;
0276     }
0277 
0278     boolean this_present_valueTypePtr = true;
0279     boolean that_present_valueTypePtr = true;
0280     if (this_present_valueTypePtr || that_present_valueTypePtr) {
0281       if (!(this_present_valueTypePtr && that_present_valueTypePtr))
0282         return false;
0283       if (this.valueTypePtr != that.valueTypePtr)
0284         return false;
0285     }
0286 
0287     return true;
0288   }
0289 
0290   @Override
0291   public int hashCode() {
0292     List<Object> list = new ArrayList<Object>();
0293 
0294     boolean present_keyTypePtr = true;
0295     list.add(present_keyTypePtr);
0296     if (present_keyTypePtr)
0297       list.add(keyTypePtr);
0298 
0299     boolean present_valueTypePtr = true;
0300     list.add(present_valueTypePtr);
0301     if (present_valueTypePtr)
0302       list.add(valueTypePtr);
0303 
0304     return list.hashCode();
0305   }
0306 
0307   @Override
0308   public int compareTo(TMapTypeEntry other) {
0309     if (!getClass().equals(other.getClass())) {
0310       return getClass().getName().compareTo(other.getClass().getName());
0311     }
0312 
0313     int lastComparison = 0;
0314 
0315     lastComparison = Boolean.valueOf(isSetKeyTypePtr()).compareTo(other.isSetKeyTypePtr());
0316     if (lastComparison != 0) {
0317       return lastComparison;
0318     }
0319     if (isSetKeyTypePtr()) {
0320       lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.keyTypePtr, other.keyTypePtr);
0321       if (lastComparison != 0) {
0322         return lastComparison;
0323       }
0324     }
0325     lastComparison = Boolean.valueOf(isSetValueTypePtr()).compareTo(other.isSetValueTypePtr());
0326     if (lastComparison != 0) {
0327       return lastComparison;
0328     }
0329     if (isSetValueTypePtr()) {
0330       lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.valueTypePtr, other.valueTypePtr);
0331       if (lastComparison != 0) {
0332         return lastComparison;
0333       }
0334     }
0335     return 0;
0336   }
0337 
0338   public _Fields fieldForId(int fieldId) {
0339     return _Fields.findByThriftId(fieldId);
0340   }
0341 
0342   public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
0343     schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
0344   }
0345 
0346   public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
0347     schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
0348   }
0349 
0350   @Override
0351   public String toString() {
0352     StringBuilder sb = new StringBuilder("TMapTypeEntry(");
0353     boolean first = true;
0354 
0355     sb.append("keyTypePtr:");
0356     sb.append(this.keyTypePtr);
0357     first = false;
0358     if (!first) sb.append(", ");
0359     sb.append("valueTypePtr:");
0360     sb.append(this.valueTypePtr);
0361     first = false;
0362     sb.append(")");
0363     return sb.toString();
0364   }
0365 
0366   public void validate() throws org.apache.thrift.TException {
0367     // check for required fields
0368     if (!isSetKeyTypePtr()) {
0369       throw new org.apache.thrift.protocol.TProtocolException("Required field 'keyTypePtr' is unset! Struct:" + toString());
0370     }
0371 
0372     if (!isSetValueTypePtr()) {
0373       throw new org.apache.thrift.protocol.TProtocolException("Required field 'valueTypePtr' is unset! Struct:" + toString());
0374     }
0375 
0376     // check for sub-struct validity
0377   }
0378 
0379   private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
0380     try {
0381       write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
0382     } catch (org.apache.thrift.TException te) {
0383       throw new java.io.IOException(te);
0384     }
0385   }
0386 
0387   private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
0388     try {
0389       // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
0390       __isset_bitfield = 0;
0391       read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
0392     } catch (org.apache.thrift.TException te) {
0393       throw new java.io.IOException(te);
0394     }
0395   }
0396 
0397   private static class TMapTypeEntryStandardSchemeFactory implements SchemeFactory {
0398     public TMapTypeEntryStandardScheme getScheme() {
0399       return new TMapTypeEntryStandardScheme();
0400     }
0401   }
0402 
0403   private static class TMapTypeEntryStandardScheme extends StandardScheme<TMapTypeEntry> {
0404 
0405     public void read(org.apache.thrift.protocol.TProtocol iprot, TMapTypeEntry struct) throws org.apache.thrift.TException {
0406       org.apache.thrift.protocol.TField schemeField;
0407       iprot.readStructBegin();
0408       while (true)
0409       {
0410         schemeField = iprot.readFieldBegin();
0411         if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
0412           break;
0413         }
0414         switch (schemeField.id) {
0415           case 1: // KEY_TYPE_PTR
0416             if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
0417               struct.keyTypePtr = iprot.readI32();
0418               struct.setKeyTypePtrIsSet(true);
0419             } else { 
0420               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
0421             }
0422             break;
0423           case 2: // VALUE_TYPE_PTR
0424             if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
0425               struct.valueTypePtr = iprot.readI32();
0426               struct.setValueTypePtrIsSet(true);
0427             } else { 
0428               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
0429             }
0430             break;
0431           default:
0432             org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
0433         }
0434         iprot.readFieldEnd();
0435       }
0436       iprot.readStructEnd();
0437       struct.validate();
0438     }
0439 
0440     public void write(org.apache.thrift.protocol.TProtocol oprot, TMapTypeEntry struct) throws org.apache.thrift.TException {
0441       struct.validate();
0442 
0443       oprot.writeStructBegin(STRUCT_DESC);
0444       oprot.writeFieldBegin(KEY_TYPE_PTR_FIELD_DESC);
0445       oprot.writeI32(struct.keyTypePtr);
0446       oprot.writeFieldEnd();
0447       oprot.writeFieldBegin(VALUE_TYPE_PTR_FIELD_DESC);
0448       oprot.writeI32(struct.valueTypePtr);
0449       oprot.writeFieldEnd();
0450       oprot.writeFieldStop();
0451       oprot.writeStructEnd();
0452     }
0453 
0454   }
0455 
0456   private static class TMapTypeEntryTupleSchemeFactory implements SchemeFactory {
0457     public TMapTypeEntryTupleScheme getScheme() {
0458       return new TMapTypeEntryTupleScheme();
0459     }
0460   }
0461 
0462   private static class TMapTypeEntryTupleScheme extends TupleScheme<TMapTypeEntry> {
0463 
0464     @Override
0465     public void write(org.apache.thrift.protocol.TProtocol prot, TMapTypeEntry struct) throws org.apache.thrift.TException {
0466       TTupleProtocol oprot = (TTupleProtocol) prot;
0467       oprot.writeI32(struct.keyTypePtr);
0468       oprot.writeI32(struct.valueTypePtr);
0469     }
0470 
0471     @Override
0472     public void read(org.apache.thrift.protocol.TProtocol prot, TMapTypeEntry struct) throws org.apache.thrift.TException {
0473       TTupleProtocol iprot = (TTupleProtocol) prot;
0474       struct.keyTypePtr = iprot.readI32();
0475       struct.setKeyTypePtrIsSet(true);
0476       struct.valueTypePtr = iprot.readI32();
0477       struct.setValueTypePtrIsSet(true);
0478     }
0479   }
0480 
0481 }
0482