final UnCompiledNode<T>[] next = ArrayUtil.grow(frontier, input.length+1); for(int idx=frontier.length;idx<next.length;idx++) { next[idx] = new UnCompiledNode<>(this, idx); frontier[idx-1].addArc(input.ints[input.offset + idx - 1], frontier[idx]); frontier[idx].inputCount++; final UnCompiledNode<T> parentNode = frontier[idx-1]; final T lastOutput = parentNode.getLastOutput(input.ints[input.offset + idx - 1]); assert validOutput(lastOutput); wordSuffix = fst.outputs.subtract(lastOutput, commonOutputPrefix); assert validOutput(wordSuffix); parentNode.setLastOutput(input.ints[input.offset + idx - 1], commonOutputPrefix); node.prependOutput(wordSuffix); } else { commonOutputPrefix = wordSuffix = NO_OUTPUT; frontier[prefixLenPlus1-1].setLastOutput(input.ints[input.offset + prefixLenPlus1-1], output);
@SuppressWarnings({"rawtypes","unchecked"}) final UnCompiledNode<T> target = (UnCompiledNode<T>) node.arcs[arcIdx].target; target.clear(); node.clear(); parent.deleteLast(lastInput.intAt(idx-1), node); } else { parent.replaceLast(lastInput.intAt(idx-1), compileNode(node, 1+lastInput.length()-idx), nextFinalOutput, parent.replaceLast(lastInput.intAt(idx-1), node, nextFinalOutput, frontier[idx] = new UnCompiledNode<>(this, idx);
System.arraycopy(frontier, 0, next, 0, frontier.length); for(int idx=frontier.length;idx<next.length;idx++) { next[idx] = new UnCompiledNode<>(this, idx); frontier[idx-1].addArc(input.ints[input.offset + idx - 1], frontier[idx]); frontier[idx].inputCount++; final UnCompiledNode<T> parentNode = frontier[idx-1]; final T lastOutput = parentNode.getLastOutput(input.ints[input.offset + idx - 1]); assert validOutput(lastOutput); wordSuffix = fst.outputs.subtract(lastOutput, commonOutputPrefix); assert validOutput(wordSuffix); parentNode.setLastOutput(input.ints[input.offset + idx - 1], commonOutputPrefix); node.prependOutput(wordSuffix); } else { commonOutputPrefix = wordSuffix = NO_OUTPUT; frontier[prefixLenPlus1-1].setLastOutput(input.ints[input.offset + prefixLenPlus1-1], output);
frontier = f; for(int idx=0;idx<frontier.length;idx++) { frontier[idx] = new UnCompiledNode<>(this, idx);
@SuppressWarnings({"rawtypes","unchecked"}) final UnCompiledNode<T> target = (UnCompiledNode<T>) node.arcs[arcIdx].target; target.clear(); node.clear(); parent.deleteLast(lastInput.intAt(idx-1), node); } else { parent.replaceLast(lastInput.intAt(idx-1), compileNode(node, 1+lastInput.length()-idx), nextFinalOutput, parent.replaceLast(lastInput.intAt(idx-1), node, nextFinalOutput, frontier[idx] = new UnCompiledNode<>(this, idx);
System.arraycopy(frontier, 0, next, 0, frontier.length); for(int idx=frontier.length;idx<next.length;idx++) { next[idx] = new UnCompiledNode<>(this, idx); frontier[idx-1].addArc(input.ints[input.offset + idx - 1], frontier[idx]); frontier[idx].inputCount++; final UnCompiledNode<T> parentNode = frontier[idx-1]; final T lastOutput = parentNode.getLastOutput(input.ints[input.offset + idx - 1]); assert validOutput(lastOutput); wordSuffix = fst.outputs.subtract(lastOutput, commonOutputPrefix); assert validOutput(wordSuffix); parentNode.setLastOutput(input.ints[input.offset + idx - 1], commonOutputPrefix); node.prependOutput(wordSuffix); } else { commonOutputPrefix = wordSuffix = NO_OUTPUT; frontier[prefixLenPlus1-1].setLastOutput(input.ints[input.offset + prefixLenPlus1-1], output);
final UnCompiledNode<T>[] next = ArrayUtil.grow(frontier, input.length+1); for(int idx=frontier.length;idx<next.length;idx++) { next[idx] = new UnCompiledNode<>(this, idx); frontier[idx-1].addArc(input.ints[input.offset + idx - 1], frontier[idx]); frontier[idx].inputCount++; final UnCompiledNode<T> parentNode = frontier[idx-1]; final T lastOutput = parentNode.getLastOutput(input.ints[input.offset + idx - 1]); assert validOutput(lastOutput); wordSuffix = fst.outputs.subtract(lastOutput, commonOutputPrefix); assert validOutput(wordSuffix); parentNode.setLastOutput(input.ints[input.offset + idx - 1], commonOutputPrefix); node.prependOutput(wordSuffix); } else { commonOutputPrefix = wordSuffix = NO_OUTPUT; frontier[prefixLenPlus1-1].setLastOutput(input.ints[input.offset + prefixLenPlus1-1], output);
frontier = f; for(int idx=0;idx<frontier.length;idx++) { frontier[idx] = new UnCompiledNode<>(this, idx);
@SuppressWarnings({"rawtypes","unchecked"}) final UnCompiledNode<T> target = (UnCompiledNode<T>) node.arcs[arcIdx].target; target.clear(); node.clear(); parent.deleteLast(lastInput.intAt(idx-1), node); } else { parent.replaceLast(lastInput.intAt(idx-1), compileNode(node, 1+lastInput.length()-idx), nextFinalOutput, parent.replaceLast(lastInput.intAt(idx-1), node, nextFinalOutput, frontier[idx] = new UnCompiledNode<>(this, idx);
@SuppressWarnings({"rawtypes","unchecked"}) final UnCompiledNode<T> target = (UnCompiledNode<T>) node.arcs[arcIdx].target; target.clear(); node.clear(); parent.deleteLast(lastInput.intAt(idx-1), node); } else { parent.replaceLast(lastInput.intAt(idx-1), compileNode(node, 1+lastInput.length()-idx), nextFinalOutput, parent.replaceLast(lastInput.intAt(idx-1), node, nextFinalOutput, frontier[idx] = new UnCompiledNode<>(this, idx);
frontier = f; for(int idx=0;idx<frontier.length;idx++) { frontier[idx] = new UnCompiledNode<>(this, idx);
private CompiledNode compileNode(UnCompiledNode<T> nodeIn, int tailLength) throws IOException { final long node; long bytesPosStart = bytes.getPosition(); if (dedupHash != null && (doShareNonSingletonNodes || nodeIn.numArcs <= 1) && tailLength <= shareMaxTailLength) { if (nodeIn.numArcs == 0) { node = fst.addNode(this, nodeIn); lastFrozenNode = node; } else { node = dedupHash.add(this, nodeIn); } } else { node = fst.addNode(this, nodeIn); } assert node != -2; long bytesPosEnd = bytes.getPosition(); if (bytesPosEnd != bytesPosStart) { // The FST added a new node: assert bytesPosEnd > bytesPosStart; lastFrozenNode = node; } nodeIn.clear(); final CompiledNode fn = new CompiledNode(); fn.node = node; return fn; }
private CompiledNode compileNode(UnCompiledNode<T> nodeIn, int tailLength) throws IOException { final long node; long bytesPosStart = bytes.getPosition(); if (dedupHash != null && (doShareNonSingletonNodes || nodeIn.numArcs <= 1) && tailLength <= shareMaxTailLength) { if (nodeIn.numArcs == 0) { node = fst.addNode(this, nodeIn); lastFrozenNode = node; } else { node = dedupHash.add(this, nodeIn); } } else { node = fst.addNode(this, nodeIn); } assert node != -2; long bytesPosEnd = bytes.getPosition(); if (bytesPosEnd != bytesPosStart) { // The FST added a new node: assert bytesPosEnd > bytesPosStart; lastFrozenNode = node; } nodeIn.clear(); final CompiledNode fn = new CompiledNode(); fn.node = node; return fn; }
private CompiledNode compileNode(UnCompiledNode<T> nodeIn, int tailLength) throws IOException { final long node; long bytesPosStart = bytes.getPosition(); if (dedupHash != null && (doShareNonSingletonNodes || nodeIn.numArcs <= 1) && tailLength <= shareMaxTailLength) { if (nodeIn.numArcs == 0) { node = fst.addNode(this, nodeIn); lastFrozenNode = node; } else { node = dedupHash.add(this, nodeIn); } } else { node = fst.addNode(this, nodeIn); } assert node != -2; long bytesPosEnd = bytes.getPosition(); if (bytesPosEnd != bytesPosStart) { // The FST added a new node: assert bytesPosEnd > bytesPosStart; lastFrozenNode = node; } nodeIn.clear(); final CompiledNode fn = new CompiledNode(); fn.node = node; return fn; }
frontier = f; for(int idx=0;idx<frontier.length;idx++) { frontier[idx] = new UnCompiledNode<>(this, idx);
private CompiledNode compileNode(UnCompiledNode<T> nodeIn, int tailLength) throws IOException { final long node; long bytesPosStart = bytes.getPosition(); if (dedupHash != null && (doShareNonSingletonNodes || nodeIn.numArcs <= 1) && tailLength <= shareMaxTailLength) { if (nodeIn.numArcs == 0) { node = fst.addNode(this, nodeIn); lastFrozenNode = node; } else { node = dedupHash.add(this, nodeIn); } } else { node = fst.addNode(this, nodeIn); } assert node != -2; long bytesPosEnd = bytes.getPosition(); if (bytesPosEnd != bytesPosStart) { // The FST added a new node: assert bytesPosEnd > bytesPosStart; lastFrozenNode = node; } nodeIn.clear(); final CompiledNode fn = new CompiledNode(); fn.node = node; return fn; }