1 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 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 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 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 |