Improved code readability
[sixth-3d.git] / src / main / java / eu / svjatoslav / sixth / e3d / gui / TextPointer.java
index 8ba9f9f..67291f5 100755 (executable)
@@ -1,12 +1,25 @@
 /*
- * 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;
 
+/**
+ * A pointer to a character in a text using row and column.
+ * <p>
+ * 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<TextPointer> {
 
+    /**
+     * The row of the character. Starts from 0.
+     */
     public int row;
+
+    /**
+     * The column of the character. Starts from 0.
+     */
     public int column;
 
     public TextPointer() {
@@ -48,6 +61,13 @@ public class TextPointer implements Comparable<TextPointer> {
 
     }
 
+    /**
+     * 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 +76,7 @@ public class TextPointer implements Comparable<TextPointer> {
         if (end == null)
             return false;
 
+        // Make sure that start is smaller than end.
         TextPointer smaller;
         TextPointer bigger;
 
@@ -67,8 +88,8 @@ public class TextPointer implements Comparable<TextPointer> {
             bigger = start;
         }
 
+        // Check if this pointer is between the specified pointers.
         return (compareTo(smaller) >= 0) && (bigger.compareTo(this) > 0);
-
     }
 
 }