org.extex.core
Class Locator

java.lang.Object
  extended by org.extex.core.Locator
All Implemented Interfaces:
java.io.Serializable

public class Locator
extends java.lang.Object
implements java.io.Serializable

The locator is the container for the information about the name of a resource and the current line number.

Version:
$Revision:5417 $
Author:
Gerd Neugebauer, Michael Niedermair
See Also:
Serialized Form

Constructor Summary
Locator(java.lang.String resource, int lineNo, java.lang.String currentLine, int currentLinePointer)
          Creates a new object.
 
Method Summary
 Locator getCause()
          Getter for cause.
 java.lang.String getLine()
          Getter for the line.
 int getLineNumber()
          Getter for the line number.
 int getLinePointer()
          Getter for the line pointer.
 java.lang.String getResourceName()
          Getter for the resource name.
 void setCause(Locator cause)
          Setter for cause.
 java.lang.String toString()
          Return a printable representation of this instance.
 java.lang.String toString(int causeLimit)
          Return a printable representation of this instance including the cause.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Locator

public Locator(java.lang.String resource,
               int lineNo,
               java.lang.String currentLine,
               int currentLinePointer)
Creates a new object.

Parameters:
resource - the name of the resource; e.g. the file name
lineNo - the line number
currentLine - the current line of input
currentLinePointer - the current position in the line of input
Method Detail

getCause

public final Locator getCause()
Getter for cause.

Returns:
the cause

getLine

public java.lang.String getLine()
Getter for the line.

Returns:
the line.

getLineNumber

public int getLineNumber()
Getter for the line number. If the line number is negative then it has the meaning of an undefined value.

Returns:
the line number

getLinePointer

public int getLinePointer()
Getter for the line pointer. The line pointer is the position within the line at which something happened.

Returns:
the line pointer.

getResourceName

public java.lang.String getResourceName()
Getter for the resource name. The resource name can be unset. In this case null is returned.

Returns:
the resource name or null

setCause

public final void setCause(Locator cause)
Setter for cause.

Parameters:
cause - the cause to set

toString

public java.lang.String toString(int causeLimit)
Return a printable representation of this instance including the cause. The result contains the file name and the line number separated by colon. This is the Unix style of presenting a file position. If the file name is null then it is treated as if it where the empty string.

Parameters:
causeLimit - the limit for the number of causes to be shown. If negative then the optional, preceding continuation indicator (..) is suppressed
Returns:
the printable representation
See Also:
toString()

toString

public java.lang.String toString()
Return a printable representation of this instance. The result contains the file name and the line number separated by colon. This is the Unix style of presenting a file position. If the file name is null then it is treated as if it where the empty string.

Overrides:
toString in class java.lang.Object
Returns:
the printable representation
See Also:
Object.toString()