X-Git-Url: http://www2.svjatoslav.eu/gitweb/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Feu%2Fsvjatoslav%2Fsixth%2Fe3d%2Fgui%2FTextPointer.java;h=701ec506656da55ad0fd9476d85ee11c6834fe06;hb=a3ff3683bd0a025061667b26b6fcf56fe20f0afc;hp=5ec2d901ce7b768170c2c386fb254ea1f11a5b5b;hpb=6b39de1e9e80433b78ae731845551e742718d613;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 5ec2d90..701ec50 100755 --- a/src/main/java/eu/svjatoslav/sixth/e3d/gui/TextPointer.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/gui/TextPointer.java @@ -1,14 +1,12 @@ /* - * Sixth 3D engine. Copyright ©2012-2020, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 3 of the GNU Lesser General Public License - * or later as published by the Free Software Foundation. - * + * 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. + */ public class TextPointer implements Comparable { public int row; @@ -53,6 +51,13 @@ 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) @@ -61,6 +66,7 @@ public class TextPointer implements Comparable { if (end == null) return false; + // Make sure that start is smaller than end. TextPointer smaller; TextPointer bigger; @@ -72,8 +78,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); - } }