Class InputModel

java.lang.Object
net.simplace.client.sim.inputs.InputModel

public class InputModel extends Object
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 Classes
    Modifier and Type
    Class
    Description
    static enum 
    level of a problem; errors prevent applying, warnings have to be confirmed
    static final class 
    a problem of an input
    static final class 
    an input of the component
  • Constructor Summary

    Constructors
    Constructor
    Description
    InputModel(net.simplace.sim.FWSimSolution aSolution, net.simplace.sim.model.FWSimComponent aComponent)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Writes the changed inputs to the component and the solution: values (or their removal) first, then the links.
    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<?>
     
    net.simplace.sim.model.FWSimComponent
     
     
    Map<String, net.simplace.sim.util.FWSimVariable<?>>
     
    Proposes sources for the inputs without source and value: variables of other containers with the same name (see sameName(String, String)) and data type.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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

      public List<InputModel.Row> getRows()
      Returns:
      the inputs
    • getComponent

      public net.simplace.sim.model.FWSimComponent getComponent()
      Returns:
      the component
    • getSources

      public Map<String, net.simplace.sim.util.FWSimVariable<?>> getSources()
      Returns:
      the possible sources by name
    • findSource

      public net.simplace.sim.util.FWSimVariable<?> findSource(String aName)
      Parameters:
      aName - name of a variable
      Returns:
      the variable, or null
    • check

      public List<InputModel.Problem> 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

      public Map<InputModel.Row, List<String>> proposeLinks()
      Proposes sources for the inputs without source and value: variables of other containers with the same name (see sameName(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.SimLinkInvalidException
      Writes the changed inputs to the component and the solution: values (or their removal) first, then the links.
      Returns:
      true if something was changed
      Throws:
      net.simplace.sim.exceptions.SimLinkInvalidException - if a link cannot be set (inputs before were already applied)