MCPcopy Create free account
hub / github.com/MenoData/Time4J / apply

Method apply

base/src/main/java/net/time4j/FractionOperator.java:70–92  ·  view source on GitHub ↗
(T entity)

Source from the content-addressed store, hash-verified

68 //~ Methoden ----------------------------------------------------------
69
70 @Override
71 public T apply(T entity) {
72
73 if (this.fraction == '9') {
74 return entity;
75 }
76
77 int nano = entity.get(NANO_OF_SECOND);
78 int max = entity.getMaximum(NANO_OF_SECOND);
79
80 switch (this.fraction) {
81 case '3':
82 nano = (nano / MIO) * MIO + (this.up ? 999999 : 0);
83 return entity.with(NANO_OF_SECOND, Math.min(max, nano));
84 case '6':
85 nano = (nano / KILO) * KILO + (this.up ? 999 : 0);
86 return entity.with(NANO_OF_SECOND, Math.min(max, nano));
87 default:
88 throw new UnsupportedOperationException(
89 "Unknown: " + this.fraction);
90 }
91
92 }
93
94}

Callers

nothing calls this directly

Calls 4

getMethod · 0.65
getMaximumMethod · 0.65
withMethod · 0.65
minMethod · 0.45

Tested by

no test coverage detected