Revision: 1.1 - (view) (download) (as text)
1 : | ktanaka | 1.1 | public abstract class LispObject{ |
2 : | static final int FIXNUM=0; | ||
3 : | static final int SYMBOL=1; | ||
4 : | static final int CONS=2; | ||
5 : | static final int STRING=3; | ||
6 : | static final int FLONUM=4; | ||
7 : | abstract int getType(); | ||
8 : | public int getInteger() throws LispException{ | ||
9 : | throw LispException.typeerr; | ||
10 : | } | ||
11 : | public String getName() throws LispException{ | ||
12 : | throw LispException.typeerr; | ||
13 : | } | ||
14 : | public LispObject car() throws LispException{ | ||
15 : | throw LispException.typeerr; | ||
16 : | } | ||
17 : | public LispObject cdr() throws LispException{ | ||
18 : | throw LispException.typeerr; | ||
19 : | } | ||
20 : | public LispObject setCar() throws LispException{ | ||
21 : | throw LispException.typeerr; | ||
22 : | } | ||
23 : | public LispObject setCdr() throws LispException{ | ||
24 : | throw LispException.typeerr; | ||
25 : | } | ||
26 : | public double getDouble() throws LispException{ | ||
27 : | throw LispException.typeerr; | ||
28 : | } | ||
29 : | public String getString() throws LispException{ | ||
30 : | throw LispException.typeerr; | ||
31 : | } | ||
32 : | public int length() throws LispException{ | ||
33 : | LispObject l=this; | ||
34 : | int i=0; | ||
35 : | while(l.getType()==CONS){ | ||
36 : | i++; | ||
37 : | l=l.cdr(); | ||
38 : | } | ||
39 : | return i; | ||
40 : | } | ||
41 : | } |
ktanaka Powered by ViewCVS 1.0-dev |
ViewCVS and CVS Help |