本文整理匯總了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();
}