Top Description Methods
com.sun.source.tree

public Interface LineMap

Known Direct Subinterfaces
com.sun.tools.javac.util.Position.LineMap

Provides methods to convert between character positions and line numbers for a compilation unit.
Since
1.6

Method Summary

Modifier and TypeMethod and Description
public long

Returns:

the tab-expanded column number of pos (first column is 1)
getColumnNumber
(long
character offset of the position
pos
)

Finds the column for a character position.

public long

Returns:

the line number of pos (first line is 1)
getLineNumber
(long
character offset of the position
pos
)

Finds the line containing a position; a line termination character is on the line it terminates.

public long

Returns:

position of character
getPosition
(long
line number (beginning at 1)
line
,
long
tab-expanded column number (beginning 1)
column
)

Finds the position corresponding to a (line,column).

public long

Returns:

position of first character in line
getStartPosition
(long
line number (beginning at 1)
line
)

Finds the start position of a line.

Method Detail

getColumnNumberback to summary
public long getColumnNumber(long pos)

Finds the column for a character position. Tab characters preceding the position on the same line will be expanded when calculating the column number.

Parameters
pos:long

character offset of the position

Returns:long

the tab-expanded column number of pos (first column is 1)

getLineNumberback to summary
public long getLineNumber(long pos)

Finds the line containing a position; a line termination character is on the line it terminates.

Parameters
pos:long

character offset of the position

Returns:long

the line number of pos (first line is 1)

getPositionback to summary
public long getPosition(long line, long column)

Finds the position corresponding to a (line,column).

Parameters
line:long

line number (beginning at 1)

column:long

tab-expanded column number (beginning 1)

Returns:long

position of character

Exceptions
IndexOutOfBoundsException:
if line < 1 if line > no. of lines
getStartPositionback to summary
public long getStartPosition(long line)

Finds the start position of a line.

Parameters
line:long

line number (beginning at 1)

Returns:long

position of first character in line

Exceptions
IndexOutOfBoundsException:
if lineNumber < 1 if lineNumber > no. of lines