# 13.3.10 DurationConstraint

### SimpleTime

Issue 8894 - Replace most of the definition of DurationConstraint

## *Generalizations

IntervalConstraint (from SimpleTime ) on page 462

Description

A DurationConstraint defines a Constraint that refers to a DurationInterval .

Attributes

• firstEvent:Boolean [0..2] The value of firstEvent[i] is related to constrainedElement[i] (where i is 1 or 2). If firstEvent[i] is true, then the corresponding observation event is the first time instant the execution enters constrainedElement[i]. If firstEvent[i] is false, then the corresponding observation event is the last time instant the execution is within constrainedElement[i]. Default value is true applied when constrainedElement[i] refers an element that represents only one time instant.

Associations

• specification: Duration [1] A duration used to determine whether the constraint is satisfied. Redefines IntervalConstraint ::specification.

Constraints

[1] The multiplicity of firstEvent must be 2 if the multiplicity of constrainedElement is 2. Otherwise, the multiplicity of firstEvent is 0. (The constraint is a requirement on the duration from the execution time from (constrainedElement[1], firstEvent[1]) to (constrainedElement[2], firstEvent[2]). If the multiplicity of constrainedElement is 1 then the constraint is a requirement on the duration given by the duration of the execution of that constrainedElement.)

if (constrainedElement->size() = 2) then (firstEvent->size() = 2) else (firstEvent->size() = 0)

Semantics

The semantics of a DurationConstraint is inherited from Constraints. All traces where the constraints are violated are negative traces i.e. if they occur in practice the system has failed.

Notation

A DurationConstraint is shown as some graphical association between a DurationInterval and the constructs that it constrains. The notation is specific to the diagram type.

Examples

See example in Figure 13.15 on page 458 where the TimeConstraint is associated with the duration of a Message and the duration between two OccurrenceSpecifications.

Figure 13.15 - DurationConstraint and other time-related concepts

Changes from previous UML