X-Git-Url: http://www2.svjatoslav.eu/gitweb/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Feu%2Fsvjatoslav%2Fsixth%2Fe3d%2Fgui%2FTextPointer.java;h=91cd6e696c72f8d35ef2a0aead54e963c2f42b58;hb=HEAD;hp=7e2bf74a6ab66282497c65e0590c3e2e33b6e9db;hpb=8aa50f568d2edcfe974ceed4192158951e7f3215;p=sixth-3d.git 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 7e2bf74..91cd6e6 100755 --- a/src/main/java/eu/svjatoslav/sixth/e3d/gui/TextPointer.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/gui/TextPointer.java @@ -1,15 +1,27 @@ /* - * Sixth 3D engine. Author: Svjatoslav Agejenko. + * Sixth 3D engine. Author: Svjatoslav Agejenko. * This project is released under Creative Commons Zero (CC0) license. */ package eu.svjatoslav.sixth.e3d.gui; +import static java.lang.Integer.compare; + /** - * A pointer to a character in a text. + * A pointer to a character in a text using row and column. + *
+ * It can be used to represent a cursor position in a text.
+ * Also, it can be used to represent beginning and end of a selection.
*/
public class TextPointer implements Comparable
+ * 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.
+ * @param start The start pointer.
+ * @param end The end pointer.
* @return True if this pointer is between the specified pointers.
*/
public boolean isBetween(final TextPointer start, final TextPointer end) {
+ *
+ */
@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.
+ *