Skip to content

Instance deletion

Leon Starr edited this page Sep 5, 2021 · 2 revisions

Deleting instances

Like creation, deletion can be triggered by a signal or an action. Deletion is easier to specify than creation since you don’t need to worry about initializing any attributes. You just need to be careful not to invalidate any references from other classes.

Synchronous deletion (with an action)

To delete an instance synchronously, use the delete !* command. Symbolically, you can remember it as “un-create”. Let’s say you have a set of Aircraft instance references:

!* ac

In the example above, all instances in the instance set variable ac are immediately deleted. It is best to use this approach with classes that do not have state models. If the class does have a state model, the modeler should ensure proper synchronization so that deletion occurs when no critical activities are being executed by the instances to be deleted. Furthermore, an error will occur if this action would invalidate any references from other classes.

As with most operations on an instance set variable, there is no special consequence or error in the case of an empty set.

Asynchronous deletion (with an event)

Deleting with an event is simply a matter of sending a normal event to the instance you want to delete. Presumably that event will cause a state transition to a deletion state in the target class. Since there’s nothing special about a deletion event, there is no special Scrall syntax.

Introduction

Model semantics

Flows (as Variables)

Constants and literals

Structure of an activity

Accessing the class model

Data flow


Grammar and parsing notes

Components

Clone this wiki locally