View Javadoc

1   /*
2    * Copyright 2001-2004 The Apache Software Foundation.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.apache.mirae.j2me.xml.sax;
18  
19  import org.xml.sax.Locator;
20  
21  /***
22   * This is an implementation of org.xml.sax.Locator
23   * @author Ias (iasandcb@tmax.co.kr)
24   * 
25   */
26  public class LocatorImpl implements Locator {
27  
28  	private String publicId;
29  	private String systemId;
30  	private int lineNumber;
31  	private int columnNumber;
32  	private int previousColumnNumber;
33  	
34  	public LocatorImpl(String publicId, String systemId, int lineNumber, int columnNumber) {
35  		this.publicId = publicId;
36  		this.systemId = systemId;
37  		this.lineNumber = lineNumber;
38  		this.columnNumber = columnNumber;	
39  	}
40  	/***
41  	 * @see org.xml.sax.Locator#getPublicId()
42  	 */
43  	public String getPublicId() {
44  		return publicId;
45  	}
46  
47  	/***
48  	 * @see org.xml.sax.Locator#getSystemId()
49  	 */
50  	public String getSystemId() {
51  		return systemId;
52  	}
53  
54  	/***
55  	 * @see org.xml.sax.Locator#getLineNumber()
56  	 */
57  	public int getLineNumber() {
58  		return lineNumber;
59  	}
60  
61  	/***
62  	 * @see org.xml.sax.Locator#getColumnNumber()
63  	 */
64  	public int getColumnNumber() {
65  		return columnNumber;
66  	}
67  
68      /***
69       * increase column number by 1 
70       *
71       */
72  	public void incrementColumnNumber() {
73  		columnNumber++;
74  	}
75      
76      /***
77       * increase column number by increment
78       *
79       */
80  
81  	public void addColumnNumber(int increment) {
82  		columnNumber += increment;
83  	}
84      
85      /***
86       * increase line number by 1
87       */
88  	
89  	public void incrementLineNumber() {
90  		lineNumber++;
91  		previousColumnNumber = columnNumber;
92  		columnNumber = 0;
93  	}
94  
95      /***
96       * decrease line number by 1
97       *
98       */
99  	public void decrementLineNumber() {
100 		lineNumber--;
101 		columnNumber = previousColumnNumber;
102 	}
103 }