0001
0002
0003
0004
0005
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 TDoubleValue implements org.apache.thrift.TBase<TDoubleValue, TDoubleValue._Fields>, java.io.Serializable, Cloneable, Comparable<TDoubleValue> {
0039 private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TDoubleValue");
0040
0041 private static final org.apache.thrift.protocol.TField VALUE_FIELD_DESC = new org.apache.thrift.protocol.TField("value", org.apache.thrift.protocol.TType.DOUBLE, (short)1);
0042
0043 private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
0044 static {
0045 schemes.put(StandardScheme.class, new TDoubleValueStandardSchemeFactory());
0046 schemes.put(TupleScheme.class, new TDoubleValueTupleSchemeFactory());
0047 }
0048
0049 private double value;
0050
0051
0052 public enum _Fields implements org.apache.thrift.TFieldIdEnum {
0053 VALUE((short)1, "value");
0054
0055 private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
0056
0057 static {
0058 for (_Fields field : EnumSet.allOf(_Fields.class)) {
0059 byName.put(field.getFieldName(), field);
0060 }
0061 }
0062
0063
0064
0065
0066 public static _Fields findByThriftId(int fieldId) {
0067 switch(fieldId) {
0068 case 1:
0069 return VALUE;
0070 default:
0071 return null;
0072 }
0073 }
0074
0075
0076
0077
0078
0079 public static _Fields findByThriftIdOrThrow(int fieldId) {
0080 _Fields fields = findByThriftId(fieldId);
0081 if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
0082 return fields;
0083 }
0084
0085
0086
0087
0088 public static _Fields findByName(String name) {
0089 return byName.get(name);
0090 }
0091
0092 private final short _thriftId;
0093 private final String _fieldName;
0094
0095 _Fields(short thriftId, String fieldName) {
0096 _thriftId = thriftId;
0097 _fieldName = fieldName;
0098 }
0099
0100 public short getThriftFieldId() {
0101 return _thriftId;
0102 }
0103
0104 public String getFieldName() {
0105 return _fieldName;
0106 }
0107 }
0108
0109
0110 private static final int __VALUE_ISSET_ID = 0;
0111 private byte __isset_bitfield = 0;
0112 private static final _Fields optionals[] = {_Fields.VALUE};
0113 public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
0114 static {
0115 Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
0116 tmpMap.put(_Fields.VALUE, new org.apache.thrift.meta_data.FieldMetaData("value", org.apache.thrift.TFieldRequirementType.OPTIONAL,
0117 new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE)));
0118 metaDataMap = Collections.unmodifiableMap(tmpMap);
0119 org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TDoubleValue.class, metaDataMap);
0120 }
0121
0122 public TDoubleValue() {
0123 }
0124
0125
0126
0127
0128 public TDoubleValue(TDoubleValue other) {
0129 __isset_bitfield = other.__isset_bitfield;
0130 this.value = other.value;
0131 }
0132
0133 public TDoubleValue deepCopy() {
0134 return new TDoubleValue(this);
0135 }
0136
0137 @Override
0138 public void clear() {
0139 setValueIsSet(false);
0140 this.value = 0.0;
0141 }
0142
0143 public double getValue() {
0144 return this.value;
0145 }
0146
0147 public void setValue(double value) {
0148 this.value = value;
0149 setValueIsSet(true);
0150 }
0151
0152 public void unsetValue() {
0153 __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __VALUE_ISSET_ID);
0154 }
0155
0156
0157 public boolean isSetValue() {
0158 return EncodingUtils.testBit(__isset_bitfield, __VALUE_ISSET_ID);
0159 }
0160
0161 public void setValueIsSet(boolean value) {
0162 __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __VALUE_ISSET_ID, value);
0163 }
0164
0165 public void setFieldValue(_Fields field, Object value) {
0166 switch (field) {
0167 case VALUE:
0168 if (value == null) {
0169 unsetValue();
0170 } else {
0171 setValue((Double)value);
0172 }
0173 break;
0174
0175 }
0176 }
0177
0178 public Object getFieldValue(_Fields field) {
0179 switch (field) {
0180 case VALUE:
0181 return getValue();
0182
0183 }
0184 throw new IllegalStateException();
0185 }
0186
0187
0188 public boolean isSet(_Fields field) {
0189 if (field == null) {
0190 throw new IllegalArgumentException();
0191 }
0192
0193 switch (field) {
0194 case VALUE:
0195 return isSetValue();
0196 }
0197 throw new IllegalStateException();
0198 }
0199
0200 @Override
0201 public boolean equals(Object that) {
0202 if (that == null)
0203 return false;
0204 if (that instanceof TDoubleValue)
0205 return this.equals((TDoubleValue)that);
0206 return false;
0207 }
0208
0209 public boolean equals(TDoubleValue that) {
0210 if (that == null)
0211 return false;
0212
0213 boolean this_present_value = true && this.isSetValue();
0214 boolean that_present_value = true && that.isSetValue();
0215 if (this_present_value || that_present_value) {
0216 if (!(this_present_value && that_present_value))
0217 return false;
0218 if (this.value != that.value)
0219 return false;
0220 }
0221
0222 return true;
0223 }
0224
0225 @Override
0226 public int hashCode() {
0227 List<Object> list = new ArrayList<Object>();
0228
0229 boolean present_value = true && (isSetValue());
0230 list.add(present_value);
0231 if (present_value)
0232 list.add(value);
0233
0234 return list.hashCode();
0235 }
0236
0237 @Override
0238 public int compareTo(TDoubleValue other) {
0239 if (!getClass().equals(other.getClass())) {
0240 return getClass().getName().compareTo(other.getClass().getName());
0241 }
0242
0243 int lastComparison = 0;
0244
0245 lastComparison = Boolean.valueOf(isSetValue()).compareTo(other.isSetValue());
0246 if (lastComparison != 0) {
0247 return lastComparison;
0248 }
0249 if (isSetValue()) {
0250 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.value, other.value);
0251 if (lastComparison != 0) {
0252 return lastComparison;
0253 }
0254 }
0255 return 0;
0256 }
0257
0258 public _Fields fieldForId(int fieldId) {
0259 return _Fields.findByThriftId(fieldId);
0260 }
0261
0262 public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
0263 schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
0264 }
0265
0266 public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
0267 schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
0268 }
0269
0270 @Override
0271 public String toString() {
0272 StringBuilder sb = new StringBuilder("TDoubleValue(");
0273 boolean first = true;
0274
0275 if (isSetValue()) {
0276 sb.append("value:");
0277 sb.append(this.value);
0278 first = false;
0279 }
0280 sb.append(")");
0281 return sb.toString();
0282 }
0283
0284 public void validate() throws org.apache.thrift.TException {
0285
0286
0287 }
0288
0289 private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
0290 try {
0291 write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
0292 } catch (org.apache.thrift.TException te) {
0293 throw new java.io.IOException(te);
0294 }
0295 }
0296
0297 private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
0298 try {
0299
0300 __isset_bitfield = 0;
0301 read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
0302 } catch (org.apache.thrift.TException te) {
0303 throw new java.io.IOException(te);
0304 }
0305 }
0306
0307 private static class TDoubleValueStandardSchemeFactory implements SchemeFactory {
0308 public TDoubleValueStandardScheme getScheme() {
0309 return new TDoubleValueStandardScheme();
0310 }
0311 }
0312
0313 private static class TDoubleValueStandardScheme extends StandardScheme<TDoubleValue> {
0314
0315 public void read(org.apache.thrift.protocol.TProtocol iprot, TDoubleValue struct) throws org.apache.thrift.TException {
0316 org.apache.thrift.protocol.TField schemeField;
0317 iprot.readStructBegin();
0318 while (true)
0319 {
0320 schemeField = iprot.readFieldBegin();
0321 if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
0322 break;
0323 }
0324 switch (schemeField.id) {
0325 case 1:
0326 if (schemeField.type == org.apache.thrift.protocol.TType.DOUBLE) {
0327 struct.value = iprot.readDouble();
0328 struct.setValueIsSet(true);
0329 } else {
0330 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
0331 }
0332 break;
0333 default:
0334 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
0335 }
0336 iprot.readFieldEnd();
0337 }
0338 iprot.readStructEnd();
0339 struct.validate();
0340 }
0341
0342 public void write(org.apache.thrift.protocol.TProtocol oprot, TDoubleValue struct) throws org.apache.thrift.TException {
0343 struct.validate();
0344
0345 oprot.writeStructBegin(STRUCT_DESC);
0346 if (struct.isSetValue()) {
0347 oprot.writeFieldBegin(VALUE_FIELD_DESC);
0348 oprot.writeDouble(struct.value);
0349 oprot.writeFieldEnd();
0350 }
0351 oprot.writeFieldStop();
0352 oprot.writeStructEnd();
0353 }
0354
0355 }
0356
0357 private static class TDoubleValueTupleSchemeFactory implements SchemeFactory {
0358 public TDoubleValueTupleScheme getScheme() {
0359 return new TDoubleValueTupleScheme();
0360 }
0361 }
0362
0363 private static class TDoubleValueTupleScheme extends TupleScheme<TDoubleValue> {
0364
0365 @Override
0366 public void write(org.apache.thrift.protocol.TProtocol prot, TDoubleValue struct) throws org.apache.thrift.TException {
0367 TTupleProtocol oprot = (TTupleProtocol) prot;
0368 BitSet optionals = new BitSet();
0369 if (struct.isSetValue()) {
0370 optionals.set(0);
0371 }
0372 oprot.writeBitSet(optionals, 1);
0373 if (struct.isSetValue()) {
0374 oprot.writeDouble(struct.value);
0375 }
0376 }
0377
0378 @Override
0379 public void read(org.apache.thrift.protocol.TProtocol prot, TDoubleValue struct) throws org.apache.thrift.TException {
0380 TTupleProtocol iprot = (TTupleProtocol) prot;
0381 BitSet incoming = iprot.readBitSet(1);
0382 if (incoming.get(0)) {
0383 struct.value = iprot.readDouble();
0384 struct.setValueIsSet(true);
0385 }
0386 }
0387 }
0388
0389 }
0390