MCPcopy Create free account
hub / github.com/apache/calcite / round

Method round

core/src/main/java/org/apache/calcite/util/TimeString.java:176–187  ·  view source on GitHub ↗
(int precision)

Source from the content-addressed store, hash-verified

174 }
175
176 public TimeString round(int precision) {
177 checkArgument(precision >= 0);
178 int targetLength = 9 + precision;
179 if (v.length() <= targetLength) {
180 return this;
181 }
182 String v = this.v.substring(0, targetLength);
183 while (v.length() >= 9 && (v.endsWith("0") || v.endsWith("."))) {
184 v = v.substring(0, v.length() - 1);
185 }
186 return new TimeString(v);
187 }
188 public int getMillisOfDay() {
189 int h = Integer.valueOf(v.substring(0, 2));
190 int m = Integer.valueOf(v.substring(3, 5));

Callers 3

testTimeStringMethod · 0.95
testTimeLiteralMethod · 0.95
toStringMethod · 0.95

Calls 3

substringMethod · 0.80
endsWithMethod · 0.65
lengthMethod · 0.45

Tested by 2

testTimeStringMethod · 0.76
testTimeLiteralMethod · 0.76