Exemple #1
0
  // returns true if multigroup
  private boolean openDocumentIndex(int docID) throws Exception {
    // The data is only the data for this document id. Thus the base is set
    // to zero.
    _data = _env.getPositions(docID);
    _base = 0;
    _startingIndex = 0;
    int kk = _data[_base] & 0xFF, k2;
    switch (kk >> 6) // get type
    {
      case 0: // single group, no extents
        k2 = _data[_base + 1];
        _firstGenerator.init(_data, _base += 2, k2);
        // decode concept table
        _nConcepts = _firstGenerator.decodeConcepts(kk & 0x3F, 0, _concepts);
        return false;

      case 2: // multi group, no extents
        _kTable.clear();
        _offsets.clear();
        _maxConcepts.clear();
        ByteArrayDecompressor compr = new ByteArrayDecompressor(_data, _base + 1);
        compr.decode(kk & 0x3F, _kTable);
        compr.ascDecode(_kTable.popLast(), _offsets);
        compr.ascDecode(_kTable.popLast(), _maxConcepts);
        _base += 1 + compr.bytesRead();
        _limit = _maxConcepts.cardinality();
        return true;

      case 1: // single group, extents
      case 3: // multi group, extents
        throw new Exception("extents not yet implemented\n");
    }
    return false;
  }
Exemple #2
0
  private ConceptGroupGenerator makeGenerator(int group) throws Exception {
    int shift, index;

    if (group > 0) {
      index = _base + _offsets.at(group - 1);
      shift = _maxConcepts.at(group - 1);
    } else {
      index = _base;
      shift = 0;
    }

    // initialize generator
    ConceptGroupGenerator gen = new ConceptGroupGenerator(_data, index, _kTable.at(2 * group + 1));
    // decode concept table
    _nConcepts = gen.decodeConcepts(_kTable.at(2 * group), shift, _concepts);
    if (group < _limit) _max = _concepts[_nConcepts] = _maxConcepts.at(group);
    else _max = _concepts[_nConcepts - 1];
    _genHeap.addGenerator(gen);
    _startingIndex = 0; // in _concepts; lower search index
    return gen;
  }