Controls

class Controls(aModel: Model)

This class holds the controls associated with an instance of a model. The controls can be accessed via their key names. The following functions are useful when accessing controls.

  • controlKeys() returns the names of the controls

  • hasControl(name:String) checks if name is a control

  • asList() the controls as a list

  • asListByType(controlType: ControlType) a filtered list of controls by control type

  • control(controlKey: String) returns the named control or null

  • controlTypes() the set of control types used by the model

  • asMap() - all the controls as a map, with the pairs (control name, value)

  • setControlsFromMap(controlMap: Map) perhaps the most useful of the functions. Sets the controls by name to the supplied value for each control.

  • setControlsFromJSON(json: String) assumes that the JSON represents a control map and sets the controls as specified.

  • controlsMapAsJsonString() a JSON string representation of a control map

  • controlData() a list holding instances of ControlData of all the controls for data transfer purposes

  • controlDataAsString() a string representation of the control data

Constructors

Link copied to clipboard
constructor(aModel: Model)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val size: Int

Functions

Link copied to clipboard
Link copied to clipboard

The type should be associated with a valid control type.

Link copied to clipboard

Generate a "flat" map (String, Double) for communication outside this class. The key is the control key and the number is the last double value assigned to the control. Any controls that cannot be translated to Double are ignored.

Link copied to clipboard
fun control(controlKey: String): ControlIfc?

Gets a control of the supplied key name or null

Link copied to clipboard

Return a List of ControlData providing additional detail on Controls (but without giving direct access to the control)

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

A JSON representation of the map of pairs (keyName, value) for the controls

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun setControlsFromMap(controlMap: Map<String, Double>): Int

Sets all the contained control values using the supplied flat map

Link copied to clipboard
open override fun toString(): String