Source code: com/tripi/asp/DebugContext.java
1 /**
2 * ArrowHead ASP Server
3 * This is a source file for the ArrowHead ASP Server - an 100% Java
4 * VBScript interpreter and ASP server.
5 *
6 * For more information, see http://www.tripi.com/arrowhead
7 *
8 * Copyright (C) 2002 Terence Haddock
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 *
24 */
25 package com.tripi.asp;
26
27 /**
28 * Debugging context, filename and line number.
29 *
30 * @author Terence Haddock
31 * @version 0.9
32 */
33 public class DebugContext
34 {
35 /** Display filename */
36 String displayFilename;
37
38 /** Line number */
39 int lineno;
40
41 /** Starting column number */
42 int columnno;
43
44 /**
45 * Constructor.
46 * @param displayFilename File name
47 * @param lineno Line number
48 */
49 public DebugContext(String displayFilename, int lineno)
50 {
51 this.displayFilename = displayFilename;
52 this.lineno = lineno;
53 this.columnno = -1;
54 }
55
56 /**
57 * Constructor.
58 * @param displayFilename File name
59 * @param lineno Line number
60 * @param column Column number
61 */
62 public DebugContext(String displayFilename, int lineno, int columnno)
63 {
64 this.displayFilename = displayFilename;
65 this.lineno = lineno;
66 this.columnno = columnno;
67 }
68
69 /**
70 * Constructor, without a defined filename/lineno.
71 */
72 public DebugContext()
73 {
74 this.displayFilename = null;
75 this.lineno = 0;
76 this.columnno = 0;
77 }
78
79 /**
80 * Set the location filename.
81 * @param filename Filename to set for the debugging context
82 */
83 public void setFilename(String filename)
84 {
85 this.displayFilename = filename;
86 }
87
88 /**
89 * Get the location filename.
90 * @param filename Filename for debugging location.
91 */
92 public String getFilename()
93 {
94 return displayFilename;
95 }
96
97 /**
98 * Set the location line number.
99 * @param lineno Line number to set for the debugging context
100 */
101 public void setLineNo(int lineno)
102 {
103 this.lineno = lineno;
104 }
105
106 /**
107 * Get the location line number.
108 * @return location line number.
109 */
110 public int getLineNo()
111 {
112 return lineno;
113 }
114
115 /**
116 * Set the location column number.
117 * @param columnno Column number to set for the debugging context
118 */
119 public void setColumnNo(int lineno)
120 {
121 this.columnno = columnno;
122 }
123
124 /**
125 * Get the column number.
126 * @return location column number.
127 */
128 public int getColumnNo()
129 {
130 return columnno;
131 }
132
133 /**
134 * Obtain the string representation of this debugging context.
135 * @return string representation of this debugging context.
136 */
137 public String toString()
138 {
139 if (columnno != -1)
140 return "file: " + displayFilename + " line: " + lineno + " column: " + columnno;
141 return "file: " + displayFilename + " line: " + lineno;
142 }
143 };
144