1 /* 2 * Copyright 2007 Edward Kuns 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 * in compliance with the License. You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software distributed under the License 10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 * or implied. See the License for the specific language governing permissions and limitations under 12 * the License. 13 * 14 * $Id: Location.java 0000 2007-01-09 00:10:00-0600 ekuns $ 15 */ 16 package org.castor.xmlctf.xmldiff.xml; 17 18 import org.xml.sax.Locator; 19 20 /** 21 * An immutable class for storing XML file location information. 22 * 23 * @author <a href="mailto:edward.kuns@aspect.com">Edward Kuns</a> 24 * @version $Revision: 0000 $ $Date: 2007-01-09 00:10:00 -0600 (Tue, 09 Jan 2007) $ 25 * @since Castor 1.1 26 */ 27 public class Location { 28 29 /** Line number. */ 30 private final int _line; 31 /** Column number. */ 32 private final int _column; 33 34 /** 35 * Creates a new Location with the current values from the provided Locator. 36 * 37 * @param locator a SAX locator 38 */ 39 public Location(Locator locator) { 40 _line = locator.getLineNumber(); 41 _column = locator.getColumnNumber(); 42 } 43 44 /** 45 * Returns the column number. 46 * 47 * @return the column number. 48 */ 49 public int getColumnNumber() { 50 return _column; 51 } 52 53 /** 54 * Returns the line number. 55 * 56 * @return the line number. 57 */ 58 public int getLineNumber() { 59 return _line; 60 } 61 62 }