X-Git-Url: http://www2.svjatoslav.eu/gitweb/?p=sixth-3d.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Feu%2Fsvjatoslav%2Fsixth%2Fe3d%2Fgui%2FTextPointer.java;fp=src%2Fmain%2Fjava%2Feu%2Fsvjatoslav%2Fsixth%2Fe3d%2Fgui%2FTextPointer.java;h=91cd6e696c72f8d35ef2a0aead54e963c2f42b58;hp=67291f5a3b23022917ff6dff4012b03cab844267;hb=a2131986d65a769e3d589e4e0370d4af0ce10c38;hpb=ca3c5528af8dda8e30f1d698ef921f6443632f54 diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/gui/TextPointer.java b/src/main/java/eu/svjatoslav/sixth/e3d/gui/TextPointer.java index 67291f5..91cd6e6 100755 --- a/src/main/java/eu/svjatoslav/sixth/e3d/gui/TextPointer.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/gui/TextPointer.java @@ -4,6 +4,8 @@ */ package eu.svjatoslav.sixth.e3d.gui; +import static java.lang.Integer.compare; + /** * A pointer to a character in a text using row and column. *

@@ -49,20 +51,32 @@ public class TextPointer implements Comparable { return result; } + /** + * Compares this pointer to another pointer. + * + * @param textPointer The pointer to compare to. + * @return

+ */ @Override public int compareTo(final TextPointer textPointer) { - if (textPointer.row > row) + if (row < textPointer.row) return -1; - if (textPointer.row < row) + if (row > textPointer.row) return 1; - return Integer.compare(column, textPointer.column); - + return compare(column, textPointer.column); } /** - * Checks if this pointer is between the specified pointers. + * Checks if this pointer is between the argument pointers. + *

+ * This pointer is considered to be between the pointers if it is bigger or equal to the start pointer + * and smaller than the end pointer. * * @param start The start pointer. * @param end The end pointer.