本文整理汇总了Java中org.elasticsearch.common.Strings.format1Decimals方法的典型用法代码示例。如果您正苦于以下问题:Java Strings.format1Decimals方法的具体用法?Java Strings.format1Decimals怎么用?Java Strings.format1Decimals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.elasticsearch.common.Strings
的用法示例。
在下文中一共展示了Strings.format1Decimals方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toString
import org.elasticsearch.common.Strings; //导入方法依赖的package包/类
@Override
public String toString() {
long bytes = getBytes();
double value = bytes;
String suffix = "b";
if (bytes >= ByteSizeUnit.C5) {
value = getPbFrac();
suffix = "pb";
} else if (bytes >= ByteSizeUnit.C4) {
value = getTbFrac();
suffix = "tb";
} else if (bytes >= ByteSizeUnit.C3) {
value = getGbFrac();
suffix = "gb";
} else if (bytes >= ByteSizeUnit.C2) {
value = getMbFrac();
suffix = "mb";
} else if (bytes >= ByteSizeUnit.C1) {
value = getKbFrac();
suffix = "kb";
}
return Strings.format1Decimals(value, suffix);
}
示例2: toString
import org.elasticsearch.common.Strings; //导入方法依赖的package包/类
@Override
public String toString() {
long singles = singles();
double value = singles;
String suffix = "";
if (singles >= SizeUnit.C5) {
value = petaFrac();
suffix = "p";
} else if (singles >= SizeUnit.C4) {
value = teraFrac();
suffix = "t";
} else if (singles >= SizeUnit.C3) {
value = gigaFrac();
suffix = "g";
} else if (singles >= SizeUnit.C2) {
value = megaFrac();
suffix = "m";
} else if (singles >= SizeUnit.C1) {
value = kiloFrac();
suffix = "k";
}
return Strings.format1Decimals(value, suffix);
}
示例3: toString
import org.elasticsearch.common.Strings; //导入方法依赖的package包/类
@Override
public String toString() {
long bytes = bytes();
double value = bytes;
String suffix = "b";
if (bytes >= ByteSizeUnit.C5) {
value = pbFrac();
suffix = "pb";
} else if (bytes >= ByteSizeUnit.C4) {
value = tbFrac();
suffix = "tb";
} else if (bytes >= ByteSizeUnit.C3) {
value = gbFrac();
suffix = "gb";
} else if (bytes >= ByteSizeUnit.C2) {
value = mbFrac();
suffix = "mb";
} else if (bytes >= ByteSizeUnit.C1) {
value = kbFrac();
suffix = "kb";
}
return Strings.format1Decimals(value, suffix);
}
示例4: toString
import org.elasticsearch.common.Strings; //导入方法依赖的package包/类
/**
* Returns a {@link String} representation of the current {@link TimeValue}.
*
* Note that this method might produce fractional time values (ex 1.6m) which cannot be
* parsed by method like {@link TimeValue#parse(String, String, int)}.
*/
@Override
public String toString() {
if (duration < 0) {
return Long.toString(duration);
}
long nanos = nanos();
if (nanos == 0) {
return "0s";
}
double value = nanos;
String suffix = "nanos";
if (nanos >= C6) {
value = daysFrac();
suffix = "d";
} else if (nanos >= C5) {
value = hoursFrac();
suffix = "h";
} else if (nanos >= C4) {
value = minutesFrac();
suffix = "m";
} else if (nanos >= C3) {
value = secondsFrac();
suffix = "s";
} else if (nanos >= C2) {
value = millisFrac();
suffix = "ms";
} else if (nanos >= C1) {
value = microsFrac();
suffix = "micros";
}
return Strings.format1Decimals(value, suffix);
}
示例5: toString
import org.elasticsearch.common.Strings; //导入方法依赖的package包/类
@Override
public String toString() {
if (duration < 0) {
return Long.toString(duration);
}
long nanos = nanos();
if (nanos == 0) {
return "0s";
}
double value = nanos;
String suffix = "nanos";
if (nanos >= C6) {
value = daysFrac();
suffix = "d";
} else if (nanos >= C5) {
value = hoursFrac();
suffix = "h";
} else if (nanos >= C4) {
value = minutesFrac();
suffix = "m";
} else if (nanos >= C3) {
value = secondsFrac();
suffix = "s";
} else if (nanos >= C2) {
value = millisFrac();
suffix = "ms";
} else if (nanos >= C1) {
value = microsFrac();
suffix = "micros";
}
return Strings.format1Decimals(value, suffix);
}
示例6: toString
import org.elasticsearch.common.Strings; //导入方法依赖的package包/类
@Override
public String toString() {
return "[" + nodeId + "][" + nodeName + "][" + path + "] free: " + new ByteSizeValue(getFreeBytes()) +
"[" + Strings.format1Decimals(getFreeDiskAsPercentage(), "%") + "]";
}