-
Notifications
You must be signed in to change notification settings - Fork 0
Instance deletion
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.
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.
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.
Copyright 2020, 2021, 2022, 2023, 2025 © Leon Starr under MIT Open Source License
- Why they are problematic
- Instance attribute creation values
- Boolean values
- Special values
- Enumerated values
- Action block
- Statement
- Single line action
- Multiple dependent actions on a single line
- An action spread across multiple lines
- A conditional group of single line actions
- Comments
- Finding instances
- Attribute access
- Creation and deletion
- Subclass migration
- Creating a table from a class
- Creating a table with a definition
- Converting a table into a class
- Set operations on tables
- Set comparisons on tables
- Join
- Rename
- Extend
- Aggregation
- Rank
- Image
- Input values
- Signatures and name doubling
- Output values
- Execution order
- Sequential execution
- Conditional execution
- Signals
- Scrall has no for_each action
- Iteration