http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/11f5141c/src/distribution/src/main/scripts/interface/gen-java/org/apache/blur/thrift/generated/DocumentGroupResult.java ---------------------------------------------------------------------- diff --git a/src/distribution/src/main/scripts/interface/gen-java/org/apache/blur/thrift/generated/DocumentGroupResult.java b/src/distribution/src/main/scripts/interface/gen-java/org/apache/blur/thrift/generated/DocumentGroupResult.java new file mode 100644 index 0000000..12ad68e --- /dev/null +++ b/src/distribution/src/main/scripts/interface/gen-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); + } + } + } + +} +
