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

Method compareTo

src/main/java/com/amazon/ion/Timestamp.java:2767–2783  ·  view source on GitHub ↗

Performs a comparison of the two points in time represented by two Timestamps. If the point in time represented by this Timestamp precedes that of t, then -1 is returned. If t precedes this Timestamp then 1 is returned. If the Timestamps represent the same point in ti

(Timestamp t)

Source from the content-addressed store, hash-verified

2765 * @see #equals(Timestamp)
2766 */
2767 public int compareTo(Timestamp t)
2768 {
2769 // Test at millisecond precision first.
2770 long this_millis = this.getMillis();
2771 long arg_millis = t.getMillis();
2772 if (this_millis != arg_millis) {
2773 return (this_millis < arg_millis) ? -1 : 1;
2774 }
2775
2776 // Values are equivalent at millisecond precision, so compare fraction
2777
2778 BigDecimal this_fraction =
2779 ((this._fraction == null) ? BigDecimal.ZERO : this._fraction);
2780 BigDecimal arg_fraction =
2781 (( t._fraction == null) ? BigDecimal.ZERO : t._fraction);
2782 return this_fraction.compareTo(arg_fraction);
2783 }
2784
2785
2786 /**

Callers 15

checkWithLocalOffsetMethod · 0.95
checkEquivalenceMethod · 0.95
compareMethod · 0.80
checkTimestampMethod · 0.80
notEqualButSameTimeMethod · 0.80
testNegativeZeroMethod · 0.80
testBigDecimalsMethod · 0.80
testDoubleEqualityMethod · 0.80
validateIonIntMethod · 0.80
TimestampMethod · 0.80

Calls 2

getMillisMethod · 0.95
getMillisMethod · 0.65

Tested by 10

checkWithLocalOffsetMethod · 0.76
checkEquivalenceMethod · 0.76
checkTimestampMethod · 0.64
notEqualButSameTimeMethod · 0.64
testNegativeZeroMethod · 0.64
testBigDecimalsMethod · 0.64
testDoubleEqualityMethod · 0.64
validateIonIntMethod · 0.64