There are two basic kinds of two dimensional objects.
List<List<Object>>. The major dimension's value indicates the index of
the "inner list" within the "outer list" while the minor dimension's value indicates the index
of the object within an "inner list."
List<ObjectWithLengthMethod as in List<String>. The major
dimension's value indicates the index within the list while the minor dimension's value
indicates how far into that length-object a position is (e.g. how many characters into a String
is a position).
Not all two dimensional objects are rectangular, so the valid values of the minor dimension depends on the major dimension.
| Modifier and Type | Class and Description |
|---|---|
| public static enum | TwoDimensional.
Determines whether to add 1 when the end of an inner list is reached For example, given the following two dimensional object (a list of lists of objects) where the inner lists values show the absolute index of that specific item within the outer list... |
| public static interface | TwoDimensional.
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). |
| Modifier and Type | Method and Description |
|---|---|
| public TwoDimensional. | offsetToPosition(int offset, TwoDimensional.
Creates a two dimensional position in some entity (e.g. area, list of lists, list of some object with length)
where the |
| public TwoDimensional. | position(int major, int minor)
Creates a two dimensional position in some entity (e.g. area, list of lists, list of some object with length)
where the |
| offsetToPosition | back to summary |
|---|---|
| public TwoDimensional. Creates a two dimensional position in some entity (e.g. area, list of lists, list of some object with length)
where the | |
| position | back to summary |
|---|---|
| public TwoDimensional. Creates a two dimensional position in some entity (e.g. area, list of lists, list of some object with length)
where the | |
For example, given the following two dimensional object (a list of lists of objects) where the inner lists values show the absolute index of that specific item within the outer list...
[ // outer list
[0, 1, 2, 3], // inner list 1
[4, 5, 6] // inner list 2
] // outer list
...navigating to listOfListsObject.offsetTo(3, BACKWARD) will return 3 whereas
listOfListsObject.offsetTo(3, FORWARD) will return 4, the "next item" in the two
dimensional object.
The Bias does not apply if the index is any non-last-index in the inner list. Thus,
listOfListsObject.offsetTo(1, BACKWARD) and listOfListsObject.offsetTo(1, FORWARD)
will return the same value, 1, since the position is not at the end of the list.
| Modifier and Type | Field and Description |
|---|---|
| public static final TwoDimensional. | Backward
When the returned value would be equal to the last index in an "inner list" or the length of some object with length, returns the value unmodified. |
| public static final TwoDimensional. | Forward
When the returned value would be equal to the last index in an "inner list" or the length of some object
with length, returns the |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static TwoDimensional. | |
| public static TwoDimensional. |
| Backward | back to summary |
|---|---|
| public static final TwoDimensional. When the returned value would be equal to the last index in an "inner list" or the length of some object
with length, returns the value unmodified. See | |
| Forward | back to summary |
|---|---|
| public static final TwoDimensional. When the returned value would be equal to the last index in an "inner list" or the length of some object
with length, returns the | |
| Bias | back to summary |
|---|---|
| private Bias() | |
| valueOf | back to summary |
|---|---|
| public static TwoDimensional. | |
| values | back to summary |
|---|---|
| public static TwoDimensional. | |
| Modifier and Type | Method and Description |
|---|---|
| public TwoDimensional. | |
| public int | |
| public int | |
| public TwoDimensional | |
| public TwoDimensional. | offsetBy(int amount, TwoDimensional.
Returns a new position that offsets this position by the given amount |
| public boolean | sameAs(TwoDimensional.
Returns |
| public int | toOffset()
Converts this position to an overall offset within the original
TwoDimensional item (to which |
| clamp | back to summary |
|---|---|
| public TwoDimensional. 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). | |
| getMajor | back to summary |
|---|---|
| public int getMajor() The major dimension, e.g. paragraph number within a document | |
| getMinor | back to summary |
|---|---|
| public int getMinor() The minor dimension, e.g. segment index or column offset within a paragraph. | |
| getTargetObject | back to summary |
|---|---|
| public TwoDimensional getTargetObject() The TwoDimensional object that this position refers to. | |
| offsetBy | back to summary |
|---|---|
| public TwoDimensional. Returns a new position that offsets this position by the given amount | |
| sameAs | back to summary |
|---|---|
| public boolean sameAs(TwoDimensional. Returns | |
| toOffset | back to summary |
|---|---|
| public int toOffset() Converts this position to an overall offset within the original
TwoDimensional item (to which | |