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

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

本文整理了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

/**
 * Returns a new (deterministic) automaton that accepts the single given
 * string.
 */
public static Automaton makeString(String s) {
 Automaton a = new Automaton();
 int lastState = a.createState();
 for (int i = 0, cp = 0; i < s.length(); i += Character.charCount(cp)) {
  int state = a.createState();
  cp = s.codePointAt(i);
  a.addTransition(lastState, state, cp);
  lastState = state;
 }
 a.setAccept(lastState, true);
 a.finishState();
 assert a.isDeterministic();
 assert Operations.hasDeadStates(a) == false;
 return a;
}

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

assert hasDeadStates(result) == false;
return result;

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

/**
 * Returns a new (deterministic) automaton that accepts the single given
 * binary term.
 */
public static Automaton makeBinary(BytesRef term) {
 Automaton a = new Automaton();
 int lastState = a.createState();
 for (int i=0;i<term.length;i++) {
  int state = a.createState();
  int label = term.bytes[term.offset+i] & 0xff;
  a.addTransition(lastState, state, label);
  lastState = state;
 }
 a.setAccept(lastState, true);
 a.finishState();
 assert a.isDeterministic();
 assert Operations.hasDeadStates(a) == false;
 return a;
}

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

/**
 * Returns a new (deterministic) automaton that accepts the single given
 * string.
 */
public static Automaton makeString(String s) {
 Automaton a = new Automaton();
 int lastState = a.createState();
 for (int i = 0, cp = 0; i < s.length(); i += Character.charCount(cp)) {
  int state = a.createState();
  cp = s.codePointAt(i);
  a.addTransition(lastState, state, cp);
  lastState = state;
 }
 a.setAccept(lastState, true);
 a.finishState();
 assert a.isDeterministic();
 assert Operations.hasDeadStates(a) == false;
 return a;
}

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

/**
 * Returns a new (deterministic) automaton that accepts the single given
 * string.
 */
public static Automaton makeString(String s) {
 Automaton a = new Automaton();
 int lastState = a.createState();
 for (int i = 0, cp = 0; i < s.length(); i += Character.charCount(cp)) {
  int state = a.createState();
  cp = s.codePointAt(i);
  a.addTransition(lastState, state, cp);
  lastState = state;
 }
 a.setAccept(lastState, true);
 a.finishState();
 assert a.isDeterministic();
 assert Operations.hasDeadStates(a) == false;
 return a;
}

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

/**
 * Returns a new (deterministic) automaton that accepts the single given
 * string.
 */
public static Automaton makeString(String s) {
 Automaton a = new Automaton();
 int lastState = a.createState();
 for (int i = 0, cp = 0; i < s.length(); i += Character.charCount(cp)) {
  int state = a.createState();
  cp = s.codePointAt(i);
  a.addTransition(lastState, state, cp);
  lastState = state;
 }
 a.setAccept(lastState, true);
 a.finishState();
 assert a.isDeterministic();
 assert Operations.hasDeadStates(a) == false;
 return a;
}

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

assert hasDeadStates(result) == false;
return result;

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

assert hasDeadStates(result) == false;
return result;

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

assert hasDeadStates(result) == false;
return result;

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

/**
 * Returns a new (deterministic) automaton that accepts the single given
 * binary term.
 */
public static Automaton makeBinary(BytesRef term) {
 Automaton a = new Automaton();
 int lastState = a.createState();
 for (int i=0;i<term.length;i++) {
  int state = a.createState();
  int label = term.bytes[term.offset+i] & 0xff;
  a.addTransition(lastState, state, label);
  lastState = state;
 }
 a.setAccept(lastState, true);
 a.finishState();
 assert a.isDeterministic();
 assert Operations.hasDeadStates(a) == false;
 return a;
}

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

/**
 * Returns a new (deterministic) automaton that accepts the single given
 * binary term.
 */
public static Automaton makeBinary(BytesRef term) {
 Automaton a = new Automaton();
 int lastState = a.createState();
 for (int i=0;i<term.length;i++) {
  int state = a.createState();
  int label = term.bytes[term.offset+i] & 0xff;
  a.addTransition(lastState, state, label);
  lastState = state;
 }
 a.setAccept(lastState, true);
 a.finishState();
 assert a.isDeterministic();
 assert Operations.hasDeadStates(a) == false;
 return a;
}

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

/**
 * Returns a new (deterministic) automaton that accepts the single given
 * binary term.
 */
public static Automaton makeBinary(BytesRef term) {
 Automaton a = new Automaton();
 int lastState = a.createState();
 for (int i=0;i<term.length;i++) {
  int state = a.createState();
  int label = term.bytes[term.offset+i] & 0xff;
  a.addTransition(lastState, state, label);
  lastState = state;
 }
 a.setAccept(lastState, true);
 a.finishState();
 assert a.isDeterministic();
 assert Operations.hasDeadStates(a) == false;
 return a;
}

相关文章