KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > armedbear > lisp > FileError


1 /*
2  * FileError.java
3  *
4  * Copyright (C) 2004 Peter Graves
5  * $Id: FileError.java,v 1.3 2004/01/16 15:16:40 piso Exp $
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * 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.lisp;
23
24 public final class FileError extends LispError
25 {
26     private LispObject pathname = NIL;
27
28     // initArgs is either a normal initArgs list or a pathname.
29
public FileError(LispObject initArgs) throws ConditionThrowable
30     {
31         super(initArgs);
32         if (initArgs instanceof Cons) {
33             LispObject pathname = NIL;
34             LispObject first, second;
35             while (initArgs != NIL) {
36                 first = initArgs.car();
37                 initArgs = initArgs.cdr();
38                 second = initArgs.car();
39                 initArgs = initArgs.cdr();
40                 if (first == Keyword.PATHNAME) {
41                     pathname = second;
42                     break;
43                 }
44             }
45             this.pathname = pathname;
46         } else
47             pathname = initArgs;
48     }
49
50     public FileError(String JavaDoc message)
51     {
52         super(message);
53     }
54
55     public FileError(String JavaDoc message, LispObject pathname)
56     {
57         super(message);
58         this.pathname = pathname;
59     }
60
61     public LispObject getPathname()
62     {
63         return pathname;
64     }
65
66     public LispObject typeOf()
67     {
68         return Symbol.FILE_ERROR;
69     }
70
71     public LispClass classOf()
72     {
73         return BuiltInClass.FILE_ERROR;
74     }
75
76     public LispObject typep(LispObject type) throws ConditionThrowable
77     {
78         if (type == Symbol.FILE_ERROR)
79             return T;
80         if (type == BuiltInClass.FILE_ERROR)
81             return T;
82         return super.typep(type);
83     }
84 }
85
Popular Tags