KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * SpecialOperator.java
3  *
4  * Copyright (C) 2002-2003 Peter Graves
5  * $Id: SpecialOperator.java,v 1.12 2004/09/19 16:19:19 asimon 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 SpecialOperator extends Functional
25 {
26     private final String JavaDoc name;
27     private final int index;
28
29     private int callCount;
30
31     public SpecialOperator(String JavaDoc name)
32     {
33         this.name = name.toUpperCase();
34         this.index = 0;
35         setLambdaName(Symbol.addFunction(this.name, this));
36     }
37
38     public SpecialOperator(String JavaDoc name, String JavaDoc arglist)
39     {
40         this(name);
41         setArglist(new SimpleString(arglist));
42     }
43       
44     public final int getFunctionalType()
45     {
46         return FTYPE_SPECIAL_OPERATOR;
47     }
48
49     public final String JavaDoc getName()
50     {
51         return name;
52     }
53
54     public String JavaDoc toString()
55     {
56         StringBuffer JavaDoc sb = new StringBuffer JavaDoc("#<SPECIAL-OPERATOR ");
57         sb.append(name);
58         sb.append(">");
59         return sb.toString();
60     }
61
62     // Profiling.
63
public final int getCallCount()
64     {
65         return callCount;
66     }
67
68     public final void setCallCount(int n)
69     {
70         callCount = n;
71     }
72
73     public final void incrementCallCount()
74     {
75         ++callCount;
76     }
77 }
78
Popular Tags