dk.brics.grammar.parser
Class Location

java.lang.Object
  extended by dk.brics.grammar.parser.Location
All Implemented Interfaces:
Serializable

public class Location
extends Object
implements Serializable

Representation of a location in a text.

See Also:
Serialized Form

Constructor Summary
Location(String file, int index, int line, int col)
          Constructs a new location.
Location(String file, String contents, int index)
          Constructs a new location.
 
Method Summary
 int getColumn()
          Returns the column number.
 String getFile()
          Returns the file name.
 int getIndex()
          Returns the character index.
 int getLine()
          Returns the line number.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Location

public Location(String file,
                int index,
                int line,
                int col)
Constructs a new location.

Parameters:
file - path or URL of text (null if unknown)
index - char index
line - line number
col - column number

Location

public Location(String file,
                String contents,
                int index)
Constructs a new location.

Parameters:
file - path or URL of text (null if unknown)
contents - contents of the text
index - char index into the text
Method Detail

getColumn

public int getColumn()
Returns the column number.

Returns:
column number (counting from 1, tab size is assumed to be 8)

getFile

public String getFile()
Returns the file name.

Returns:
path or URL

getIndex

public int getIndex()
Returns the character index.

Returns:
character index

getLine

public int getLine()
Returns the line number.

Returns:
char line number (counting from 1)


Copyright © 2005-2008 Anders Møller.