ezbake.data.elastic.thrift.DateHistogramFacet.java Source code

Java tutorial

Introduction

Here is the source code for ezbake.data.elastic.thrift.DateHistogramFacet.java

Source

/*   Copyright (C) 2013-2014 Computer Sciences Corporation
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License. */

/**
 * Autogenerated by Thrift Compiler (0.9.1)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package ezbake.data.elastic.thrift;

import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;

import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import org.apache.thrift.async.AsyncMethodCallback;
import org.apache.thrift.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class DateHistogramFacet implements org.apache.thrift.TBase<DateHistogramFacet, DateHistogramFacet._Fields>,
        java.io.Serializable, Cloneable, Comparable<DateHistogramFacet> {
    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct(
            "DateHistogramFacet");

    private static final org.apache.thrift.protocol.TField FIELD_FIELD_DESC = new org.apache.thrift.protocol.TField(
            "field", org.apache.thrift.protocol.TType.STRUCT, (short) 1);
    private static final org.apache.thrift.protocol.TField INTERVAL_FIELD_DESC = new org.apache.thrift.protocol.TField(
            "interval", org.apache.thrift.protocol.TType.STRUCT, (short) 2);
    private static final org.apache.thrift.protocol.TField FACTOR_FIELD_DESC = new org.apache.thrift.protocol.TField(
            "factor", org.apache.thrift.protocol.TType.I32, (short) 3);
    private static final org.apache.thrift.protocol.TField POST_ZONE_HOURS_FIELD_DESC = new org.apache.thrift.protocol.TField(
            "post_zone_hours", org.apache.thrift.protocol.TType.I16, (short) 4);
    private static final org.apache.thrift.protocol.TField PRE_ZONE_HOURS_FIELD_DESC = new org.apache.thrift.protocol.TField(
            "pre_zone_hours", org.apache.thrift.protocol.TType.I16, (short) 5);

    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
    static {
        schemes.put(StandardScheme.class, new DateHistogramFacetStandardSchemeFactory());
        schemes.put(TupleScheme.class, new DateHistogramFacetTupleSchemeFactory());
    }

    public DateField field; // required
    public DateInterval interval; // required
    public int factor; // optional
    public short post_zone_hours; // optional
    public short pre_zone_hours; // optional

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
        FIELD((short) 1, "field"), INTERVAL((short) 2, "interval"), FACTOR((short) 3, "factor"), POST_ZONE_HOURS(
                (short) 4, "post_zone_hours"), PRE_ZONE_HOURS((short) 5, "pre_zone_hours");

        private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();

        static {
            for (_Fields field : EnumSet.allOf(_Fields.class)) {
                byName.put(field.getFieldName(), field);
            }
        }

        /**
         * Find the _Fields constant that matches fieldId, or null if its not found.
         */
        public static _Fields findByThriftId(int fieldId) {
            switch (fieldId) {
            case 1: // FIELD
                return FIELD;
            case 2: // INTERVAL
                return INTERVAL;
            case 3: // FACTOR
                return FACTOR;
            case 4: // POST_ZONE_HOURS
                return POST_ZONE_HOURS;
            case 5: // PRE_ZONE_HOURS
                return PRE_ZONE_HOURS;
            default:
                return null;
            }
        }

        /**
         * Find the _Fields constant that matches fieldId, throwing an exception
         * if it is not found.
         */
        public static _Fields findByThriftIdOrThrow(int fieldId) {
            _Fields fields = findByThriftId(fieldId);
            if (fields == null)
                throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
            return fields;
        }

        /**
         * Find the _Fields constant that matches name, or null if its not found.
         */
        public static _Fields findByName(String name) {
            return byName.get(name);
        }

        private final short _thriftId;
        private final String _fieldName;

        _Fields(short thriftId, String fieldName) {
            _thriftId = thriftId;
            _fieldName = fieldName;
        }

        public short getThriftFieldId() {
            return _thriftId;
        }

        public String getFieldName() {
            return _fieldName;
        }
    }

    // isset id assignments
    private static final int __FACTOR_ISSET_ID = 0;
    private static final int __POST_ZONE_HOURS_ISSET_ID = 1;
    private static final int __PRE_ZONE_HOURS_ISSET_ID = 2;
    private byte __isset_bitfield = 0;
    private _Fields optionals[] = { _Fields.FACTOR, _Fields.POST_ZONE_HOURS, _Fields.PRE_ZONE_HOURS };
    public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
    static {
        Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(
                _Fields.class);
        tmpMap.put(_Fields.FIELD,
                new org.apache.thrift.meta_data.FieldMetaData("field",
                        org.apache.thrift.TFieldRequirementType.REQUIRED,
                        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT,
                                DateField.class)));
        tmpMap.put(_Fields.INTERVAL,
                new org.apache.thrift.meta_data.FieldMetaData("interval",
                        org.apache.thrift.TFieldRequirementType.REQUIRED,
                        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT,
                                DateInterval.class)));
        tmpMap.put(_Fields.FACTOR,
                new org.apache.thrift.meta_data.FieldMetaData("factor",
                        org.apache.thrift.TFieldRequirementType.OPTIONAL,
                        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
        tmpMap.put(_Fields.POST_ZONE_HOURS,
                new org.apache.thrift.meta_data.FieldMetaData("post_zone_hours",
                        org.apache.thrift.TFieldRequirementType.OPTIONAL,
                        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I16)));
        tmpMap.put(_Fields.PRE_ZONE_HOURS,
                new org.apache.thrift.meta_data.FieldMetaData("pre_zone_hours",
                        org.apache.thrift.TFieldRequirementType.OPTIONAL,
                        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I16)));
        metaDataMap = Collections.unmodifiableMap(tmpMap);
        org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(DateHistogramFacet.class, metaDataMap);
    }

    public DateHistogramFacet() {
    }

    public DateHistogramFacet(DateField field, DateInterval interval) {
        this();
        this.field = field;
        this.interval = interval;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public DateHistogramFacet(DateHistogramFacet other) {
        __isset_bitfield = other.__isset_bitfield;
        if (other.isSetField()) {
            this.field = new DateField(other.field);
        }
        if (other.isSetInterval()) {
            this.interval = new DateInterval(other.interval);
        }
        this.factor = other.factor;
        this.post_zone_hours = other.post_zone_hours;
        this.pre_zone_hours = other.pre_zone_hours;
    }

    public DateHistogramFacet deepCopy() {
        return new DateHistogramFacet(this);
    }

    @Override
    public void clear() {
        this.field = null;
        this.interval = null;
        setFactorIsSet(false);
        this.factor = 0;
        setPost_zone_hoursIsSet(false);
        this.post_zone_hours = 0;
        setPre_zone_hoursIsSet(false);
        this.pre_zone_hours = 0;
    }

    public DateField getField() {
        return this.field;
    }

    public DateHistogramFacet setField(DateField field) {
        this.field = field;
        return this;
    }

    public void unsetField() {
        this.field = null;
    }

    /** Returns true if field field is set (has been assigned a value) and false otherwise */
    public boolean isSetField() {
        return this.field != null;
    }

    public void setFieldIsSet(boolean value) {
        if (!value) {
            this.field = null;
        }
    }

    public DateInterval getInterval() {
        return this.interval;
    }

    public DateHistogramFacet setInterval(DateInterval interval) {
        this.interval = interval;
        return this;
    }

    public void unsetInterval() {
        this.interval = null;
    }

    /** Returns true if field interval is set (has been assigned a value) and false otherwise */
    public boolean isSetInterval() {
        return this.interval != null;
    }

    public void setIntervalIsSet(boolean value) {
        if (!value) {
            this.interval = null;
        }
    }

    public int getFactor() {
        return this.factor;
    }

    public DateHistogramFacet setFactor(int factor) {
        this.factor = factor;
        setFactorIsSet(true);
        return this;
    }

    public void unsetFactor() {
        __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __FACTOR_ISSET_ID);
    }

    /** Returns true if field factor is set (has been assigned a value) and false otherwise */
    public boolean isSetFactor() {
        return EncodingUtils.testBit(__isset_bitfield, __FACTOR_ISSET_ID);
    }

    public void setFactorIsSet(boolean value) {
        __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __FACTOR_ISSET_ID, value);
    }

    public short getPost_zone_hours() {
        return this.post_zone_hours;
    }

    public DateHistogramFacet setPost_zone_hours(short post_zone_hours) {
        this.post_zone_hours = post_zone_hours;
        setPost_zone_hoursIsSet(true);
        return this;
    }

    public void unsetPost_zone_hours() {
        __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __POST_ZONE_HOURS_ISSET_ID);
    }

    /** Returns true if field post_zone_hours is set (has been assigned a value) and false otherwise */
    public boolean isSetPost_zone_hours() {
        return EncodingUtils.testBit(__isset_bitfield, __POST_ZONE_HOURS_ISSET_ID);
    }

    public void setPost_zone_hoursIsSet(boolean value) {
        __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __POST_ZONE_HOURS_ISSET_ID, value);
    }

    public short getPre_zone_hours() {
        return this.pre_zone_hours;
    }

    public DateHistogramFacet setPre_zone_hours(short pre_zone_hours) {
        this.pre_zone_hours = pre_zone_hours;
        setPre_zone_hoursIsSet(true);
        return this;
    }

    public void unsetPre_zone_hours() {
        __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __PRE_ZONE_HOURS_ISSET_ID);
    }

    /** Returns true if field pre_zone_hours is set (has been assigned a value) and false otherwise */
    public boolean isSetPre_zone_hours() {
        return EncodingUtils.testBit(__isset_bitfield, __PRE_ZONE_HOURS_ISSET_ID);
    }

    public void setPre_zone_hoursIsSet(boolean value) {
        __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __PRE_ZONE_HOURS_ISSET_ID, value);
    }

    public void setFieldValue(_Fields field, Object value) {
        switch (field) {
        case FIELD:
            if (value == null) {
                unsetField();
            } else {
                setField((DateField) value);
            }
            break;

        case INTERVAL:
            if (value == null) {
                unsetInterval();
            } else {
                setInterval((DateInterval) value);
            }
            break;

        case FACTOR:
            if (value == null) {
                unsetFactor();
            } else {
                setFactor((Integer) value);
            }
            break;

        case POST_ZONE_HOURS:
            if (value == null) {
                unsetPost_zone_hours();
            } else {
                setPost_zone_hours((Short) value);
            }
            break;

        case PRE_ZONE_HOURS:
            if (value == null) {
                unsetPre_zone_hours();
            } else {
                setPre_zone_hours((Short) value);
            }
            break;

        }
    }

    public Object getFieldValue(_Fields field) {
        switch (field) {
        case FIELD:
            return getField();

        case INTERVAL:
            return getInterval();

        case FACTOR:
            return Integer.valueOf(getFactor());

        case POST_ZONE_HOURS:
            return Short.valueOf(getPost_zone_hours());

        case PRE_ZONE_HOURS:
            return Short.valueOf(getPre_zone_hours());

        }
        throw new IllegalStateException();
    }

    /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
    public boolean isSet(_Fields field) {
        if (field == null) {
            throw new IllegalArgumentException();
        }

        switch (field) {
        case FIELD:
            return isSetField();
        case INTERVAL:
            return isSetInterval();
        case FACTOR:
            return isSetFactor();
        case POST_ZONE_HOURS:
            return isSetPost_zone_hours();
        case PRE_ZONE_HOURS:
            return isSetPre_zone_hours();
        }
        throw new IllegalStateException();
    }

    @Override
    public boolean equals(Object that) {
        if (that == null)
            return false;
        if (that instanceof DateHistogramFacet)
            return this.equals((DateHistogramFacet) that);
        return false;
    }

    public boolean equals(DateHistogramFacet that) {
        if (that == null)
            return false;

        boolean this_present_field = true && this.isSetField();
        boolean that_present_field = true && that.isSetField();
        if (this_present_field || that_present_field) {
            if (!(this_present_field && that_present_field))
                return false;
            if (!this.field.equals(that.field))
                return false;
        }

        boolean this_present_interval = true && this.isSetInterval();
        boolean that_present_interval = true && that.isSetInterval();
        if (this_present_interval || that_present_interval) {
            if (!(this_present_interval && that_present_interval))
                return false;
            if (!this.interval.equals(that.interval))
                return false;
        }

        boolean this_present_factor = true && this.isSetFactor();
        boolean that_present_factor = true && that.isSetFactor();
        if (this_present_factor || that_present_factor) {
            if (!(this_present_factor && that_present_factor))
                return false;
            if (this.factor != that.factor)
                return false;
        }

        boolean this_present_post_zone_hours = true && this.isSetPost_zone_hours();
        boolean that_present_post_zone_hours = true && that.isSetPost_zone_hours();
        if (this_present_post_zone_hours || that_present_post_zone_hours) {
            if (!(this_present_post_zone_hours && that_present_post_zone_hours))
                return false;
            if (this.post_zone_hours != that.post_zone_hours)
                return false;
        }

        boolean this_present_pre_zone_hours = true && this.isSetPre_zone_hours();
        boolean that_present_pre_zone_hours = true && that.isSetPre_zone_hours();
        if (this_present_pre_zone_hours || that_present_pre_zone_hours) {
            if (!(this_present_pre_zone_hours && that_present_pre_zone_hours))
                return false;
            if (this.pre_zone_hours != that.pre_zone_hours)
                return false;
        }

        return true;
    }

    @Override
    public int hashCode() {
        HashCodeBuilder builder = new HashCodeBuilder();

        boolean present_field = true && (isSetField());
        builder.append(present_field);
        if (present_field)
            builder.append(field);

        boolean present_interval = true && (isSetInterval());
        builder.append(present_interval);
        if (present_interval)
            builder.append(interval);

        boolean present_factor = true && (isSetFactor());
        builder.append(present_factor);
        if (present_factor)
            builder.append(factor);

        boolean present_post_zone_hours = true && (isSetPost_zone_hours());
        builder.append(present_post_zone_hours);
        if (present_post_zone_hours)
            builder.append(post_zone_hours);

        boolean present_pre_zone_hours = true && (isSetPre_zone_hours());
        builder.append(present_pre_zone_hours);
        if (present_pre_zone_hours)
            builder.append(pre_zone_hours);

        return builder.toHashCode();
    }

    @Override
    public int compareTo(DateHistogramFacet other) {
        if (!getClass().equals(other.getClass())) {
            return getClass().getName().compareTo(other.getClass().getName());
        }

        int lastComparison = 0;

        lastComparison = Boolean.valueOf(isSetField()).compareTo(other.isSetField());
        if (lastComparison != 0) {
            return lastComparison;
        }
        if (isSetField()) {
            lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.field, other.field);
            if (lastComparison != 0) {
                return lastComparison;
            }
        }
        lastComparison = Boolean.valueOf(isSetInterval()).compareTo(other.isSetInterval());
        if (lastComparison != 0) {
            return lastComparison;
        }
        if (isSetInterval()) {
            lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.interval, other.interval);
            if (lastComparison != 0) {
                return lastComparison;
            }
        }
        lastComparison = Boolean.valueOf(isSetFactor()).compareTo(other.isSetFactor());
        if (lastComparison != 0) {
            return lastComparison;
        }
        if (isSetFactor()) {
            lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.factor, other.factor);
            if (lastComparison != 0) {
                return lastComparison;
            }
        }
        lastComparison = Boolean.valueOf(isSetPost_zone_hours()).compareTo(other.isSetPost_zone_hours());
        if (lastComparison != 0) {
            return lastComparison;
        }
        if (isSetPost_zone_hours()) {
            lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.post_zone_hours, other.post_zone_hours);
            if (lastComparison != 0) {
                return lastComparison;
            }
        }
        lastComparison = Boolean.valueOf(isSetPre_zone_hours()).compareTo(other.isSetPre_zone_hours());
        if (lastComparison != 0) {
            return lastComparison;
        }
        if (isSetPre_zone_hours()) {
            lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.pre_zone_hours, other.pre_zone_hours);
            if (lastComparison != 0) {
                return lastComparison;
            }
        }
        return 0;
    }

    public _Fields fieldForId(int fieldId) {
        return _Fields.findByThriftId(fieldId);
    }

    public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
        schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
    }

    public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
        schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder("DateHistogramFacet(");
        boolean first = true;

        sb.append("field:");
        if (this.field == null) {
            sb.append("null");
        } else {
            sb.append(this.field);
        }
        first = false;
        if (!first)
            sb.append(", ");
        sb.append("interval:");
        if (this.interval == null) {
            sb.append("null");
        } else {
            sb.append(this.interval);
        }
        first = false;
        if (isSetFactor()) {
            if (!first)
                sb.append(", ");
            sb.append("factor:");
            sb.append(this.factor);
            first = false;
        }
        if (isSetPost_zone_hours()) {
            if (!first)
                sb.append(", ");
            sb.append("post_zone_hours:");
            sb.append(this.post_zone_hours);
            first = false;
        }
        if (isSetPre_zone_hours()) {
            if (!first)
                sb.append(", ");
            sb.append("pre_zone_hours:");
            sb.append(this.pre_zone_hours);
            first = false;
        }
        sb.append(")");
        return sb.toString();
    }

    public void validate() throws org.apache.thrift.TException {
        // check for required fields
        if (field == null) {
            throw new org.apache.thrift.protocol.TProtocolException(
                    "Required field 'field' was not present! Struct: " + toString());
        }
        if (interval == null) {
            throw new org.apache.thrift.protocol.TProtocolException(
                    "Required field 'interval' was not present! Struct: " + toString());
        }
        // check for sub-struct validity
    }

    private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
        try {
            write(new org.apache.thrift.protocol.TCompactProtocol(
                    new org.apache.thrift.transport.TIOStreamTransport(out)));
        } catch (org.apache.thrift.TException te) {
            throw new java.io.IOException(te);
        }
    }

    private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
        try {
            // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
            __isset_bitfield = 0;
            read(new org.apache.thrift.protocol.TCompactProtocol(
                    new org.apache.thrift.transport.TIOStreamTransport(in)));
        } catch (org.apache.thrift.TException te) {
            throw new java.io.IOException(te);
        }
    }

    private static class DateHistogramFacetStandardSchemeFactory implements SchemeFactory {
        public DateHistogramFacetStandardScheme getScheme() {
            return new DateHistogramFacetStandardScheme();
        }
    }

    private static class DateHistogramFacetStandardScheme extends StandardScheme<DateHistogramFacet> {

        public void read(org.apache.thrift.protocol.TProtocol iprot, DateHistogramFacet struct)
                throws org.apache.thrift.TException {
            org.apache.thrift.protocol.TField schemeField;
            iprot.readStructBegin();
            while (true) {
                schemeField = iprot.readFieldBegin();
                if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
                    break;
                }
                switch (schemeField.id) {
                case 1: // FIELD
                    if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                        struct.field = new DateField();
                        struct.field.read(iprot);
                        struct.setFieldIsSet(true);
                    } else {
                        org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
                    }
                    break;
                case 2: // INTERVAL
                    if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                        struct.interval = new DateInterval();
                        struct.interval.read(iprot);
                        struct.setIntervalIsSet(true);
                    } else {
                        org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
                    }
                    break;
                case 3: // FACTOR
                    if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
                        struct.factor = iprot.readI32();
                        struct.setFactorIsSet(true);
                    } else {
                        org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
                    }
                    break;
                case 4: // POST_ZONE_HOURS
                    if (schemeField.type == org.apache.thrift.protocol.TType.I16) {
                        struct.post_zone_hours = iprot.readI16();
                        struct.setPost_zone_hoursIsSet(true);
                    } else {
                        org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
                    }
                    break;
                case 5: // PRE_ZONE_HOURS
                    if (schemeField.type == org.apache.thrift.protocol.TType.I16) {
                        struct.pre_zone_hours = iprot.readI16();
                        struct.setPre_zone_hoursIsSet(true);
                    } else {
                        org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
                    }
                    break;
                default:
                    org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
                }
                iprot.readFieldEnd();
            }
            iprot.readStructEnd();

            // check for required fields of primitive type, which can't be checked in the validate method
            struct.validate();
        }

        public void write(org.apache.thrift.protocol.TProtocol oprot, DateHistogramFacet struct)
                throws org.apache.thrift.TException {
            struct.validate();

            oprot.writeStructBegin(STRUCT_DESC);
            if (struct.field != null) {
                oprot.writeFieldBegin(FIELD_FIELD_DESC);
                struct.field.write(oprot);
                oprot.writeFieldEnd();
            }
            if (struct.interval != null) {
                oprot.writeFieldBegin(INTERVAL_FIELD_DESC);
                struct.interval.write(oprot);
                oprot.writeFieldEnd();
            }
            if (struct.isSetFactor()) {
                oprot.writeFieldBegin(FACTOR_FIELD_DESC);
                oprot.writeI32(struct.factor);
                oprot.writeFieldEnd();
            }
            if (struct.isSetPost_zone_hours()) {
                oprot.writeFieldBegin(POST_ZONE_HOURS_FIELD_DESC);
                oprot.writeI16(struct.post_zone_hours);
                oprot.writeFieldEnd();
            }
            if (struct.isSetPre_zone_hours()) {
                oprot.writeFieldBegin(PRE_ZONE_HOURS_FIELD_DESC);
                oprot.writeI16(struct.pre_zone_hours);
                oprot.writeFieldEnd();
            }
            oprot.writeFieldStop();
            oprot.writeStructEnd();
        }

    }

    private static class DateHistogramFacetTupleSchemeFactory implements SchemeFactory {
        public DateHistogramFacetTupleScheme getScheme() {
            return new DateHistogramFacetTupleScheme();
        }
    }

    private static class DateHistogramFacetTupleScheme extends TupleScheme<DateHistogramFacet> {

        @Override
        public void write(org.apache.thrift.protocol.TProtocol prot, DateHistogramFacet struct)
                throws org.apache.thrift.TException {
            TTupleProtocol oprot = (TTupleProtocol) prot;
            struct.field.write(oprot);
            struct.interval.write(oprot);
            BitSet optionals = new BitSet();
            if (struct.isSetFactor()) {
                optionals.set(0);
            }
            if (struct.isSetPost_zone_hours()) {
                optionals.set(1);
            }
            if (struct.isSetPre_zone_hours()) {
                optionals.set(2);
            }
            oprot.writeBitSet(optionals, 3);
            if (struct.isSetFactor()) {
                oprot.writeI32(struct.factor);
            }
            if (struct.isSetPost_zone_hours()) {
                oprot.writeI16(struct.post_zone_hours);
            }
            if (struct.isSetPre_zone_hours()) {
                oprot.writeI16(struct.pre_zone_hours);
            }
        }

        @Override
        public void read(org.apache.thrift.protocol.TProtocol prot, DateHistogramFacet struct)
                throws org.apache.thrift.TException {
            TTupleProtocol iprot = (TTupleProtocol) prot;
            struct.field = new DateField();
            struct.field.read(iprot);
            struct.setFieldIsSet(true);
            struct.interval = new DateInterval();
            struct.interval.read(iprot);
            struct.setIntervalIsSet(true);
            BitSet incoming = iprot.readBitSet(3);
            if (incoming.get(0)) {
                struct.factor = iprot.readI32();
                struct.setFactorIsSet(true);
            }
            if (incoming.get(1)) {
                struct.post_zone_hours = iprot.readI16();
                struct.setPost_zone_hoursIsSet(true);
            }
            if (incoming.get(2)) {
                struct.pre_zone_hours = iprot.readI16();
                struct.setPre_zone_hoursIsSet(true);
            }
        }
    }

}