Ejemplo n.º 1
0
  @Override
  TrieNode add(final TrieLeaf o, final int l, final InputInfo ii) throws QueryException {
    final int k = key(o.hash, l);
    final TrieNode ch = kids[k], nw;
    if (ch != null) {
      final TrieNode ins = ch.add(o, l + 1, ii);
      if (ins == ch) return this;
      nw = ins;
    } else nw = o;

    final TrieNode[] ks = copyKids();
    ks[k] = nw;

    // we don't replace here, so the size must increase
    return new TrieBranch(ks, used | 1 << k, size + 1);
  }
Ejemplo n.º 2
0
 @Override
 TrieNode addAll(final TrieNode o, final int l, final InputInfo ii) throws QueryException {
   return o.add(this, l, ii);
 }