Package org.apache.blur.thrift.generated

Source Code of org.apache.blur.thrift.generated.BlurQuery$BlurQueryTupleSchemeFactory

/**
* Autogenerated by Thrift Compiler (0.9.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
*  @generated
*/
package org.apache.blur.thrift.generated;

/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements.  See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/



import org.apache.blur.thirdparty.thrift_0_9_0.scheme.IScheme;
import org.apache.blur.thirdparty.thrift_0_9_0.scheme.SchemeFactory;
import org.apache.blur.thirdparty.thrift_0_9_0.scheme.StandardScheme;

import org.apache.blur.thirdparty.thrift_0_9_0.scheme.TupleScheme;
import org.apache.blur.thirdparty.thrift_0_9_0.protocol.TTupleProtocol;
import org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocolException;
import org.apache.blur.thirdparty.thrift_0_9_0.EncodingUtils;
import org.apache.blur.thirdparty.thrift_0_9_0.TException;
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;

/**
* The Blur Query object that contains the query that needs to be executed along
* with the query options.
*/
public class BlurQuery implements org.apache.blur.thirdparty.thrift_0_9_0.TBase<BlurQuery, BlurQuery._Fields>, java.io.Serializable, Cloneable {
  private static final org.apache.blur.thirdparty.thrift_0_9_0.protocol.TStruct STRUCT_DESC = new org.apache.blur.thirdparty.thrift_0_9_0.protocol.TStruct("BlurQuery");

  private static final org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField QUERY_FIELD_DESC = new org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField("query", org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRUCT, (short)1);
  private static final org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField FACETS_FIELD_DESC = new org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField("facets", org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.LIST, (short)3);
  private static final org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField SELECTOR_FIELD_DESC = new org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField("selector", org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRUCT, (short)4);
  private static final org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField USE_CACHE_IF_PRESENT_FIELD_DESC = new org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField("useCacheIfPresent", org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.BOOL, (short)6);
  private static final org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField START_FIELD_DESC = new org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField("start", org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.I64, (short)7);
  private static final org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField FETCH_FIELD_DESC = new org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField("fetch", org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.I32, (short)8);
  private static final org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField MINIMUM_NUMBER_OF_RESULTS_FIELD_DESC = new org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField("minimumNumberOfResults", org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.I64, (short)9);
  private static final org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField MAX_QUERY_TIME_FIELD_DESC = new org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField("maxQueryTime", org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.I64, (short)10);
  private static final org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField UUID_FIELD_DESC = new org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField("uuid", org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRING, (short)11);
  private static final org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField USER_CONTEXT_FIELD_DESC = new org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField("userContext", org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRING, (short)12);
  private static final org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField CACHE_RESULT_FIELD_DESC = new org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField("cacheResult", org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.BOOL, (short)13);
  private static final org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField START_TIME_FIELD_DESC = new org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField("startTime", org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.I64, (short)14);

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

  /**
   * The query information.
   */
  public Query query; // required
  /**
   * A list of Facets to execute with the given query.
   */
  public List<Facet> facets; // required
  /**
   * Selector is used to fetch data in the search results, if null only location ids will be fetched.
   */
  public Selector selector; // required
  /**
   * Enabled by default to use a cached result if the query matches a previous run query with the
   * configured amount of time.
   */
  public boolean useCacheIfPresent; // required
  /**
   * The starting result position, 0 by default.
   */
  public long start; // required
  /**
   * The number of fetched results, 10 by default.
   */
  public int fetch; // required
  /**
   * The minimum number of results to find before returning.
   */
  public long minimumNumberOfResults; // required
  /**
   * The maximum amount of time the query should execute before timing out.
   */
  public long maxQueryTime; // required
  /**
   * Sets the uuid of this query, this is normal set by the client so that the status
   * of a running query can be found or the query can be canceled.
   */
  public String uuid; // required
  /**
   * Sets a user context, only used for logging at this point.
   */
  public String userContext; // required
  /**
   * Enabled by default to cache this result.  False would not cache the result.
   */
  public boolean cacheResult; // required
  /**
   * Sets the start time, if 0 the controller sets the time.
   */
  public long startTime; // required

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements org.apache.blur.thirdparty.thrift_0_9_0.TFieldIdEnum {
    /**
     * The query information.
     */
    QUERY((short)1, "query"),
    /**
     * A list of Facets to execute with the given query.
     */
    FACETS((short)3, "facets"),
    /**
     * Selector is used to fetch data in the search results, if null only location ids will be fetched.
     */
    SELECTOR((short)4, "selector"),
    /**
     * Enabled by default to use a cached result if the query matches a previous run query with the
     * configured amount of time.
     */
    USE_CACHE_IF_PRESENT((short)6, "useCacheIfPresent"),
    /**
     * The starting result position, 0 by default.
     */
    START((short)7, "start"),
    /**
     * The number of fetched results, 10 by default.
     */
    FETCH((short)8, "fetch"),
    /**
     * The minimum number of results to find before returning.
     */
    MINIMUM_NUMBER_OF_RESULTS((short)9, "minimumNumberOfResults"),
    /**
     * The maximum amount of time the query should execute before timing out.
     */
    MAX_QUERY_TIME((short)10, "maxQueryTime"),
    /**
     * Sets the uuid of this query, this is normal set by the client so that the status
     * of a running query can be found or the query can be canceled.
     */
    UUID((short)11, "uuid"),
    /**
     * Sets a user context, only used for logging at this point.
     */
    USER_CONTEXT((short)12, "userContext"),
    /**
     * Enabled by default to cache this result.  False would not cache the result.
     */
    CACHE_RESULT((short)13, "cacheResult"),
    /**
     * Sets the start time, if 0 the controller sets the time.
     */
    START_TIME((short)14, "startTime");

    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: // QUERY
          return QUERY;
        case 3: // FACETS
          return FACETS;
        case 4: // SELECTOR
          return SELECTOR;
        case 6: // USE_CACHE_IF_PRESENT
          return USE_CACHE_IF_PRESENT;
        case 7: // START
          return START;
        case 8: // FETCH
          return FETCH;
        case 9: // MINIMUM_NUMBER_OF_RESULTS
          return MINIMUM_NUMBER_OF_RESULTS;
        case 10: // MAX_QUERY_TIME
          return MAX_QUERY_TIME;
        case 11: // UUID
          return UUID;
        case 12: // USER_CONTEXT
          return USER_CONTEXT;
        case 13: // CACHE_RESULT
          return CACHE_RESULT;
        case 14: // START_TIME
          return START_TIME;
        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 __USECACHEIFPRESENT_ISSET_ID = 0;
  private static final int __START_ISSET_ID = 1;
  private static final int __FETCH_ISSET_ID = 2;
  private static final int __MINIMUMNUMBEROFRESULTS_ISSET_ID = 3;
  private static final int __MAXQUERYTIME_ISSET_ID = 4;
  private static final int __CACHERESULT_ISSET_ID = 5;
  private static final int __STARTTIME_ISSET_ID = 6;
  private byte __isset_bitfield = 0;
  public static final Map<_Fields, org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldMetaData> metaDataMap;
  static {
    Map<_Fields, org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldMetaData>(_Fields.class);
    tmpMap.put(_Fields.QUERY, new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldMetaData("query", org.apache.blur.thirdparty.thrift_0_9_0.TFieldRequirementType.DEFAULT,
        new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.StructMetaData(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRUCT, Query.class)));
    tmpMap.put(_Fields.FACETS, new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldMetaData("facets", org.apache.blur.thirdparty.thrift_0_9_0.TFieldRequirementType.DEFAULT,
        new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.ListMetaData(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.LIST,
            new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.StructMetaData(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRUCT, Facet.class))));
    tmpMap.put(_Fields.SELECTOR, new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldMetaData("selector", org.apache.blur.thirdparty.thrift_0_9_0.TFieldRequirementType.DEFAULT,
        new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.StructMetaData(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRUCT, Selector.class)));
    tmpMap.put(_Fields.USE_CACHE_IF_PRESENT, new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldMetaData("useCacheIfPresent", org.apache.blur.thirdparty.thrift_0_9_0.TFieldRequirementType.DEFAULT,
        new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldValueMetaData(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.BOOL)));
    tmpMap.put(_Fields.START, new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldMetaData("start", org.apache.blur.thirdparty.thrift_0_9_0.TFieldRequirementType.DEFAULT,
        new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldValueMetaData(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.I64)));
    tmpMap.put(_Fields.FETCH, new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldMetaData("fetch", org.apache.blur.thirdparty.thrift_0_9_0.TFieldRequirementType.DEFAULT,
        new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldValueMetaData(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.I32)));
    tmpMap.put(_Fields.MINIMUM_NUMBER_OF_RESULTS, new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldMetaData("minimumNumberOfResults", org.apache.blur.thirdparty.thrift_0_9_0.TFieldRequirementType.DEFAULT,
        new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldValueMetaData(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.I64)));
    tmpMap.put(_Fields.MAX_QUERY_TIME, new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldMetaData("maxQueryTime", org.apache.blur.thirdparty.thrift_0_9_0.TFieldRequirementType.DEFAULT,
        new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldValueMetaData(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.I64)));
    tmpMap.put(_Fields.UUID, new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldMetaData("uuid", org.apache.blur.thirdparty.thrift_0_9_0.TFieldRequirementType.DEFAULT,
        new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldValueMetaData(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRING)));
    tmpMap.put(_Fields.USER_CONTEXT, new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldMetaData("userContext", org.apache.blur.thirdparty.thrift_0_9_0.TFieldRequirementType.DEFAULT,
        new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldValueMetaData(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRING)));
    tmpMap.put(_Fields.CACHE_RESULT, new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldMetaData("cacheResult", org.apache.blur.thirdparty.thrift_0_9_0.TFieldRequirementType.DEFAULT,
        new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldValueMetaData(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.BOOL)));
    tmpMap.put(_Fields.START_TIME, new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldMetaData("startTime", org.apache.blur.thirdparty.thrift_0_9_0.TFieldRequirementType.DEFAULT,
        new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldValueMetaData(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.I64)));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldMetaData.addStructMetaDataMap(BlurQuery.class, metaDataMap);
  }

  public BlurQuery() {
    this.useCacheIfPresent = true;

    this.start = 0L;

    this.fetch = 10;

    this.minimumNumberOfResults = 9223372036854775807L;

    this.maxQueryTime = 9223372036854775807L;

    this.cacheResult = true;

    this.startTime = 0L;

  }

  public BlurQuery(
    Query query,
    List<Facet> facets,
    Selector selector,
    boolean useCacheIfPresent,
    long start,
    int fetch,
    long minimumNumberOfResults,
    long maxQueryTime,
    String uuid,
    String userContext,
    boolean cacheResult,
    long startTime)
  {
    this();
    this.query = query;
    this.facets = facets;
    this.selector = selector;
    this.useCacheIfPresent = useCacheIfPresent;
    setUseCacheIfPresentIsSet(true);
    this.start = start;
    setStartIsSet(true);
    this.fetch = fetch;
    setFetchIsSet(true);
    this.minimumNumberOfResults = minimumNumberOfResults;
    setMinimumNumberOfResultsIsSet(true);
    this.maxQueryTime = maxQueryTime;
    setMaxQueryTimeIsSet(true);
    this.uuid = uuid;
    this.userContext = userContext;
    this.cacheResult = cacheResult;
    setCacheResultIsSet(true);
    this.startTime = startTime;
    setStartTimeIsSet(true);
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public BlurQuery(BlurQuery other) {
    __isset_bitfield = other.__isset_bitfield;
    if (other.isSetQuery()) {
      this.query = new Query(other.query);
    }
    if (other.isSetFacets()) {
      List<Facet> __this__facets = new ArrayList<Facet>();
      for (Facet other_element : other.facets) {
        __this__facets.add(new Facet(other_element));
      }
      this.facets = __this__facets;
    }
    if (other.isSetSelector()) {
      this.selector = new Selector(other.selector);
    }
    this.useCacheIfPresent = other.useCacheIfPresent;
    this.start = other.start;
    this.fetch = other.fetch;
    this.minimumNumberOfResults = other.minimumNumberOfResults;
    this.maxQueryTime = other.maxQueryTime;
    if (other.isSetUuid()) {
      this.uuid = other.uuid;
    }
    if (other.isSetUserContext()) {
      this.userContext = other.userContext;
    }
    this.cacheResult = other.cacheResult;
    this.startTime = other.startTime;
  }

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

  @Override
  public void clear() {
    this.query = null;
    this.facets = null;
    this.selector = null;
    this.useCacheIfPresent = true;

    this.start = 0L;

    this.fetch = 10;

    this.minimumNumberOfResults = 9223372036854775807L;

    this.maxQueryTime = 9223372036854775807L;

    this.uuid = null;
    this.userContext = null;
    this.cacheResult = true;

    this.startTime = 0L;

  }

  /**
   * The query information.
   */
  public Query getQuery() {
    return this.query;
  }

  /**
   * The query information.
   */
  public BlurQuery setQuery(Query query) {
    this.query = query;
    return this;
  }

  public void unsetQuery() {
    this.query = null;
  }

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

  public void setQueryIsSet(boolean value) {
    if (!value) {
      this.query = null;
    }
  }

  public int getFacetsSize() {
    return (this.facets == null) ? 0 : this.facets.size();
  }

  public java.util.Iterator<Facet> getFacetsIterator() {
    return (this.facets == null) ? null : this.facets.iterator();
  }

  public void addToFacets(Facet elem) {
    if (this.facets == null) {
      this.facets = new ArrayList<Facet>();
    }
    this.facets.add(elem);
  }

  /**
   * A list of Facets to execute with the given query.
   */
  public List<Facet> getFacets() {
    return this.facets;
  }

  /**
   * A list of Facets to execute with the given query.
   */
  public BlurQuery setFacets(List<Facet> facets) {
    this.facets = facets;
    return this;
  }

  public void unsetFacets() {
    this.facets = null;
  }

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

  public void setFacetsIsSet(boolean value) {
    if (!value) {
      this.facets = null;
    }
  }

  /**
   * Selector is used to fetch data in the search results, if null only location ids will be fetched.
   */
  public Selector getSelector() {
    return this.selector;
  }

  /**
   * Selector is used to fetch data in the search results, if null only location ids will be fetched.
   */
  public BlurQuery setSelector(Selector selector) {
    this.selector = selector;
    return this;
  }

  public void unsetSelector() {
    this.selector = null;
  }

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

  public void setSelectorIsSet(boolean value) {
    if (!value) {
      this.selector = null;
    }
  }

  /**
   * Enabled by default to use a cached result if the query matches a previous run query with the
   * configured amount of time.
   */
  public boolean isUseCacheIfPresent() {
    return this.useCacheIfPresent;
  }

  /**
   * Enabled by default to use a cached result if the query matches a previous run query with the
   * configured amount of time.
   */
  public BlurQuery setUseCacheIfPresent(boolean useCacheIfPresent) {
    this.useCacheIfPresent = useCacheIfPresent;
    setUseCacheIfPresentIsSet(true);
    return this;
  }

  public void unsetUseCacheIfPresent() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __USECACHEIFPRESENT_ISSET_ID);
  }

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

  public void setUseCacheIfPresentIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __USECACHEIFPRESENT_ISSET_ID, value);
  }

  /**
   * The starting result position, 0 by default.
   */
  public long getStart() {
    return this.start;
  }

  /**
   * The starting result position, 0 by default.
   */
  public BlurQuery setStart(long start) {
    this.start = start;
    setStartIsSet(true);
    return this;
  }

  public void unsetStart() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __START_ISSET_ID);
  }

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

  public void setStartIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __START_ISSET_ID, value);
  }

  /**
   * The number of fetched results, 10 by default.
   */
  public int getFetch() {
    return this.fetch;
  }

  /**
   * The number of fetched results, 10 by default.
   */
  public BlurQuery setFetch(int fetch) {
    this.fetch = fetch;
    setFetchIsSet(true);
    return this;
  }

  public void unsetFetch() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __FETCH_ISSET_ID);
  }

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

  public void setFetchIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __FETCH_ISSET_ID, value);
  }

  /**
   * The minimum number of results to find before returning.
   */
  public long getMinimumNumberOfResults() {
    return this.minimumNumberOfResults;
  }

  /**
   * The minimum number of results to find before returning.
   */
  public BlurQuery setMinimumNumberOfResults(long minimumNumberOfResults) {
    this.minimumNumberOfResults = minimumNumberOfResults;
    setMinimumNumberOfResultsIsSet(true);
    return this;
  }

  public void unsetMinimumNumberOfResults() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __MINIMUMNUMBEROFRESULTS_ISSET_ID);
  }

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

  public void setMinimumNumberOfResultsIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __MINIMUMNUMBEROFRESULTS_ISSET_ID, value);
  }

  /**
   * The maximum amount of time the query should execute before timing out.
   */
  public long getMaxQueryTime() {
    return this.maxQueryTime;
  }

  /**
   * The maximum amount of time the query should execute before timing out.
   */
  public BlurQuery setMaxQueryTime(long maxQueryTime) {
    this.maxQueryTime = maxQueryTime;
    setMaxQueryTimeIsSet(true);
    return this;
  }

  public void unsetMaxQueryTime() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __MAXQUERYTIME_ISSET_ID);
  }

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

  public void setMaxQueryTimeIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __MAXQUERYTIME_ISSET_ID, value);
  }

  /**
   * Sets the uuid of this query, this is normal set by the client so that the status
   * of a running query can be found or the query can be canceled.
   */
  public String getUuid() {
    return this.uuid;
  }

  /**
   * Sets the uuid of this query, this is normal set by the client so that the status
   * of a running query can be found or the query can be canceled.
   */
  public BlurQuery setUuid(String uuid) {
    this.uuid = uuid;
    return this;
  }

  public void unsetUuid() {
    this.uuid = null;
  }

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

  public void setUuidIsSet(boolean value) {
    if (!value) {
      this.uuid = null;
    }
  }

  /**
   * Sets a user context, only used for logging at this point.
   */
  public String getUserContext() {
    return this.userContext;
  }

  /**
   * Sets a user context, only used for logging at this point.
   */
  public BlurQuery setUserContext(String userContext) {
    this.userContext = userContext;
    return this;
  }

  public void unsetUserContext() {
    this.userContext = null;
  }

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

  public void setUserContextIsSet(boolean value) {
    if (!value) {
      this.userContext = null;
    }
  }

  /**
   * Enabled by default to cache this result.  False would not cache the result.
   */
  public boolean isCacheResult() {
    return this.cacheResult;
  }

  /**
   * Enabled by default to cache this result.  False would not cache the result.
   */
  public BlurQuery setCacheResult(boolean cacheResult) {
    this.cacheResult = cacheResult;
    setCacheResultIsSet(true);
    return this;
  }

  public void unsetCacheResult() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __CACHERESULT_ISSET_ID);
  }

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

  public void setCacheResultIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __CACHERESULT_ISSET_ID, value);
  }

  /**
   * Sets the start time, if 0 the controller sets the time.
   */
  public long getStartTime() {
    return this.startTime;
  }

  /**
   * Sets the start time, if 0 the controller sets the time.
   */
  public BlurQuery setStartTime(long startTime) {
    this.startTime = startTime;
    setStartTimeIsSet(true);
    return this;
  }

  public void unsetStartTime() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __STARTTIME_ISSET_ID);
  }

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

  public void setStartTimeIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __STARTTIME_ISSET_ID, value);
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case QUERY:
      if (value == null) {
        unsetQuery();
      } else {
        setQuery((Query)value);
      }
      break;

    case FACETS:
      if (value == null) {
        unsetFacets();
      } else {
        setFacets((List<Facet>)value);
      }
      break;

    case SELECTOR:
      if (value == null) {
        unsetSelector();
      } else {
        setSelector((Selector)value);
      }
      break;

    case USE_CACHE_IF_PRESENT:
      if (value == null) {
        unsetUseCacheIfPresent();
      } else {
        setUseCacheIfPresent((Boolean)value);
      }
      break;

    case START:
      if (value == null) {
        unsetStart();
      } else {
        setStart((Long)value);
      }
      break;

    case FETCH:
      if (value == null) {
        unsetFetch();
      } else {
        setFetch((Integer)value);
      }
      break;

    case MINIMUM_NUMBER_OF_RESULTS:
      if (value == null) {
        unsetMinimumNumberOfResults();
      } else {
        setMinimumNumberOfResults((Long)value);
      }
      break;

    case MAX_QUERY_TIME:
      if (value == null) {
        unsetMaxQueryTime();
      } else {
        setMaxQueryTime((Long)value);
      }
      break;

    case UUID:
      if (value == null) {
        unsetUuid();
      } else {
        setUuid((String)value);
      }
      break;

    case USER_CONTEXT:
      if (value == null) {
        unsetUserContext();
      } else {
        setUserContext((String)value);
      }
      break;

    case CACHE_RESULT:
      if (value == null) {
        unsetCacheResult();
      } else {
        setCacheResult((Boolean)value);
      }
      break;

    case START_TIME:
      if (value == null) {
        unsetStartTime();
      } else {
        setStartTime((Long)value);
      }
      break;

    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case QUERY:
      return getQuery();

    case FACETS:
      return getFacets();

    case SELECTOR:
      return getSelector();

    case USE_CACHE_IF_PRESENT:
      return Boolean.valueOf(isUseCacheIfPresent());

    case START:
      return Long.valueOf(getStart());

    case FETCH:
      return Integer.valueOf(getFetch());

    case MINIMUM_NUMBER_OF_RESULTS:
      return Long.valueOf(getMinimumNumberOfResults());

    case MAX_QUERY_TIME:
      return Long.valueOf(getMaxQueryTime());

    case UUID:
      return getUuid();

    case USER_CONTEXT:
      return getUserContext();

    case CACHE_RESULT:
      return Boolean.valueOf(isCacheResult());

    case START_TIME:
      return Long.valueOf(getStartTime());

    }
    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 QUERY:
      return isSetQuery();
    case FACETS:
      return isSetFacets();
    case SELECTOR:
      return isSetSelector();
    case USE_CACHE_IF_PRESENT:
      return isSetUseCacheIfPresent();
    case START:
      return isSetStart();
    case FETCH:
      return isSetFetch();
    case MINIMUM_NUMBER_OF_RESULTS:
      return isSetMinimumNumberOfResults();
    case MAX_QUERY_TIME:
      return isSetMaxQueryTime();
    case UUID:
      return isSetUuid();
    case USER_CONTEXT:
      return isSetUserContext();
    case CACHE_RESULT:
      return isSetCacheResult();
    case START_TIME:
      return isSetStartTime();
    }
    throw new IllegalStateException();
  }

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

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

    boolean this_present_query = true && this.isSetQuery();
    boolean that_present_query = true && that.isSetQuery();
    if (this_present_query || that_present_query) {
      if (!(this_present_query && that_present_query))
        return false;
      if (!this.query.equals(that.query))
        return false;
    }

    boolean this_present_facets = true && this.isSetFacets();
    boolean that_present_facets = true && that.isSetFacets();
    if (this_present_facets || that_present_facets) {
      if (!(this_present_facets && that_present_facets))
        return false;
      if (!this.facets.equals(that.facets))
        return false;
    }

    boolean this_present_selector = true && this.isSetSelector();
    boolean that_present_selector = true && that.isSetSelector();
    if (this_present_selector || that_present_selector) {
      if (!(this_present_selector && that_present_selector))
        return false;
      if (!this.selector.equals(that.selector))
        return false;
    }

    boolean this_present_useCacheIfPresent = true;
    boolean that_present_useCacheIfPresent = true;
    if (this_present_useCacheIfPresent || that_present_useCacheIfPresent) {
      if (!(this_present_useCacheIfPresent && that_present_useCacheIfPresent))
        return false;
      if (this.useCacheIfPresent != that.useCacheIfPresent)
        return false;
    }

    boolean this_present_start = true;
    boolean that_present_start = true;
    if (this_present_start || that_present_start) {
      if (!(this_present_start && that_present_start))
        return false;
      if (this.start != that.start)
        return false;
    }

    boolean this_present_fetch = true;
    boolean that_present_fetch = true;
    if (this_present_fetch || that_present_fetch) {
      if (!(this_present_fetch && that_present_fetch))
        return false;
      if (this.fetch != that.fetch)
        return false;
    }

    boolean this_present_minimumNumberOfResults = true;
    boolean that_present_minimumNumberOfResults = true;
    if (this_present_minimumNumberOfResults || that_present_minimumNumberOfResults) {
      if (!(this_present_minimumNumberOfResults && that_present_minimumNumberOfResults))
        return false;
      if (this.minimumNumberOfResults != that.minimumNumberOfResults)
        return false;
    }

    boolean this_present_maxQueryTime = true;
    boolean that_present_maxQueryTime = true;
    if (this_present_maxQueryTime || that_present_maxQueryTime) {
      if (!(this_present_maxQueryTime && that_present_maxQueryTime))
        return false;
      if (this.maxQueryTime != that.maxQueryTime)
        return false;
    }

    boolean this_present_uuid = true && this.isSetUuid();
    boolean that_present_uuid = true && that.isSetUuid();
    if (this_present_uuid || that_present_uuid) {
      if (!(this_present_uuid && that_present_uuid))
        return false;
      if (!this.uuid.equals(that.uuid))
        return false;
    }

    boolean this_present_userContext = true && this.isSetUserContext();
    boolean that_present_userContext = true && that.isSetUserContext();
    if (this_present_userContext || that_present_userContext) {
      if (!(this_present_userContext && that_present_userContext))
        return false;
      if (!this.userContext.equals(that.userContext))
        return false;
    }

    boolean this_present_cacheResult = true;
    boolean that_present_cacheResult = true;
    if (this_present_cacheResult || that_present_cacheResult) {
      if (!(this_present_cacheResult && that_present_cacheResult))
        return false;
      if (this.cacheResult != that.cacheResult)
        return false;
    }

    boolean this_present_startTime = true;
    boolean that_present_startTime = true;
    if (this_present_startTime || that_present_startTime) {
      if (!(this_present_startTime && that_present_startTime))
        return false;
      if (this.startTime != that.startTime)
        return false;
    }

    return true;
  }

  @Override
  public int hashCode() {
    return 0;
  }

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

    int lastComparison = 0;
    BlurQuery typedOther = (BlurQuery)other;

    lastComparison = Boolean.valueOf(isSetQuery()).compareTo(typedOther.isSetQuery());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetQuery()) {
      lastComparison = org.apache.blur.thirdparty.thrift_0_9_0.TBaseHelper.compareTo(this.query, typedOther.query);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetFacets()).compareTo(typedOther.isSetFacets());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetFacets()) {
      lastComparison = org.apache.blur.thirdparty.thrift_0_9_0.TBaseHelper.compareTo(this.facets, typedOther.facets);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetSelector()).compareTo(typedOther.isSetSelector());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetSelector()) {
      lastComparison = org.apache.blur.thirdparty.thrift_0_9_0.TBaseHelper.compareTo(this.selector, typedOther.selector);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetUseCacheIfPresent()).compareTo(typedOther.isSetUseCacheIfPresent());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetUseCacheIfPresent()) {
      lastComparison = org.apache.blur.thirdparty.thrift_0_9_0.TBaseHelper.compareTo(this.useCacheIfPresent, typedOther.useCacheIfPresent);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetStart()).compareTo(typedOther.isSetStart());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetStart()) {
      lastComparison = org.apache.blur.thirdparty.thrift_0_9_0.TBaseHelper.compareTo(this.start, typedOther.start);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetFetch()).compareTo(typedOther.isSetFetch());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetFetch()) {
      lastComparison = org.apache.blur.thirdparty.thrift_0_9_0.TBaseHelper.compareTo(this.fetch, typedOther.fetch);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetMinimumNumberOfResults()).compareTo(typedOther.isSetMinimumNumberOfResults());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetMinimumNumberOfResults()) {
      lastComparison = org.apache.blur.thirdparty.thrift_0_9_0.TBaseHelper.compareTo(this.minimumNumberOfResults, typedOther.minimumNumberOfResults);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetMaxQueryTime()).compareTo(typedOther.isSetMaxQueryTime());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetMaxQueryTime()) {
      lastComparison = org.apache.blur.thirdparty.thrift_0_9_0.TBaseHelper.compareTo(this.maxQueryTime, typedOther.maxQueryTime);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetUuid()).compareTo(typedOther.isSetUuid());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetUuid()) {
      lastComparison = org.apache.blur.thirdparty.thrift_0_9_0.TBaseHelper.compareTo(this.uuid, typedOther.uuid);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetUserContext()).compareTo(typedOther.isSetUserContext());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetUserContext()) {
      lastComparison = org.apache.blur.thirdparty.thrift_0_9_0.TBaseHelper.compareTo(this.userContext, typedOther.userContext);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetCacheResult()).compareTo(typedOther.isSetCacheResult());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetCacheResult()) {
      lastComparison = org.apache.blur.thirdparty.thrift_0_9_0.TBaseHelper.compareTo(this.cacheResult, typedOther.cacheResult);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetStartTime()).compareTo(typedOther.isSetStartTime());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetStartTime()) {
      lastComparison = org.apache.blur.thirdparty.thrift_0_9_0.TBaseHelper.compareTo(this.startTime, typedOther.startTime);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }

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

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

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

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

    sb.append("query:");
    if (this.query == null) {
      sb.append("null");
    } else {
      sb.append(this.query);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("facets:");
    if (this.facets == null) {
      sb.append("null");
    } else {
      sb.append(this.facets);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("selector:");
    if (this.selector == null) {
      sb.append("null");
    } else {
      sb.append(this.selector);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("useCacheIfPresent:");
    sb.append(this.useCacheIfPresent);
    first = false;
    if (!first) sb.append(", ");
    sb.append("start:");
    sb.append(this.start);
    first = false;
    if (!first) sb.append(", ");
    sb.append("fetch:");
    sb.append(this.fetch);
    first = false;
    if (!first) sb.append(", ");
    sb.append("minimumNumberOfResults:");
    sb.append(this.minimumNumberOfResults);
    first = false;
    if (!first) sb.append(", ");
    sb.append("maxQueryTime:");
    sb.append(this.maxQueryTime);
    first = false;
    if (!first) sb.append(", ");
    sb.append("uuid:");
    if (this.uuid == null) {
      sb.append("null");
    } else {
      sb.append(this.uuid);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("userContext:");
    if (this.userContext == null) {
      sb.append("null");
    } else {
      sb.append(this.userContext);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("cacheResult:");
    sb.append(this.cacheResult);
    first = false;
    if (!first) sb.append(", ");
    sb.append("startTime:");
    sb.append(this.startTime);
    first = false;
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.blur.thirdparty.thrift_0_9_0.TException {
    // check for required fields
    // check for sub-struct validity
    if (query != null) {
      query.validate();
    }
    if (selector != null) {
      selector.validate();
    }
  }

  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
    try {
      write(new org.apache.blur.thirdparty.thrift_0_9_0.protocol.TCompactProtocol(new org.apache.blur.thirdparty.thrift_0_9_0.transport.TIOStreamTransport(out)));
    } catch (org.apache.blur.thirdparty.thrift_0_9_0.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.blur.thirdparty.thrift_0_9_0.protocol.TCompactProtocol(new org.apache.blur.thirdparty.thrift_0_9_0.transport.TIOStreamTransport(in)));
    } catch (org.apache.blur.thirdparty.thrift_0_9_0.TException te) {
      throw new java.io.IOException(te);
    }
  }

  private static class BlurQueryStandardSchemeFactory implements SchemeFactory {
    public BlurQueryStandardScheme getScheme() {
      return new BlurQueryStandardScheme();
    }
  }

  private static class BlurQueryStandardScheme extends StandardScheme<BlurQuery> {

    public void read(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocol iprot, BlurQuery struct) throws org.apache.blur.thirdparty.thrift_0_9_0.TException {
      org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField schemeField;
      iprot.readStructBegin();
      while (true)
      {
        schemeField = iprot.readFieldBegin();
        if (schemeField.type == org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STOP) {
          break;
        }
        switch (schemeField.id) {
          case 1: // QUERY
            if (schemeField.type == org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRUCT) {
              struct.query = new Query();
              struct.query.read(iprot);
              struct.setQueryIsSet(true);
            } else {
              org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // FACETS
            if (schemeField.type == org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.LIST) {
              {
                org.apache.blur.thirdparty.thrift_0_9_0.protocol.TList _list42 = iprot.readListBegin();
                struct.facets = new ArrayList<Facet>(_list42.size);
                for (int _i43 = 0; _i43 < _list42.size; ++_i43)
                {
                  Facet _elem44; // required
                  _elem44 = new Facet();
                  _elem44.read(iprot);
                  struct.facets.add(_elem44);
                }
                iprot.readListEnd();
              }
              struct.setFacetsIsSet(true);
            } else {
              org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // SELECTOR
            if (schemeField.type == org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRUCT) {
              struct.selector = new Selector();
              struct.selector.read(iprot);
              struct.setSelectorIsSet(true);
            } else {
              org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 6: // USE_CACHE_IF_PRESENT
            if (schemeField.type == org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.BOOL) {
              struct.useCacheIfPresent = iprot.readBool();
              struct.setUseCacheIfPresentIsSet(true);
            } else {
              org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 7: // START
            if (schemeField.type == org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.I64) {
              struct.start = iprot.readI64();
              struct.setStartIsSet(true);
            } else {
              org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 8: // FETCH
            if (schemeField.type == org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.I32) {
              struct.fetch = iprot.readI32();
              struct.setFetchIsSet(true);
            } else {
              org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 9: // MINIMUM_NUMBER_OF_RESULTS
            if (schemeField.type == org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.I64) {
              struct.minimumNumberOfResults = iprot.readI64();
              struct.setMinimumNumberOfResultsIsSet(true);
            } else {
              org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 10: // MAX_QUERY_TIME
            if (schemeField.type == org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.I64) {
              struct.maxQueryTime = iprot.readI64();
              struct.setMaxQueryTimeIsSet(true);
            } else {
              org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 11: // UUID
            if (schemeField.type == org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRING) {
              struct.uuid = iprot.readString();
              struct.setUuidIsSet(true);
            } else {
              org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 12: // USER_CONTEXT
            if (schemeField.type == org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRING) {
              struct.userContext = iprot.readString();
              struct.setUserContextIsSet(true);
            } else {
              org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 13: // CACHE_RESULT
            if (schemeField.type == org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.BOOL) {
              struct.cacheResult = iprot.readBool();
              struct.setCacheResultIsSet(true);
            } else {
              org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 14: // START_TIME
            if (schemeField.type == org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.I64) {
              struct.startTime = iprot.readI64();
              struct.setStartTimeIsSet(true);
            } else {
              org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          default:
            org.apache.blur.thirdparty.thrift_0_9_0.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.blur.thirdparty.thrift_0_9_0.protocol.TProtocol oprot, BlurQuery struct) throws org.apache.blur.thirdparty.thrift_0_9_0.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.query != null) {
        oprot.writeFieldBegin(QUERY_FIELD_DESC);
        struct.query.write(oprot);
        oprot.writeFieldEnd();
      }
      if (struct.facets != null) {
        oprot.writeFieldBegin(FACETS_FIELD_DESC);
        {
          oprot.writeListBegin(new org.apache.blur.thirdparty.thrift_0_9_0.protocol.TList(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRUCT, struct.facets.size()));
          for (Facet _iter45 : struct.facets)
          {
            _iter45.write(oprot);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      }
      if (struct.selector != null) {
        oprot.writeFieldBegin(SELECTOR_FIELD_DESC);
        struct.selector.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldBegin(USE_CACHE_IF_PRESENT_FIELD_DESC);
      oprot.writeBool(struct.useCacheIfPresent);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(START_FIELD_DESC);
      oprot.writeI64(struct.start);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(FETCH_FIELD_DESC);
      oprot.writeI32(struct.fetch);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(MINIMUM_NUMBER_OF_RESULTS_FIELD_DESC);
      oprot.writeI64(struct.minimumNumberOfResults);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(MAX_QUERY_TIME_FIELD_DESC);
      oprot.writeI64(struct.maxQueryTime);
      oprot.writeFieldEnd();
      if (struct.uuid != null) {
        oprot.writeFieldBegin(UUID_FIELD_DESC);
        oprot.writeString(struct.uuid);
        oprot.writeFieldEnd();
      }
      if (struct.userContext != null) {
        oprot.writeFieldBegin(USER_CONTEXT_FIELD_DESC);
        oprot.writeString(struct.userContext);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldBegin(CACHE_RESULT_FIELD_DESC);
      oprot.writeBool(struct.cacheResult);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(START_TIME_FIELD_DESC);
      oprot.writeI64(struct.startTime);
      oprot.writeFieldEnd();
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class BlurQueryTupleSchemeFactory implements SchemeFactory {
    public BlurQueryTupleScheme getScheme() {
      return new BlurQueryTupleScheme();
    }
  }

  private static class BlurQueryTupleScheme extends TupleScheme<BlurQuery> {

    @Override
    public void write(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocol prot, BlurQuery struct) throws org.apache.blur.thirdparty.thrift_0_9_0.TException {
      TTupleProtocol oprot = (TTupleProtocol) prot;
      BitSet optionals = new BitSet();
      if (struct.isSetQuery()) {
        optionals.set(0);
      }
      if (struct.isSetFacets()) {
        optionals.set(1);
      }
      if (struct.isSetSelector()) {
        optionals.set(2);
      }
      if (struct.isSetUseCacheIfPresent()) {
        optionals.set(3);
      }
      if (struct.isSetStart()) {
        optionals.set(4);
      }
      if (struct.isSetFetch()) {
        optionals.set(5);
      }
      if (struct.isSetMinimumNumberOfResults()) {
        optionals.set(6);
      }
      if (struct.isSetMaxQueryTime()) {
        optionals.set(7);
      }
      if (struct.isSetUuid()) {
        optionals.set(8);
      }
      if (struct.isSetUserContext()) {
        optionals.set(9);
      }
      if (struct.isSetCacheResult()) {
        optionals.set(10);
      }
      if (struct.isSetStartTime()) {
        optionals.set(11);
      }
      oprot.writeBitSet(optionals, 12);
      if (struct.isSetQuery()) {
        struct.query.write(oprot);
      }
      if (struct.isSetFacets()) {
        {
          oprot.writeI32(struct.facets.size());
          for (Facet _iter46 : struct.facets)
          {
            _iter46.write(oprot);
          }
        }
      }
      if (struct.isSetSelector()) {
        struct.selector.write(oprot);
      }
      if (struct.isSetUseCacheIfPresent()) {
        oprot.writeBool(struct.useCacheIfPresent);
      }
      if (struct.isSetStart()) {
        oprot.writeI64(struct.start);
      }
      if (struct.isSetFetch()) {
        oprot.writeI32(struct.fetch);
      }
      if (struct.isSetMinimumNumberOfResults()) {
        oprot.writeI64(struct.minimumNumberOfResults);
      }
      if (struct.isSetMaxQueryTime()) {
        oprot.writeI64(struct.maxQueryTime);
      }
      if (struct.isSetUuid()) {
        oprot.writeString(struct.uuid);
      }
      if (struct.isSetUserContext()) {
        oprot.writeString(struct.userContext);
      }
      if (struct.isSetCacheResult()) {
        oprot.writeBool(struct.cacheResult);
      }
      if (struct.isSetStartTime()) {
        oprot.writeI64(struct.startTime);
      }
    }

    @Override
    public void read(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocol prot, BlurQuery struct) throws org.apache.blur.thirdparty.thrift_0_9_0.TException {
      TTupleProtocol iprot = (TTupleProtocol) prot;
      BitSet incoming = iprot.readBitSet(12);
      if (incoming.get(0)) {
        struct.query = new Query();
        struct.query.read(iprot);
        struct.setQueryIsSet(true);
      }
      if (incoming.get(1)) {
        {
          org.apache.blur.thirdparty.thrift_0_9_0.protocol.TList _list47 = new org.apache.blur.thirdparty.thrift_0_9_0.protocol.TList(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRUCT, iprot.readI32());
          struct.facets = new ArrayList<Facet>(_list47.size);
          for (int _i48 = 0; _i48 < _list47.size; ++_i48)
          {
            Facet _elem49; // required
            _elem49 = new Facet();
            _elem49.read(iprot);
            struct.facets.add(_elem49);
          }
        }
        struct.setFacetsIsSet(true);
      }
      if (incoming.get(2)) {
        struct.selector = new Selector();
        struct.selector.read(iprot);
        struct.setSelectorIsSet(true);
      }
      if (incoming.get(3)) {
        struct.useCacheIfPresent = iprot.readBool();
        struct.setUseCacheIfPresentIsSet(true);
      }
      if (incoming.get(4)) {
        struct.start = iprot.readI64();
        struct.setStartIsSet(true);
      }
      if (incoming.get(5)) {
        struct.fetch = iprot.readI32();
        struct.setFetchIsSet(true);
      }
      if (incoming.get(6)) {
        struct.minimumNumberOfResults = iprot.readI64();
        struct.setMinimumNumberOfResultsIsSet(true);
      }
      if (incoming.get(7)) {
        struct.maxQueryTime = iprot.readI64();
        struct.setMaxQueryTimeIsSet(true);
      }
      if (incoming.get(8)) {
        struct.uuid = iprot.readString();
        struct.setUuidIsSet(true);
      }
      if (incoming.get(9)) {
        struct.userContext = iprot.readString();
        struct.setUserContextIsSet(true);
      }
      if (incoming.get(10)) {
        struct.cacheResult = iprot.readBool();
        struct.setCacheResultIsSet(true);
      }
      if (incoming.get(11)) {
        struct.startTime = iprot.readI64();
        struct.setStartTimeIsSet(true);
      }
    }
  }

}
TOP

Related Classes of org.apache.blur.thrift.generated.BlurQuery$BlurQueryTupleSchemeFactory

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.