KickJava   Java API By Example, From Geeks To Geeks.

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


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 /* @author rich
10  * Created on 19-Dec-2003
11  */

12 package org.nfunk.jep;
13
14 /**
15  * A factory class which is used to create variables.
16  * By default this class creates variables of type {@link Variable}.
17  * This class should be subclassed if the type of variable used needs to be changed.
18  * This class is passed to the constructor of {@link SymbolTable}
19  * which ensures that variables of the correct type are always created.
20  *
21  * @author Rich Morris
22  * Created on 19-Dec-2003
23  */

24 public class VariableFactory
25 {
26     /** Create a variable with a name and value */
27     public Variable createVariable(String JavaDoc name, Object JavaDoc value) {
28         return new Variable(name,value);
29     }
30
31     /** Create a variable with a name but not value */
32     public Variable createVariable(String JavaDoc name) {
33         return new Variable(name);
34     }
35 }
36
Popular Tags