KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jfun > parsec > UserException


1 /*****************************************************************************
2  * Copyright (C) Zephyr Business Solutions Corp. All rights reserved. *
3  * ------------------------------------------------------------------------- *
4  * The software in this package is published under the terms of the BSD *
5  * style license a copy of which has been included with this distribution in *
6  * the LICENSE.txt file. *
7  *****************************************************************************/

8 /*
9  * Created on Jan 29, 2005
10  *
11  * Author Ben Yu
12  * ZBS
13  */

14 package jfun.parsec;
15
16 /**
17  * User code can throw this exception
18  * when a non-recoverable error is encountered.
19  * The framework will transform it to ParserException.
20  * <p> Zephyr Business Solutions Corp.
21  *
22  * @author Ben Yu
23  *
24  */

25 public class UserException extends RuntimeException JavaDoc {
26   private final int ind;
27   
28   /**
29    * Get the index in the original source.
30    */

31   public int getInd() {
32     return ind;
33   }
34   /**
35    * Create a UserException object.
36    * @param msg the error message.
37    */

38   public UserException(String JavaDoc msg){
39     this(-1, msg);
40   }
41   /**
42    * Create a UserException object.
43    * @param msg the error message.
44    */

45   public UserException(String JavaDoc msg, Throwable JavaDoc cause){
46     this(-1, msg, cause);
47   }
48   /**
49    * Create a UserException object.
50    * @param ind the index in the original source.
51    * -1 if the index is unknown.
52    */

53   public UserException(final int ind) {
54     this.ind = ind;
55   }
56
57
58   /**
59    * Create a UserException object.
60    * @param ind the index in the original source.
61    * -1 if the index is unknown.
62    * @param msg the error message.
63    */

64   public UserException(final int ind, String JavaDoc msg) {
65     super(msg);
66     this.ind = ind;
67   }
68   /**
69    * Create a UserException object.
70    * @param ind the index in the original source.
71    * -1 if the index is unknown.
72    * @param msg the error message.
73    * @param arg1 the chained exception.
74    */

75   public UserException(int ind, String JavaDoc msg, Throwable JavaDoc arg1) {
76     super(msg, arg1);
77     this.ind = ind;
78   }
79   /**
80    * Create a UserException object.
81    * @param ind the index in the original source.
82    * -1 if the index is unknown.
83    * @param arg0 the chained exception.
84    */

85   public UserException(int ind, Throwable JavaDoc arg0) {
86     super(arg0);
87     this.ind = ind;
88   }
89 }
90
Popular Tags