StringControlIfc

Represents a string-valued simulation control extracted from a property annotated with KSLStringControl.

The interface is intentionally parallel to ControlIfc for numeric controls but replaces the numeric value and bounds with a String value and an optional membership constraint (allowedValues).

Setting value to a string that is not a member of allowedValues (when that list is non-empty) throws a ControlUpdateException. The underlying property is only updated when validation passes.

The initialValue is captured once at extraction time and provides a known safe fallback state. It is not automatically restored on error — callers may read it and assign it back manually if a revert is desired.

Properties

Link copied to clipboard
abstract val allowedValues: List<String>

Permitted values declared on the KSLStringControl annotation. An empty list means the control is unconstrained — any String is accepted.

Link copied to clipboard
abstract val comment: String

Optional comment supplied in the KSLStringControl annotation.

Link copied to clipboard
abstract val elementId: Int

Identifier of the model element that owns this control.

Link copied to clipboard
abstract val elementName: String

Name of the model element that owns this control.

Link copied to clipboard

Ancestor names from the model root down to (but not including) the model element holding this control, also exclusive of the Model itself. Empty when the control's element is a direct child of the Model.

Link copied to clipboard
abstract val elementType: String

Simple class name of the model element that owns this control.

Link copied to clipboard
abstract val initialValue: String

The string value captured at extraction time. Provides a safe fallback if the caller needs to revert after a failed or unwanted update.

Link copied to clipboard
abstract val keyName: String

Unique access key of the form "${elementName}.${propertyName}".

Link copied to clipboard
abstract val modelName: String

Name of the model that contains the owning element.

Link copied to clipboard
open val parentElementId: Int?

Identifier of the parent model element, or null.

Link copied to clipboard

Name of the parent of the model element holding this control, or null when that element is a direct child of the Model. See ControlIfc.parentElementName for the same convention applied to numeric controls.

Link copied to clipboard

Simple class name of the parent model element, or null.

Link copied to clipboard
abstract val propertyName: String

Name of the annotated property.

Link copied to clipboard
abstract var value: String

Current string value of the underlying property. Setting this property validates against allowedValues before delegating to the property setter via reflection.

Functions

Link copied to clipboard
open fun isAllowed(v: String): Boolean

Returns true if v is permitted by allowedValues. Always returns true when allowedValues is empty (unconstrained).