예제 #1
0
  @Override
  public IndexIterator iter(final IndexToken tok) {
    final byte k = tok.type() == IndexType.TEXT ? Data.TEXT : Data.ATTR;
    final int i = id(tok.get());
    if (i > 0) {
      final int[] pres = ids[i];
      final int s = len[i];
      if (s > 0) {
        return new IndexIterator() {
          int p;

          @Override
          public boolean more() {
            return p < s;
          }

          @Override
          public int next() {
            while (more() && data.kind(pres[p++]) != k) ;
            return pres[p - 1];
          }
        };
      }
    }
    return IndexIterator.EMPTY;
  }
예제 #2
0
  @Override
  public IndexIterator iter(final IndexToken token) {
    final int id = values.id(token.get());
    if (id == 0) return IndexIterator.EMPTY;

    final int len = lenList.get(id);
    final int[] ids = idsList.get(id), pres;
    if (data.meta.updindex) {
      final IntList tmp = new IntList();
      for (int i = 0; i < len; ++i) tmp.add(data.pre(ids[i]));
      pres = tmp.sort().finish();
    } else {
      pres = ids;
    }

    return new IndexIterator() {
      int p;

      @Override
      public boolean more() {
        return p < len;
      }

      @Override
      public int pre() {
        return pres[p++];
      }

      @Override
      public int size() {
        return len;
      }
    };
  }
예제 #3
0
파일: Data.java 프로젝트: JosuaKrause/basex
 /**
  * Returns the number of indexed pre references for the specified token.
  *
  * @param token text to be found
  * @return number of hits
  */
 public final int count(final IndexToken token) {
   return index(token.type()).count(token);
 }
예제 #4
0
파일: Data.java 프로젝트: JosuaKrause/basex
 /**
  * Returns the indexed pre references for the specified token.
  *
  * @param token index token reference
  * @return array of sorted pre values
  */
 public final IndexIterator iter(final IndexToken token) {
   return index(token.type()).iter(token);
 }
예제 #5
0
 @Override
 public int costs(final IndexToken it) {
   return lenList.get(values.id(it.get()));
 }
예제 #6
0
 @Override
 public int count(final IndexToken it) {
   final int i = id(it.get());
   return i == 0 ? 0 : len[i];
 }