期間の比較
期間は、別の期間の前、後、またはそれと重複する場合があります。また、2 つの期間の持続期間を比較することもできます。
以下の演算子を使用して、期間の順序を比較します。
- is before
例えば、'the exceptional promotion period' is before 'the flight period' となります。
- is after
例えば、'the exceptional promotion period' is after 'the flight period' となります。
- overlaps with
例えば、'the exceptional promotion period' overlaps with 'the flight period' となります。
重複のいくつかのケースは、ある期間に別の期間が含まれている場合、またはある期間が別の期間中にある場合に取得されます。
- is during the same time as
この演算子は、2 つの期間が、完全に同じ開始時刻と同じ終了時刻を持っていることをチェックします。例えば、'the exceptional promotion period' is during the same time as 'the flight period' となります。
特定の期間が、別の期間と同じ時刻に開始または停止することもあります。
以下のルールは、2 つの出張 (Trip) が重複しているかどうかをチェックします。
definitions
set 'Trip1' to a trip in the trips of 'the customer';
set 'Trip2' to a trip in the trips of 'the customer';
set 'the first trip' to the period between the start of 'Trip1' and the end of 'Trip1';
set 'the second trip' to the period between the start of 'Trip2' and the end of 'Trip2';
if
'the first trip' overlaps with 'the second trip'
then
print "overbooked travel agenda";
別の期間より短いか長い期間
以下の演算子を使用して、別の期間と比較して特定の期間をチェックします。
- is shorter than と is shorter than or equal to
例えば、'the flight period' is shorter than 'the trip period' となります。
- is longer than と is longer than or equal to
例えば、'the trip period' is longer than or equal to 'the flight period' となります。