Spec-Zone.ru › OpenJDK 25

Interface LineMap

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

Method Summary

Modifier and Type Method Description
long getColumnNumber(long pos)
Finds the column for a character position.
long getLineNumber(long pos)
Finds the line containing a position; a line termination character is on the line it terminates.
long getPosition(long line, long column)
Finds the position corresponding to a (line,column).
long getStartPosition(long line)
Finds the start position of a line.

Method Details

getStartPosition

long getStartPosition(long line)
Finds the start position of a line.
Parameters:
line - line number (beginning at 1)
Returns:
position of first character in line
Throws:
IndexOutOfBoundsException - if lineNumber < 1 if lineNumber > no. of lines

getPosition

long getPosition(long line, long column)
Finds the position corresponding to a (line,column).
Parameters:
line - line number (beginning at 1)
column - tab-expanded column number (beginning 1)
Returns:
position of character
Throws:
IndexOutOfBoundsException - if line < 1 if line > no. of lines

getLineNumber

long getLineNumber(long pos)
Finds the line containing a position; a line termination character is on the line it terminates.
Parameters:
pos - character offset of the position
Returns:
the line number of pos (first line is 1)

getColumnNumber

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 - character offset of the position
Returns:
the tab-expanded column number of pos (first column is 1)

Report a bug or suggest an enhancement
For further API reference and developer documentation see the Java SE Documentation, which contains more detailed, developer-targeted descriptions with conceptual overviews, definitions of terms, workarounds, and working code examples. Other versions.
Java is a trademark or registered trademark of Oracle and/or its affiliates in the US and other countries.
Copyright © 1993, 2025, Oracle and/or its affiliates, 500 Oracle Parkway, Redwood Shores, CA 94065 USA.
All rights reserved. Use is subject to license terms and the documentation redistribution policy.

© 1993, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/25/docs/api/jdk.compiler/com/sun/source/tree/LineMap.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API