KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > nfunk > jep > FunctionTable


1 /*****************************************************************************
2
3 JEP - Java Math Expression Parser 2.3.0
4       October 3 2004
5       (c) Copyright 2004, Nathan Funk and Richard Morris
6       See LICENSE.txt for license information.
7
8 *****************************************************************************/

9 package org.nfunk.jep;
10 import java.util.Hashtable JavaDoc;
11 import org.nfunk.jep.function.PostfixMathCommandI;
12 public class FunctionTable extends Hashtable JavaDoc
13 {
14     public FunctionTable()
15     {
16         
17     }
18     
19     /** adds the PostfixMathCommandI for the function with name s.
20      * RJM addition Oct 03
21      */

22     public Object JavaDoc put(String JavaDoc s,PostfixMathCommandI pfmc)
23     {
24         return super.put(s,pfmc);
25     }
26     
27     /** overrides the standard hashtable method.
28      * If the arguments are of the wrong type then throws
29      * ClassCastException
30      * RJM addition Oct 03
31      * TODO is Hashtable always index by Strings?
32      */

33     public Object JavaDoc put(Object JavaDoc o,Object JavaDoc p)
34     {
35         return put((String JavaDoc) o,(PostfixMathCommandI) p);
36     }
37     
38     /** returns the PostfixMathCommandI for function with name s.
39      * RJM addition Oct 03
40      */

41     public PostfixMathCommandI get(String JavaDoc s)
42     {
43         return (PostfixMathCommandI) super.get(s);
44     }
45     
46     /** overrides the standard hashtable method.
47      * If the argument is of the wrong type (i.e. not a String)
48      * then throws ClassCastException
49      * RJM addition Oct 03
50      */

51     
52     public Object JavaDoc get(Object JavaDoc o)
53     {
54         return get((String JavaDoc) o);
55     }
56 }
57
Popular Tags