本文整理汇总了Java中com.google.common.collect.ImmutableMap.isEmpty方法的典型用法代码示例。如果您正苦于以下问题:Java ImmutableMap.isEmpty方法的具体用法?Java ImmutableMap.isEmpty怎么用?Java ImmutableMap.isEmpty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.common.collect.ImmutableMap
的用法示例。
在下文中一共展示了ImmutableMap.isEmpty方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: finish
import com.google.common.collect.ImmutableMap; //导入方法依赖的package包/类
@Override
public void finish() throws IOException {
final ImmutableMap<Symbol, Double> scores = this.scores.build();
final ImmutableMap<Symbol, Integer> falsePositives = this.falsePositives.build();
final ImmutableMap<Symbol, Integer> truePositives = this.truePositives.build();
final ImmutableMap<Symbol, Integer> falseNegatives = this.falseNegatives.build();
// see guidelines section 7.3.1.1.3 for aggregating rules:
outputDir.mkdirs();
final double meanScore = scores.isEmpty()?Double.NaN:DoubleMath.mean(scores.values());
Files.asCharSink(new File(outputDir, "linearScore.txt"), Charsets.UTF_8)
.write(Double.toString(meanScore));
for (final Symbol queryId : scores.keySet()) {
final File queryDir = new File(outputDir, queryId.asString());
queryDir.mkdirs();
final File queryScoreFile = new File(queryDir, "score.txt");
// avoid dividing by zero
final double normalizer = Math.max(truePositives.get(queryId) + falseNegatives.get(queryId), 1);
// see guidelines referenced above
// pretends that the corpus is a single document
Files.asCharSink(queryScoreFile, Charsets.UTF_8).write(String
.format(SCORE_PATTERN, truePositives.get(queryId), falsePositives.get(queryId),
falseNegatives.get(queryId), 100 * scores.get(queryId) / normalizer));
}
}
示例2: isHostNet
import com.google.common.collect.ImmutableMap; //导入方法依赖的package包/类
/**
* 容器网络模式是否为host模式
* @param containerId
* @return
*/
public static boolean isHostNet(String containerId){
String cacheKey = "isHostNet" + containerId;
Boolean v = (Boolean) getCache(cacheKey);
if (v != null){
return v;
}
Boolean value = false;
try {
ContainerInfo containerInfo = getContainerInfo(containerId);
if (containerInfo != null) {
ImmutableMap<String, AttachedNetwork> networks = containerInfo.networkSettings().networks();
if (networks != null && !networks.isEmpty()){
value = networks.get("host") != null && StringUtils.isNotEmpty(networks.get("host").ipAddress());
setCache(cacheKey,value);
}else {
log.warn("容器{}无Networks配置",containerInfo.name());
}
}
} catch (Exception e) {
log.error("",e);
}
return value;
}
示例3: process
import com.google.common.collect.ImmutableMap; //导入方法依赖的package包/类
@Override
public MultiLayerModel process(ImmutableMap<String, String> customData)
{
ImmutableMap.Builder<Optional<BlockRenderLayer>, ModelResourceLocation> builder = ImmutableMap.builder();
for(String key : customData.keySet())
{
if("base".equals(key))
{
builder.put(Optional.<BlockRenderLayer>absent(), getLocation(customData.get(key)));
}
for(BlockRenderLayer layer : BlockRenderLayer.values())
{
if(layer.toString().equals(key))
{
builder.put(Optional.of(layer), getLocation(customData.get(key)));
}
}
}
ImmutableMap<Optional<BlockRenderLayer>, ModelResourceLocation> models = builder.build();
if(models.isEmpty()) return INSTANCE;
return new MultiLayerModel(models);
}
示例4: handleResponseSetIDs
import com.google.common.collect.ImmutableMap; //导入方法依赖的package包/类
@Override
protected void handleResponseSetIDs(final ResponseLinking.Builder responseLinking,
final ImmutableSet<ResponseSet> responseSets,
final ImmutableMap<String, ResponseSet> responseIDs,
final Optional<ImmutableMap.Builder<String, String>> foreignLinkingIdToLocal)
throws IOException {
if (!responseIDs.isEmpty()) {
throw new IOException("IDs not allowed in 2014 linking format");
}
}
示例5: getContainerIp
import com.google.common.collect.ImmutableMap; //导入方法依赖的package包/类
/**
* 获取容器IP地址
* @param containerId
* 容器ID
* @return
* 1、获取失败返回null
* 2、host网络模式直接返回宿主机IP
*/
public static String getContainerIp(String containerId){
String cacheKey = "containerIp" + containerId;
String v = (String) getCache(cacheKey);
if (StringUtils.isNotEmpty(v)) {
return v;
}
try {
if (isHostNet(containerId)){
return HostUtil.getHostIp();
}
ContainerInfo containerInfo = getContainerInfo(containerId);
if (containerInfo != null) {
ImmutableMap<String, AttachedNetwork> networks = containerInfo.networkSettings().networks();
if (networks != null && !networks.isEmpty()){
String ip = networks.get(networks.keySet().asList().get(0)).ipAddress();
setCache(cacheKey,ip);
return ip;
}else {
log.warn("容器{}无Networks配置",containerInfo.name());
}
}
} catch (Exception e) {
log.error("",e);
}
return null;
}
示例6: createState
import com.google.common.collect.ImmutableMap; //导入方法依赖的package包/类
@Override
protected StateImplementation createState(Block block, ImmutableMap<IProperty<?>, Comparable<?>> properties, ImmutableMap<IUnlistedProperty<?>, Optional<?>> unlistedProperties)
{
if (unlistedProperties == null || unlistedProperties.isEmpty()) return super.createState(block, properties, unlistedProperties);
return new ExtendedStateImplementation(block, properties, unlistedProperties, null);
}