本文整理汇总了Java中org.apache.lucene.util.RollingBuffer类的典型用法代码示例。如果您正苦于以下问题:Java RollingBuffer类的具体用法?Java RollingBuffer怎么用?Java RollingBuffer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RollingBuffer类属于org.apache.lucene.util包,在下文中一共展示了RollingBuffer类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: addHoles
import org.apache.lucene.util.RollingBuffer; //导入依赖的package包/类
private static void addHoles(Automaton.Builder builder, RollingBuffer<Position> positions, int pos) {
Position posData = positions.get(pos);
Position prevPosData = positions.get(pos-1);
while(posData.arriving == -1 || prevPosData.leaving == -1) {
if (posData.arriving == -1) {
posData.arriving = builder.createState();
builder.addTransition(posData.arriving, posData.leaving, POS_SEP);
}
if (prevPosData.leaving == -1) {
if (pos == 1) {
prevPosData.leaving = 0;
} else {
prevPosData.leaving = builder.createState();
}
if (prevPosData.arriving != -1) {
builder.addTransition(prevPosData.arriving, prevPosData.leaving, POS_SEP);
}
}
builder.addTransition(prevPosData.leaving, posData.arriving, HOLE);
pos--;
if (pos <= 0) {
break;
}
posData = prevPosData;
prevPosData = positions.get(pos-1);
}
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:29,代码来源:TokenStreamToAutomaton.java
示例2: addHoles
import org.apache.lucene.util.RollingBuffer; //导入依赖的package包/类
private static void addHoles(State startState, RollingBuffer<Position> positions, int pos) {
Position posData = positions.get(pos);
Position prevPosData = positions.get(pos-1);
while(posData.arriving == null || prevPosData.leaving == null) {
if (posData.arriving == null) {
posData.arriving = new State();
posData.arriving.addTransition(new Transition(POS_SEP, posData.leaving));
}
if (prevPosData.leaving == null) {
if (pos == 1) {
prevPosData.leaving = startState;
} else {
prevPosData.leaving = new State();
}
if (prevPosData.arriving != null) {
prevPosData.arriving.addTransition(new Transition(POS_SEP, prevPosData.leaving));
}
}
prevPosData.leaving.addTransition(new Transition(HOLE, posData.arriving));
pos--;
if (pos <= 0) {
break;
}
posData = prevPosData;
prevPosData = positions.get(pos-1);
}
}
开发者ID:pkarmstr,项目名称:NYBC,代码行数:29,代码来源:TokenStreamToAutomaton.java
注:本文中的org.apache.lucene.util.RollingBuffer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论