本文整理了Java中org.apache.brooklyn.util.text.Strings.ies()
方法的一些代码示例,展示了Strings.ies()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Strings.ies()
方法的具体详情如下:
包路径:org.apache.brooklyn.util.text.Strings
类名称:Strings
方法名:ies
[英]returns "ies" if the argument is not 1, "y" otherwise; useful when constructing plurals
[中]如果参数不是1,则返回“y”,否则返回“y”;在构造复数时很有用
代码示例来源:origin: org.apache.brooklyn/brooklyn-utils-common
/** as {@link #ies(int)} based on size of argument */
public static String ies(Iterable<?> x) {
if (x==null) return ies(0);
return ies(x.iterator());
}
/** as {@link #ies(int)} based on size of argument */
代码示例来源:origin: org.apache.brooklyn/brooklyn-utils-common
/** as {@link #ies(int)} based on size of argument */
public static String ies(@Nullable Map<?,?> x) {
return ies(x==null ? 0 : x.size());
}
/** as {@link #ies(int)} based on size of argument */
代码示例来源:origin: org.apache.brooklyn/brooklyn-utils-common
/** as {@link #ies(int)} based on size of argument */
public static String ies(Iterator<?> x) {
int count = 0;
if (x==null || !x.hasNext()) {}
else {
x.next(); count++;
if (x.hasNext()) count++;
}
return ies(count);
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-core
@Beta
protected MultiBuilder(Iterable<? extends Entity> sources, AttributeSensor<T> sensor, Predicate<? super T> readiness) {
builder = new Builder<T,V>(null, sensor);
builder.readiness(readiness);
for (Entity s : checkNotNull(sources, "sources")) {
multiSource.add(new AttributeAndSensorCondition<T>(s, sensor, readiness));
}
this.name = "waiting on "+sensor.getName();
this.descriptionBase = "waiting on "+sensor.getName()+" "+readiness
+" from "+Iterables.size(sources)+" entit"+Strings.ies(sources);
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-core
protected Object computeServiceProblems() {
Map<Entity, Lifecycle> values = getValues(SERVICE_STATE_ACTUAL);
int numRunning=0;
List<Entity> onesNotHealthy=MutableList.of();
Set<Lifecycle> ignoreStates = getConfig(IGNORE_ENTITIES_WITH_THESE_SERVICE_STATES);
for (Map.Entry<Entity,Lifecycle> state: values.entrySet()) {
if (state.getValue()==Lifecycle.RUNNING) numRunning++;
else if (!ignoreStates.contains(state.getValue()))
onesNotHealthy.add(state.getKey());
}
QuorumCheck qc = getConfig(RUNNING_QUORUM_CHECK);
if (qc!=null) {
if (qc.isQuorate(numRunning, onesNotHealthy.size()+numRunning))
// quorate
return null;
if (onesNotHealthy.isEmpty())
return "Not enough entities running to be quorate";
} else {
if (onesNotHealthy.isEmpty())
return null;
}
return "Required entit"+Strings.ies(onesNotHealthy.size())+" not healthy: "+
(onesNotHealthy.size()>3 ? nameOfEntity(onesNotHealthy.get(0))+" and "+(onesNotHealthy.size()-1)+" others"
: Strings.join(nameOfEntity(onesNotHealthy), ", "));
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-core
allExceptions.add(new IllegalStateException("Missing referenced entit" + Strings.ies(missingEntities) + ": " + missingEntities));
allExceptions.add(new IllegalStateException("Missing referenced polic" + Strings.ies(missingPolicies) + ": " + ": " + missingPolicies));
代码示例来源:origin: org.apache.brooklyn/brooklyn-core
protected void finishingUp() {
checkContinuingPhase(8);
if (!isEmpty) {
BrooklynLogging.log(LOG, shouldLogRebinding() ? LoggingLevel.INFO : LoggingLevel.DEBUG,
"Rebind complete " + "("+mode+(readOnlyRebindCount.get()>=0 ? ", iteration "+readOnlyRebindCount : "")+")" +
" in {}: {} app{}, {} entit{}, {} location{}, {} polic{}, {} enricher{}, {} feed{}, {} catalog item{}",
Time.makeTimeStringRounded(timer), applications.size(), Strings.s(applications),
rebindContext.getEntities().size(), Strings.ies(rebindContext.getEntities()),
rebindContext.getLocations().size(), Strings.s(rebindContext.getLocations()),
rebindContext.getPolicies().size(), Strings.ies(rebindContext.getPolicies()),
rebindContext.getEnrichers().size(), Strings.s(rebindContext.getEnrichers()),
rebindContext.getFeeds().size(), Strings.s(rebindContext.getFeeds()),
rebindContext.getCatalogItems().size(), Strings.s(rebindContext.getCatalogItems())
);
}
// Return the top-level applications
logRebindingDebug("RebindManager complete; apps: {}", getMementoRootEntities());
}
内容来源于网络,如有侵权,请联系作者删除!