MCPcopy Create free account
hub / github.com/amazon-ion/ion-java / checkFraction

Method checkFraction

src/main/java/com/amazon/ion/Timestamp.java:2949–2963  ·  view source on GitHub ↗
(Precision precision, BigDecimal fraction)

Source from the content-addressed store, hash-verified

2947 }
2948
2949 private static Precision checkFraction(Precision precision, BigDecimal fraction)
2950 {
2951 if (precision.includes(Precision.SECOND)) {
2952 if (fraction != null && (fraction.signum() == -1 || BigDecimal.ONE.compareTo(fraction) != 1)) {
2953 throw new IllegalArgumentException(String.format("Fractional seconds %s must be greater than or equal to 0 and less than 1", fraction));
2954 }
2955 }
2956 else {
2957 if (fraction != null) {
2958 throw new IllegalArgumentException("Fraction must be null for non-second precision: " + fraction);
2959 }
2960 }
2961
2962 return precision;
2963 }
2964}

Callers 2

TimestampMethod · 0.95

Calls 2

compareToMethod · 0.80
includesMethod · 0.45

Tested by

no test coverage detected