ProcessActivator

protected inner class ProcessActivator<T : ProcessModel.Entity>(entityCreator: () -> T, initialCountLimit: Int = 1, var processName: String? = null, var resetCountOption: Boolean = true, var activationPriority: Int = KSLEvent.DEFAULT_PRIORITY, name: String? = null) : ModelElement(source)

This class will activate the entity's default process or the process provided by the process name argument. When the increment counter reaches the supplied initial count limit the entity's process will be activated. If the reset count option is true the internal counter is reset and additional entities will be created and activated when the count again reaches the limit. If the supplied process name is null (or not a named process for the entity), then the entity's default process will be activated. If both are unspecified, then an error occurs.

This class works similarly to an EntityGenerator, except it is based on counts rather than time.

Parameters

entityCreator

the thing that creates the entities of the particular type. Typically, a reference to the constructor of the class

initialCountLimit

the limit to use to indicate when to activate the entity

processName

the name of the process, from the process() function that will be activated

resetCountOption

if true the counter will be reset after an activation occurs. True is the default. True allows multiple activations based on the count limit.

activationPriority

the priority for scheduling the activation at the time the counter is reached

name

the model element name, must be unique.

Constructors

Link copied to clipboard
constructor(entityCreator: () -> T, initialCountLimit: Int = 1, processName: String? = null, resetCountOption: Boolean = true, activationPriority: Int = KSLEvent.DEFAULT_PRIORITY, name: String? = null)

Properties

Link copied to clipboard
Link copied to clipboard
var count: Int

The current count towards activation. If the reset count option is true, this will be reset each time the limit is reached and an entity is created and activated.

Link copied to clipboard

The count limit for activation, which can be changed only when the model is not running This is the limit that specifies when the entity will be created and the process activated.

Link copied to clipboard

If not null, this property holds a reference to the entity created during the activation process.

Link copied to clipboard

The default initialization option that specifies that the activator is on or off when the model element is initialized. The default is true.

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

False will turn the activator off during a replication. True means that it is on. This will be reset to the onAtInitializationOption so that each replication starts with the same specification.

Functions

Link copied to clipboard

Causes the activation counter to be incremented. Once the counter reaches the limit the entity will be created and the entity's process is activated. If the reset count option is true, the counter will be reset to allow additional entities to be activated.

Link copied to clipboard
protected open override fun initialize()

This method should be overridden by subclasses that need actions performed to initialize prior to a replication. It is called once before each replication occurs if the model element wants initialization. It is called after beforeReplication() is called