X-Git-Url: http://www2.svjatoslav.eu/gitweb/?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=7e2bf74a6ab66282497c65e0590c3e2e33b6e9db;hb=8aa50f568d2edcfe974ceed4192158951e7f3215;hp=8ba9f9f171ef20076f3f9c1957b388c17c630918;hpb=9d03f0af97129ee791c0b1a33703fe1e34e9c050;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 8ba9f9f..7e2bf74 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,9 @@ */ package eu.svjatoslav.sixth.e3d.gui; +/** + * A pointer to a character in a text. + */ public class TextPointer implements Comparable { public int row; @@ -48,6 +51,15 @@ public class TextPointer implements Comparable { } + /** + * Checks if this pointer is between the specified pointers. + * + * @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) { if (start == null) @@ -56,6 +68,7 @@ public class TextPointer implements Comparable { if (end == null) return false; + // Make sure that start is smaller than end. TextPointer smaller; TextPointer bigger; @@ -67,8 +80,8 @@ public class TextPointer implements Comparable { bigger = start; } + // Check if this pointer is between the specified pointers. return (compareTo(smaller) >= 0) && (bigger.compareTo(this) > 0); - } }