KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > w3c > flute > parser > LocatorImpl


1 /*
2  * Copyright (c) 1999 World Wide Web Consortium
3  * (Massachusetts Institute of Technology, Institut National de Recherche
4  * en Informatique et en Automatique, Keio University).
5  * All Rights Reserved. http://www.w3.org/Consortium/Legal/
6  *
7  * $Id: LocatorImpl.java,v 1.1.1.1 2006/04/23 14:51:25 taqua Exp $
8  */

9 package org.w3c.flute.parser;
10
11 import org.w3c.css.sac.Locator;
12
13 /**
14  * @version $Revision: 1.1.1.1 $
15  * @author Philippe Le Hegaret
16  */

17 public class LocatorImpl implements Locator {
18
19     // W3C DEBUG mode
20
private static boolean W3CDebug;
21     static {
22     try {
23         W3CDebug = (Boolean.getBoolean("debug")
24             || Boolean.getBoolean("org.w3c.flute.parser.LocatorImpl.debug")
25             || Boolean.getBoolean("org.w3c.flute.parser.debug")
26             || Boolean.getBoolean("org.w3c.flute.debug")
27             || Boolean.getBoolean("org.w3c.debug")
28             || Boolean.getBoolean("org.debug"));
29     } catch (Exception JavaDoc e) {
30         // nothing
31
}
32     }
33     
34     String JavaDoc uri;
35     int line;
36     int column;
37
38     public String JavaDoc getURI() {
39     return uri;
40     }
41
42     public int getLineNumber() {
43     return line;
44     }
45
46     public int getColumnNumber() {
47     return column;
48     }
49
50     /**
51      * Creates a new LocatorImpl
52      */

53     public LocatorImpl(Parser p) {
54     if (W3CDebug) {
55         System.err.println( "LocatorImpl::newLocator(" + p + ");");
56     }
57         uri = p.source.getURI();
58     line = p.token.beginLine;
59     column = p.token.beginColumn;
60     }
61     
62     /**
63      * Reinitializes a LocatorImpl
64      */

65     public LocatorImpl(Parser p, Token tok) {
66     if (W3CDebug) {
67         System.err.println( "LocatorImpl::newLocator(" + p
68                 + ", " + tok + ");");
69     }
70         uri = p.source.getURI();
71     line = tok.beginLine;
72     column = tok.beginColumn;
73     }
74     
75     /**
76      * Reinitializes a LocatorImpl
77      */

78     public LocatorImpl(Parser p, int line, int column) {
79     if (W3CDebug) {
80         System.err.println( "LocatorImpl::newLocator(" + p
81                 + ", " + line
82                  + ", " + column + ");");
83     }
84         uri = p.source.getURI();
85     this.line = line;
86     this.column = column;
87     }
88     
89     /**
90      * Reinitializes a LocatorImpl
91      */

92     public LocatorImpl reInit(Parser p) {
93     if (W3CDebug) {
94         System.err.println( "LocatorImpl::reInit(" + p + ");" );
95     }
96         uri = p.source.getURI();
97     line = p.token.beginLine;
98     column = p.token.beginColumn;
99     return this;
100     }
101     
102     /**
103      * Reinitializes a LocatorImpl
104      */

105     public LocatorImpl reInit(Parser p, Token tok) {
106     if (W3CDebug) {
107         System.err.println( "LocatorImpl::reInit(" + p
108                 + ", " + tok + ");");
109     }
110         uri = p.source.getURI();
111     line = tok.beginLine;
112     column = tok.beginColumn;
113     return this;
114     }
115     
116     /**
117      * Reinitializes a LocatorImpl
118      */

119     public LocatorImpl reInit(Parser p, int line, int column) {
120     if (W3CDebug) {
121         System.err.println("LocatorImpl::reInit(" + p
122                    + ", " + line
123                    + ", " + column + ");");
124     }
125         uri = p.source.getURI();
126     this.line = line;
127     this.column = column;
128     return this;
129     }
130 }
131
Popular Tags