@Test public void test_compareTo() { assertThat(new TextPointerImpl(1, 2).compareTo(new TextPointerImpl(1, 2))).isEqualTo(0); assertThat(new TextPointerImpl(1, 2).compareTo(new TextPointerImpl(1, 4))).isEqualTo(-1); assertThat(new TextPointerImpl(1, 2).compareTo(new TextPointerImpl(2, 1))).isEqualTo(-1); assertThat(new TextPointerImpl(1, 2).compareTo(new TextPointerImpl(1, 1))).isEqualTo(1); }
@Override public int compareTo(TextPointer other) { int lineCompare = Integer.compare(this.line(), other.line()); if (lineCompare != 0) { return lineCompare; } return Integer.compare(this.lineOffset(), other.lineOffset()); }
TextPointerImpl implements TextPointer { @Override public int compareTo(TextPointer other) { int lineCompare = Integer.compare(this.line(), other.line()); if (lineCompare != 0) { return lineCompare; } return Integer.compare(this.lineOffset(), other.lineOffset()); } }
TextPointerImpl implements TextPointer { @Override public int compareTo(TextPointer other) { int lineCompare = Integer.compare(this.line(), other.line()); if (lineCompare != 0) { return lineCompare; } return Integer.compare(this.lineOffset(), other.lineOffset()); } TextPointerImpl(int line, int lineOffset); }
TextPointerImpl implements TextPointer { @Override public int compareTo(TextPointer other) { int lineCompare = Integer.compare(this.line(), other.line()); if (lineCompare != 0) { return lineCompare; } return Integer.compare(this.lineOffset(), other.lineOffset()); } TextPointerImpl(int line, int lineOffset); @Override int line(); @Override int lineOffset(); @Override int compareTo(TextPointer other); @Override boolean equals(Object o); @Override int hashCode(); }
TextPointerImpl implements TextPointer { @Override public int compareTo(TextPointer other) { int lineCompare = Integer.compare(this.line(), other.line()); if (lineCompare != 0) { return lineCompare; } return Integer.compare(this.lineOffset(), other.lineOffset()); } TextPointerImpl(int line, int lineOffset); @Override int line(); @Override int lineOffset(); @Override int compareTo(TextPointer other); @Override boolean equals(Object o); @Override int hashCode();  }