Class FWSimpleSimComponent
java.lang.Object
net.simplace.sim.model.FWSimComponent
net.simplace.sim.components.FWSimpleSimComponent
- All Implemented Interfaces:
IntegratableComponent, FWSimFieldContainer
SimComponent defined completely in the solution, without own Java class: the children of
process (and
optionally integrate) are output variables whose values are calculated by their rules (JEXL) in each
step (resp. after the integration). The variables used in the rules become the inputs of the component.- Author:
- Andreas Enders
-
Nested Class Summary
Nested classes/interfaces inherited from class FWSimComponent
FWSimComponent.TEST_STATE -
Field Summary
Fields inherited from class FWSimComponent
iFieldMap, iFrequence, iInputMap, iJexlRule, iMasterComponentGroup, iName, iOrderNumber, iResetWhenInactive, isComponentGroup, iSimComponentElement, iSimModel, iVarMap -
Constructor Summary
ConstructorsConstructorDescriptionConstructor for instantiation via reflection.FWSimpleSimComponent(String aName, HashMap<String, FWSimVariable<?>> aFieldMap, HashMap<String, String> aInputMap, org.jdom2.Element aSimComponentElement, FWSimVarMap aVarMap, int aOrderNumber) FWSimpleSimComponent(String aName, HashMap<String, FWSimVariable<?>> aFieldMap, LinkedList<FWSimVariable<?>> aProcessAlgorithmsMap, LinkedList<FWSimVariable<?>> aIntegrateAlgorithmsMap, HashMap<String, String> aInputMap, org.jdom2.Element aSimComponentElement, FWSimVarMap aVarMap, int aOrderNumber) Constructor used byclone(FWSimVarMap); the algorithm lists are shared untilinit(). -
Method Summary
Modifier and TypeMethodDescriptionprotected voidbind()Nothing to bind; the variables are evaluated by their rules.protected FWSimComponentclone(FWSimVarMap aVarMap) Clones the component for a simulation; the algorithm lists are replaced by the simulation's instances ininit().HashMap<String, FWSimVariable<?>> Creates the variables of theprocessandintegratechildren and registers the variables used in their rules as inputs (component.varasvar, a leadingvbecomesc).HashMap<String, FWSimVariable<?>> fillTestVariables(int aParamIndex, FWSimComponent.TEST_STATE aDefineOrCheck) No component tests for simple components.final org.jdom2.ElementgetEditFormXML(boolean aEnabled) Creates the edit form: name, class and the process and integrate definitions as text (onename=ruleper line).protected voidinit()Replaces the algorithm variables by the instances of the variable map of the simulation.voidEvaluates the rules of the integrate variables in order and sets their values.protected voidprocess()Evaluates the rules of the process variables in order and sets their values.voidsetVariables(List<org.jdom2.Element> aProcess, List<org.jdom2.Element> aIntegrate) Replaces the variables of the component (e.g.org.jdom2.ElementtoXML()Creates thesimcomponentelement: a copy of the configuration element as read or as set bysetVariables(List, List)(keeping description, comments and all attributes); without element it is created from theprocessandintegratevariables.Methods inherited from class FWSimComponent
addVariable, checkCondition, createSimComponent, createSimComponent, createSimComponent, createSimComponent, doProcess, getConstantVariables, getContentType, getCreateFormXML, getDescription, getFieldMap, getFrequence, getFrequenceRuleScript, getInputs, getInputValueText, getInputVariables, getMasterComponentGroup, getName, getOrderNumber, getOutputVariables, getSimComponentElement, getVariable, getVariableField, getVarMap, initialize, isConditionCheck, isVariableAvailable, performLinks, performLinks, readInputs, removeVariable, reset, runComponentTest, setInputValue, setVariablesDefault, syncInputLinks, toComponentLinkingXML, toDocXML, toGroupXML, toOutputDefinitionXML, toResourcesDataXML, toResourcesDefinitionXML, toString, writeVarInfos
-
Constructor Details
-
FWSimpleSimComponent
public FWSimpleSimComponent(String aName, HashMap<String, FWSimVariable<?>> aFieldMap, HashMap<String, String> aInputMap, org.jdom2.Element aSimComponentElement, FWSimVarMap aVarMap, int aOrderNumber) - Parameters:
aName- name of the componentaFieldMap- variables of the componentaInputMap- input links of the componentaSimComponentElement- thesimcomponentelementaVarMap- variable map of the simulationaOrderNumber- order number of the component
-
FWSimpleSimComponent
public FWSimpleSimComponent()Constructor for instantiation via reflection. -
FWSimpleSimComponent
public FWSimpleSimComponent(String aName, HashMap<String, FWSimVariable<?>> aFieldMap, LinkedList<FWSimVariable<?>> aProcessAlgorithmsMap, LinkedList<FWSimVariable<?>> aIntegrateAlgorithmsMap, HashMap<String, String> aInputMap, org.jdom2.Element aSimComponentElement, FWSimVarMap aVarMap, int aOrderNumber) Constructor used byclone(FWSimVarMap); the algorithm lists are shared untilinit().- Parameters:
aName- name of the componentaFieldMap- variables of the componentaProcessAlgorithmsMap- variables calculated in the process stepaIntegrateAlgorithmsMap- variables calculated after the integrationaInputMap- input links of the componentaSimComponentElement- thesimcomponentelementaVarMap- variable map of the simulationaOrderNumber- order number of the component
-
-
Method Details
-
createVariables
Creates the variables of theprocessandintegratechildren and registers the variables used in their rules as inputs (component.varasvar, a leadingvbecomesc). Each of the two elements may be missing; if both are missing, an error is logged.- Specified by:
createVariablesin interfaceFWSimFieldContainer- Specified by:
createVariablesin classFWSimComponent- Returns:
- the field map, or
nullwithout component element - See Also:
-
bind
protected void bind()Nothing to bind; the variables are evaluated by their rules.- Overrides:
bindin classFWSimComponent
-
init
protected void init()Replaces the algorithm variables by the instances of the variable map of the simulation.- Specified by:
initin classFWSimComponent- See Also:
-
process
protected void process()Evaluates the rules of the process variables in order and sets their values. Errors are logged.- Specified by:
processin classFWSimComponent- See Also:
-
postIntegrate
public void postIntegrate()Evaluates the rules of the integrate variables in order and sets their values. Errors are logged, like inprocess().- Specified by:
postIntegratein interfaceIntegratableComponent- See Also:
-
getLinkedVariableNames
-
getProcessAlgorithms
- Returns:
- the variables calculated in the process step
-
getIntegrateAlgorithms
- Returns:
- the variables calculated after the integration
-
getFieldsInfo
- Returns:
- the configuration of the component (algorithms and variables) as HTML, e.g. for an info dialog of the GUI
-
getEditFormXML
public final org.jdom2.Element getEditFormXML(boolean aEnabled) Creates the edit form: name, class and the process and integrate definitions as text (onename=ruleper line).- Specified by:
getEditFormXMLin interfaceFWSimFieldContainer- Overrides:
getEditFormXMLin classFWSimComponent- Parameters:
aEnabled- if the definitions are editable- Returns:
- the XML form definition used by the GUI to edit the settings of this container
- See Also:
-
toXML
public org.jdom2.Element toXML()Creates thesimcomponentelement: a copy of the configuration element as read or as set bysetVariables(List, List)(keeping description, comments and all attributes); without element it is created from theprocessandintegratevariables.- Specified by:
toXMLin interfaceFWSimFieldContainer- Overrides:
toXMLin classFWSimComponent- Returns:
- an XML element with all settings of this container
- See Also:
-
setVariables
Replaces the variables of the component (e.g. from the editor of the GUI, Redmine #62): thevarelements ofprocessandintegrateare replaced in the configuration element (other content like comments stays, an empty section is removed), the old variables are removed from the var map and the field map of the model, the new ones are created and registered, and the inputs are derived from the rules again.- Parameters:
aProcess- thevarelements calculated in the process step, in orderaIntegrate- thevarelements calculated after the integration, in order
-
fillTestVariables
public HashMap<String, FWSimVariable<?>> fillTestVariables(int aParamIndex, FWSimComponent.TEST_STATE aDefineOrCheck) No component tests for simple components.- Specified by:
fillTestVariablesin classFWSimComponent- Parameters:
aParamIndex- index of the test case (not used)aDefineOrCheck- define or check phase (not used)- Returns:
- always
null - See Also:
-
clone
Clones the component for a simulation; the algorithm lists are replaced by the simulation's instances ininit().- Specified by:
clonein classFWSimComponent- Parameters:
aVarMap- var map of the new simulation- Returns:
- the new instance
- See Also:
-