Пример #1
0
 /**
  * Returns an atomized content for any node kind. The atomized value can be an attribute value or
  * XML content.
  *
  * @param pre pre value
  * @return atomized value
  */
 public final byte[] atom(final int pre) {
   switch (kind(pre)) {
     case TEXT:
     case COMM:
       return text(pre, true);
     case ATTR:
       return text(pre, false);
     case PI:
       byte[] txt = text(pre, true);
       final int i = indexOf(txt, ' ');
       return i == -1 ? EMPTY : substring(txt, i + 1);
     default:
       // create atomized text node
       TokenBuilder tb = null;
       byte[] t = EMPTY;
       int p = pre;
       final int s = p + size(p, kind(p));
       while (p != s) {
         final int k = kind(p);
         if (k == TEXT) {
           txt = text(p, true);
           if (t == EMPTY) {
             t = txt;
           } else {
             if (tb == null) tb = new TokenBuilder(t);
             tb.add(txt);
           }
         }
         p += attSize(p, k);
       }
       return tb == null ? t : tb.finish();
   }
 }
Пример #2
0
  @Override
  public synchronized byte[] info(final MainOptions options) {
    final TokenBuilder tb = new TokenBuilder();
    final long l = inX.length() + inY.length() + inZ.length();
    tb.add(LI_NAMES).add(data.meta.ftinclude).add(NL);
    tb.add(LI_SIZE + Performance.format(l, true) + NL);

    final IndexStats stats = new IndexStats(options.get(MainOptions.MAXSTAT));
    addOccs(stats);
    stats.print(tb);
    return tb.finish();
  }