Package org.fxmisc.richtext.model
Class TwoLevelNavigator
- java.lang.Object
-
- org.fxmisc.richtext.model.TwoLevelNavigator
-
- All Implemented Interfaces:
TwoDimensional
public class TwoLevelNavigator extends Object implements TwoDimensional
Default implementation ofTwoDimensionalthat makes it trivial to calculate a position within a two dimensional object.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.fxmisc.richtext.model.TwoDimensional
TwoDimensional.Bias, TwoDimensional.Position
-
-
Constructor Summary
Constructors Constructor Description TwoLevelNavigator(IntSupplier elemCount, IntUnaryOperator elemLength)Creates a navigator that can be used to find aTwoDimensional.Positionwithin a two dimensional object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TwoDimensional.PositionoffsetToPosition(int offset, TwoDimensional.Bias bias)Creates a two dimensional position in some entity (e.g.TwoDimensional.Positionposition(int major, int minor)Creates a two dimensional position in some entity (e.g.
-
-
-
Constructor Detail
-
TwoLevelNavigator
public TwoLevelNavigator(IntSupplier elemCount, IntUnaryOperator elemLength)
Creates a navigator that can be used to find aTwoDimensional.Positionwithin a two dimensional object.- Parameters:
elemCount- a supplier that returns the number of "inner lists" within an "outer list" (seeTwoDimensionalfor clarification). For example,List::sizeelemLength- a function that, given the index of an "inner list," returns either the size of that "inner list" of the length of that inner object.
-
-
Method Detail
-
position
public TwoDimensional.Position position(int major, int minor)
Description copied from interface:TwoDimensionalCreates a two dimensional position in some entity (e.g. area, list of lists, list of some object with length) where themajorvalue is the index within the outer list) and theminorvalue is either the index within the inner list or some amount of length in a list of objects that have length.- Specified by:
positionin interfaceTwoDimensional
-
offsetToPosition
public TwoDimensional.Position offsetToPosition(int offset, TwoDimensional.Bias bias)
Description copied from interface:TwoDimensionalCreates a two dimensional position in some entity (e.g. area, list of lists, list of some object with length) where theoffsetvalue is an absolute position in that entity.- Specified by:
offsetToPositionin interfaceTwoDimensional
-
-