Class MediumWeightComponentSet
- java.lang.Object
-
- com.singularsys.jep.ComponentSet
-
- com.singularsys.jep.misc.MediumWeightComponentSet
-
public class MediumWeightComponentSet extends ComponentSet
A medium weight set of components reusing components from an existing Jep instance. This class will reuse the NumberFactory, VariableFactory, and PrintVisitor components of the supplied Jep. The FunctionTable and OperatorTable will use their respective
shallowCopy()
methods. These will copy most functions or operators except when the PFMC implementsJepComponent
indicating it is not thread safe. In that case the functionsgetLightWeightInstance()
will be called to create a thread safe version. 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 mediumweight jep instance use
Jep j = new Jep(); MediumWeightComponentSet mwcs = new MediumWeightComponentSet(j); Jep j2 = new Jep(mwcs);
Such instance typically use 4kB compared to 1kB for the lightWeightComponetSet, 56kB bytes for a Jep instance with a StandardParser and 14kB bytes with a configurable parser.
Jep j = new Jep(); MediumWeightComponentSet lwcs = new LightWeightComponentSet(j); FunctionTable ft = lwcs.getFunctionTable().shallowCopy(); // use new instances of the pfmc's lwcs.setFunctionTable(ft);
As of Jep version 3.5 the LightWeightComponentSet uses a Null Print Visitor so cannot print.
- See Also:
LightWeightComponentSet
-
-
Constructor Summary
Constructors Constructor Description MediumWeightComponentSet(Jep jep)
Create a lightweight instance with copies of all variablesMediumWeightComponentSet(Jep jep, boolean copyConstants)
Create a lightweight instance either with an empty variable table or one with just the constants.
-
Method Summary
-
Methods inherited from class com.singularsys.jep.ComponentSet
addAuxComponent, addComponents, getAuxComponents, getAuxComps, getBaseComponents, getComponents, getEvaluator, getFunctionTable, getNodeFactory, getNumberFactory, getOperatorTable, getParser, getPrintVisitor, getVariableFactory, getVariableTable, setAuxComps, setEvaluator, setFunctionTable, setNodeFactory, setNumberFactory, setOperatorTable, setParser, setPrintVisitor, setVariableFactory, setVariableTable
-
-
-
-
Constructor Detail
-
MediumWeightComponentSet
public MediumWeightComponentSet(Jep jep)
Create a lightweight instance with copies of all variables
-
MediumWeightComponentSet
public MediumWeightComponentSet(Jep jep, boolean copyConstants)
Create a lightweight instance either with an empty variable table or one with just the constants.- Parameters:
jep
- the source instancecopyConstants
- if true copy the constants, if false leave empty
-
-