지속 기간 관련 작업
지속 기간은 두 시점 간의 간격입니다. 지속 기간은 두 시점 간의 간격으로 표현되거나, 숫자와 단위(예: 6개월)로 정의될 수 있습니다.
절대 지속 기간
- 주어진 두 시점에 대해 계산되는 지속 기간: the duration between <a date> and <a date>.
예: the duration between the departure time of 'the flight' and the arrival time of 'the flight'
- 기간의 지속 기간: the duration of <a time period>.
예: the duration of 'the flight period'
- 오브젝트의 속성으로서의 지속 기간(예: the planned duration of 'the flight')
비즈니스 모델 정의에서 (duration) 유형을 이벤트 또는 엔티티 속성으로 설정할 수 있습니다. 예를 들어, .bmd 파일에서 항공편 엔티티에 대해 a flight has a planned duration (duration) 문장을 씁니다.
절대 지속 기간을 특정 시간 단위로 변환할 수 있습니다(the planned duration of 'the flight' in hours). 이 오퍼레이션은 정수를 리턴합니다. 년/월이 비정규 시간 단위이므로, 이 변환에는 년/월이 포함되지 않습니다.
다음 규칙은 항공편의 지속 기간이 예상보다 길어지는지 여부를 확인합니다.
when a flight arrival event occurs
definitions
set 'the flight departure event' to a flight departure event;
set 'the actual duration' to the duration between 'the flight departure event' and this flight arrival event;
if 'the actual duration' is longer than the planned duration of 'the flight'
then print "The duration of the flight is longer than expected";
달력 지속 기간
달력 지속 기간은 시간 단위로 표현됩니다. 단위는 년, 월, 주, 일, 시, 분 및 초일 수 있습니다.
규칙에서 플레이스홀더 <calendar duration>을 단위의 숫자 및 이름으로 또는 이의 조합으로 대체할 수 있습니다.
- 단위의 숫자 및 이름(예: 5 days before 'the flight departure event')
- 숫자 및 시간 단위의 조합(예: 1 week 5 days 2 hours before 'the flight departure event')
서로 다른 단위의 지속 기간을 결합하여 새 지속 기간을 만들 수 있습니다. 이 단위는 내림차순으로 정렬되고 처리됩니다. 예: 1 year 1 month 1 day 또는 7 days 3 hours.
다음 규칙은 1시간 30분의 달력 지속 기간을 사용하여 항공편 출발의 지연을 확인합니다.
when a flight departure event occurs
if this flight departure event is after 1 hour 30 minutes after the scheduled departure time of 'the flight'
then print "The departure of the flight was delayed by at least an hour and a half.";