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 TBoolColumn implements org.apache.thrift.TBase<TBoolColumn, TBoolColumn._Fields>, java.io.Serializable, Cloneable, Comparable<TBoolColumn> {
0039   private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TBoolColumn");
0040 
0041   private static final org.apache.thrift.protocol.TField VALUES_FIELD_DESC = new org.apache.thrift.protocol.TField("values", org.apache.thrift.protocol.TType.LIST, (short)1);
0042   private static final org.apache.thrift.protocol.TField NULLS_FIELD_DESC = new org.apache.thrift.protocol.TField("nulls", org.apache.thrift.protocol.TType.STRING, (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 TBoolColumnStandardSchemeFactory());
0047     schemes.put(TupleScheme.class, new TBoolColumnTupleSchemeFactory());
0048   }
0049 
0050   private List<Boolean> values; // required
0051   private ByteBuffer nulls; // 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     VALUES((short)1, "values"),
0056     NULLS((short)2, "nulls");
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: // VALUES
0072           return VALUES;
0073         case 2: // NULLS
0074           return NULLS;
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   public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
0116   static {
0117     Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
0118     tmpMap.put(_Fields.VALUES, new org.apache.thrift.meta_data.FieldMetaData("values", org.apache.thrift.TFieldRequirementType.REQUIRED, 
0119         new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
0120             new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL))));
0121     tmpMap.put(_Fields.NULLS, new org.apache.thrift.meta_data.FieldMetaData("nulls", org.apache.thrift.TFieldRequirementType.REQUIRED, 
0122         new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING        , true)));
0123     metaDataMap = Collections.unmodifiableMap(tmpMap);
0124     org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TBoolColumn.class, metaDataMap);
0125   }
0126 
0127   public TBoolColumn() {
0128   }
0129 
0130   public TBoolColumn(
0131     List<Boolean> values,
0132     ByteBuffer nulls)
0133   {
0134     this();
0135     this.values = values;
0136     this.nulls = org.apache.thrift.TBaseHelper.copyBinary(nulls);
0137   }
0138 
0139   /**
0140    * Performs a deep copy on <i>other</i>.
0141    */
0142   public TBoolColumn(TBoolColumn other) {
0143     if (other.isSetValues()) {
0144       List<Boolean> __this__values = new ArrayList<Boolean>(other.values);
0145       this.values = __this__values;
0146     }
0147     if (other.isSetNulls()) {
0148       this.nulls = org.apache.thrift.TBaseHelper.copyBinary(other.nulls);
0149     }
0150   }
0151 
0152   public TBoolColumn deepCopy() {
0153     return new TBoolColumn(this);
0154   }
0155 
0156   @Override
0157   public void clear() {
0158     this.values = null;
0159     this.nulls = null;
0160   }
0161 
0162   public int getValuesSize() {
0163     return (this.values == null) ? 0 : this.values.size();
0164   }
0165 
0166   public java.util.Iterator<Boolean> getValuesIterator() {
0167     return (this.values == null) ? null : this.values.iterator();
0168   }
0169 
0170   public void addToValues(boolean elem) {
0171     if (this.values == null) {
0172       this.values = new ArrayList<Boolean>();
0173     }
0174     this.values.add(elem);
0175   }
0176 
0177   public List<Boolean> getValues() {
0178     return this.values;
0179   }
0180 
0181   public void setValues(List<Boolean> values) {
0182     this.values = values;
0183   }
0184 
0185   public void unsetValues() {
0186     this.values = null;
0187   }
0188 
0189   /** Returns true if field values is set (has been assigned a value) and false otherwise */
0190   public boolean isSetValues() {
0191     return this.values != null;
0192   }
0193 
0194   public void setValuesIsSet(boolean value) {
0195     if (!value) {
0196       this.values = null;
0197     }
0198   }
0199 
0200   public byte[] getNulls() {
0201     setNulls(org.apache.thrift.TBaseHelper.rightSize(nulls));
0202     return nulls == null ? null : nulls.array();
0203   }
0204 
0205   public ByteBuffer bufferForNulls() {
0206     return org.apache.thrift.TBaseHelper.copyBinary(nulls);
0207   }
0208 
0209   public void setNulls(byte[] nulls) {
0210     this.nulls = nulls == null ? (ByteBuffer)null : ByteBuffer.wrap(Arrays.copyOf(nulls, nulls.length));
0211   }
0212 
0213   public void setNulls(ByteBuffer nulls) {
0214     this.nulls = org.apache.thrift.TBaseHelper.copyBinary(nulls);
0215   }
0216 
0217   public void unsetNulls() {
0218     this.nulls = null;
0219   }
0220 
0221   /** Returns true if field nulls is set (has been assigned a value) and false otherwise */
0222   public boolean isSetNulls() {
0223     return this.nulls != null;
0224   }
0225 
0226   public void setNullsIsSet(boolean value) {
0227     if (!value) {
0228       this.nulls = null;
0229     }
0230   }
0231 
0232   public void setFieldValue(_Fields field, Object value) {
0233     switch (field) {
0234     case VALUES:
0235       if (value == null) {
0236         unsetValues();
0237       } else {
0238         setValues((List<Boolean>)value);
0239       }
0240       break;
0241 
0242     case NULLS:
0243       if (value == null) {
0244         unsetNulls();
0245       } else {
0246         setNulls((ByteBuffer)value);
0247       }
0248       break;
0249 
0250     }
0251   }
0252 
0253   public Object getFieldValue(_Fields field) {
0254     switch (field) {
0255     case VALUES:
0256       return getValues();
0257 
0258     case NULLS:
0259       return getNulls();
0260 
0261     }
0262     throw new IllegalStateException();
0263   }
0264 
0265   /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
0266   public boolean isSet(_Fields field) {
0267     if (field == null) {
0268       throw new IllegalArgumentException();
0269     }
0270 
0271     switch (field) {
0272     case VALUES:
0273       return isSetValues();
0274     case NULLS:
0275       return isSetNulls();
0276     }
0277     throw new IllegalStateException();
0278   }
0279 
0280   @Override
0281   public boolean equals(Object that) {
0282     if (that == null)
0283       return false;
0284     if (that instanceof TBoolColumn)
0285       return this.equals((TBoolColumn)that);
0286     return false;
0287   }
0288 
0289   public boolean equals(TBoolColumn that) {
0290     if (that == null)
0291       return false;
0292 
0293     boolean this_present_values = true && this.isSetValues();
0294     boolean that_present_values = true && that.isSetValues();
0295     if (this_present_values || that_present_values) {
0296       if (!(this_present_values && that_present_values))
0297         return false;
0298       if (!this.values.equals(that.values))
0299         return false;
0300     }
0301 
0302     boolean this_present_nulls = true && this.isSetNulls();
0303     boolean that_present_nulls = true && that.isSetNulls();
0304     if (this_present_nulls || that_present_nulls) {
0305       if (!(this_present_nulls && that_present_nulls))
0306         return false;
0307       if (!this.nulls.equals(that.nulls))
0308         return false;
0309     }
0310 
0311     return true;
0312   }
0313 
0314   @Override
0315   public int hashCode() {
0316     List<Object> list = new ArrayList<Object>();
0317 
0318     boolean present_values = true && (isSetValues());
0319     list.add(present_values);
0320     if (present_values)
0321       list.add(values);
0322 
0323     boolean present_nulls = true && (isSetNulls());
0324     list.add(present_nulls);
0325     if (present_nulls)
0326       list.add(nulls);
0327 
0328     return list.hashCode();
0329   }
0330 
0331   @Override
0332   public int compareTo(TBoolColumn other) {
0333     if (!getClass().equals(other.getClass())) {
0334       return getClass().getName().compareTo(other.getClass().getName());
0335     }
0336 
0337     int lastComparison = 0;
0338 
0339     lastComparison = Boolean.valueOf(isSetValues()).compareTo(other.isSetValues());
0340     if (lastComparison != 0) {
0341       return lastComparison;
0342     }
0343     if (isSetValues()) {
0344       lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.values, other.values);
0345       if (lastComparison != 0) {
0346         return lastComparison;
0347       }
0348     }
0349     lastComparison = Boolean.valueOf(isSetNulls()).compareTo(other.isSetNulls());
0350     if (lastComparison != 0) {
0351       return lastComparison;
0352     }
0353     if (isSetNulls()) {
0354       lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.nulls, other.nulls);
0355       if (lastComparison != 0) {
0356         return lastComparison;
0357       }
0358     }
0359     return 0;
0360   }
0361 
0362   public _Fields fieldForId(int fieldId) {
0363     return _Fields.findByThriftId(fieldId);
0364   }
0365 
0366   public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
0367     schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
0368   }
0369 
0370   public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
0371     schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
0372   }
0373 
0374   @Override
0375   public String toString() {
0376     StringBuilder sb = new StringBuilder("TBoolColumn(");
0377     boolean first = true;
0378 
0379     sb.append("values:");
0380     if (this.values == null) {
0381       sb.append("null");
0382     } else {
0383       sb.append(this.values);
0384     }
0385     first = false;
0386     if (!first) sb.append(", ");
0387     sb.append("nulls:");
0388     if (this.nulls == null) {
0389       sb.append("null");
0390     } else {
0391       org.apache.thrift.TBaseHelper.toString(this.nulls, sb);
0392     }
0393     first = false;
0394     sb.append(")");
0395     return sb.toString();
0396   }
0397 
0398   public void validate() throws org.apache.thrift.TException {
0399     // check for required fields
0400     if (!isSetValues()) {
0401       throw new org.apache.thrift.protocol.TProtocolException("Required field 'values' is unset! Struct:" + toString());
0402     }
0403 
0404     if (!isSetNulls()) {
0405       throw new org.apache.thrift.protocol.TProtocolException("Required field 'nulls' is unset! Struct:" + toString());
0406     }
0407 
0408     // check for sub-struct validity
0409   }
0410 
0411   private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
0412     try {
0413       write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
0414     } catch (org.apache.thrift.TException te) {
0415       throw new java.io.IOException(te);
0416     }
0417   }
0418 
0419   private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
0420     try {
0421       read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
0422     } catch (org.apache.thrift.TException te) {
0423       throw new java.io.IOException(te);
0424     }
0425   }
0426 
0427   private static class TBoolColumnStandardSchemeFactory implements SchemeFactory {
0428     public TBoolColumnStandardScheme getScheme() {
0429       return new TBoolColumnStandardScheme();
0430     }
0431   }
0432 
0433   private static class TBoolColumnStandardScheme extends StandardScheme<TBoolColumn> {
0434 
0435     public void read(org.apache.thrift.protocol.TProtocol iprot, TBoolColumn struct) throws org.apache.thrift.TException {
0436       org.apache.thrift.protocol.TField schemeField;
0437       iprot.readStructBegin();
0438       while (true)
0439       {
0440         schemeField = iprot.readFieldBegin();
0441         if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
0442           break;
0443         }
0444         switch (schemeField.id) {
0445           case 1: // VALUES
0446             if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
0447               {
0448                 org.apache.thrift.protocol.TList _list54 = iprot.readListBegin();
0449                 struct.values = new ArrayList<Boolean>(_list54.size);
0450                 boolean _elem55;
0451                 for (int _i56 = 0; _i56 < _list54.size; ++_i56)
0452                 {
0453                   _elem55 = iprot.readBool();
0454                   struct.values.add(_elem55);
0455                 }
0456                 iprot.readListEnd();
0457               }
0458               struct.setValuesIsSet(true);
0459             } else { 
0460               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
0461             }
0462             break;
0463           case 2: // NULLS
0464             if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
0465               struct.nulls = iprot.readBinary();
0466               struct.setNullsIsSet(true);
0467             } else { 
0468               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
0469             }
0470             break;
0471           default:
0472             org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
0473         }
0474         iprot.readFieldEnd();
0475       }
0476       iprot.readStructEnd();
0477       struct.validate();
0478     }
0479 
0480     public void write(org.apache.thrift.protocol.TProtocol oprot, TBoolColumn struct) throws org.apache.thrift.TException {
0481       struct.validate();
0482 
0483       oprot.writeStructBegin(STRUCT_DESC);
0484       if (struct.values != null) {
0485         oprot.writeFieldBegin(VALUES_FIELD_DESC);
0486         {
0487           oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.BOOL, struct.values.size()));
0488           for (boolean _iter57 : struct.values)
0489           {
0490             oprot.writeBool(_iter57);
0491           }
0492           oprot.writeListEnd();
0493         }
0494         oprot.writeFieldEnd();
0495       }
0496       if (struct.nulls != null) {
0497         oprot.writeFieldBegin(NULLS_FIELD_DESC);
0498         oprot.writeBinary(struct.nulls);
0499         oprot.writeFieldEnd();
0500       }
0501       oprot.writeFieldStop();
0502       oprot.writeStructEnd();
0503     }
0504 
0505   }
0506 
0507   private static class TBoolColumnTupleSchemeFactory implements SchemeFactory {
0508     public TBoolColumnTupleScheme getScheme() {
0509       return new TBoolColumnTupleScheme();
0510     }
0511   }
0512 
0513   private static class TBoolColumnTupleScheme extends TupleScheme<TBoolColumn> {
0514 
0515     @Override
0516     public void write(org.apache.thrift.protocol.TProtocol prot, TBoolColumn struct) throws org.apache.thrift.TException {
0517       TTupleProtocol oprot = (TTupleProtocol) prot;
0518       {
0519         oprot.writeI32(struct.values.size());
0520         for (boolean _iter58 : struct.values)
0521         {
0522           oprot.writeBool(_iter58);
0523         }
0524       }
0525       oprot.writeBinary(struct.nulls);
0526     }
0527 
0528     @Override
0529     public void read(org.apache.thrift.protocol.TProtocol prot, TBoolColumn struct) throws org.apache.thrift.TException {
0530       TTupleProtocol iprot = (TTupleProtocol) prot;
0531       {
0532         org.apache.thrift.protocol.TList _list59 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.BOOL, iprot.readI32());
0533         struct.values = new ArrayList<Boolean>(_list59.size);
0534         boolean _elem60;
0535         for (int _i61 = 0; _i61 < _list59.size; ++_i61)
0536         {
0537           _elem60 = iprot.readBool();
0538           struct.values.add(_elem60);
0539         }
0540       }
0541       struct.setValuesIsSet(true);
0542       struct.nulls = iprot.readBinary();
0543       struct.setNullsIsSet(true);
0544     }
0545   }
0546 
0547 }
0548