KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * SimpleCondition.java
3  *
4  * Copyright (C) 2003 Peter Graves
5  * $Id: SimpleCondition.java,v 1.8 2003/12/13 00:58:51 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 class SimpleCondition extends Condition
25 {
26     public SimpleCondition()
27     {
28         setFormatControl(NIL);
29         setFormatArguments(NIL);
30     }
31
32     public SimpleCondition(LispObject formatControl, LispObject formatArguments)
33     {
34         setFormatControl(formatControl);
35         setFormatArguments(formatArguments);
36     }
37
38     public SimpleCondition(LispObject initArgs) throws ConditionThrowable
39     {
40         super(initArgs);
41     }
42
43     public SimpleCondition(String JavaDoc message)
44     {
45         super(message);
46     }
47
48     public LispObject typeOf()
49     {
50         return Symbol.SIMPLE_CONDITION;
51     }
52
53     public LispClass classOf()
54     {
55         return BuiltInClass.SIMPLE_CONDITION;
56     }
57
58     public LispObject typep(LispObject type) throws ConditionThrowable
59     {
60         if (type == Symbol.SIMPLE_CONDITION)
61             return T;
62         if (type == BuiltInClass.SIMPLE_CONDITION)
63             return T;
64         return super.typep(type);
65     }
66
67     // ### simple-condition-format-control
68
private static final Primitive1 SIMPLE_CONDITION_FORMAT_CONTROL =
69         new Primitive1("simple-condition-format-control", "condition")
70     {
71         public LispObject execute(LispObject arg) throws ConditionThrowable
72         {
73             if (arg instanceof Condition)
74                 return ((Condition)arg).getFormatControl();
75             return signal(new TypeError(arg, Symbol.CONDITION));
76         }
77     };
78
79     // ### simple-condition-format-arguments
80
private static final Primitive1 SIMPLE_CONDITION_FORMAT_ARGUMENTS =
81         new Primitive1("simple-condition-format-arguments", "condition")
82     {
83         public LispObject execute(LispObject arg) throws ConditionThrowable
84         {
85             if (arg instanceof Condition)
86                 return ((Condition)arg).getFormatArguments();
87             return signal(new TypeError(arg, Symbol.CONDITION));
88         }
89     };
90 }
91
Popular Tags