本文整理汇总了Java中org.apache.lucene.util.fst.FST.Arc.isFinal方法的典型用法代码示例。如果您正苦于以下问题:Java Arc.isFinal方法的具体用法?Java Arc.isFinal怎么用?Java Arc.isFinal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.lucene.util.fst.FST.Arc
的用法示例。
在下文中一共展示了Arc.isFinal方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: get
import org.apache.lucene.util.fst.FST.Arc; //导入方法依赖的package包/类
/**
* Returns the value mapped to the given key or <code>null</code> if the key is not in the FST dictionary.
*/
public BytesRef get(char[] buffer, int bufferLen, Arc<BytesRef> scratchArc, BytesReader fstReader) throws IOException {
BytesRef pendingOutput = fst.outputs.getNoOutput();
BytesRef matchOutput = null;
int bufUpto = 0;
fst.getFirstArc(scratchArc);
while (bufUpto < bufferLen) {
final int codePoint = Character.codePointAt(buffer, bufUpto, bufferLen);
if (fst.findTargetArc(ignoreCase ? Character.toLowerCase(codePoint) : codePoint, scratchArc, scratchArc, fstReader) == null) {
return null;
}
pendingOutput = fst.outputs.add(pendingOutput, scratchArc.output);
bufUpto += Character.charCount(codePoint);
}
if (scratchArc.isFinal()) {
matchOutput = fst.outputs.add(pendingOutput, scratchArc.nextFinalOutput);
}
return matchOutput;
}
示例2: get
import org.apache.lucene.util.fst.FST.Arc; //导入方法依赖的package包/类
/**
* Returns the weight associated with an input string,
* or null if it does not exist.
*/
public Object get(CharSequence key) {
if (fst == null) {
return null;
}
Arc<Long> arc = new Arc<>();
Long result = null;
try {
result = lookupPrefix(new BytesRef(key), arc);
} catch (IOException bogus) { throw new RuntimeException(bogus); }
if (result == null || !arc.isFinal()) {
return null;
} else {
return Integer.valueOf(decodeWeight(result + arc.nextFinalOutput));
}
}
示例3: get
import org.apache.lucene.util.fst.FST.Arc; //导入方法依赖的package包/类
/**
* Returns the weight associated with an input string,
* or null if it does not exist.
*/
public Object get(CharSequence key) {
if (fst == null) {
return null;
}
Arc<Long> arc = new Arc<Long>();
Long result = null;
try {
result = lookupPrefix(new BytesRef(key), arc);
} catch (IOException bogus) { throw new RuntimeException(bogus); }
if (result == null || !arc.isFinal()) {
return null;
} else {
return Integer.valueOf(decodeWeight(result + arc.nextFinalOutput));
}
}