com.singularsys.jep.misc
Class CaseInsensitiveFunctionTable
java.lang.Object
com.singularsys.jep.FunctionTable
com.singularsys.jep.misc.CaseInsensitiveFunctionTable
- All Implemented Interfaces:
- JepComponent, java.io.Serializable
public class CaseInsensitiveFunctionTable
- extends FunctionTable
A version of a function table which is case insensitive.
Note that this table does not include any functions by default. You will
need to add any functions you need.
jep = new Jep();
jep.setComponent(new CaseInsensitiveFunctionTable());
jep.addFunction("if",new If());
jep.parse("if(1>0,2,3)");
System.out.println(jep.evaluate());
If you want to include all the functions in an existing table you can use
FunctionTable oldFT = jep.getFunctionTable();
jep.setComponent(new CaseInsensitiveFunctionTable());
for(Entry ent:oldFT.entrySet()) {
jep.addFunction(ent.getKey(), ent.getValue());
}
- See Also:
- Serialized Form
Methods inherited from class com.singularsys.jep.FunctionTable |
clear, containsValue, entrySet, getLightWeightInstance, init, isEmpty, keySet, remove, size, toString, values |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
CaseInsensitiveFunctionTable
public CaseInsensitiveFunctionTable()
getFunction
public PostfixMathCommandI getFunction(java.lang.String name)
- Overrides:
getFunction
in class FunctionTable
addFunction
public PostfixMathCommandI addFunction(java.lang.String name,
PostfixMathCommandI pfmc)
- Overrides:
addFunction
in class FunctionTable
containsKey
public boolean containsKey(java.lang.String key)
- Overrides:
containsKey
in class FunctionTable
shallowCopy
public FunctionTable shallowCopy()
- Description copied from class:
FunctionTable
- Returns a new shallow copy of this function table.
The entries in the table refer to the the same instances of the postfix math commands.
If sub-classes use pfmc's which are not thread safe
they should override this methods and set a new instance for the table.
- Overrides:
shallowCopy
in class FunctionTable
- Returns:
- a new shallow copy of this function table
Copyright © 2010 Singular Systems http://www.singularsys.com/jep