incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject [34/39] Massive changes to the thrift RPC defs, see mail list for details subject (Rows, Records, Session oh my).
Date Thu, 28 Feb 2013 03:07:37 GMT
http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/11f5141c/src/blur-thrift/src/main/java/org/apache/blur/thrift/generated/DocumentRecord.java
----------------------------------------------------------------------
diff --git a/src/blur-thrift/src/main/java/org/apache/blur/thrift/generated/DocumentRecord.java
b/src/blur-thrift/src/main/java/org/apache/blur/thrift/generated/DocumentRecord.java
new file mode 100644
index 0000000..4db5d2a
--- /dev/null
+++ b/src/blur-thrift/src/main/java/org/apache/blur/thrift/generated/DocumentRecord.java
@@ -0,0 +1,510 @@
+/**
+ * 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 DocumentRecord implements org.apache.thrift.TBase<DocumentRecord, DocumentRecord._Fields>,
java.io.Serializable, Cloneable {
+  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("DocumentRecord");
+
+  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 DOCUMENT_FIELD_DESC = new org.apache.thrift.protocol.TField("document",
org.apache.thrift.protocol.TType.STRUCT, (short)2);
+
+  private static final Map<Class<? extends IScheme>, SchemeFactory> schemes =
new HashMap<Class<? extends IScheme>, SchemeFactory>();
+  static {
+    schemes.put(StandardScheme.class, new DocumentRecordStandardSchemeFactory());
+    schemes.put(TupleScheme.class, new DocumentRecordTupleSchemeFactory());
+  }
+
+  public String id; // required
+  public org.apache.blur.thrift.generated.Document document; // 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"),
+    DOCUMENT((short)2, "document");
+
+    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: // DOCUMENT
+          return DOCUMENT;
+        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.DOCUMENT, new org.apache.thrift.meta_data.FieldMetaData("document",
org.apache.thrift.TFieldRequirementType.DEFAULT, 
+        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT,
org.apache.blur.thrift.generated.Document.class)));
+    metaDataMap = Collections.unmodifiableMap(tmpMap);
+    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(DocumentRecord.class,
metaDataMap);
+  }
+
+  public DocumentRecord() {
+  }
+
+  public DocumentRecord(
+    String id,
+    org.apache.blur.thrift.generated.Document document)
+  {
+    this();
+    this.id = id;
+    this.document = document;
+  }
+
+  /**
+   * Performs a deep copy on <i>other</i>.
+   */
+  public DocumentRecord(DocumentRecord other) {
+    if (other.isSetId()) {
+      this.id = other.id;
+    }
+    if (other.isSetDocument()) {
+      this.document = new org.apache.blur.thrift.generated.Document(other.document);
+    }
+  }
+
+  public DocumentRecord deepCopy() {
+    return new DocumentRecord(this);
+  }
+
+  @Override
+  public void clear() {
+    this.id = null;
+    this.document = null;
+  }
+
+  public String getId() {
+    return this.id;
+  }
+
+  public DocumentRecord 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 org.apache.blur.thrift.generated.Document getDocument() {
+    return this.document;
+  }
+
+  public DocumentRecord setDocument(org.apache.blur.thrift.generated.Document document) {
+    this.document = document;
+    return this;
+  }
+
+  public void unsetDocument() {
+    this.document = null;
+  }
+
+  /** Returns true if field document is set (has been assigned a value) and false otherwise
*/
+  public boolean isSetDocument() {
+    return this.document != null;
+  }
+
+  public void setDocumentIsSet(boolean value) {
+    if (!value) {
+      this.document = null;
+    }
+  }
+
+  public void setFieldValue(_Fields field, Object value) {
+    switch (field) {
+    case ID:
+      if (value == null) {
+        unsetId();
+      } else {
+        setId((String)value);
+      }
+      break;
+
+    case DOCUMENT:
+      if (value == null) {
+        unsetDocument();
+      } else {
+        setDocument((org.apache.blur.thrift.generated.Document)value);
+      }
+      break;
+
+    }
+  }
+
+  public Object getFieldValue(_Fields field) {
+    switch (field) {
+    case ID:
+      return getId();
+
+    case DOCUMENT:
+      return getDocument();
+
+    }
+    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 DOCUMENT:
+      return isSetDocument();
+    }
+    throw new IllegalStateException();
+  }
+
+  @Override
+  public boolean equals(Object that) {
+    if (that == null)
+      return false;
+    if (that instanceof DocumentRecord)
+      return this.equals((DocumentRecord)that);
+    return false;
+  }
+
+  public boolean equals(DocumentRecord 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_document = true && this.isSetDocument();
+    boolean that_present_document = true && that.isSetDocument();
+    if (this_present_document || that_present_document) {
+      if (!(this_present_document && that_present_document))
+        return false;
+      if (!this.document.equals(that.document))
+        return false;
+    }
+
+    return true;
+  }
+
+  @Override
+  public int hashCode() {
+    return 0;
+  }
+
+  public int compareTo(DocumentRecord other) {
+    if (!getClass().equals(other.getClass())) {
+      return getClass().getName().compareTo(other.getClass().getName());
+    }
+
+    int lastComparison = 0;
+    DocumentRecord typedOther = (DocumentRecord)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(isSetDocument()).compareTo(typedOther.isSetDocument());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetDocument()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.document, typedOther.document);
+      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("DocumentRecord(");
+    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("document:");
+    if (this.document == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.document);
+    }
+    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 (document != null) {
+      document.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 DocumentRecordStandardSchemeFactory implements SchemeFactory {
+    public DocumentRecordStandardScheme getScheme() {
+      return new DocumentRecordStandardScheme();
+    }
+  }
+
+  private static class DocumentRecordStandardScheme extends StandardScheme<DocumentRecord>
{
+
+    public void read(org.apache.thrift.protocol.TProtocol iprot, DocumentRecord 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: // DOCUMENT
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+              struct.document = new org.apache.blur.thrift.generated.Document();
+              struct.document.read(iprot);
+              struct.setDocumentIsSet(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, DocumentRecord 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.document != null) {
+        oprot.writeFieldBegin(DOCUMENT_FIELD_DESC);
+        struct.document.write(oprot);
+        oprot.writeFieldEnd();
+      }
+      oprot.writeFieldStop();
+      oprot.writeStructEnd();
+    }
+
+  }
+
+  private static class DocumentRecordTupleSchemeFactory implements SchemeFactory {
+    public DocumentRecordTupleScheme getScheme() {
+      return new DocumentRecordTupleScheme();
+    }
+  }
+
+  private static class DocumentRecordTupleScheme extends TupleScheme<DocumentRecord>
{
+
+    @Override
+    public void write(org.apache.thrift.protocol.TProtocol prot, DocumentRecord struct) throws
org.apache.thrift.TException {
+      TTupleProtocol oprot = (TTupleProtocol) prot;
+      BitSet optionals = new BitSet();
+      if (struct.isSetId()) {
+        optionals.set(0);
+      }
+      if (struct.isSetDocument()) {
+        optionals.set(1);
+      }
+      oprot.writeBitSet(optionals, 2);
+      if (struct.isSetId()) {
+        oprot.writeString(struct.id);
+      }
+      if (struct.isSetDocument()) {
+        struct.document.write(oprot);
+      }
+    }
+
+    @Override
+    public void read(org.apache.thrift.protocol.TProtocol prot, DocumentRecord struct) throws
org.apache.thrift.TException {
+      TTupleProtocol iprot = (TTupleProtocol) prot;
+      BitSet incoming = iprot.readBitSet(2);
+      if (incoming.get(0)) {
+        struct.id = iprot.readString();
+        struct.setIdIsSet(true);
+      }
+      if (incoming.get(1)) {
+        struct.document = new org.apache.blur.thrift.generated.Document();
+        struct.document.read(iprot);
+        struct.setDocumentIsSet(true);
+      }
+    }
+  }
+
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/11f5141c/src/blur-thrift/src/main/java/org/apache/blur/thrift/generated/DocumentResult.java
----------------------------------------------------------------------
diff --git a/src/blur-thrift/src/main/java/org/apache/blur/thrift/generated/DocumentResult.java
b/src/blur-thrift/src/main/java/org/apache/blur/thrift/generated/DocumentResult.java
new file mode 100644
index 0000000..2f3692f
--- /dev/null
+++ b/src/blur-thrift/src/main/java/org/apache/blur/thrift/generated/DocumentResult.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 DocumentResult implements org.apache.thrift.TBase<DocumentResult, DocumentResult._Fields>,
java.io.Serializable, Cloneable {
+  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("DocumentResult");
+
+  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 DocumentResultStandardSchemeFactory());
+    schemes.put(TupleScheme.class, new DocumentResultTupleSchemeFactory());
+  }
+
+  public long totalHits; // required
+  public List<DocumentRecord> 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,
DocumentRecord.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(DocumentResult.class,
metaDataMap);
+  }
+
+  public DocumentResult() {
+  }
+
+  public DocumentResult(
+    long totalHits,
+    List<DocumentRecord> 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 DocumentResult(DocumentResult other) {
+    __isset_bitfield = other.__isset_bitfield;
+    this.totalHits = other.totalHits;
+    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;
+    }
+    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 DocumentResult deepCopy() {
+    return new DocumentResult(this);
+  }
+
+  @Override
+  public void clear() {
+    setTotalHitsIsSet(false);
+    this.totalHits = 0;
+    this.documents = null;
+    this.scores = null;
+  }
+
+  public long getTotalHits() {
+    return this.totalHits;
+  }
+
+  public DocumentResult 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<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 DocumentResult 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 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 DocumentResult 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<DocumentRecord>)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 DocumentResult)
+      return this.equals((DocumentResult)that);
+    return false;
+  }
+
+  public boolean equals(DocumentResult 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(DocumentResult other) {
+    if (!getClass().equals(other.getClass())) {
+      return getClass().getName().compareTo(other.getClass().getName());
+    }
+
+    int lastComparison = 0;
+    DocumentResult typedOther = (DocumentResult)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("DocumentResult(");
+    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 DocumentResultStandardSchemeFactory implements SchemeFactory {
+    public DocumentResultStandardScheme getScheme() {
+      return new DocumentResultStandardScheme();
+    }
+  }
+
+  private static class DocumentResultStandardScheme extends StandardScheme<DocumentResult>
{
+
+    public void read(org.apache.thrift.protocol.TProtocol iprot, DocumentResult 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 _list0 = iprot.readListBegin();
+                struct.documents = new ArrayList<DocumentRecord>(_list0.size);
+                for (int _i1 = 0; _i1 < _list0.size; ++_i1)
+                {
+                  DocumentRecord _elem2; // required
+                  _elem2 = new DocumentRecord();
+                  _elem2.read(iprot);
+                  struct.documents.add(_elem2);
+                }
+                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 _list3 = iprot.readListBegin();
+                struct.scores = new ArrayList<Double>(_list3.size);
+                for (int _i4 = 0; _i4 < _list3.size; ++_i4)
+                {
+                  double _elem5; // required
+                  _elem5 = iprot.readDouble();
+                  struct.scores.add(_elem5);
+                }
+                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, DocumentResult 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 (DocumentRecord _iter6 : struct.documents)
+          {
+            _iter6.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 _iter7 : struct.scores)
+          {
+            oprot.writeDouble(_iter7);
+          }
+          oprot.writeListEnd();
+        }
+        oprot.writeFieldEnd();
+      }
+      oprot.writeFieldStop();
+      oprot.writeStructEnd();
+    }
+
+  }
+
+  private static class DocumentResultTupleSchemeFactory implements SchemeFactory {
+    public DocumentResultTupleScheme getScheme() {
+      return new DocumentResultTupleScheme();
+    }
+  }
+
+  private static class DocumentResultTupleScheme extends TupleScheme<DocumentResult>
{
+
+    @Override
+    public void write(org.apache.thrift.protocol.TProtocol prot, DocumentResult 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 (DocumentRecord _iter8 : struct.documents)
+          {
+            _iter8.write(oprot);
+          }
+        }
+      }
+      if (struct.isSetScores()) {
+        {
+          oprot.writeI32(struct.scores.size());
+          for (double _iter9 : struct.scores)
+          {
+            oprot.writeDouble(_iter9);
+          }
+        }
+      }
+    }
+
+    @Override
+    public void read(org.apache.thrift.protocol.TProtocol prot, DocumentResult 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 _list10 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT,
iprot.readI32());
+          struct.documents = new ArrayList<DocumentRecord>(_list10.size);
+          for (int _i11 = 0; _i11 < _list10.size; ++_i11)
+          {
+            DocumentRecord _elem12; // required
+            _elem12 = new DocumentRecord();
+            _elem12.read(iprot);
+            struct.documents.add(_elem12);
+          }
+        }
+        struct.setDocumentsIsSet(true);
+      }
+      if (incoming.get(2)) {
+        {
+          org.apache.thrift.protocol.TList _list13 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.DOUBLE,
iprot.readI32());
+          struct.scores = new ArrayList<Double>(_list13.size);
+          for (int _i14 = 0; _i14 < _list13.size; ++_i14)
+          {
+            double _elem15; // required
+            _elem15 = iprot.readDouble();
+            struct.scores.add(_elem15);
+          }
+        }
+        struct.setScoresIsSet(true);
+      }
+    }
+  }
+
+}
+


Mime
View raw message