時刻と期間の比較
時刻が、特定の期間より前か、後か、その期間中かをチェックします。特定の期間が時刻を含んでいること、または特定の時刻に開始および終了していることをチェックします。
期間と時刻の比較
- before
時刻が特定の期間の開始より早い場合、この時刻はその期間より前になります。
- after
時刻が、特定の期間の終了より遅いか、その期間と同じインスタンスの場合、この時刻は期間より後になります。
- during
時刻が開始時刻より遅いか同じインスタンスで、終了時刻より早い場合、時刻は期間内になります。
時刻は、特定の期間の開始および終了と比較することができます。例えば、each purchase event is before the end of 'the trip' となります。
時刻をカレンダー期間と比較することもできます。例えば、次のようになります。
the departure time of 'the flight' is during the calendar year 2012
the departure time of 'the flight' is after the calendar month February 2007
the departure time of 'the flight' is before today
以下のルールで、フライト期間が、スケジュールされた出発日と到着日によって定義されます。
when a purchase event occurs
definitions
set 'the flight' to a flight in the flights of 'the customer';
set 'the flight period' to the period between the scheduled departure time of 'the flight' and the scheduled arrival time of 'the flight';
if
this purchase event is during 'the flight period'
then
print "purchase on board";
時刻と比較される期間、または時刻を含む期間
- before
- after
- includes
例えば、the period of two hours after the start of 'the business trip' includes 'the purchase event' となります。
- starts at
- ends at
例えば、'the exceptional promotion period' ends at 'the purchase event' となります。
乗り換えのルールを、期間を時刻と比較することによって表すことができます。このルールは、includes 演算子を使用します。
when a flight arrival event occurs
if
there is at least one flight in the flights of 'the customer'
where the period of 1 hour after this flight arrival event includes the scheduled departure time of this flight,
then
print "less than 1 hour of transit time.";
期間内の時刻
時刻は、時刻の前または後の持続期間によって定義される期間内にある場合があります。
例えば、'the purchase event' is within 2 hours after the start of 'the business trip' となります。この式は、'the purchase event' is during the period of 2 hours after the start of 'the business trip' と同等です。
以下のルールは、現在のフライトの到着後の 1 時間以内に、別のフライトがあるかどうかをチェックします。
when a flight arrival event occurs
if
there is at least one flight in the flights of 'the customer'
where the scheduled departure time of this flight is within 1 hour after the scheduled arrival time of this flight,
then
print "less than 1 hour of transit time.";
時刻と開始時刻および終了時刻の比較
この言語には、時刻が開始時刻と終了時刻の間にあるかどうかをテストするためのいくつかの演算子が含まれています。比較では、開始時刻と終了時刻を含めたり、除外したりすることができます。
以下の演算子を使用して、開始時刻と終了時刻の間の時刻をチェックします。
- before または after
例えば、'the purchase event' is after the start of 'the business trip' and before the arrival time of 'the flight' となります。
- on or before または on or after
例えば、'the purchase event' is on or after the start of 'the business trip' and before the arrival time of 'the flight' となります。