org.apache.tools.ant
Class Location
java.lang.Object
org.apache.tools.ant.Location
- Serializable
public class Location
extends java.lang.Object
implements Serializable
Stores the location of a piece of text within a file (file name,
line number and column number). Note that the column number is
currently ignored.
Location(Locator loc) - Creates a location from the SAX locator using the system ID as
the filename.
|
Location(String fileName) - Creates a location consisting of a file name but no line number or
column number.
|
Location(String fileName, int lineNumber, int columnNumber) - Creates a location consisting of a file name, line number and
column number.
|
UNKNOWN_LOCATION
public static final Location UNKNOWN_LOCATION
Location to use when one is needed but no information is available
Location
public Location(Locator loc)
Creates a location from the SAX locator using the system ID as
the filename.
Location
public Location(String fileName)
Creates a location consisting of a file name but no line number or
column number.
fileName
- The name of the file. May be null
,
in which case the location is equivalent to
UNKNOWN_LOCATION
.
Location
public Location(String fileName,
int lineNumber,
int columnNumber)
Creates a location consisting of a file name, line number and
column number.
fileName
- The name of the file. May be null
,
in which case the location is equivalent to
UNKNOWN_LOCATION
.lineNumber
- Line number within the file. Use 0 for unknown
positions within a file.columnNumber
- Column number within the line.
equals
public boolean equals(Object other)
Equality operation.
other
- the object to compare to.
- true if the other object contains the same information
as this object.
getFileName
public String getFileName()
- the filename portion of the location
getLineNumber
public int getLineNumber()
hashCode
public int hashCode()
Hash operation.
- a hash code value for this location.
toString
public String toString()
Returns the file name, line number, a colon and a trailing space.
An error message can be appended easily. For unknown locations, an
empty string is returned.
- a String of the form
"fileName:lineNumber: "
if both file name and line number are known,
"fileName: "
if only the file name is known,
and the empty string for unknown locations.
Copyright B) 2000-2007 Apache Software Foundation. All Rights Reserved.