Class SimpleComponentModel
java.lang.Object
net.simplace.client.sim.simple.SimpleComponentModel
The variables of a SimpleSimComponent (FWSimpleSimComponent) as edited in the GUI (Redmine #62): each variable is
calculated by its rule, in order, in the process step or after the integration. Reads the variables from the
configuration element (
from(String, Element)), checks them (check(Predicate, Function)) and writes
them as var elements (toVarElements(PHASE)); attributes not edited here (e.g. min, max, mode)
are kept.- Author:
- Andreas Enders, Claude (Anthropic), co-author
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumlevel of a problem; errors prevent applying, warnings have to be confirmedstatic enumwhen a variable is calculatedstatic final classa problem of a variablestatic final classa variable of the component -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionChecks all variables: no variable, invalid or duplicate id, unknown data type, empty rule, syntax error (errors); unknown variables in a rule, default not of the data type, variables removed or renamed which are used by other parts of the solution (warnings); a variable using a later (or itself) variable of the component - it gets the value of the previous step -, operator hints of the rule check (hints).static SimpleComponentModelgetVars()voidRemoves a variable; a variable read from the element is remembered for the check of its users.voidSorts the variables by phase (process first), keeping the order within each phase.org.jdom2.ElementList<org.jdom2.Element>
-
Field Details
-
DATA_TYPES
data types of the variables
-
-
Constructor Details
-
SimpleComponentModel
- Parameters:
aComponentName- id of the component (prefix of its variable names)
-
-
Method Details
-
from
- Parameters:
aComponentName- id of the componentaComponentElement- thesimcomponentelement, may benull(no variables)- Returns:
- the model with the variables of
processandintegrate, in order
-
getVars
- Returns:
- the variables: first all of the process step, then all calculated after the integration, each in order
-
getComponentName
- Returns:
- the id of the component
-
sortByPhase
public void sortByPhase()Sorts the variables by phase (process first), keeping the order within each phase. -
currentNames
-
check
public List<SimpleComponentModel.Problem> check(Predicate<String> aKnownVariable, Function<String, List<String>> aUsers) Checks all variables: no variable, invalid or duplicate id, unknown data type, empty rule, syntax error (errors); unknown variables in a rule, default not of the data type, variables removed or renamed which are used by other parts of the solution (warnings); a variable using a later (or itself) variable of the component - it gets the value of the previous step -, operator hints of the rule check (hints).- Parameters:
aKnownVariable- tells whether a variable of the solution is known (the variables of this component are added), ornullto skip this checkaUsers- the users (e.g. components, outputs) of a variable of the solution, ornullto skip this check- Returns:
- the problems
-
remove
Removes a variable; a variable read from the element is remembered for the check of its users.- Parameters:
aVar- the variable
-
toVarElements
- Parameters:
aPhase- process or integrate- Returns:
- the
varelements of the phase, in order (copies of the read elements with the edited attributes, or new elements)
-
toComponentElement
public org.jdom2.Element toComponentElement()- Returns:
- a new
simcomponentelement of a FWSimpleSimComponent with these variables (e.g. for a new component)
-