http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/11f5141c/src/blur-thrift/src/main/java/org/apache/blur/thrift/generated/DocumentGroup.java ---------------------------------------------------------------------- diff --git a/src/blur-thrift/src/main/java/org/apache/blur/thrift/generated/DocumentGroup.java b/src/blur-thrift/src/main/java/org/apache/blur/thrift/generated/DocumentGroup.java new file mode 100644 index 0000000..20b4c22 --- /dev/null +++ b/src/blur-thrift/src/main/java/org/apache/blur/thrift/generated/DocumentGroup.java @@ -0,0 +1,664 @@ +/** + * 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.thrift.scheme.IScheme; +import org.apache.thrift.scheme.SchemeFactory; +import org.apache.thrift.scheme.StandardScheme; + +import org.apache.thrift.scheme.TupleScheme; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.protocol.TProtocolException; +import org.apache.thrift.EncodingUtils; +import org.apache.thrift.TException; +import java.util.List; +import java.util.ArrayList; +import java.util.Map; +import java.util.HashMap; +import java.util.EnumMap; +import java.util.Set; +import java.util.HashSet; +import java.util.EnumSet; +import java.util.Collections; +import java.util.BitSet; +import java.nio.ByteBuffer; +import java.util.Arrays; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class DocumentGroup implements org.apache.thrift.TBase<DocumentGroup, DocumentGroup._Fields>, java.io.Serializable, Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("DocumentGroup"); + + private static final org.apache.thrift.protocol.TField ID_FIELD_DESC = new org.apache.thrift.protocol.TField("id", org.apache.thrift.protocol.TType.STRING, (short)1); + private static final org.apache.thrift.protocol.TField PRIME_DOC_FIELD_DESC = new org.apache.thrift.protocol.TField("primeDoc", org.apache.thrift.protocol.TType.STRUCT, (short)2); + private static final org.apache.thrift.protocol.TField DOCUMENTS_FIELD_DESC = new org.apache.thrift.protocol.TField("documents", org.apache.thrift.protocol.TType.LIST, (short)3); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new DocumentGroupStandardSchemeFactory()); + schemes.put(TupleScheme.class, new DocumentGroupTupleSchemeFactory()); + } + + public String id; // required + public DocumentRecord primeDoc; // required + public List<DocumentRecord> documents; // required + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ID((short)1, "id"), + PRIME_DOC((short)2, "primeDoc"), + DOCUMENTS((short)3, "documents"); + + 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: // ID + return ID; + case 2: // PRIME_DOC + return PRIME_DOC; + case 3: // DOCUMENTS + return DOCUMENTS; + 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 + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.ID, new org.apache.thrift.meta_data.FieldMetaData("id", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.PRIME_DOC, new org.apache.thrift.meta_data.FieldMetaData("primeDoc", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, DocumentRecord.class))); + tmpMap.put(_Fields.DOCUMENTS, new org.apache.thrift.meta_data.FieldMetaData("documents", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, DocumentRecord.class)))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(DocumentGroup.class, metaDataMap); + } + + public DocumentGroup() { + } + + public DocumentGroup( + String id, + DocumentRecord primeDoc, + List<DocumentRecord> documents) + { + this(); + this.id = id; + this.primeDoc = primeDoc; + this.documents = documents; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public DocumentGroup(DocumentGroup other) { + if (other.isSetId()) { + this.id = other.id; + } + if (other.isSetPrimeDoc()) { + this.primeDoc = new DocumentRecord(other.primeDoc); + } + if (other.isSetDocuments()) { + List<DocumentRecord> __this__documents = new ArrayList<DocumentRecord>(); + for (DocumentRecord other_element : other.documents) { + __this__documents.add(new DocumentRecord(other_element)); + } + this.documents = __this__documents; + } + } + + public DocumentGroup deepCopy() { + return new DocumentGroup(this); + } + + @Override + public void clear() { + this.id = null; + this.primeDoc = null; + this.documents = null; + } + + public String getId() { + return this.id; + } + + public DocumentGroup setId(String id) { + this.id = id; + return this; + } + + public void unsetId() { + this.id = null; + } + + /** Returns true if field id is set (has been assigned a value) and false otherwise */ + public boolean isSetId() { + return this.id != null; + } + + public void setIdIsSet(boolean value) { + if (!value) { + this.id = null; + } + } + + public DocumentRecord getPrimeDoc() { + return this.primeDoc; + } + + public DocumentGroup setPrimeDoc(DocumentRecord primeDoc) { + this.primeDoc = primeDoc; + return this; + } + + public void unsetPrimeDoc() { + this.primeDoc = null; + } + + /** Returns true if field primeDoc is set (has been assigned a value) and false otherwise */ + public boolean isSetPrimeDoc() { + return this.primeDoc != null; + } + + public void setPrimeDocIsSet(boolean value) { + if (!value) { + this.primeDoc = null; + } + } + + public int getDocumentsSize() { + return (this.documents == null) ? 0 : this.documents.size(); + } + + public java.util.Iterator<DocumentRecord> getDocumentsIterator() { + return (this.documents == null) ? null : this.documents.iterator(); + } + + public void addToDocuments(DocumentRecord elem) { + if (this.documents == null) { + this.documents = new ArrayList<DocumentRecord>(); + } + this.documents.add(elem); + } + + public List<DocumentRecord> getDocuments() { + return this.documents; + } + + public DocumentGroup setDocuments(List<DocumentRecord> documents) { + this.documents = documents; + return this; + } + + public void unsetDocuments() { + this.documents = null; + } + + /** Returns true if field documents is set (has been assigned a value) and false otherwise */ + public boolean isSetDocuments() { + return this.documents != null; + } + + public void setDocumentsIsSet(boolean value) { + if (!value) { + this.documents = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case ID: + if (value == null) { + unsetId(); + } else { + setId((String)value); + } + break; + + case PRIME_DOC: + if (value == null) { + unsetPrimeDoc(); + } else { + setPrimeDoc((DocumentRecord)value); + } + break; + + case DOCUMENTS: + if (value == null) { + unsetDocuments(); + } else { + setDocuments((List<DocumentRecord>)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case ID: + return getId(); + + case PRIME_DOC: + return getPrimeDoc(); + + case DOCUMENTS: + return getDocuments(); + + } + 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 ID: + return isSetId(); + case PRIME_DOC: + return isSetPrimeDoc(); + case DOCUMENTS: + return isSetDocuments(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof DocumentGroup) + return this.equals((DocumentGroup)that); + return false; + } + + public boolean equals(DocumentGroup that) { + if (that == null) + return false; + + boolean this_present_id = true && this.isSetId(); + boolean that_present_id = true && that.isSetId(); + if (this_present_id || that_present_id) { + if (!(this_present_id && that_present_id)) + return false; + if (!this.id.equals(that.id)) + return false; + } + + boolean this_present_primeDoc = true && this.isSetPrimeDoc(); + boolean that_present_primeDoc = true && that.isSetPrimeDoc(); + if (this_present_primeDoc || that_present_primeDoc) { + if (!(this_present_primeDoc && that_present_primeDoc)) + return false; + if (!this.primeDoc.equals(that.primeDoc)) + return false; + } + + boolean this_present_documents = true && this.isSetDocuments(); + boolean that_present_documents = true && that.isSetDocuments(); + if (this_present_documents || that_present_documents) { + if (!(this_present_documents && that_present_documents)) + return false; + if (!this.documents.equals(that.documents)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(DocumentGroup other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + DocumentGroup typedOther = (DocumentGroup)other; + + lastComparison = Boolean.valueOf(isSetId()).compareTo(typedOther.isSetId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.id, typedOther.id); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetPrimeDoc()).compareTo(typedOther.isSetPrimeDoc()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetPrimeDoc()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.primeDoc, typedOther.primeDoc); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetDocuments()).compareTo(typedOther.isSetDocuments()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDocuments()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.documents, typedOther.documents); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("DocumentGroup("); + boolean first = true; + + sb.append("id:"); + if (this.id == null) { + sb.append("null"); + } else { + sb.append(this.id); + } + first = false; + if (!first) sb.append(", "); + sb.append("primeDoc:"); + if (this.primeDoc == null) { + sb.append("null"); + } else { + sb.append(this.primeDoc); + } + first = false; + if (!first) sb.append(", "); + sb.append("documents:"); + if (this.documents == null) { + sb.append("null"); + } else { + sb.append(this.documents); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + if (primeDoc != null) { + primeDoc.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + try { + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class DocumentGroupStandardSchemeFactory implements SchemeFactory { + public DocumentGroupStandardScheme getScheme() { + return new DocumentGroupStandardScheme(); + } + } + + private static class DocumentGroupStandardScheme extends StandardScheme<DocumentGroup> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, DocumentGroup struct) throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) + { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.id = iprot.readString(); + struct.setIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // PRIME_DOC + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.primeDoc = new DocumentRecord(); + struct.primeDoc.read(iprot); + struct.setPrimeDocIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 3: // DOCUMENTS + if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { + { + org.apache.thrift.protocol.TList _list16 = iprot.readListBegin(); + struct.documents = new ArrayList<DocumentRecord>(_list16.size); + for (int _i17 = 0; _i17 < _list16.size; ++_i17) + { + DocumentRecord _elem18; // required + _elem18 = new DocumentRecord(); + _elem18.read(iprot); + struct.documents.add(_elem18); + } + iprot.readListEnd(); + } + struct.setDocumentsIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, DocumentGroup struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.id != null) { + oprot.writeFieldBegin(ID_FIELD_DESC); + oprot.writeString(struct.id); + oprot.writeFieldEnd(); + } + if (struct.primeDoc != null) { + oprot.writeFieldBegin(PRIME_DOC_FIELD_DESC); + struct.primeDoc.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.documents != null) { + oprot.writeFieldBegin(DOCUMENTS_FIELD_DESC); + { + oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.documents.size())); + for (DocumentRecord _iter19 : struct.documents) + { + _iter19.write(oprot); + } + oprot.writeListEnd(); + } + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class DocumentGroupTupleSchemeFactory implements SchemeFactory { + public DocumentGroupTupleScheme getScheme() { + return new DocumentGroupTupleScheme(); + } + } + + private static class DocumentGroupTupleScheme extends TupleScheme<DocumentGroup> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, DocumentGroup struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetId()) { + optionals.set(0); + } + if (struct.isSetPrimeDoc()) { + optionals.set(1); + } + if (struct.isSetDocuments()) { + optionals.set(2); + } + oprot.writeBitSet(optionals, 3); + if (struct.isSetId()) { + oprot.writeString(struct.id); + } + if (struct.isSetPrimeDoc()) { + struct.primeDoc.write(oprot); + } + if (struct.isSetDocuments()) { + { + oprot.writeI32(struct.documents.size()); + for (DocumentRecord _iter20 : struct.documents) + { + _iter20.write(oprot); + } + } + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, DocumentGroup struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(3); + if (incoming.get(0)) { + struct.id = iprot.readString(); + struct.setIdIsSet(true); + } + if (incoming.get(1)) { + struct.primeDoc = new DocumentRecord(); + struct.primeDoc.read(iprot); + struct.setPrimeDocIsSet(true); + } + if (incoming.get(2)) { + { + org.apache.thrift.protocol.TList _list21 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.documents = new ArrayList<DocumentRecord>(_list21.size); + for (int _i22 = 0; _i22 < _list21.size; ++_i22) + { + DocumentRecord _elem23; // required + _elem23 = new DocumentRecord(); + _elem23.read(iprot); + struct.documents.add(_elem23); + } + } + struct.setDocumentsIsSet(true); + } + } + } + +} +
http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/11f5141c/src/blur-thrift/src/main/java/org/apache/blur/thrift/generated/DocumentGroupResult.java ---------------------------------------------------------------------- diff --git a/src/blur-thrift/src/main/java/org/apache/blur/thrift/generated/DocumentGroupResult.java b/src/blur-thrift/src/main/java/org/apache/blur/thrift/generated/DocumentGroupResult.java new file mode 100644 index 0000000..12ad68e --- /dev/null +++ b/src/blur-thrift/src/main/java/org/apache/blur/thrift/generated/DocumentGroupResult.java @@ -0,0 +1,709 @@ +/** + * 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.thrift.scheme.IScheme; +import org.apache.thrift.scheme.SchemeFactory; +import org.apache.thrift.scheme.StandardScheme; + +import org.apache.thrift.scheme.TupleScheme; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.protocol.TProtocolException; +import org.apache.thrift.EncodingUtils; +import org.apache.thrift.TException; +import java.util.List; +import java.util.ArrayList; +import java.util.Map; +import java.util.HashMap; +import java.util.EnumMap; +import java.util.Set; +import java.util.HashSet; +import java.util.EnumSet; +import java.util.Collections; +import java.util.BitSet; +import java.nio.ByteBuffer; +import java.util.Arrays; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class DocumentGroupResult implements org.apache.thrift.TBase<DocumentGroupResult, DocumentGroupResult._Fields>, java.io.Serializable, Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("DocumentGroupResult"); + + private static final org.apache.thrift.protocol.TField TOTAL_HITS_FIELD_DESC = new org.apache.thrift.protocol.TField("totalHits", org.apache.thrift.protocol.TType.I64, (short)1); + private static final org.apache.thrift.protocol.TField DOCUMENTS_FIELD_DESC = new org.apache.thrift.protocol.TField("documents", org.apache.thrift.protocol.TType.LIST, (short)2); + private static final org.apache.thrift.protocol.TField SCORES_FIELD_DESC = new org.apache.thrift.protocol.TField("scores", org.apache.thrift.protocol.TType.LIST, (short)3); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new DocumentGroupResultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new DocumentGroupResultTupleSchemeFactory()); + } + + public long totalHits; // required + public List<DocumentGroup> documents; // required + public List<Double> scores; // required + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + TOTAL_HITS((short)1, "totalHits"), + DOCUMENTS((short)2, "documents"), + SCORES((short)3, "scores"); + + 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_HITS + return TOTAL_HITS; + case 2: // DOCUMENTS + return DOCUMENTS; + case 3: // SCORES + return SCORES; + 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 __TOTALHITS_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.TOTAL_HITS, new org.apache.thrift.meta_data.FieldMetaData("totalHits", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); + tmpMap.put(_Fields.DOCUMENTS, new org.apache.thrift.meta_data.FieldMetaData("documents", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, DocumentGroup.class)))); + tmpMap.put(_Fields.SCORES, new org.apache.thrift.meta_data.FieldMetaData("scores", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE)))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(DocumentGroupResult.class, metaDataMap); + } + + public DocumentGroupResult() { + } + + public DocumentGroupResult( + long totalHits, + List<DocumentGroup> documents, + List<Double> scores) + { + this(); + this.totalHits = totalHits; + setTotalHitsIsSet(true); + this.documents = documents; + this.scores = scores; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public DocumentGroupResult(DocumentGroupResult other) { + __isset_bitfield = other.__isset_bitfield; + this.totalHits = other.totalHits; + if (other.isSetDocuments()) { + List<DocumentGroup> __this__documents = new ArrayList<DocumentGroup>(); + for (DocumentGroup other_element : other.documents) { + __this__documents.add(new DocumentGroup(other_element)); + } + this.documents = __this__documents; + } + if (other.isSetScores()) { + List<Double> __this__scores = new ArrayList<Double>(); + for (Double other_element : other.scores) { + __this__scores.add(other_element); + } + this.scores = __this__scores; + } + } + + public DocumentGroupResult deepCopy() { + return new DocumentGroupResult(this); + } + + @Override + public void clear() { + setTotalHitsIsSet(false); + this.totalHits = 0; + this.documents = null; + this.scores = null; + } + + public long getTotalHits() { + return this.totalHits; + } + + public DocumentGroupResult setTotalHits(long totalHits) { + this.totalHits = totalHits; + setTotalHitsIsSet(true); + return this; + } + + public void unsetTotalHits() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __TOTALHITS_ISSET_ID); + } + + /** Returns true if field totalHits is set (has been assigned a value) and false otherwise */ + public boolean isSetTotalHits() { + return EncodingUtils.testBit(__isset_bitfield, __TOTALHITS_ISSET_ID); + } + + public void setTotalHitsIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __TOTALHITS_ISSET_ID, value); + } + + public int getDocumentsSize() { + return (this.documents == null) ? 0 : this.documents.size(); + } + + public java.util.Iterator<DocumentGroup> getDocumentsIterator() { + return (this.documents == null) ? null : this.documents.iterator(); + } + + public void addToDocuments(DocumentGroup elem) { + if (this.documents == null) { + this.documents = new ArrayList<DocumentGroup>(); + } + this.documents.add(elem); + } + + public List<DocumentGroup> getDocuments() { + return this.documents; + } + + public DocumentGroupResult setDocuments(List<DocumentGroup> documents) { + this.documents = documents; + return this; + } + + public void unsetDocuments() { + this.documents = null; + } + + /** Returns true if field documents is set (has been assigned a value) and false otherwise */ + public boolean isSetDocuments() { + return this.documents != null; + } + + public void setDocumentsIsSet(boolean value) { + if (!value) { + this.documents = null; + } + } + + public int getScoresSize() { + return (this.scores == null) ? 0 : this.scores.size(); + } + + public java.util.Iterator<Double> getScoresIterator() { + return (this.scores == null) ? null : this.scores.iterator(); + } + + public void addToScores(double elem) { + if (this.scores == null) { + this.scores = new ArrayList<Double>(); + } + this.scores.add(elem); + } + + public List<Double> getScores() { + return this.scores; + } + + public DocumentGroupResult setScores(List<Double> scores) { + this.scores = scores; + return this; + } + + public void unsetScores() { + this.scores = null; + } + + /** Returns true if field scores is set (has been assigned a value) and false otherwise */ + public boolean isSetScores() { + return this.scores != null; + } + + public void setScoresIsSet(boolean value) { + if (!value) { + this.scores = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case TOTAL_HITS: + if (value == null) { + unsetTotalHits(); + } else { + setTotalHits((Long)value); + } + break; + + case DOCUMENTS: + if (value == null) { + unsetDocuments(); + } else { + setDocuments((List<DocumentGroup>)value); + } + break; + + case SCORES: + if (value == null) { + unsetScores(); + } else { + setScores((List<Double>)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case TOTAL_HITS: + return Long.valueOf(getTotalHits()); + + case DOCUMENTS: + return getDocuments(); + + case SCORES: + return getScores(); + + } + 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_HITS: + return isSetTotalHits(); + case DOCUMENTS: + return isSetDocuments(); + case SCORES: + return isSetScores(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof DocumentGroupResult) + return this.equals((DocumentGroupResult)that); + return false; + } + + public boolean equals(DocumentGroupResult that) { + if (that == null) + return false; + + boolean this_present_totalHits = true; + boolean that_present_totalHits = true; + if (this_present_totalHits || that_present_totalHits) { + if (!(this_present_totalHits && that_present_totalHits)) + return false; + if (this.totalHits != that.totalHits) + return false; + } + + boolean this_present_documents = true && this.isSetDocuments(); + boolean that_present_documents = true && that.isSetDocuments(); + if (this_present_documents || that_present_documents) { + if (!(this_present_documents && that_present_documents)) + return false; + if (!this.documents.equals(that.documents)) + return false; + } + + boolean this_present_scores = true && this.isSetScores(); + boolean that_present_scores = true && that.isSetScores(); + if (this_present_scores || that_present_scores) { + if (!(this_present_scores && that_present_scores)) + return false; + if (!this.scores.equals(that.scores)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(DocumentGroupResult other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + DocumentGroupResult typedOther = (DocumentGroupResult)other; + + lastComparison = Boolean.valueOf(isSetTotalHits()).compareTo(typedOther.isSetTotalHits()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetTotalHits()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.totalHits, typedOther.totalHits); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetDocuments()).compareTo(typedOther.isSetDocuments()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDocuments()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.documents, typedOther.documents); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetScores()).compareTo(typedOther.isSetScores()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetScores()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.scores, typedOther.scores); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("DocumentGroupResult("); + boolean first = true; + + sb.append("totalHits:"); + sb.append(this.totalHits); + first = false; + if (!first) sb.append(", "); + sb.append("documents:"); + if (this.documents == null) { + sb.append("null"); + } else { + sb.append(this.documents); + } + first = false; + if (!first) sb.append(", "); + sb.append("scores:"); + if (this.scores == null) { + sb.append("null"); + } else { + sb.append(this.scores); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor. + __isset_bitfield = 0; + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class DocumentGroupResultStandardSchemeFactory implements SchemeFactory { + public DocumentGroupResultStandardScheme getScheme() { + return new DocumentGroupResultStandardScheme(); + } + } + + private static class DocumentGroupResultStandardScheme extends StandardScheme<DocumentGroupResult> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, DocumentGroupResult struct) throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) + { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // TOTAL_HITS + if (schemeField.type == org.apache.thrift.protocol.TType.I64) { + struct.totalHits = iprot.readI64(); + struct.setTotalHitsIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // DOCUMENTS + if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { + { + org.apache.thrift.protocol.TList _list24 = iprot.readListBegin(); + struct.documents = new ArrayList<DocumentGroup>(_list24.size); + for (int _i25 = 0; _i25 < _list24.size; ++_i25) + { + DocumentGroup _elem26; // required + _elem26 = new DocumentGroup(); + _elem26.read(iprot); + struct.documents.add(_elem26); + } + iprot.readListEnd(); + } + struct.setDocumentsIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 3: // SCORES + if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { + { + org.apache.thrift.protocol.TList _list27 = iprot.readListBegin(); + struct.scores = new ArrayList<Double>(_list27.size); + for (int _i28 = 0; _i28 < _list27.size; ++_i28) + { + double _elem29; // required + _elem29 = iprot.readDouble(); + struct.scores.add(_elem29); + } + iprot.readListEnd(); + } + struct.setScoresIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, DocumentGroupResult struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(TOTAL_HITS_FIELD_DESC); + oprot.writeI64(struct.totalHits); + oprot.writeFieldEnd(); + if (struct.documents != null) { + oprot.writeFieldBegin(DOCUMENTS_FIELD_DESC); + { + oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.documents.size())); + for (DocumentGroup _iter30 : struct.documents) + { + _iter30.write(oprot); + } + oprot.writeListEnd(); + } + oprot.writeFieldEnd(); + } + if (struct.scores != null) { + oprot.writeFieldBegin(SCORES_FIELD_DESC); + { + oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.DOUBLE, struct.scores.size())); + for (double _iter31 : struct.scores) + { + oprot.writeDouble(_iter31); + } + oprot.writeListEnd(); + } + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class DocumentGroupResultTupleSchemeFactory implements SchemeFactory { + public DocumentGroupResultTupleScheme getScheme() { + return new DocumentGroupResultTupleScheme(); + } + } + + private static class DocumentGroupResultTupleScheme extends TupleScheme<DocumentGroupResult> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, DocumentGroupResult struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetTotalHits()) { + optionals.set(0); + } + if (struct.isSetDocuments()) { + optionals.set(1); + } + if (struct.isSetScores()) { + optionals.set(2); + } + oprot.writeBitSet(optionals, 3); + if (struct.isSetTotalHits()) { + oprot.writeI64(struct.totalHits); + } + if (struct.isSetDocuments()) { + { + oprot.writeI32(struct.documents.size()); + for (DocumentGroup _iter32 : struct.documents) + { + _iter32.write(oprot); + } + } + } + if (struct.isSetScores()) { + { + oprot.writeI32(struct.scores.size()); + for (double _iter33 : struct.scores) + { + oprot.writeDouble(_iter33); + } + } + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, DocumentGroupResult struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(3); + if (incoming.get(0)) { + struct.totalHits = iprot.readI64(); + struct.setTotalHitsIsSet(true); + } + if (incoming.get(1)) { + { + org.apache.thrift.protocol.TList _list34 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.documents = new ArrayList<DocumentGroup>(_list34.size); + for (int _i35 = 0; _i35 < _list34.size; ++_i35) + { + DocumentGroup _elem36; // required + _elem36 = new DocumentGroup(); + _elem36.read(iprot); + struct.documents.add(_elem36); + } + } + struct.setDocumentsIsSet(true); + } + if (incoming.get(2)) { + { + org.apache.thrift.protocol.TList _list37 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.DOUBLE, iprot.readI32()); + struct.scores = new ArrayList<Double>(_list37.size); + for (int _i38 = 0; _i38 < _list37.size; ++_i38) + { + double _elem39; // required + _elem39 = iprot.readDouble(); + struct.scores.add(_elem39); + } + } + struct.setScoresIsSet(true); + } + } + } + +} +
