Package org.fxmisc.richtext.model
Interface TwoDimensional.Position
-
- Enclosing interface:
- TwoDimensional
public static interface TwoDimensional.PositionA 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.Positionclamp()Returns a new position which clamps the minor position to be valid given the major position.intgetMajor()The major dimension, e.g.intgetMinor()The minor dimension, e.g.TwoDimensionalgetTargetObject()The TwoDimensional object that this position refers to.TwoDimensional.PositionoffsetBy(int amount, TwoDimensional.Bias bias)Returns a new position that offsets this position by the given amountbooleansameAs(TwoDimensional.Position other)Returnstrueif the given position is equal to this position, that is they both point to the same place in the same two-dimensional object.inttoOffset()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)
Returnstrueif 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.
-
-