本文整理汇总了Java中org.apache.commons.collections.bidimap.TreeBidiMap类的典型用法代码示例。如果您正苦于以下问题:Java TreeBidiMap类的具体用法?Java TreeBidiMap怎么用?Java TreeBidiMap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TreeBidiMap类属于org.apache.commons.collections.bidimap包,在下文中一共展示了TreeBidiMap类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: parseSpringSchemas
import org.apache.commons.collections.bidimap.TreeBidiMap; //导入依赖的package包/类
private Map<String, String> parseSpringSchemas(String springSchemasContent) {
BidiMap schemaUrlsAndFileNames = new TreeBidiMap();
for (String line : springSchemasContent.split("\n")) {
if (line != null && !line.startsWith("#") && line.contains("=")) {
String url = line.substring(0, line.indexOf("=")).replaceAll("\\\\", "");
String fileName = line.substring(line.indexOf("=") + 1);
if (schemaUrlsAndFileNames.containsValue(fileName)) {
if (url.contains("current")) { //Avoid duplicates and prefer URL with "current"
schemaUrlsAndFileNames.removeValue(fileName);
schemaUrlsAndFileNames.put(url, fileName);
}
} else {
schemaUrlsAndFileNames.put(url, fileName);
}
}
}
return schemaUrlsAndFileNames;
}
开发者ID:machaval,项目名称:mule-intellij-plugins,代码行数:20,代码来源:MuleSchemaProvider.java
示例2: extractAnnotationSpans
import org.apache.commons.collections.bidimap.TreeBidiMap; //导入依赖的package包/类
public static AnnotationSpans extractAnnotationSpans(JCas jCas)
{
BidiMap sentenceBeginIndexToCharacterIndex = new TreeBidiMap();
BidiMap sentenceEndIndexToCharacterIndex = new TreeBidiMap();
List<Sentence> sentences = new ArrayList<>(JCasUtil.select(jCas, Sentence.class));
for (int i = 0; i < sentences.size(); i++) {
Sentence sentence = sentences.get(i);
sentenceBeginIndexToCharacterIndex.put(i, sentence.getBegin());
sentenceEndIndexToCharacterIndex.put(i, sentence.getEnd());
}
// System.out.println(sentenceBeginIndexToCharacterIndex);
// System.out.println(sentenceEndIndexToCharacterIndex);
AnnotationSpans annotationSpans = new AnnotationSpans(
sentenceBeginIndexToCharacterIndex.size());
Collection<ArgumentComponent> components = JCasUtil.select(jCas, ArgumentComponent.class);
for (ArgumentComponent component : components) {
if (!ArgumentUnitUtils.isImplicit(component)) {
// System.out.println("=====");
// System.out.println(component.getCoveredText());
int relativeOffset = (int) sentenceBeginIndexToCharacterIndex
.getKey(component.getBegin());
int endingSentenceIndex = (int) sentenceEndIndexToCharacterIndex
.getKey(component.getEnd());
int length = endingSentenceIndex - relativeOffset + 1;
String type = component.getType().getShortName();
SingleAnnotationSpan singleAnnotationSpan = new SingleAnnotationSpan(type,
relativeOffset, length);
annotationSpans.getAnnotationSpans().add(singleAnnotationSpan);
}
}
return annotationSpans;
}
开发者ID:UKPLab,项目名称:argument-reasoning-comprehension-task,代码行数:45,代码来源:AnnotationSpans.java
注:本文中的org.apache.commons.collections.bidimap.TreeBidiMap类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论