org.modeshape.common.text

## Class Position

- java.lang.Object
- - org.modeshape.common.text.Position

-     @Immutable
      public final class Position
      extends Object

  A class that represents the position of a particular character in terms of the lines and columns of a character sequence.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static Position` | `EMPTY_CONTENT_POSITION` The position is used when there is no content.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Position(int indexInContent, int line, int column)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Position` | `add(Position position)` Return a new position that is the addition of this position and that supplied.
    `int` | `getColumn()` Get the 1-based column number of the character.
    `int` | `getIndexInContent()` Get the 0-based index of this position in the content character array.
    `int` | `getLine()` Get the 1-based line number of the character.
    `int` | `hashCode()`
    `String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### EMPTY_CONTENT_POSITION

          public static final Position EMPTY_CONTENT_POSITION

      The position is used when there is no content.

  - ### Constructor Detail

    - #### Position

          public Position(int indexInContent,
                  int line,
                  int column)

  - ### Method Detail

    - #### getIndexInContent

          public int getIndexInContent()

      Get the 0-based index of this position in the content character array.
      Returns:
        the index; never negative except for the first position in an empty content.

    - #### getColumn

          public int getColumn()

      Get the 1-based column number of the character.
      Returns:
        the column number; always positive

    - #### getLine

          public int getLine()

      Get the 1-based line number of the character.
      Returns:
        the line number; always positive

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`
      See Also:
        `Object.hashCode()`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`
      See Also:
        `Object.toString()`

    - #### add

          public Position add(Position position)

      Return a new position that is the addition of this position and that supplied.
      Parameters:
        `position` - the position to add to this object; may not be null
      Returns:
        the combined position

Copyright © 2008-2014 JBoss, a division of Red Hat. All Rights Reserved.