本文整理汇总了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();
}
示例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);
}
}
示例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());
}
示例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());
}
}
示例5: size
import org.elasticsearch.common.collect.ImmutableOpenMap; //导入方法依赖的package包/类
@Override
protected int size(ImmutableOpenMap<Integer, V> map) {
return map.size();
}