|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.sun.tools.javac.util.Position
public class Position
A class that defines source code positions as simple character offsets from the beginning of the file. The first character is at position 0. Support is also provided for (line,column) coordinates, but tab expansion is optional and no Unicode excape translation is considered. The first character is at location (1,1).
This is NOT part of any API supported by Sun Microsystems. If you write code that depends on this, you do so at your own risk. This code and its internal interfaces are subject to change or deletion without notice.
| Nested Class Summary | |
|---|---|
static interface |
Position.LineMap
|
(package private) static class |
Position.LineMapImpl
|
static class |
Position.LineTabMapImpl
A LineMap that handles tab expansion correctly. |
| Field Summary | |
|---|---|
static int |
FIRSTCOLUMN
|
static int |
FIRSTLINE
|
static int |
FIRSTPOS
|
static int |
LINESHIFT
|
static int |
MAXCOLUMN
|
static int |
MAXLINE
|
static int |
MAXPOS
|
static int |
NOPOS
|
| Constructor Summary | |
|---|---|
private |
Position()
This is class is not supposed to be instantiated. |
| Method Summary | |
|---|---|
static int |
encodePosition(int line,
int col)
Encode line and column numbers in an integer as: line-number << LINESHIFT + column-number {@link Position.NOPOS represents an undefined position. |
static Position.LineMap |
makeLineMap(char[] src,
int max,
boolean expandTabs)
A two-way map between line/column numbers and positions, derived from a scan done at creation time. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int NOPOS
public static final int FIRSTPOS
public static final int FIRSTLINE
public static final int FIRSTCOLUMN
public static final int LINESHIFT
public static final int MAXCOLUMN
public static final int MAXLINE
public static final int MAXPOS
| Constructor Detail |
|---|
private Position()
| Method Detail |
|---|
public static Position.LineMap makeLineMap(char[] src,
int max,
boolean expandTabs)
Notes: The first character position FIRSTPOS is at (FIRSTLINE,FIRSTCOLUMN). No account is taken of Unicode escapes.
src - Source charactersmax - Number of characters to readexpandTabs - If true, expand tabs when calculating columns
public static int encodePosition(int line,
int col)
line - number of line (first is 1)col - number of character on line (first is 1)
java.lang.IllegalArgumentException - if line or col is less than 1
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||