net.sf.saxon.expr.instruct
Class LocationMap

java.lang.Object
  extended by net.sf.saxon.expr.instruct.LocationMap
All Implemented Interfaces:
Serializable, LocationProvider

public class LocationMap
extends Object
implements LocationProvider, Serializable

A LocationMap allocates integer codes to (systemId, lineNumber) pairs. The integer codes are held inside an Expression object to track the location of the expression in the source code

See Also:
Serialized Form

Constructor Summary
LocationMap()
          Create a location map
 
Method Summary
 int allocateLocationId(String module, int lineNumber)
          Allocate a location identifier to an expression
 int getColumnNumber(long locationId)
          Get the column number within the document, entity, or module containing a particular location
 int getLineNumber(long locationId)
          Get the line number corresponding to a locationId
 String getSystemId(long locationId)
          Get the system identifier corresponding to a locationId
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocationMap

public LocationMap()
Create a location map

Method Detail

allocateLocationId

public int allocateLocationId(String module,
                              int lineNumber)
Allocate a location identifier to an expression

Parameters:
module - the URI (system identifier) of the module
lineNumber - the line number of the expression within the module
Returns:
the corresponding location identifier

getSystemId

public String getSystemId(long locationId)
Get the system identifier corresponding to a locationId

Specified by:
getSystemId in interface LocationProvider
Parameters:
locationId - the location identifier
Returns:
the corresponding system identifier

getLineNumber

public int getLineNumber(long locationId)
Get the line number corresponding to a locationId

Specified by:
getLineNumber in interface LocationProvider
Parameters:
locationId - the location identifier
Returns:
the corresponding line number

getColumnNumber

public int getColumnNumber(long locationId)
Description copied from interface: LocationProvider
Get the column number within the document, entity, or module containing a particular location

Specified by:
getColumnNumber in interface LocationProvider
Parameters:
locationId - identifier of the location in question (as passed down the Receiver pipeline)
Returns:
the column number within the document, entity, or module, or -1 if this is not available


Copyright (c) 2004-2010 Saxonica Limited. All rights reserved.