Home | History | Annotate | Download | only in domts
      1 /*
      2  * Copyright (c) 2004 World Wide Web Consortium,
      3  * (Massachusetts Institute of Technology, Institut National de
      4  * Recherche en Informatique et en Automatique, Keio University). All
      5  * Rights Reserved. This program is distributed under the W3C's Software
      6  * Intellectual Property License. This program is distributed in the
      7  * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
      8  * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
      9  * PURPOSE.
     10  * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
     11  */
     12 package org.w3c.domts;
     13 
     14 import org.w3c.dom.DOMLocator;
     15 import org.w3c.dom.Node;
     16 
     17 /**
     18  * Implementation of DOMLocator
     19  *
     20  */
     21 public class DOMLocatorImpl
     22     implements DOMLocator {
     23   private final int lineNumber;
     24   private final int columnNumber;
     25   private final int byteOffset;
     26   private final int utf16Offset;
     27   private final Node relatedNode;
     28   private final String uri;
     29 
     30   public DOMLocatorImpl(DOMLocator src) {
     31     this.lineNumber = src.getLineNumber();
     32     this.columnNumber = src.getColumnNumber();
     33     this.byteOffset = src.getByteOffset();
     34     this.utf16Offset = src.getUtf16Offset();
     35     this.relatedNode = src.getRelatedNode();
     36     this.uri = src.getUri();
     37   }
     38 
     39   /*
     40    * Line number
     41    * @see org.w3c.dom.DOMLocator#getLineNumber()
     42    */
     43   public int getLineNumber() {
     44     return lineNumber;
     45   }
     46 
     47   /*
     48    * Column number
     49    * @see org.w3c.dom.DOMLocator#getColumnNumber()
     50    */
     51   public int getColumnNumber() {
     52     return columnNumber;
     53   }
     54 
     55   /*
     56    * Byte offset
     57    * @see org.w3c.dom.DOMLocator#getByteOffset()
     58    */
     59   public int getByteOffset() {
     60     return byteOffset;
     61   }
     62 
     63   /* UTF-16 offset
     64    * @see org.w3c.dom.DOMLocator#getUtf16Offset()
     65    */
     66   public int getUtf16Offset() {
     67     return utf16Offset;
     68   }
     69 
     70   /* Related node
     71    * @see org.w3c.dom.DOMLocator#getRelatedNode()
     72    */
     73   public Node getRelatedNode() {
     74     return relatedNode;
     75   }
     76 
     77   /* URI
     78    * @see org.w3c.dom.DOMLocator#getUri()
     79    */
     80   public String getUri() {
     81     return uri;
     82   }
     83 
     84 }
     85