Class InputModel
java.lang.Object
net.simplace.client.sim.inputs.InputModel
The inputs of a SimComponent as edited in the input dialog (Redmine #62): per input either a source (link to another
variable) or a value. Checks the entries (
check()), proposes links by name (proposeLinks()) and
writes the changes to the component and the solution (apply()).- 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 final classa problem of an inputstatic final classan input of the component -
Constructor Summary
ConstructorsConstructorDescriptionInputModel(net.simplace.sim.FWSimSolution aSolution, net.simplace.sim.model.FWSimComponent aComponent) -
Method Summary
Modifier and TypeMethodDescriptionbooleanapply()Writes the changed inputs to the component and the solution: values (or their removal) first, then the links.check()Checks all inputs: unknown source, different data types, source and value together, value not convertible (errors); different units, input without source, value and default, source from the component itself (warnings); source computed later in the order of execution (hint: the value of the previous step is used).net.simplace.sim.util.FWSimVariable<?> findSource(String aName) net.simplace.sim.model.FWSimComponentgetRows()Proposes sources for the inputs without source and value: variables of other containers with the same name (seesameName(String, String)) and data type.
-
Constructor Details
-
InputModel
public InputModel(net.simplace.sim.FWSimSolution aSolution, net.simplace.sim.model.FWSimComponent aComponent) - Parameters:
aSolution- the solution (template)aComponent- the component
-
-
Method Details
-
getRows
- Returns:
- the inputs
-
getComponent
public net.simplace.sim.model.FWSimComponent getComponent()- Returns:
- the component
-
getSources
-
findSource
- Parameters:
aName- name of a variable- Returns:
- the variable, or
null
-
check
Checks all inputs: unknown source, different data types, source and value together, value not convertible (errors); different units, input without source, value and default, source from the component itself (warnings); source computed later in the order of execution (hint: the value of the previous step is used).- Returns:
- the problems
-
proposeLinks
Proposes sources for the inputs without source and value: variables of other containers with the same name (seesameName(String, String)) and data type. Inputs with exactly one candidate are proposed; inputs with several candidates are returned with all of them.- Returns:
- for each input without source and value the candidates (empty lists are left out)
-
apply
public boolean apply() throws net.simplace.sim.exceptions.SimLinkInvalidExceptionWrites the changed inputs to the component and the solution: values (or their removal) first, then the links.- Returns:
trueif something was changed- Throws:
net.simplace.sim.exceptions.SimLinkInvalidException- if a link cannot be set (inputs before were already applied)
-