/** * Returns true if the given byte array is accepted by this automaton */ public boolean run(byte[] s, int offset, int length) { int p = 0; int l = offset + length; for (int i = offset; i < l; i++) { p = step(p, s[i] & 0xFF); if (p == -1) return false; } return accept[p]; } }
state = runAutomaton.step(state, seekBytesRef.byteAt(i) & 0xff); assert state >= 0: "state=" + state;
int nextState = runAutomaton.step(state, seekBytesRef.byteAt(pos) & 0xff); if (nextState == -1) break; if ((pos = backtrack(pos)) < 0) /* no more solutions at all */ return false; final int newState = runAutomaton.step(savedStates.intAt(pos), seekBytesRef.byteAt(pos) & 0xff); if (newState >= 0 && runAutomaton.isAccept(newState))
while (true) { int label = input.bytes[input.offset + idx] & 0xff; int nextState = runAutomaton.step(state, label);
/** * Returns true if the given byte array is accepted by this automaton */ public boolean run(byte[] s, int offset, int length) { int p = 0; int l = offset + length; for (int i = offset; i < l; i++) { p = step(p, s[i] & 0xFF); if (p == -1) return false; } return accept[p]; } }
/** * Returns true if the given byte array is accepted by this automaton */ public boolean run(byte[] s, int offset, int length) { int p = initial; int l = offset + length; for (int i = offset; i < l; i++) { p = step(p, s[i] & 0xFF); if (p == -1) return false; } return accept[p]; } }
/** * Returns true if the given byte array is accepted by this automaton */ public boolean run(byte[] s, int offset, int length) { int p = initial; int l = offset + length; for (int i = offset; i < l; i++) { p = step(p, s[i] & 0xFF); if (p == -1) return false; } return accept[p]; } }
/** Load frame for target arc(node) on fst, so that * arc.label >= label and !fsa.reject(arc.label) */ Frame loadCeilFrame(int label, Frame top, Frame frame) throws IOException { FST.Arc<Long> arc = frame.arc; arc = Util.readCeilArc(label, fst, top.arc, arc, fstReader); if (arc == null) { return null; } frame.state = fsa.step(top.state, arc.label); //if (TEST) System.out.println(" loadCeil frame="+frame); if (frame.state == -1) { return loadNextFrame(top, frame); } return frame; }
/** Load frame for target arc(node) on fst, so that * arc.label >= label and !fsa.reject(arc.label) */ Frame loadCeilFrame(int label, Frame top, Frame frame) throws IOException { FST.Arc<FSTTermOutputs.TermData> arc = frame.fstArc; arc = Util.readCeilArc(label, fst, top.fstArc, arc, fstReader); if (arc == null) { return null; } frame.fsaState = fsa.step(top.fsaState, arc.label); //if (TEST) System.out.println(" loadCeil frame="+frame); if (frame.fsaState == -1) { return loadNextFrame(top, frame); } return frame; }
/** Load frame for target arc(node) on fst */ Frame loadExpandFrame(Frame top, Frame frame) throws IOException { if (!canGrow(top)) { return null; } frame.arc = fst.readFirstRealTargetArc(top.arc.target, frame.arc, fstReader); frame.state = fsa.step(top.state, frame.arc.label); //if (TEST) System.out.println(" loadExpand frame="+frame); if (frame.state == -1) { return loadNextFrame(top, frame); } return frame; }
/** Load frame for target arc(node) on fst */ Frame loadExpandFrame(Frame top, Frame frame) throws IOException { if (!canGrow(top)) { return null; } frame.fstArc = fst.readFirstRealTargetArc(top.fstArc.target, frame.fstArc, fstReader); frame.fsaState = fsa.step(top.fsaState, frame.fstArc.label); //if (TEST) System.out.println(" loadExpand frame="+frame); if (frame.fsaState == -1) { return loadNextFrame(top, frame); } return frame; }
/** Load frame for sibling arc(node) on fst */ Frame loadNextFrame(Frame top, Frame frame) throws IOException { if (!canRewind(frame)) { return null; } while (!frame.fstArc.isLast()) { frame.fstArc = fst.readNextRealArc(frame.fstArc, fstReader); frame.fsaState = fsa.step(top.fsaState, frame.fstArc.label); if (frame.fsaState != -1) { break; } } //if (TEST) System.out.println(" loadNext frame="+frame); if (frame.fsaState == -1) { return null; } return frame; }
/** Load frame for sibling arc(node) on fst */ Frame loadNextFrame(Frame top, Frame frame) throws IOException { if (!canRewind(frame)) { return null; } while (!frame.arc.isLast()) { frame.arc = fst.readNextRealArc(frame.arc, fstReader); frame.state = fsa.step(top.state, frame.arc.label); if (frame.state != -1) { break; } } //if (TEST) System.out.println(" loadNext frame="+frame); if (frame.state == -1) { return null; } return frame; }
state = runAutomaton.step(state, seekBytesRef.byteAt(i) & 0xff); assert state >= 0: "state=" + state;
state = runAutomaton.step(state, seekBytesRef.byteAt(i) & 0xff); assert state >= 0: "state=" + state;
state = runAutomaton.step(state, seekBytesRef.byteAt(i) & 0xff); assert state >= 0: "state=" + state;
int nextState = runAutomaton.step(state, seekBytesRef.byteAt(pos) & 0xff); if (nextState == -1) break; if ((pos = backtrack(pos)) < 0) /* no more solutions at all */ return false; final int newState = runAutomaton.step(savedStates.intAt(pos), seekBytesRef.byteAt(pos) & 0xff); if (newState >= 0 && runAutomaton.isAccept(newState))
int nextState = runAutomaton.step(state, seekBytesRef.byteAt(pos) & 0xff); if (nextState == -1) break; if ((pos = backtrack(pos)) < 0) /* no more solutions at all */ return false; final int newState = runAutomaton.step(savedStates.intAt(pos), seekBytesRef.byteAt(pos) & 0xff); if (newState >= 0 && runAutomaton.isAccept(newState))
while (true) { int label = input.bytes[input.offset + idx] & 0xff; int nextState = runAutomaton.step(state, label);
int nextState = runAutomaton.step(state, seekBytesRef.byteAt(pos) & 0xff); if (nextState == -1) break; if ((pos = backtrack(pos)) < 0) /* no more solutions at all */ return false; final int newState = runAutomaton.step(savedStates.intAt(pos), seekBytesRef.byteAt(pos) & 0xff); if (newState >= 0 && runAutomaton.isAccept(newState))