Source code: netscape/jsdebug/JSSourceLocation.java
1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 *
3 * The contents of this file are subject to the Netscape Public
4 * License Version 1.1 (the "License"); you may not use this file
5 * except in compliance with the License. You may obtain a copy of
6 * the License at http://www.mozilla.org/NPL/
7 *
8 * Software distributed under the License is distributed on an "AS
9 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
10 * implied. See the License for the specific language governing
11 * rights and limitations under the License.
12 *
13 * The Original Code is mozilla.org code.
14 *
15 * The Initial Developer of the Original Code is Netscape
16 * Communications Corporation. Portions created by Netscape are
17 * Copyright (C) 1998 Netscape Communications Corporation. All
18 * Rights Reserved.
19 *
20 * Contributor(s):
21 */
22
23 package netscape.jsdebug;
24
25 /**
26 * JAvaScript specific SourceLocation
27 *
28 * @author John Bandhauer
29 * @version 1.0
30 * @since 1.0
31 */
32 public class JSSourceLocation extends SourceLocation
33 {
34 public JSSourceLocation( JSPC pc, int line )
35 {
36 _pc = pc;
37 _line = line;
38 _url = pc.getScript().getURL();
39 }
40
41 /**
42 * Gets the first line number associated with this SourceLocation.
43 * This is the lowest common denominator information that will be
44 * available: some implementations may choose to include more
45 * specific location information in a subclass of SourceLocation.
46 */
47 public int getLine() {return _line;}
48
49 public String getURL() {return _url;}
50
51 /**
52 * Get the first PC associated with a given SourceLocation.
53 * This is the place to set a breakpoint at that location.
54 * returns null if there is no code corresponding to that source
55 * location.
56 */
57 public PC getPC() {return _pc;}
58
59 public String toString()
60 {
61 return "<SourceLocation "+_url+"#"+_line+">";
62 }
63
64 private JSPC _pc;
65 private int _line;
66 private String _url;
67 }