001: /*
002: * Nil.java
003: *
004: * Copyright (C) 2002-2003 Peter Graves
005: * $Id: Nil.java,v 1.6 2003/11/15 11:03:30 beedlem Exp $
006: *
007: * This program is free software; you can redistribute it and/or
008: * modify it under the terms of the GNU General Public License
009: * as published by the Free Software Foundation; either version 2
010: * of the License, or (at your option) any later version.
011: *
012: * This program is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
015: * GNU General Public License for more details.
016: *
017: * You should have received a copy of the GNU General Public License
018: * along with this program; if not, write to the Free Software
019: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
020: */
021:
022: package org.armedbear.lisp;
023:
024: public final class Nil extends Symbol {
025: public Nil(Package pkg) {
026: super ("NIL", pkg);
027: pkg.addSymbol(this );
028: }
029:
030: public LispObject typeOf() {
031: return Symbol.NULL;
032: }
033:
034: public LispClass classOf() {
035: return BuiltInClass.NULL;
036: }
037:
038: public LispObject typep(LispObject typeSpecifier)
039: throws ConditionThrowable {
040: if (typeSpecifier == Symbol.NULL)
041: return T;
042: if (typeSpecifier == Symbol.LIST)
043: return T;
044: if (typeSpecifier == Symbol.SEQUENCE)
045: return T;
046: if (typeSpecifier == Symbol.SYMBOL)
047: return T;
048: if (typeSpecifier == Symbol.BOOLEAN)
049: return T;
050: return super .typep(typeSpecifier);
051: }
052:
053: public LispObject CONSTANTP() {
054: return T;
055: }
056:
057: public final LispObject getSymbolValue() {
058: return this ;
059: }
060:
061: public LispObject car() {
062: return this ;
063: }
064:
065: public LispObject cdr() {
066: return this ;
067: }
068:
069: public final LispObject cadr() {
070: return this ;
071: }
072:
073: public final LispObject cddr() {
074: return this ;
075: }
076:
077: public int length() {
078: return 0;
079: }
080:
081: public LispObject elt(int index) throws ConditionThrowable {
082: throw new ConditionThrowable(new TypeError(
083: "ELT: invalid index " + index + " for " + this ));
084: }
085:
086: public LispObject nreverse() {
087: return this ;
088: }
089:
090: public LispObject[] copyToArray() {
091: return new LispObject[0];
092: }
093:
094: public boolean listp() {
095: return true;
096: }
097:
098: public LispObject LISTP() {
099: return T;
100: }
101:
102: public LispObject ENDP() {
103: return T;
104: }
105:
106: public LispObject NOT() {
107: return T;
108: }
109:
110: public final LispObject getSymbolFunction() {
111: return null;
112: }
113:
114: public LispObject remove(LispObject item) throws ConditionThrowable {
115: return this ;
116: }
117:
118: public String toString() {
119: return "NIL";
120: }
121: }
|