Class Position

java.lang.Object
org.graalvm.tools.lsp.server.types.JSONBase
org.graalvm.tools.lsp.server.types.Position

public class Position extends JSONBase
Position in a text document expressed as zero-based line and character offset. The offsets are based on a UTF-16 string representation. Positions are line end character agnostic. So you can not specify a position that denotes `\r|\n` or `\n|` where `|` represents the character offset.
  • Method Details

    • getLine

      public int getLine()
      Line position in a document (zero-based). If a line number is greater than the number of lines in a document, it defaults back to the number of lines in the document. If a line number is negative, it defaults to 0.
    • setLine

      public Position setLine(int line)
    • getCharacter

      public int getCharacter()
      Character offset on a line in a document (zero-based). Assuming that the line is represented as a string, the `character` value represents the gap between the `character` and `character + 1`. If the character value is greater than the line length it defaults back to the line length. If a line number is negative, it defaults to 0.
    • setCharacter

      public Position setCharacter(int character)
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • create

      public static Position create(int line, int character)
      Creates a new Position literal from the given line and character.
      Parameters:
      line - The position's line.
      character - The position's character.