01: /*
02: * OccurrenceLine.java
03: *
04: * Copyright (C) 2000-2002 Peter Graves
05: * $Id: OccurrenceLine.java,v 1.1.1.1 2002/09/24 16:07:44 piso Exp $
06: *
07: * This program is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU General Public License
09: * as published by the Free Software Foundation; either version 2
10: * of the License, or (at your option) any later version.
11: *
12: * This program is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15: * GNU General Public License for more details.
16: *
17: * You should have received a copy of the GNU General Public License
18: * along with this program; if not, write to the Free Software
19: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20: */
21:
22: package org.armedbear.j;
23:
24: public final class OccurrenceLine extends TextLine {
25: private Line sourceLine;
26: private int sourceLineNumber; // 1-based.
27:
28: public OccurrenceLine(Line sourceLine) {
29: super ();
30: FastStringBuffer sb = new FastStringBuffer();
31: sb.append(sourceLine.lineNumber() + 1);
32: sb.append(':');
33: sb.append(sourceLine.getText());
34: init(sb.toString());
35: this .sourceLine = sourceLine;
36: // sourceLineNumber is 1-based.
37: sourceLineNumber = sourceLine.lineNumber() + 1;
38: }
39:
40: // sourceLineNumber is 1-based.
41: public OccurrenceLine(String s, int sourceLineNumber) {
42: super ();
43: FastStringBuffer sb = new FastStringBuffer();
44: sb.append(sourceLineNumber);
45: sb.append(':');
46: sb.append(s);
47: init(sb.toString());
48: this .sourceLineNumber = sourceLineNumber;
49: }
50:
51: public OccurrenceLine(Tag tag) {
52: super ();
53: String s = tag.getCanonicalSignature();
54: if (s == null)
55: s = tag.getLongName();
56: init(s);
57: }
58:
59: public final Line getSourceLine() {
60: return sourceLine;
61: }
62:
63: // sourceLineNumber is 1-based.
64: public final int getSourceLineNumber() {
65: return sourceLineNumber;
66: }
67: }
|