當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。