org.apache.lucene.util.automaton.Operations.hasDeadStates()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(5.0k)|赞(0)|评价(0)|浏览(140)

本文整理了Java中org.apache.lucene.util.automaton.Operations.hasDeadStates()方法的一些代码示例,展示了Operations.hasDeadStates()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Operations.hasDeadStates()方法的具体详情如下:
包路径:org.apache.lucene.util.automaton.Operations
类名称:Operations
方法名:hasDeadStates

Operations.hasDeadStates介绍

[英]Returns true if this automaton has any states that cannot be reached from the initial state or cannot reach an accept state. Cost is O(numTransitions+numStates).
[中]如果此自动机具有从初始状态无法达到的任何状态或无法达到接受状态,则返回true。成本为O(numTransitions+numStates)。

代码示例

代码示例来源:origin: org.apache.lucene/lucene-core

  1. /**
  2. * Returns a new (deterministic) automaton that accepts the single given
  3. * string.
  4. */
  5. public static Automaton makeString(String s) {
  6. Automaton a = new Automaton();
  7. int lastState = a.createState();
  8. for (int i = 0, cp = 0; i < s.length(); i += Character.charCount(cp)) {
  9. int state = a.createState();
  10. cp = s.codePointAt(i);
  11. a.addTransition(lastState, state, cp);
  12. lastState = state;
  13. }
  14. a.setAccept(lastState, true);
  15. a.finishState();
  16. assert a.isDeterministic();
  17. assert Operations.hasDeadStates(a) == false;
  18. return a;
  19. }

代码示例来源:origin: org.apache.lucene/lucene-core

  1. assert hasDeadStates(result) == false;
  2. return result;

代码示例来源:origin: org.apache.lucene/lucene-core

  1. /**
  2. * Returns a new (deterministic) automaton that accepts the single given
  3. * binary term.
  4. */
  5. public static Automaton makeBinary(BytesRef term) {
  6. Automaton a = new Automaton();
  7. int lastState = a.createState();
  8. for (int i=0;i<term.length;i++) {
  9. int state = a.createState();
  10. int label = term.bytes[term.offset+i] & 0xff;
  11. a.addTransition(lastState, state, label);
  12. lastState = state;
  13. }
  14. a.setAccept(lastState, true);
  15. a.finishState();
  16. assert a.isDeterministic();
  17. assert Operations.hasDeadStates(a) == false;
  18. return a;
  19. }

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.lucene

  1. /**
  2. * Returns a new (deterministic) automaton that accepts the single given
  3. * string.
  4. */
  5. public static Automaton makeString(String s) {
  6. Automaton a = new Automaton();
  7. int lastState = a.createState();
  8. for (int i = 0, cp = 0; i < s.length(); i += Character.charCount(cp)) {
  9. int state = a.createState();
  10. cp = s.codePointAt(i);
  11. a.addTransition(lastState, state, cp);
  12. lastState = state;
  13. }
  14. a.setAccept(lastState, true);
  15. a.finishState();
  16. assert a.isDeterministic();
  17. assert Operations.hasDeadStates(a) == false;
  18. return a;
  19. }

代码示例来源:origin: harbby/presto-connectors

  1. /**
  2. * Returns a new (deterministic) automaton that accepts the single given
  3. * string.
  4. */
  5. public static Automaton makeString(String s) {
  6. Automaton a = new Automaton();
  7. int lastState = a.createState();
  8. for (int i = 0, cp = 0; i < s.length(); i += Character.charCount(cp)) {
  9. int state = a.createState();
  10. cp = s.codePointAt(i);
  11. a.addTransition(lastState, state, cp);
  12. lastState = state;
  13. }
  14. a.setAccept(lastState, true);
  15. a.finishState();
  16. assert a.isDeterministic();
  17. assert Operations.hasDeadStates(a) == false;
  18. return a;
  19. }

代码示例来源:origin: org.infinispan/infinispan-embedded-query

  1. /**
  2. * Returns a new (deterministic) automaton that accepts the single given
  3. * string.
  4. */
  5. public static Automaton makeString(String s) {
  6. Automaton a = new Automaton();
  7. int lastState = a.createState();
  8. for (int i = 0, cp = 0; i < s.length(); i += Character.charCount(cp)) {
  9. int state = a.createState();
  10. cp = s.codePointAt(i);
  11. a.addTransition(lastState, state, cp);
  12. lastState = state;
  13. }
  14. a.setAccept(lastState, true);
  15. a.finishState();
  16. assert a.isDeterministic();
  17. assert Operations.hasDeadStates(a) == false;
  18. return a;
  19. }

代码示例来源:origin: org.infinispan/infinispan-embedded-query

  1. assert hasDeadStates(result) == false;
  2. return result;

代码示例来源:origin: harbby/presto-connectors

  1. assert hasDeadStates(result) == false;
  2. return result;

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.lucene

  1. assert hasDeadStates(result) == false;
  2. return result;

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.lucene

  1. /**
  2. * Returns a new (deterministic) automaton that accepts the single given
  3. * binary term.
  4. */
  5. public static Automaton makeBinary(BytesRef term) {
  6. Automaton a = new Automaton();
  7. int lastState = a.createState();
  8. for (int i=0;i<term.length;i++) {
  9. int state = a.createState();
  10. int label = term.bytes[term.offset+i] & 0xff;
  11. a.addTransition(lastState, state, label);
  12. lastState = state;
  13. }
  14. a.setAccept(lastState, true);
  15. a.finishState();
  16. assert a.isDeterministic();
  17. assert Operations.hasDeadStates(a) == false;
  18. return a;
  19. }

代码示例来源:origin: org.infinispan/infinispan-embedded-query

  1. /**
  2. * Returns a new (deterministic) automaton that accepts the single given
  3. * binary term.
  4. */
  5. public static Automaton makeBinary(BytesRef term) {
  6. Automaton a = new Automaton();
  7. int lastState = a.createState();
  8. for (int i=0;i<term.length;i++) {
  9. int state = a.createState();
  10. int label = term.bytes[term.offset+i] & 0xff;
  11. a.addTransition(lastState, state, label);
  12. lastState = state;
  13. }
  14. a.setAccept(lastState, true);
  15. a.finishState();
  16. assert a.isDeterministic();
  17. assert Operations.hasDeadStates(a) == false;
  18. return a;
  19. }

代码示例来源:origin: harbby/presto-connectors

  1. /**
  2. * Returns a new (deterministic) automaton that accepts the single given
  3. * binary term.
  4. */
  5. public static Automaton makeBinary(BytesRef term) {
  6. Automaton a = new Automaton();
  7. int lastState = a.createState();
  8. for (int i=0;i<term.length;i++) {
  9. int state = a.createState();
  10. int label = term.bytes[term.offset+i] & 0xff;
  11. a.addTransition(lastState, state, label);
  12. lastState = state;
  13. }
  14. a.setAccept(lastState, true);
  15. a.finishState();
  16. assert a.isDeterministic();
  17. assert Operations.hasDeadStates(a) == false;
  18. return a;
  19. }

相关文章