Ejemplo n.º 1
0
 @Override
 public void read(org.apache.thrift.protocol.TProtocol prot, tokenize_result struct)
     throws org.apache.thrift.TException {
   TTupleProtocol iprot = (TTupleProtocol) prot;
   BitSet incoming = iprot.readBitSet(1);
   if (incoming.get(0)) {
     {
       org.apache.thrift.protocol.TList _list10 =
           new org.apache.thrift.protocol.TList(
               org.apache.thrift.protocol.TType.LIST, iprot.readI32());
       struct.success = new ArrayList<List<String>>(_list10.size);
       for (int _i11 = 0; _i11 < _list10.size; ++_i11) {
         List<String> _elem12;
         {
           org.apache.thrift.protocol.TList _list13 =
               new org.apache.thrift.protocol.TList(
                   org.apache.thrift.protocol.TType.STRING, iprot.readI32());
           _elem12 = new ArrayList<String>(_list13.size);
           for (int _i14 = 0; _i14 < _list13.size; ++_i14) {
             String _elem15;
             _elem15 = iprot.readString();
             _elem12.add(_elem15);
           }
         }
         struct.success.add(_elem12);
       }
     }
     struct.setSuccessIsSet(true);
   }
 }
Ejemplo n.º 2
0
 public List<List<String>> recv_tokenize() throws org.apache.thrift.TException {
   tokenize_result result = new tokenize_result();
   receiveBase(result, "tokenize");
   if (result.isSetSuccess()) {
     return result.success;
   }
   throw new org.apache.thrift.TApplicationException(
       org.apache.thrift.TApplicationException.MISSING_RESULT,
       "tokenize failed: unknown result");
 }
Ejemplo n.º 3
0
      public void write(org.apache.thrift.protocol.TProtocol oprot, tokenize_result struct)
          throws org.apache.thrift.TException {
        struct.validate();

        oprot.writeStructBegin(STRUCT_DESC);
        if (struct.success != null) {
          oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
          {
            oprot.writeListBegin(
                new org.apache.thrift.protocol.TList(
                    org.apache.thrift.protocol.TType.LIST, struct.success.size()));
            for (List<String> _iter6 : struct.success) {
              {
                oprot.writeListBegin(
                    new org.apache.thrift.protocol.TList(
                        org.apache.thrift.protocol.TType.STRING, _iter6.size()));
                for (String _iter7 : _iter6) {
                  oprot.writeString(_iter7);
                }
                oprot.writeListEnd();
              }
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }
Ejemplo n.º 4
0
      public void read(org.apache.thrift.protocol.TProtocol iprot, tokenize_result 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 0: // SUCCESS
              if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
                {
                  org.apache.thrift.protocol.TList _list0 = iprot.readListBegin();
                  struct.success = new ArrayList<List<String>>(_list0.size);
                  for (int _i1 = 0; _i1 < _list0.size; ++_i1) {
                    List<String> _elem2;
                    {
                      org.apache.thrift.protocol.TList _list3 = iprot.readListBegin();
                      _elem2 = new ArrayList<String>(_list3.size);
                      for (int _i4 = 0; _i4 < _list3.size; ++_i4) {
                        String _elem5;
                        _elem5 = iprot.readString();
                        _elem2.add(_elem5);
                      }
                      iprot.readListEnd();
                    }
                    struct.success.add(_elem2);
                  }
                  iprot.readListEnd();
                }
                struct.setSuccessIsSet(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();
      }
Ejemplo n.º 5
0
 /** Performs a deep copy on <i>other</i>. */
 public tokenize_result(tokenize_result other) {
   if (other.isSetSuccess()) {
     List<List<String>> __this__success = new ArrayList<List<String>>(other.success.size());
     for (List<String> other_element : other.success) {
       List<String> __this__success_copy = new ArrayList<String>(other_element);
       __this__success.add(__this__success_copy);
     }
     this.success = __this__success;
   }
 }
Ejemplo n.º 6
0
    @Override
    public int compareTo(tokenize_result other) {
      if (!getClass().equals(other.getClass())) {
        return getClass().getName().compareTo(other.getClass().getName());
      }

      int lastComparison = 0;

      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetSuccess()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      return 0;
    }
Ejemplo n.º 7
0
    public boolean equals(tokenize_result that) {
      if (that == null) return false;

      boolean this_present_success = true && this.isSetSuccess();
      boolean that_present_success = true && that.isSetSuccess();
      if (this_present_success || that_present_success) {
        if (!(this_present_success && that_present_success)) return false;
        if (!this.success.equals(that.success)) return false;
      }

      return true;
    }
Ejemplo n.º 8
0
 @Override
 public void write(org.apache.thrift.protocol.TProtocol prot, tokenize_result struct)
     throws org.apache.thrift.TException {
   TTupleProtocol oprot = (TTupleProtocol) prot;
   BitSet optionals = new BitSet();
   if (struct.isSetSuccess()) {
     optionals.set(0);
   }
   oprot.writeBitSet(optionals, 1);
   if (struct.isSetSuccess()) {
     {
       oprot.writeI32(struct.success.size());
       for (List<String> _iter8 : struct.success) {
         {
           oprot.writeI32(_iter8.size());
           for (String _iter9 : _iter8) {
             oprot.writeString(_iter9);
           }
         }
       }
     }
   }
 }
Ejemplo n.º 9
0
 public tokenize_result getResult(I iface, tokenize_args args)
     throws org.apache.thrift.TException {
   tokenize_result result = new tokenize_result();
   result.success = iface.tokenize(args.document, args.wordGran);
   return result;
 }