com.sun.tools.javac.util
Class Position.LineMapImpl

java.lang.Object
  extended by com.sun.tools.javac.util.Position.LineMapImpl
All Implemented Interfaces:
LineMap, Position.LineMap
Direct Known Subclasses:
Position.LineTabMapImpl
Enclosing class:
Position

static class Position.LineMapImpl
extends java.lang.Object
implements Position.LineMap


Field Summary
private  int lastLine
           
private  int lastPosition
           
protected  int[] startPosition
           
 
Constructor Summary
protected Position.LineMapImpl()
           
 
Method Summary
protected  void build(char[] src, int max)
           
 int getColumnNumber(int pos)
          Find the column for a character position.
 long getColumnNumber(long pos)
          Find the column for a character position.
 int getLineNumber(int pos)
          Find the line containing a position; a line termination character is on the line it terminates.
 long getLineNumber(long pos)
          Find the line containing a position; a line termination character is on the line it terminates.
 int getPosition(int line, int column)
          Find the position corresponding to a (line,column).
 long getPosition(long line, long column)
          Find the position corresponding to a (line,column).
 int getStartPosition(int line)
          Find the start position of a line.
 long getStartPosition(long line)
          Find the start position of a line.
private static int longToInt(long longValue)
           
protected  void setTabPosition(int offset)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

startPosition

protected int[] startPosition

lastPosition

private int lastPosition

lastLine

private int lastLine
Constructor Detail

Position.LineMapImpl

protected Position.LineMapImpl()
Method Detail

build

protected void build(char[] src,
                     int max)

getStartPosition

public int getStartPosition(int line)
Description copied from interface: Position.LineMap
Find the start position of a line.

Specified by:
getStartPosition in interface Position.LineMap
Parameters:
line - number of line (first is 1)
Returns:
position of first character in line

getStartPosition

public long getStartPosition(long line)
Description copied from interface: LineMap
Find the start position of a line.

Specified by:
getStartPosition in interface LineMap
Parameters:
line - line number (beginning at 1)
Returns:
position of first character in line

getPosition

public int getPosition(int line,
                       int column)
Description copied from interface: Position.LineMap
Find the position corresponding to a (line,column).

Specified by:
getPosition in interface Position.LineMap
Parameters:
line - number of line (first is 1)
column - number of character on line (first is 1)
Returns:
position of character

getPosition

public long getPosition(long line,
                        long column)
Description copied from interface: LineMap
Find the position corresponding to a (line,column).

Specified by:
getPosition in interface LineMap
Parameters:
line - line number (beginning at 1)
column - tab-expanded column number (beginning 1)
Returns:
position of character

getLineNumber

public int getLineNumber(int pos)
Description copied from interface: Position.LineMap
Find the line containing a position; a line termination character is on the line it terminates.

Specified by:
getLineNumber in interface Position.LineMap
Parameters:
pos - character offset of the position
Returns:
the line number on which pos occurs (first line is 1)

getLineNumber

public long getLineNumber(long pos)
Description copied from interface: LineMap
Find the line containing a position; a line termination character is on the line it terminates.

Specified by:
getLineNumber in interface LineMap
Parameters:
pos - character offset of the position
Returns:
the line number of pos (first line is 1)

getColumnNumber

public int getColumnNumber(int pos)
Description copied from interface: Position.LineMap
Find the column for a character position. Note: this method does not handle tab expansion. If tab expansion is needed, use a LineTabMap instead.

Specified by:
getColumnNumber in interface Position.LineMap
Parameters:
pos - character offset of the position
Returns:
the column number at which pos occurs

getColumnNumber

public long getColumnNumber(long pos)
Description copied from interface: LineMap
Find the column for a character position. Tab characters preceding the position on the same line will be expanded when calculating the column number.

Specified by:
getColumnNumber in interface LineMap
Parameters:
pos - character offset of the position
Returns:
the tab-expanded column number of pos (first column is 1)

longToInt

private static int longToInt(long longValue)

setTabPosition

protected void setTabPosition(int offset)