Interface Location


public interface Location
Represents the location of a node within its document.

Location is a span from a starting line and column to an ending line and column; or alternatively, from a starting character position to an ending character position.

Since:
Jun 6, 2008
Version:
$Id: //open/util/resgen/src/org/eigenbase/xom/Location.java#2 $
Author:
jhyde
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the column where this node ends.
    int
    Returns the line where this node ends.
    int
    Returns the character position where this node ends.
    int
    Returns the column where this node starts.
    int
    Returns the line where this node starts.
    int
    Returns the character position where this node starts.
    getText(boolean headOnly)
    Returns the text of this location.
  • Method Details

    • getStartLine

      int getStartLine()
      Returns the line where this node starts. The first line in the document is 1.
      Returns:
      Line of the start of this node
    • getStartColumn

      int getStartColumn()
      Returns the column where this node starts. The first column in the document is 1.
      Returns:
      column of the start of this node
    • getStartPos

      int getStartPos()
      Returns the character position where this node starts. The first character in the document is 0.
      Returns:
      Character position of the start of this node
    • getEndLine

      int getEndLine()
      Returns the line where this node ends. The first line in the document is 1.
      Returns:
      Line of the end of this node
    • getEndColumn

      int getEndColumn()
      Returns the column where this node ends. The first column in the document is 1.
      Returns:
      column of the end of this node
    • getEndPos

      int getEndPos()
      Returns the character position where this node ends. The first character in the document is 0.
      Returns:
      Character position of the end of this node
    • getText

      String getText(boolean headOnly)
      Returns the text of this location.

      If this location is an element and headOnly is true, returns only the text of the head of the element. For example,

       <Foo a="1" b="2">
         <Bar c="3">
       </Foo>
       
      returns "<Foo a='1' b='2'><Bar c='3'></Foo>" if headOnly is false, "<Foo a='1' b='2'>" if it is true.
      Parameters:
      headOnly - Whether to return only the head of elements
      Returns:
      Source text underlying a location