Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.singularsys.jep.misc
Class LightWeightComponentSet

    java.lang.Object
      com.singularsys.jep.ComponentSet
          com.singularsys.jep.misc.LightWeightComponentSet

    public class LightWeightComponentSet

extends ComponentSet

A lightweight set of components reusing components from an existing Jep instance. This class will reuse the NumberFactory, VariableFactory, FunctionTable, OperatorTable, and PrintVisitor components of the supplied Jep. It will have a NullParser so it can not be used for parsing expressions. New copies of the VariableTable, StandardEvaluator and NodeFactory are used. The VariableTable will be filled with the copies of the variables in the supplied instances' variable table.

To construct a lightweight jep instance use

     Jep j = new Jep();
     LightWeightComponentSet lwcs = new LightWeightComponentSet(j);
     Jep j2 = new Jep(lwcs);

Such instance typically use 1kB compared to 56kB bytes for a Jep instance with a StandardParser and 14kB bytes with a configurable parser.

As this reuses the function table and PostfixMathCommands in it. There may be cases where the pfmc are not optimized for use in multiple threads `Random` is the only example of this. While safe to use in multiple threads efficiency is improved if each thread has its own copy. If this is an issue the shallowCopy() methods of function table can be used.

     Jep j = new Jep();
     LightWeightComponentSet lwcs = new LightWeightComponentSet(j);
     FunctionTable ft = lwcs.getFunctionTable().shallowCopy();
     // use new instances of the pfmc's
     lwcs.setFunctionTable(ft);

Field Summary

Fields inherited from class com.singularsys.jep.ComponentSet
`evaluator, funTab, nodeFac, numFac, opTab, parser, pv, varFac, varTab`

Constructor Summary
`LightWeightComponentSet(Jep jep)`

Method Summary

Methods inherited from class com.singularsys.jep.ComponentSet
`getComponents, getEvaluator, getFunctionTable, getNodeFactory, getNumberFactory, getOperatorTable, getParser, getPrintVisitor, getVariableFactory, getVariableTable, setEvaluator, setFunctionTable, setNodeFactory, setNumberFactory, setOperatorTable, setParser, setPrintVisitor, setVariableFactory, setVariableTable`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### LightWeightComponentSet

    public LightWeightComponentSet(Jep jep)

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2007 Singular Systems http://www.singularsys.com/jep