org.incava.text

Class LineMapping


public class LineMapping
extends ArrayList

Converts from 0-indexed string positions to line:column values. Lines and columns are 1-indexed, matching the Java parser.

Nested Class Summary

class
LineMapping.PositionToLocation

Constructor Summary

LineMapping(String text, int startLine, int startColumn)

Method Summary

Location
getLocation(int pos)
Converts the string position to a line:column location.
Location[]
getLocations(Point pos)
Converts the string position to a line:column start and end location.
Location[]
getLocations(int startPos, int endPos)
Converts the string position to a line:column start and end location.

Constructor Details

LineMapping

public LineMapping(String text,
                   int startLine,
                   int startColumn)

Method Details

getLocation

public Location getLocation(int pos)
Converts the string position to a line:column location.

getLocations

public Location[] getLocations(Point pos)
Converts the string position to a line:column start and end location.

getLocations

public Location[] getLocations(int startPos,
                               int endPos)
Converts the string position to a line:column start and end location.