Package org.fxmisc.richtext.model
Interface TwoDimensional.Position
-
- Enclosing interface:
- TwoDimensional
public static interface TwoDimensional.Position
A two dimensional position, with a major offset (such as a paragraph index within a document) and a minor dimension (such as a segment index or column position within a paragraph). Major and minor positions begin at 0.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description TwoDimensional.Position
clamp()
Returns a new position which clamps the minor position to be valid given the major position.int
getMajor()
The major dimension, e.g.int
getMinor()
The minor dimension, e.g.TwoDimensional
getTargetObject()
The TwoDimensional object that this position refers to.TwoDimensional.Position
offsetBy(int amount, TwoDimensional.Bias bias)
Returns a new position that offsets this position by the given amountboolean
sameAs(TwoDimensional.Position other)
Returnstrue
if the given position is equal to this position, that is they both point to the same place in the same two-dimensional object.int
toOffset()
Converts this position to an overall offset within the original TwoDimensional item (to whichgetTargetObject()
refers).
-
-
-
Method Detail
-
getTargetObject
TwoDimensional getTargetObject()
The TwoDimensional object that this position refers to.
-
getMajor
int getMajor()
The major dimension, e.g. paragraph number within a document
-
getMinor
int getMinor()
The minor dimension, e.g. segment index or column offset within a paragraph.
-
sameAs
boolean sameAs(TwoDimensional.Position other)
Returnstrue
if the given position is equal to this position, that is they both point to the same place in the same two-dimensional object. Otherwise returnsfalse
.
-
clamp
TwoDimensional.Position clamp()
Returns a new position which clamps the minor position to be valid given the major position. (i.e. if the position is beyond the end of a given paragraph, moves the position back to the end of the paragraph).
-
offsetBy
TwoDimensional.Position offsetBy(int amount, TwoDimensional.Bias bias)
Returns a new position that offsets this position by the given amount
-
toOffset
int toOffset()
Converts this position to an overall offset within the original TwoDimensional item (to whichgetTargetObject()
refers). For example, moving a caret to a relative position (paragraph 2, column 3) might result in the offset value (absolute position) of 28.
-
-