/** * 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; /** * BlurResults holds all information resulting from a query. */ public class BlurResults implements org.apache.blur.thirdparty.thrift_0_9_0.TBase<BlurResults, BlurResults._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("BlurResults"); private static final org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField TOTAL_RESULTS_FIELD_DESC = new org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField("totalResults", org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.I64, (short)1); private static final org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField SHARD_INFO_FIELD_DESC = new org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField("shardInfo", org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.MAP, (short)2); private static final org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField RESULTS_FIELD_DESC = new org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField("results", 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 FACET_COUNTS_FIELD_DESC = new org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField("facetCounts", org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.LIST, (short)4); private static final org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField EXCEPTIONS_FIELD_DESC = new org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField("exceptions", org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.LIST, (short)5); 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)6); private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); static { schemes.put(StandardScheme.class, new BlurResultsStandardSchemeFactory()); schemes.put(TupleScheme.class, new BlurResultsTupleSchemeFactory()); } /** * The total number of hits in the query. */ public long totalResults; // required /** * Hit counts from each shard in the table. */ public Map<String,Long> shardInfo; // required /** * The query results. */ public List<BlurResult> results; // required /** * The faceted count. */ public List<Long> facetCounts; // required /** * Not currently used, a future feature could allow for partial results with errors. */ public List<BlurException> exceptions; // required /** * The original query. */ public BlurQuery query; // 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 total number of hits in the query. */ TOTAL_RESULTS((short)1, "totalResults"), /** * Hit counts from each shard in the table. */ SHARD_INFO((short)2, "shardInfo"), /** * The query results. */ RESULTS((short)3, "results"), /** * The faceted count. */ FACET_COUNTS((short)4, "facetCounts"), /** * Not currently used, a future feature could allow for partial results with errors. */ EXCEPTIONS((short)5, "exceptions"), /** * The original query. */ QUERY((short)6, "query"); 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: // TOTAL_RESULTS return TOTAL_RESULTS; case 2: // SHARD_INFO return SHARD_INFO; case 3: // RESULTS return RESULTS; case 4: // FACET_COUNTS return FACET_COUNTS; case 5: // EXCEPTIONS return EXCEPTIONS; case 6: // QUERY return QUERY; 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 __TOTALRESULTS_ISSET_ID = 0; 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.TOTAL_RESULTS, new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldMetaData("totalResults", 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.SHARD_INFO, new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldMetaData("shardInfo", org.apache.blur.thirdparty.thrift_0_9_0.TFieldRequirementType.DEFAULT, new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.MapMetaData(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.MAP, new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldValueMetaData(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRING), 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.RESULTS, new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldMetaData("results", 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, BlurResult.class)))); tmpMap.put(_Fields.FACET_COUNTS, new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldMetaData("facetCounts", 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.FieldValueMetaData(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.I64)))); tmpMap.put(_Fields.EXCEPTIONS, new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldMetaData("exceptions", 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.FieldValueMetaData(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRUCT)))); 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, BlurQuery.class))); metaDataMap = Collections.unmodifiableMap(tmpMap); org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldMetaData.addStructMetaDataMap(BlurResults.class, metaDataMap); } public BlurResults() { this.totalResults = 0L; } public BlurResults( long totalResults, Map<String,Long> shardInfo, List<BlurResult> results, List<Long> facetCounts, List<BlurException> exceptions, BlurQuery query) { this(); this.totalResults = totalResults; setTotalResultsIsSet(true); this.shardInfo = shardInfo; this.results = results; this.facetCounts = facetCounts; this.exceptions = exceptions; this.query = query; } /** * Performs a deep copy on <i>other</i>. */ public BlurResults(BlurResults other) { __isset_bitfield = other.__isset_bitfield; this.totalResults = other.totalResults; if (other.isSetShardInfo()) { Map<String,Long> __this__shardInfo = new HashMap<String,Long>(); for (Map.Entry<String, Long> other_element : other.shardInfo.entrySet()) { String other_element_key = other_element.getKey(); Long other_element_value = other_element.getValue(); String __this__shardInfo_copy_key = other_element_key; Long __this__shardInfo_copy_value = other_element_value; __this__shardInfo.put(__this__shardInfo_copy_key, __this__shardInfo_copy_value); } this.shardInfo = __this__shardInfo; } if (other.isSetResults()) { List<BlurResult> __this__results = new ArrayList<BlurResult>(); for (BlurResult other_element : other.results) { __this__results.add(new BlurResult(other_element)); } this.results = __this__results; } if (other.isSetFacetCounts()) { List<Long> __this__facetCounts = new ArrayList<Long>(); for (Long other_element : other.facetCounts) { __this__facetCounts.add(other_element); } this.facetCounts = __this__facetCounts; } if (other.isSetExceptions()) { List<BlurException> __this__exceptions = new ArrayList<BlurException>(); for (BlurException other_element : other.exceptions) { __this__exceptions.add(new BlurException(other_element)); } this.exceptions = __this__exceptions; } if (other.isSetQuery()) { this.query = new BlurQuery(other.query); } } public BlurResults deepCopy() { return new BlurResults(this); } @Override public void clear() { this.totalResults = 0L; this.shardInfo = null; this.results = null; this.facetCounts = null; this.exceptions = null; this.query = null; } /** * The total number of hits in the query. */ public long getTotalResults() { return this.totalResults; } /** * The total number of hits in the query. */ public BlurResults setTotalResults(long totalResults) { this.totalResults = totalResults; setTotalResultsIsSet(true); return this; } public void unsetTotalResults() { __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __TOTALRESULTS_ISSET_ID); } /** Returns true if field totalResults is set (has been assigned a value) and false otherwise */ public boolean isSetTotalResults() { return EncodingUtils.testBit(__isset_bitfield, __TOTALRESULTS_ISSET_ID); } public void setTotalResultsIsSet(boolean value) { __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __TOTALRESULTS_ISSET_ID, value); } public int getShardInfoSize() { return (this.shardInfo == null) ? 0 : this.shardInfo.size(); } public void putToShardInfo(String key, long val) { if (this.shardInfo == null) { this.shardInfo = new HashMap<String,Long>(); } this.shardInfo.put(key, val); } /** * Hit counts from each shard in the table. */ public Map<String,Long> getShardInfo() { return this.shardInfo; } /** * Hit counts from each shard in the table. */ public BlurResults setShardInfo(Map<String,Long> shardInfo) { this.shardInfo = shardInfo; return this; } public void unsetShardInfo() { this.shardInfo = null; } /** Returns true if field shardInfo is set (has been assigned a value) and false otherwise */ public boolean isSetShardInfo() { return this.shardInfo != null; } public void setShardInfoIsSet(boolean value) { if (!value) { this.shardInfo = null; } } public int getResultsSize() { return (this.results == null) ? 0 : this.results.size(); } public java.util.Iterator<BlurResult> getResultsIterator() { return (this.results == null) ? null : this.results.iterator(); } public void addToResults(BlurResult elem) { if (this.results == null) { this.results = new ArrayList<BlurResult>(); } this.results.add(elem); } /** * The query results. */ public List<BlurResult> getResults() { return this.results; } /** * The query results. */ public BlurResults setResults(List<BlurResult> results) { this.results = results; return this; } public void unsetResults() { this.results = null; } /** Returns true if field results is set (has been assigned a value) and false otherwise */ public boolean isSetResults() { return this.results != null; } public void setResultsIsSet(boolean value) { if (!value) { this.results = null; } } public int getFacetCountsSize() { return (this.facetCounts == null) ? 0 : this.facetCounts.size(); } public java.util.Iterator<Long> getFacetCountsIterator() { return (this.facetCounts == null) ? null : this.facetCounts.iterator(); } public void addToFacetCounts(long elem) { if (this.facetCounts == null) { this.facetCounts = new ArrayList<Long>(); } this.facetCounts.add(elem); } /** * The faceted count. */ public List<Long> getFacetCounts() { return this.facetCounts; } /** * The faceted count. */ public BlurResults setFacetCounts(List<Long> facetCounts) { this.facetCounts = facetCounts; return this; } public void unsetFacetCounts() { this.facetCounts = null; } /** Returns true if field facetCounts is set (has been assigned a value) and false otherwise */ public boolean isSetFacetCounts() { return this.facetCounts != null; } public void setFacetCountsIsSet(boolean value) { if (!value) { this.facetCounts = null; } } public int getExceptionsSize() { return (this.exceptions == null) ? 0 : this.exceptions.size(); } public java.util.Iterator<BlurException> getExceptionsIterator() { return (this.exceptions == null) ? null : this.exceptions.iterator(); } public void addToExceptions(BlurException elem) { if (this.exceptions == null) { this.exceptions = new ArrayList<BlurException>(); } this.exceptions.add(elem); } /** * Not currently used, a future feature could allow for partial results with errors. */ public List<BlurException> getExceptions() { return this.exceptions; } /** * Not currently used, a future feature could allow for partial results with errors. */ public BlurResults setExceptions(List<BlurException> exceptions) { this.exceptions = exceptions; return this; } public void unsetExceptions() { this.exceptions = null; } /** Returns true if field exceptions is set (has been assigned a value) and false otherwise */ public boolean isSetExceptions() { return this.exceptions != null; } public void setExceptionsIsSet(boolean value) { if (!value) { this.exceptions = null; } } /** * The original query. */ public BlurQuery getQuery() { return this.query; } /** * The original query. */ public BlurResults setQuery(BlurQuery 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 void setFieldValue(_Fields field, Object value) { switch (field) { case TOTAL_RESULTS: if (value == null) { unsetTotalResults(); } else { setTotalResults((Long)value); } break; case SHARD_INFO: if (value == null) { unsetShardInfo(); } else { setShardInfo((Map<String,Long>)value); } break; case RESULTS: if (value == null) { unsetResults(); } else { setResults((List<BlurResult>)value); } break; case FACET_COUNTS: if (value == null) { unsetFacetCounts(); } else { setFacetCounts((List<Long>)value); } break; case EXCEPTIONS: if (value == null) { unsetExceptions(); } else { setExceptions((List<BlurException>)value); } break; case QUERY: if (value == null) { unsetQuery(); } else { setQuery((BlurQuery)value); } break; } } public Object getFieldValue(_Fields field) { switch (field) { case TOTAL_RESULTS: return Long.valueOf(getTotalResults()); case SHARD_INFO: return getShardInfo(); case RESULTS: return getResults(); case FACET_COUNTS: return getFacetCounts(); case EXCEPTIONS: return getExceptions(); case QUERY: return getQuery(); } 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 TOTAL_RESULTS: return isSetTotalResults(); case SHARD_INFO: return isSetShardInfo(); case RESULTS: return isSetResults(); case FACET_COUNTS: return isSetFacetCounts(); case EXCEPTIONS: return isSetExceptions(); case QUERY: return isSetQuery(); } throw new IllegalStateException(); } @Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof BlurResults) return this.equals((BlurResults)that); return false; } public boolean equals(BlurResults that) { if (that == null) return false; boolean this_present_totalResults = true; boolean that_present_totalResults = true; if (this_present_totalResults || that_present_totalResults) { if (!(this_present_totalResults && that_present_totalResults)) return false; if (this.totalResults != that.totalResults) return false; } boolean this_present_shardInfo = true && this.isSetShardInfo(); boolean that_present_shardInfo = true && that.isSetShardInfo(); if (this_present_shardInfo || that_present_shardInfo) { if (!(this_present_shardInfo && that_present_shardInfo)) return false; if (!this.shardInfo.equals(that.shardInfo)) return false; } boolean this_present_results = true && this.isSetResults(); boolean that_present_results = true && that.isSetResults(); if (this_present_results || that_present_results) { if (!(this_present_results && that_present_results)) return false; if (!this.results.equals(that.results)) return false; } boolean this_present_facetCounts = true && this.isSetFacetCounts(); boolean that_present_facetCounts = true && that.isSetFacetCounts(); if (this_present_facetCounts || that_present_facetCounts) { if (!(this_present_facetCounts && that_present_facetCounts)) return false; if (!this.facetCounts.equals(that.facetCounts)) return false; } boolean this_present_exceptions = true && this.isSetExceptions(); boolean that_present_exceptions = true && that.isSetExceptions(); if (this_present_exceptions || that_present_exceptions) { if (!(this_present_exceptions && that_present_exceptions)) return false; if (!this.exceptions.equals(that.exceptions)) 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; } return true; } @Override public int hashCode() { return 0; } public int compareTo(BlurResults other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; BlurResults typedOther = (BlurResults)other; lastComparison = Boolean.valueOf(isSetTotalResults()).compareTo(typedOther.isSetTotalResults()); if (lastComparison != 0) { return lastComparison; } if (isSetTotalResults()) { lastComparison = org.apache.blur.thirdparty.thrift_0_9_0.TBaseHelper.compareTo(this.totalResults, typedOther.totalResults); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetShardInfo()).compareTo(typedOther.isSetShardInfo()); if (lastComparison != 0) { return lastComparison; } if (isSetShardInfo()) { lastComparison = org.apache.blur.thirdparty.thrift_0_9_0.TBaseHelper.compareTo(this.shardInfo, typedOther.shardInfo); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetResults()).compareTo(typedOther.isSetResults()); if (lastComparison != 0) { return lastComparison; } if (isSetResults()) { lastComparison = org.apache.blur.thirdparty.thrift_0_9_0.TBaseHelper.compareTo(this.results, typedOther.results); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetFacetCounts()).compareTo(typedOther.isSetFacetCounts()); if (lastComparison != 0) { return lastComparison; } if (isSetFacetCounts()) { lastComparison = org.apache.blur.thirdparty.thrift_0_9_0.TBaseHelper.compareTo(this.facetCounts, typedOther.facetCounts); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetExceptions()).compareTo(typedOther.isSetExceptions()); if (lastComparison != 0) { return lastComparison; } if (isSetExceptions()) { lastComparison = org.apache.blur.thirdparty.thrift_0_9_0.TBaseHelper.compareTo(this.exceptions, typedOther.exceptions); if (lastComparison != 0) { return lastComparison; } } 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; } } 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("BlurResults("); boolean first = true; sb.append("totalResults:"); sb.append(this.totalResults); first = false; if (!first) sb.append(", "); sb.append("shardInfo:"); if (this.shardInfo == null) { sb.append("null"); } else { sb.append(this.shardInfo); } first = false; if (!first) sb.append(", "); sb.append("results:"); if (this.results == null) { sb.append("null"); } else { sb.append(this.results); } first = false; if (!first) sb.append(", "); sb.append("facetCounts:"); if (this.facetCounts == null) { sb.append("null"); } else { sb.append(this.facetCounts); } first = false; if (!first) sb.append(", "); sb.append("exceptions:"); if (this.exceptions == null) { sb.append("null"); } else { sb.append(this.exceptions); } first = false; if (!first) sb.append(", "); sb.append("query:"); if (this.query == null) { sb.append("null"); } else { sb.append(this.query); } 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(); } } 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 BlurResultsStandardSchemeFactory implements SchemeFactory { public BlurResultsStandardScheme getScheme() { return new BlurResultsStandardScheme(); } } private static class BlurResultsStandardScheme extends StandardScheme<BlurResults> { public void read(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocol iprot, BlurResults 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: // TOTAL_RESULTS if (schemeField.type == org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.I64) { struct.totalResults = iprot.readI64(); struct.setTotalResultsIsSet(true); } else { org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 2: // SHARD_INFO if (schemeField.type == org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.MAP) { { org.apache.blur.thirdparty.thrift_0_9_0.protocol.TMap _map84 = iprot.readMapBegin(); struct.shardInfo = new HashMap<String,Long>(2*_map84.size); for (int _i85 = 0; _i85 < _map84.size; ++_i85) { String _key86; // required long _val87; // required _key86 = iprot.readString(); _val87 = iprot.readI64(); struct.shardInfo.put(_key86, _val87); } iprot.readMapEnd(); } struct.setShardInfoIsSet(true); } else { org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 3: // RESULTS if (schemeField.type == org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.LIST) { { org.apache.blur.thirdparty.thrift_0_9_0.protocol.TList _list88 = iprot.readListBegin(); struct.results = new ArrayList<BlurResult>(_list88.size); for (int _i89 = 0; _i89 < _list88.size; ++_i89) { BlurResult _elem90; // required _elem90 = new BlurResult(); _elem90.read(iprot); struct.results.add(_elem90); } iprot.readListEnd(); } struct.setResultsIsSet(true); } else { org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 4: // FACET_COUNTS if (schemeField.type == org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.LIST) { { org.apache.blur.thirdparty.thrift_0_9_0.protocol.TList _list91 = iprot.readListBegin(); struct.facetCounts = new ArrayList<Long>(_list91.size); for (int _i92 = 0; _i92 < _list91.size; ++_i92) { long _elem93; // required _elem93 = iprot.readI64(); struct.facetCounts.add(_elem93); } iprot.readListEnd(); } struct.setFacetCountsIsSet(true); } else { org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 5: // EXCEPTIONS if (schemeField.type == org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.LIST) { { org.apache.blur.thirdparty.thrift_0_9_0.protocol.TList _list94 = iprot.readListBegin(); struct.exceptions = new ArrayList<BlurException>(_list94.size); for (int _i95 = 0; _i95 < _list94.size; ++_i95) { BlurException _elem96; // required _elem96 = new BlurException(); _elem96.read(iprot); struct.exceptions.add(_elem96); } iprot.readListEnd(); } struct.setExceptionsIsSet(true); } else { org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 6: // QUERY if (schemeField.type == org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRUCT) { struct.query = new BlurQuery(); struct.query.read(iprot); struct.setQueryIsSet(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, BlurResults struct) throws org.apache.blur.thirdparty.thrift_0_9_0.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); oprot.writeFieldBegin(TOTAL_RESULTS_FIELD_DESC); oprot.writeI64(struct.totalResults); oprot.writeFieldEnd(); if (struct.shardInfo != null) { oprot.writeFieldBegin(SHARD_INFO_FIELD_DESC); { oprot.writeMapBegin(new org.apache.blur.thirdparty.thrift_0_9_0.protocol.TMap(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRING, org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.I64, struct.shardInfo.size())); for (Map.Entry<String, Long> _iter97 : struct.shardInfo.entrySet()) { oprot.writeString(_iter97.getKey()); oprot.writeI64(_iter97.getValue()); } oprot.writeMapEnd(); } oprot.writeFieldEnd(); } if (struct.results != null) { oprot.writeFieldBegin(RESULTS_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.results.size())); for (BlurResult _iter98 : struct.results) { _iter98.write(oprot); } oprot.writeListEnd(); } oprot.writeFieldEnd(); } if (struct.facetCounts != null) { oprot.writeFieldBegin(FACET_COUNTS_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.I64, struct.facetCounts.size())); for (long _iter99 : struct.facetCounts) { oprot.writeI64(_iter99); } oprot.writeListEnd(); } oprot.writeFieldEnd(); } if (struct.exceptions != null) { oprot.writeFieldBegin(EXCEPTIONS_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.exceptions.size())); for (BlurException _iter100 : struct.exceptions) { _iter100.write(oprot); } oprot.writeListEnd(); } oprot.writeFieldEnd(); } if (struct.query != null) { oprot.writeFieldBegin(QUERY_FIELD_DESC); struct.query.write(oprot); oprot.writeFieldEnd(); } oprot.writeFieldStop(); oprot.writeStructEnd(); } } private static class BlurResultsTupleSchemeFactory implements SchemeFactory { public BlurResultsTupleScheme getScheme() { return new BlurResultsTupleScheme(); } } private static class BlurResultsTupleScheme extends TupleScheme<BlurResults> { @Override public void write(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocol prot, BlurResults struct) throws org.apache.blur.thirdparty.thrift_0_9_0.TException { TTupleProtocol oprot = (TTupleProtocol) prot; BitSet optionals = new BitSet(); if (struct.isSetTotalResults()) { optionals.set(0); } if (struct.isSetShardInfo()) { optionals.set(1); } if (struct.isSetResults()) { optionals.set(2); } if (struct.isSetFacetCounts()) { optionals.set(3); } if (struct.isSetExceptions()) { optionals.set(4); } if (struct.isSetQuery()) { optionals.set(5); } oprot.writeBitSet(optionals, 6); if (struct.isSetTotalResults()) { oprot.writeI64(struct.totalResults); } if (struct.isSetShardInfo()) { { oprot.writeI32(struct.shardInfo.size()); for (Map.Entry<String, Long> _iter101 : struct.shardInfo.entrySet()) { oprot.writeString(_iter101.getKey()); oprot.writeI64(_iter101.getValue()); } } } if (struct.isSetResults()) { { oprot.writeI32(struct.results.size()); for (BlurResult _iter102 : struct.results) { _iter102.write(oprot); } } } if (struct.isSetFacetCounts()) { { oprot.writeI32(struct.facetCounts.size()); for (long _iter103 : struct.facetCounts) { oprot.writeI64(_iter103); } } } if (struct.isSetExceptions()) { { oprot.writeI32(struct.exceptions.size()); for (BlurException _iter104 : struct.exceptions) { _iter104.write(oprot); } } } if (struct.isSetQuery()) { struct.query.write(oprot); } } @Override public void read(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocol prot, BlurResults struct) throws org.apache.blur.thirdparty.thrift_0_9_0.TException { TTupleProtocol iprot = (TTupleProtocol) prot; BitSet incoming = iprot.readBitSet(6); if (incoming.get(0)) { struct.totalResults = iprot.readI64(); struct.setTotalResultsIsSet(true); } if (incoming.get(1)) { { org.apache.blur.thirdparty.thrift_0_9_0.protocol.TMap _map105 = new org.apache.blur.thirdparty.thrift_0_9_0.protocol.TMap(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRING, org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.I64, iprot.readI32()); struct.shardInfo = new HashMap<String,Long>(2*_map105.size); for (int _i106 = 0; _i106 < _map105.size; ++_i106) { String _key107; // required long _val108; // required _key107 = iprot.readString(); _val108 = iprot.readI64(); struct.shardInfo.put(_key107, _val108); } } struct.setShardInfoIsSet(true); } if (incoming.get(2)) { { org.apache.blur.thirdparty.thrift_0_9_0.protocol.TList _list109 = 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.results = new ArrayList<BlurResult>(_list109.size); for (int _i110 = 0; _i110 < _list109.size; ++_i110) { BlurResult _elem111; // required _elem111 = new BlurResult(); _elem111.read(iprot); struct.results.add(_elem111); } } struct.setResultsIsSet(true); } if (incoming.get(3)) { { org.apache.blur.thirdparty.thrift_0_9_0.protocol.TList _list112 = new org.apache.blur.thirdparty.thrift_0_9_0.protocol.TList(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.I64, iprot.readI32()); struct.facetCounts = new ArrayList<Long>(_list112.size); for (int _i113 = 0; _i113 < _list112.size; ++_i113) { long _elem114; // required _elem114 = iprot.readI64(); struct.facetCounts.add(_elem114); } } struct.setFacetCountsIsSet(true); } if (incoming.get(4)) { { org.apache.blur.thirdparty.thrift_0_9_0.protocol.TList _list115 = 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.exceptions = new ArrayList<BlurException>(_list115.size); for (int _i116 = 0; _i116 < _list115.size; ++_i116) { BlurException _elem117; // required _elem117 = new BlurException(); _elem117.read(iprot); struct.exceptions.add(_elem117); } } struct.setExceptionsIsSet(true); } if (incoming.get(5)) { struct.query = new BlurQuery(); struct.query.read(iprot); struct.setQueryIsSet(true); } } } }