项目:bazel
文件:ProfileInfo.java
/**
* Collects all Skylark function tasks. Must be called before calling
* {@link #getSkylarkUserFunctionTasks} and {@link #getSkylarkBuiltinFunctionTasks}.
*/
private void calculateSkylarkStatistics() {
userFunctions = ListMultimapBuilder.treeKeys().arrayListValues().build();
compiledUserFunctions = ListMultimapBuilder.treeKeys().arrayListValues().build();
builtinFunctions = ListMultimapBuilder.treeKeys().arrayListValues().build();
for (Task task : allTasksById) {
if (task.type == ProfilerTask.SKYLARK_BUILTIN_FN) {
builtinFunctions.put(task.getDescription(),task);
} else if (task.type == ProfilerTask.SKYLARK_USER_FN) {
userFunctions.put(task.getDescription(),task);
} else if (task.type == ProfilerTask.SKYLARK_USER_COMPILED_FN) {
compiledUserFunctions.put(task.getDescription(),task);
}
}
}
项目:lumen-kb
文件:YagoEntityByLabelCacheStore.java
@Override
public void loadAll(GridCacheTx tx,Collection<? extends String> keys,GridBiInClosure<String,ListMultimap<String,String>> c) throws GridException {
ImmutableMap<? extends String,String>> resultMap = Maps.toMap(keys,(it) -> ListMultimapBuilder.<String,String>hashKeys().arrayListValues().build());
String quoteds = Joiner.on('|').join( keys.stream().map((it) -> Pattern.quote(it)).collect(Collectors.toList()) );
Pattern pattern = Pattern.compile("^(" + quoteds + ")$",Pattern.CASE_INSENSITIVE);
ImmutableList<ImmutableMap<String,Pattern>> crits = ImmutableList.of(
ImmutableMap.of("p",pattern),ImmutableMap.of("l",ImmutableMap.of("m",ImmutableMap.of("g",ImmutableMap.of("f",pattern) );
BasicDBObject crit = new BasicDBObject("$or",crits);
log.debug("Finding {} : {}",keys,crit);
try (DBCursor cursor = labelColl.find(crit).setReadPreference(ReadPreference.secondaryPreferred())) {
for (DBObject dbo : cursor) {
String entityId = (String) dbo.get("_id");
final YagoLabel label = toYagoLabel(dbo);
for (String key : keys) {
final ListMultimap<String,String> labelResult = resultMap.get(key);
if (label.getPreferredMeaningLabels() != null && label.getPreferredMeaningLabels().stream().anyMatch( (it) -> it.equalsIgnoreCase(key) )) {
log.debug("{} isPreferredMeaningOf {}",entityId,key);
// if has isPreferredMeaningOf,then this entity is prioritized for this label
labelResult.get("_").remove(entityId);
labelResult.get("_").add(0,entityId);
} else if (!labelResult.get("_").contains(entityId)) {
if (StringUtils.equalsIgnoreCase(key,label.getPrefLabel()) ||
label.getLabels().stream().anyMatch( (it) -> it.equalsIgnoreCase(key) ) ||
StringUtils.equalsIgnoreCase(key,label.getGivenname()) ||
StringUtils.equalsIgnoreCase(key,label.getFamilyName()) ) {
labelResult.get("_").add(entityId);
}
}
}
}
}
resultMap.forEach(c::apply);
}
项目:NucleusFramework
文件:PlayerListMultimap.java
/**
* Constructor.
*
* @param plugin The owning plugin.
*/
public PlayerListMultimap(Plugin plugin) {
super(plugin);
_map = ListMultimapBuilder.hashKeys().arrayListValues().build();
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。