org.apache.calcite.util.Util.human()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(4.8k)|赞(0)|评价(0)|浏览(127)

本文整理了Java中org.apache.calcite.util.Util.human()方法的一些代码示例,展示了Util.human()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.human()方法的具体详情如下:
包路径:org.apache.calcite.util.Util
类名称:Util
方法名:human

Util.human介绍

[英]Converts a number into human-readable form, with 3 digits and a "K", "M" or "G" multiplier for thousands, millions or billions.

Examples: -2, 0, 1, 999, 1.00K, 1.99K, 3.45M, 4.56B.
[中]将数字转换为人类可读的形式,包括3位数字和“K”、“M”或“G”乘法器,用于数千、数百万或数十亿。
示例:-2,0,1999,1.00K,1.99K,3.45M,4.56B。

代码示例

代码示例来源:origin: Qihoo360/Quicksql

@Override public String toString() {
  return "LeafVertex(id: " + id
    + ", cost: " + Util.human(cost)
    + ", factors: " + factors
    + ", fieldOffset: " + fieldOffset
    + ")";
 }
}

代码示例来源:origin: Qihoo360/Quicksql

@Override public String toString() {
  return "JoinVertex(id: " + id
    + ", cost: " + Util.human(cost)
    + ", factors: " + factors
    + ", leftFactor: " + leftFactor
    + ", rightFactor: " + rightFactor
    + ")";
 }
}

代码示例来源:origin: org.apache.calcite/calcite-core

@Override public String toString() {
  return "LeafVertex(id: " + id
    + ", cost: " + Util.human(cost)
    + ", factors: " + factors
    + ", fieldOffset: " + fieldOffset
    + ")";
 }
}

代码示例来源:origin: org.apache.calcite/calcite-core

@Override public String toString() {
  return "JoinVertex(id: " + id
    + ", cost: " + Util.human(cost)
    + ", factors: " + factors
    + ", leftFactor: " + leftFactor
    + ", rightFactor: " + rightFactor
    + ")";
 }
}

代码示例来源:origin: Qihoo360/Quicksql

return "-" + human(-d);

代码示例来源:origin: org.apache.calcite/calcite-core

return "-" + human(-d);

代码示例来源:origin: Qihoo360/Quicksql

@Test public void testHuman() {
 assertThat(Util.human(0D), equalTo("0"));
 assertThat(Util.human(1D), equalTo("1"));
 assertThat(Util.human(19D), equalTo("19"));
 assertThat(Util.human(198D), equalTo("198"));
 assertThat(Util.human(1000D), equalTo("1.00K"));
 assertThat(Util.human(1002D), equalTo("1.00K"));
 assertThat(Util.human(1009D), equalTo("1.01K"));
 assertThat(Util.human(1234D), equalTo("1.23K"));
 assertThat(Util.human(1987D), equalTo("1.99K"));
 assertThat(Util.human(1999D), equalTo("2.00K"));
 assertThat(Util.human(86837.2D), equalTo("86.8K"));
 assertThat(Util.human(868372.8D), equalTo("868K"));
 assertThat(Util.human(1009000D), equalTo("1.01M"));
 assertThat(Util.human(1999999D), equalTo("2.00M"));
 assertThat(Util.human(1009000000D), equalTo("1.01G"));
 assertThat(Util.human(1999999000D), equalTo("2.00G"));
 assertThat(Util.human(-1D), equalTo("-1"));
 assertThat(Util.human(-19D), equalTo("-19"));
 assertThat(Util.human(-198D), equalTo("-198"));
 assertThat(Util.human(-1999999000D), equalTo("-2.00G"));
 assertThat(Util.human(0.18D), equalTo("0.18"));
 assertThat(Util.human(0.018D), equalTo("0.018"));
 assertThat(Util.human(0.0018D), equalTo("0.0018"));
 assertThat(Util.human(0.00018D), equalTo("1.8E-4"));
 assertThat(Util.human(0.000018D), equalTo("1.8E-5"));
 assertThat(Util.human(0.0000018D), equalTo("1.8E-6"));

代码示例来源:origin: org.apache.calcite/calcite-core

@Test public void testHuman() {
 assertThat(Util.human(0D), equalTo("0"));
 assertThat(Util.human(1D), equalTo("1"));
 assertThat(Util.human(19D), equalTo("19"));
 assertThat(Util.human(198D), equalTo("198"));
 assertThat(Util.human(1000D), equalTo("1.00K"));
 assertThat(Util.human(1002D), equalTo("1.00K"));
 assertThat(Util.human(1009D), equalTo("1.01K"));
 assertThat(Util.human(1234D), equalTo("1.23K"));
 assertThat(Util.human(1987D), equalTo("1.99K"));
 assertThat(Util.human(1999D), equalTo("2.00K"));
 assertThat(Util.human(86837.2D), equalTo("86.8K"));
 assertThat(Util.human(868372.8D), equalTo("868K"));
 assertThat(Util.human(1009000D), equalTo("1.01M"));
 assertThat(Util.human(1999999D), equalTo("2.00M"));
 assertThat(Util.human(1009000000D), equalTo("1.01G"));
 assertThat(Util.human(1999999000D), equalTo("2.00G"));
 assertThat(Util.human(-1D), equalTo("-1"));
 assertThat(Util.human(-19D), equalTo("-19"));
 assertThat(Util.human(-198D), equalTo("-198"));
 assertThat(Util.human(-1999999000D), equalTo("-2.00G"));
 assertThat(Util.human(0.18D), equalTo("0.18"));
 assertThat(Util.human(0.018D), equalTo("0.018"));
 assertThat(Util.human(0.0018D), equalTo("0.0018"));
 assertThat(Util.human(0.00018D), equalTo("1.8E-4"));
 assertThat(Util.human(0.000018D), equalTo("1.8E-5"));
 assertThat(Util.human(0.0000018D), equalTo("1.8E-6"));

相关文章