@Test public void compareTo() { DocTimestamp b_e = DocTimestamp.earliest; DocTimestamp b_l = DocTimestamp.latest; DocTimestamp b__l = DocTimestamp.latest; DocTimestamp b0 = new DocTimestamp( new BsonTimestamp(0)); DocTimestamp b1 = new DocTimestamp( new BsonTimestamp(1)); DocTimestamp b2 = new DocTimestamp( new BsonTimestamp(2)); DocTimestamp b_b = new DocTimestamp( new BsonTimestamp((int) (System.currentTimeMillis() / 1000) - 1, 0)); DocTimestamp bc = new DocTimestamp( new BsonTimestamp((int) (System.currentTimeMillis() / 1000) + 1, 0)); assertEquals(b_e.compareTo(b0), -1); assertEquals(b_l.compareTo(b_b), 1); assertEquals(b_l.compareTo(bc), -1); assertEquals(b_e.compareTo(b_l), -1); assertEquals(b_l.compareTo(b__l), 0); assertEquals(b0.compareTo(b2), -1); assertEquals(b1.compareTo(b2), -1); assertEquals(b2.compareTo(b0), 1); assertEquals(b2.compareTo(bc), -1); }
@Override public int compareTo(DocTimestamp o) { if (o == this) { return 0; } if (this == earliest) { return -1; } else if (o == earliest) { return 1; } return timestamp.compareTo(o.timestamp); }
DocTimestamp implements SyncInitMeta<DocTimestamp> { @Override public int compareTo(DocTimestamp o) { if (o == this) { return 0; } if (this == earliest) { return -1; } else if (o == earliest) { return 1; } return timestamp.compareTo(o.timestamp); } }
DocTimestamp implements SyncInitMeta<DocTimestamp> { @Override public int compareTo(DocTimestamp o) { if (o == this) { return 0; } if (this == earliest) { return -1; } else if (o == earliest) { return 1; } return timestamp.compareTo(o.timestamp); } DocTimestamp(BsonTimestamp data); }
DocTimestamp implements SyncInitMeta<DocTimestamp> { @Override public int compareTo(DocTimestamp o) { if (o == this) { return 0; } if (this == earliest) { return -1; } else if (o == earliest) { return 1; } return timestamp.compareTo(o.timestamp); } DocTimestamp(BsonTimestamp data); @Override int compareTo(DocTimestamp o); @Override String toString(); }
DocTimestamp implements SyncInitMeta<DocTimestamp> { @Override public int compareTo(DocTimestamp o) { if (o == this) { return 0; } if (this == earliest) { return -1; } else if (o == earliest) { return 1; } return timestamp.compareTo(o.timestamp); } DocTimestamp(BsonTimestamp data); @Override int compareTo(DocTimestamp o); @Override String toString(); static final DocTimestamp earliest; static final DocTimestamp latest; }