Source code: com/voytechs/jnetstream/npl/NodeException.java
1 /*
2 * NodeException: NodeException.java
3 * Auth: Mark Bednarczyk
4 * Date: DATE
5 * Id: $Id: NodeException.java,v 1.1.1.1 2003/09/22 16:32:19 voytechs Exp $
6 ********************************************
7 Copyright (C) 2003 Mark Bednarczyk
8
9 This program is free software; you can redistribute it and/or
10 modify it under the terms of the GNU General Public License
11 as published by the Free Software Foundation; either version 2
12 of the License, or (at your option) any later version.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 ********************************************
23 * $Log: NodeException.java,v $
24 * Revision 1.1.1.1 2003/09/22 16:32:19 voytechs
25 * Initial import.
26 *
27 */
28 package com.voytechs.jnetstream.npl;
29
30 import java.lang.*;
31 import java.util.*;
32
33 /**
34 *
35 */
36 public class NodeException
37 extends Exception {
38
39 /* Internal attributes */
40 private static final boolean debug = false;
41
42 private Node node;
43 private Token token = null;
44
45 /**
46 *
47 * @param
48 * @exception
49 */
50 public NodeException(String msg) {
51 super(msg);
52 }
53
54 /**
55 *
56 * @param
57 * @exception
58 */
59 public NodeException(String msg, Node node) {
60 super(msg);
61
62 this.node = node;
63 this.token = node.getToken();
64 }
65
66 /**
67 *
68 * @param
69 * @exception
70 */
71 public NodeException(String msg, Token token) {
72 super(msg);
73
74 this.node = node;
75 this.token = token;
76 }
77
78 public String toString() {
79 return(getMessage());
80 }
81
82 public int getLineNumber() {
83 if(token == null)
84 return(0);
85
86 return(token.getLineNumber());
87 }
88
89 public Token getToken() {
90 return(token);
91 }
92
93 /**
94 * Test function for NodeException
95 * @param args command line arguments
96 */
97 public static void main(String [] args) {
98 }
99
100 } /* END OF: NodeException */