当前位置: 首页>>代码示例>>Java>>正文


Java ImmutableOpenMap.size方法代码示例

本文整理汇总了Java中org.elasticsearch.common.collect.ImmutableOpenMap.size方法的典型用法代码示例。如果您正苦于以下问题:Java ImmutableOpenMap.size方法的具体用法?Java ImmutableOpenMap.size怎么用?Java ImmutableOpenMap.size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.elasticsearch.common.collect.ImmutableOpenMap的用法示例。


在下文中一共展示了ImmutableOpenMap.size方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: randomClusterStateParts

import org.elasticsearch.common.collect.ImmutableOpenMap; //导入方法依赖的package包/类
/**
 * Takes an existing cluster state and randomly adds, removes or updates a cluster state part using randomPart generator.
 * If a new part is added the prefix value is used as a prefix of randomly generated part name.
 */
private <T> ClusterState randomClusterStateParts(ClusterState clusterState, String prefix, RandomClusterPart<T> randomPart) {
    ClusterState.Builder builder = ClusterState.builder(clusterState);
    ImmutableOpenMap<String, T> parts = randomPart.parts(clusterState);
    int partCount = parts.size();
    if (partCount > 0) {
        List<String> randomParts = randomSubsetOf(randomInt(partCount - 1), randomPart.parts(clusterState).keys().toArray(String.class));
        for (String part : randomParts) {
            if (randomBoolean()) {
                randomPart.remove(builder, part);
            } else {
                randomPart.put(builder, randomPart.randomChange(parts.get(part)));
            }
        }
    }
    int additionalPartCount = randomIntBetween(1, 20);
    for (int i = 0; i < additionalPartCount; i++) {
        String name = randomName(prefix);
        randomPart.put(builder, randomPart.randomCreate(name));
    }
    return builder.build();
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:26,代码来源:ClusterStateDiffIT.java

示例2: describeMismatchSafely

import org.elasticsearch.common.collect.ImmutableOpenMap; //导入方法依赖的package包/类
@Override
public void describeMismatchSafely(final ImmutableOpenMap map, final Description mismatchDescription) {
    if (map.size() == 0) {
        mismatchDescription.appendText("was empty");
    } else {
        mismatchDescription.appendText(" was ").appendValue(map);
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:9,代码来源:CollectionMatchers.java

示例3: averageUsage

import org.elasticsearch.common.collect.ImmutableOpenMap; //导入方法依赖的package包/类
/**
 * Returns a {@link DiskUsage} for the {@link RoutingNode} using the
 * average usage of other nodes in the disk usage map.
 * @param node Node to return an averaged DiskUsage object for
 * @param usages Map of nodeId to DiskUsage for all known nodes
 * @return DiskUsage representing given node using the average disk usage
 */
DiskUsage averageUsage(RoutingNode node, ImmutableOpenMap<String, DiskUsage> usages) {
    if (usages.size() == 0) {
        return new DiskUsage(node.nodeId(), node.node().getName(), "_na_", 0, 0);
    }
    long totalBytes = 0;
    long freeBytes = 0;
    for (ObjectCursor<DiskUsage> du : usages.values()) {
        totalBytes += du.value.getTotalBytes();
        freeBytes += du.value.getFreeBytes();
    }
    return new DiskUsage(node.nodeId(), node.node().getName(), "_na_", totalBytes / usages.size(), freeBytes / usages.size());
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:20,代码来源:DiskThresholdDecider.java

示例4: assertEmptyOrOnlyDefaultMappings

import org.elasticsearch.common.collect.ImmutableOpenMap; //导入方法依赖的package包/类
private void assertEmptyOrOnlyDefaultMappings(GetIndexResponse response, String indexName) {
    ImmutableOpenMap<String, ImmutableOpenMap<String, MappingMetaData>> mappings = response.mappings();
    assertThat(mappings, notNullValue());
    assertThat(mappings.size(), equalTo(1));
    ImmutableOpenMap<String, MappingMetaData> indexMappings = mappings.get(indexName);
    assertThat(indexMappings, notNullValue());
    assertThat(indexMappings.size(), anyOf(equalTo(0), equalTo(1)));
    if (indexMappings.size() == 1) {
        MappingMetaData mapping = indexMappings.get("_default_");
        assertThat(mapping, notNullValue());
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:13,代码来源:GetIndexIT.java

示例5: size

import org.elasticsearch.common.collect.ImmutableOpenMap; //导入方法依赖的package包/类
@Override
protected int size(ImmutableOpenMap<Integer, V> map) {
    return map.size();
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:5,代码来源:DiffableTests.java


注:本文中的org.elasticsearch.common.collect.ImmutableOpenMap.size方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。