@Test public final void testCompareTo() { assertTrue(TS_1_1.compareTo(TS_1_1) == 0); assertTrue(TS_1_1.compareTo(new MastershipBasedTimestamp(1, 1)) == 0); assertTrue(TS_1_1.compareTo(TS_1_2) < 0); assertTrue(TS_1_2.compareTo(TS_1_1) > 0); assertTrue(TS_1_2.compareTo(TS_2_1) < 0); assertTrue(TS_1_2.compareTo(TS_2_2) < 0); assertTrue(TS_2_1.compareTo(TS_1_1) > 0); assertTrue(TS_2_2.compareTo(TS_1_1) > 0); }
@Override public int compareTo(Timestamp o) { checkArgument(o instanceof MastershipBasedTimestamp, "Must be MastershipBasedTimestamp", o); MastershipBasedTimestamp that = (MastershipBasedTimestamp) o; return ComparisonChain.start() .compare(this.termNumber, that.termNumber) .compare(this.sequenceNumber, that.sequenceNumber) .result(); }
MastershipBasedTimestamp implements Timestamp { @Override public int compareTo(Timestamp o) { checkArgument(o instanceof MastershipBasedTimestamp, "Must be MastershipBasedTimestamp", o); MastershipBasedTimestamp that = (MastershipBasedTimestamp) o; return ComparisonChain.start() .compare(this.termNumber, that.termNumber) .compare(this.sequenceNumber, that.sequenceNumber) .result(); } }
MastershipBasedTimestamp implements Timestamp { @Override public int compareTo(Timestamp o) { checkArgument(o instanceof MastershipBasedTimestamp, "Must be MastershipBasedTimestamp", o); MastershipBasedTimestamp that = (MastershipBasedTimestamp) o; return ComparisonChain.start() .compare(this.termNumber, that.termNumber) .compare(this.sequenceNumber, that.sequenceNumber) .result(); } protected  MastershipBasedTimestamp();  MastershipBasedTimestamp(long termNumber, long sequenceNumber); }
MastershipBasedTimestamp implements Timestamp { @Override public int compareTo(Timestamp o) { checkArgument(o instanceof MastershipBasedTimestamp, "Must be MastershipBasedTimestamp", o); MastershipBasedTimestamp that = (MastershipBasedTimestamp) o; return ComparisonChain.start() .compare(this.termNumber, that.termNumber) .compare(this.sequenceNumber, that.sequenceNumber) .result(); } protected  MastershipBasedTimestamp();  MastershipBasedTimestamp(long termNumber, long sequenceNumber); @Override int compareTo(Timestamp o); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString(); long termNumber(); long sequenceNumber(); }
MastershipBasedTimestamp implements Timestamp { @Override public int compareTo(Timestamp o) { checkArgument(o instanceof MastershipBasedTimestamp, "Must be MastershipBasedTimestamp", o); MastershipBasedTimestamp that = (MastershipBasedTimestamp) o; return ComparisonChain.start() .compare(this.termNumber, that.termNumber) .compare(this.sequenceNumber, that.sequenceNumber) .result(); } protected  MastershipBasedTimestamp();  MastershipBasedTimestamp(long termNumber, long sequenceNumber); @Override int compareTo(Timestamp o); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString(); long termNumber(); long sequenceNumber();  }