/** * Returns true if the given string is accepted by the automaton. The input must be deterministic. * <p> * Complexity: linear in the length of the string. * <p> * <b>Note:</b> for full performance, use the {@link RunAutomaton} class. */ public static boolean run(Automaton a, String s) { assert a.isDeterministic(); int state = 0; for (int i = 0, cp = 0; i < s.length(); i += Character.charCount(cp)) { int nextState = a.step(state, cp = s.codePointAt(i)); if (nextState == -1) { return false; } state = nextState; } return a.isAccept(state); }
/** * Returns true if the given string (expressed as unicode codepoints) is accepted by the automaton. The input must be deterministic. * <p> * Complexity: linear in the length of the string. * <p> * <b>Note:</b> for full performance, use the {@link RunAutomaton} class. */ public static boolean run(Automaton a, IntsRef s) { assert a.isDeterministic(); int state = 0; for (int i=0;i<s.length;i++) { int nextState = a.step(state, s.ints[s.offset+i]); if (nextState == -1) { return false; } state = nextState; } return a.isAccept(state); }
accept[n] = a.isAccept(n); for (int c = 0; c < points.length; c++) { int dest = a.step(n, points[c]); assert dest == -1 || dest < size; transitions[n * points.length + c] = dest;
block[q] = j; for (int x = 0; x < sigmaLen; x++) { final ArrayList<Integer>[] r = reverse[a.step(q, sigma[x])]; if (r[x] == null) { r[x] = new ArrayList<>();
/** * Returns true if the given string is accepted by the automaton. The input must be deterministic. * <p> * Complexity: linear in the length of the string. * <p> * <b>Note:</b> for full performance, use the {@link RunAutomaton} class. */ public static boolean run(Automaton a, String s) { assert a.isDeterministic(); int state = 0; for (int i = 0, cp = 0; i < s.length(); i += Character.charCount(cp)) { int nextState = a.step(state, cp = s.codePointAt(i)); if (nextState == -1) { return false; } state = nextState; } return a.isAccept(state); }
/** * Returns true if the given string is accepted by the automaton. The input must be deterministic. * <p> * Complexity: linear in the length of the string. * <p> * <b>Note:</b> for full performance, use the {@link RunAutomaton} class. */ public static boolean run(Automaton a, String s) { assert a.isDeterministic(); int state = 0; for (int i = 0, cp = 0; i < s.length(); i += Character.charCount(cp)) { int nextState = a.step(state, cp = s.codePointAt(i)); if (nextState == -1) { return false; } state = nextState; } return a.isAccept(state); }
/** * Returns true if the given string is accepted by the automaton. The input must be deterministic. * <p> * Complexity: linear in the length of the string. * <p> * <b>Note:</b> for full performance, use the {@link RunAutomaton} class. */ public static boolean run(Automaton a, String s) { assert a.isDeterministic(); int state = 0; for (int i = 0, cp = 0; i < s.length(); i += Character.charCount(cp)) { int nextState = a.step(state, cp = s.codePointAt(i)); if (nextState == -1) { return false; } state = nextState; } return a.isAccept(state); }
/** * Returns true if the given string (expressed as unicode codepoints) is accepted by the automaton. The input must be deterministic. * <p> * Complexity: linear in the length of the string. * <p> * <b>Note:</b> for full performance, use the {@link RunAutomaton} class. */ public static boolean run(Automaton a, IntsRef s) { assert a.isDeterministic(); int state = 0; for (int i=0;i<s.length;i++) { int nextState = a.step(state, s.ints[s.offset+i]); if (nextState == -1) { return false; } state = nextState; } return a.isAccept(state); }
/** * Returns true if the given string (expressed as unicode codepoints) is accepted by the automaton. The input must be deterministic. * <p> * Complexity: linear in the length of the string. * <p> * <b>Note:</b> for full performance, use the {@link RunAutomaton} class. */ public static boolean run(Automaton a, IntsRef s) { assert a.isDeterministic(); int state = 0; for (int i=0;i<s.length;i++) { int nextState = a.step(state, s.ints[s.offset+i]); if (nextState == -1) { return false; } state = nextState; } return a.isAccept(state); }
/** * Returns true if the given string (expressed as unicode codepoints) is accepted by the automaton. The input must be deterministic. * <p> * Complexity: linear in the length of the string. * <p> * <b>Note:</b> for full performance, use the {@link RunAutomaton} class. */ public static boolean run(Automaton a, IntsRef s) { assert a.isDeterministic(); int state = 0; for (int i=0;i<s.length;i++) { int nextState = a.step(state, s.ints[s.offset+i]); if (nextState == -1) { return false; } state = nextState; } return a.isAccept(state); }
accept[n] = a.isAccept(n); for (int c = 0; c < points.length; c++) { int dest = a.step(n, points[c]); assert dest == -1 || dest < size; transitions[n * points.length + c] = dest;
accept[n] = a.isAccept(n); for (int c = 0; c < points.length; c++) { int dest = a.step(n, points[c]); assert dest == -1 || dest < size; transitions[n * points.length + c] = dest;
accept[n] = a.isAccept(n); for (int c = 0; c < points.length; c++) { int dest = a.step(n, points[c]); assert dest == -1 || dest < size; transitions[n * points.length + c] = dest;
block[q] = j; for (int x = 0; x < sigmaLen; x++) { final ArrayList<Integer>[] r = reverse[a.step(q, sigma[x])]; if (r[x] == null) { r[x] = new ArrayList<>();
block[q] = j; for (int x = 0; x < sigmaLen; x++) { final ArrayList<Integer>[] r = reverse[a.step(q, sigma[x])]; if (r[x] == null) { r[x] = new ArrayList<>();
block[q] = j; for (int x = 0; x < sigmaLen; x++) { final ArrayList<Integer>[] r = reverse[a.step(q, sigma[x])]; if (r[x] == null) { r[x] = new ArrayList<>();