Package eu.svjatoslav.sixth.e3d.gui
Class TextPointer
java.lang.Object
eu.svjatoslav.sixth.e3d.gui.TextPointer
- All Implemented Interfaces:
Comparable<TextPointer>
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.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
compareTo
(TextPointer textPointer) Compares this pointer to another pointer.boolean
int
hashCode()
boolean
isBetween
(TextPointer start, TextPointer end) Checks if this pointer is between the argument pointers.
-
Field Details
-
row
public int rowThe row of the character. Starts from 0. -
column
public int columnThe column of the character. Starts from 0.
-
-
Constructor Details
-
TextPointer
public TextPointer() -
TextPointer
public TextPointer(int row, int column) -
TextPointer
-
-
Method Details
-
equals
-
hashCode
public int hashCode() -
compareTo
Compares this pointer to another pointer.- Specified by:
compareTo
in interfaceComparable<TextPointer>
- Parameters:
textPointer
- The pointer to compare to.- Returns:
- -1 if this pointer is smaller than the argument pointer.
- 0 if they are equal.
- 1 if this pointer is bigger than the argument pointer.
-
isBetween
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.
- Parameters:
start
- The start pointer.end
- The end pointer.- Returns:
- True if this pointer is between the specified pointers.
-