作者:轩风羽_609 | 来源:互联网 | 2023-06-07 20:26
本文整理了Java中org.apache.lucene.util.automaton.Automaton.copy()方法的一些代码示例,展示了Automaton.copy()的具体用法。这些代码示例
本文整理了Java中org.apache.lucene.util.automaton.Automaton.copy()
方法的一些代码示例,展示了Automaton.copy()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Automaton.copy()
方法的具体详情如下:
包路径:org.apache.lucene.util.automaton.Automaton
类名称:Automaton
方法名:copy
Automaton.copy介绍
[英]Copies over all states/transitions from other. The states numbers are sequentially assigned (appended).
[中]从其他状态复制所有状态/转换。州编号按顺序分配(追加)。
代码示例
代码示例来源:origin: org.apache.lucene/lucene-core
/**
* Returns an automaton that accepts the union of the empty string and the
* language of the given automaton. This may create a dead state.
*
* Complexity: linear in number of states.
*/
static public Automaton optional(Automaton a) {
Automaton result = new Automaton();
result.createState();
result.setAccept(0, true);
if (a.getNumStates() > 0) {
result.copy(a);
result.addEpsilon(0, 1);
}
result.finishState();
return result;
}
代码示例来源:origin: org.apache.lucene/lucene-core
/**
* Returns an automaton that accepts the union of the languages of the given
* automata.
*
* Complexity: linear in number of states.
*/
public static Automaton union(Collection l) {
Automaton result = new Automaton();
// Create initial state:
result.createState();
// Copy over all automata
for(Automaton a : l) {
result.copy(a);
}
// Add epsilon transition from new initial state
int stateOffset = 1;
for(Automaton a : l) {
if (a.getNumStates() == 0) {
continue;
}
result.addEpsilon(0, stateOffset);
stateOffset += a.getNumStates();
}
result.finishState();
return removeDeadStates(result);
}
代码示例来源:origin: org.apache.lucene/lucene-core
} else if (min == 1) {
b = new Automaton();
b.copy(a);
} else {
List as = new ArrayList<>();
代码示例来源:origin: harbby/presto-connectors
/**
* Returns an automaton that accepts the union of the empty string and the
* language of the given automaton. This may create a dead state.
*
* Complexity: linear in number of states.
*/
static public Automaton optional(Automaton a) {
Automaton result = new Automaton();
result.createState();
result.setAccept(0, true);
if (a.getNumStates() > 0) {
result.copy(a);
result.addEpsilon(0, 1);
}
result.finishState();
return result;
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.lucene
/**
* Returns an automaton that accepts the union of the empty string and the
* language of the given automaton. This may create a dead state.
*
* Complexity: linear in number of states.
*/
static public Automaton optional(Automaton a) {
Automaton result = new Automaton();
result.createState();
result.setAccept(0, true);
if (a.getNumStates() > 0) {
result.copy(a);
result.addEpsilon(0, 1);
}
result.finishState();
return result;
}
代码示例来源:origin: org.infinispan/infinispan-embedded-query
/**
* Returns an automaton that accepts the union of the empty string and the
* language of the given automaton. This may create a dead state.
*
* Complexity: linear in number of states.
*/
static public Automaton optional(Automaton a) {
Automaton result = new Automaton();
result.createState();
result.setAccept(0, true);
if (a.getNumStates() > 0) {
result.copy(a);
result.addEpsilon(0, 1);
}
result.finishState();
return result;
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.lucene
/**
* Returns an automaton that accepts the union of the languages of the given
* automata.
*
* Complexity: linear in number of states.
*/
public static Automaton union(Collection l) {
Automaton result = new Automaton();
// Create initial state:
result.createState();
// Copy over all automata
for(Automaton a : l) {
result.copy(a);
}
// Add epsilon transition from new initial state
int stateOffset = 1;
for(Automaton a : l) {
if (a.getNumStates() == 0) {
continue;
}
result.addEpsilon(0, stateOffset);
stateOffset += a.getNumStates();
}
result.finishState();
return removeDeadStates(result);
}
代码示例来源:origin: org.infinispan/infinispan-embedded-query
} else if (min == 1) {
b = new Automaton();
b.copy(a);
} else {
List as = new ArrayList<>();
代码示例来源:origin: org.infinispan/infinispan-embedded-query
/**
* Returns an automaton that accepts the union of the languages of the given
* automata.
*
* Complexity: linear in number of states.
*/
public static Automaton union(Collection l) {
Automaton result = new Automaton();
// Create initial state:
result.createState();
// Copy over all automata
for(Automaton a : l) {
result.copy(a);
}
// Add epsilon transition from new initial state
int stateOffset = 1;
for(Automaton a : l) {
if (a.getNumStates() == 0) {
continue;
}
result.addEpsilon(0, stateOffset);
stateOffset += a.getNumStates();
}
result.finishState();
return removeDeadStates(result);
}
代码示例来源:origin: harbby/presto-connectors
/**
* Returns an automaton that accepts the union of the languages of the given
* automata.
*
* Complexity: linear in number of states.
*/
public static Automaton union(Collection l) {
Automaton result = new Automaton();
// Create initial state:
result.createState();
// Copy over all automata
for(Automaton a : l) {
result.copy(a);
}
// Add epsilon transition from new initial state
int stateOffset = 1;
for(Automaton a : l) {
if (a.getNumStates() == 0) {
continue;
}
result.addEpsilon(0, stateOffset);
stateOffset += a.getNumStates();
}
result.finishState();
return removeDeadStates(result);
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.lucene
} else if (min == 1) {
b = new Automaton();
b.copy(a);
} else {
List as = new ArrayList<>();
代码示例来源:origin: harbby/presto-connectors
} else if (min == 1) {
b = new Automaton();
b.copy(a);
} else {
List as = new ArrayList<>();