時刻の比較

特定の時刻が、別の時刻より前、後、または同時であることをチェックします。

以下の演算子を使用して、時刻を比較します。
  • is after および is after or the same as。
  • is before および is before or the same as。
  • is at the same time as。

例えば、the arrival time of 'the first flight' is before the departure time of 'the second flight' となります。

以下のルールは、1 番目のフライトが到着し、2 番目のフライトが出発するまでに、少なくとも 1 時間あることをチェックします。

definitions
    set 'flight1' to a flight in the flights of 'the customer'; 
    set 'flight2' to a flight in the flights of 'the customer' 
        where the scheduled departure time of this flight is after the scheduled arrival time of 'flight1';
if 
    the scheduled departure time of 'flight2' is before 1 hour after the scheduled arrival time of 'flight1'
then
    print "Less than 1 hour of transit time";

時刻と 1 日の時間帯の比較

時間帯情報は、時刻に保管されます。例えばイベントでは、時間帯情報はタイム・スタンプに含まれます。

以下のルールは、購入イベントが、イベントが発生した時間帯の午後に発生したかどうかをチェックします。

when a purchase event occurs
    where the time of day of this purchase event is after or the same as 12:00 PM
then
    print "Afternoon purchase.";

時間インスタンスの比較

以下のルールは、時間帯に関係なく、2 つの時刻の時間インスタンスを比較します。

when a flight departure event occurs
    where this flight departure event is after the scheduled departure time of 'the flight'
then
    print "The flight's departure was late";
以下のルールは、フライトの出発が、予定されている出発時刻と完全に同時であることをチェックします。
重要: 演算子 is at the same time as は、秒単位まで時間インスタンスをチェックします。このルールは、時間が秒数まで完全に同じでない場合、false を返します。
when a flight departure event occurs
    where this flight departure event is at the same time as the scheduled departure time of 'the flight'
then
    print "The flight departed on time";

イベントの比較

以下のルールは、フライトの再スケジュールが、航空機に手荷物が積み込まれた後に発生するかどうかをチェックします。

when a flight rescheduled event has occurred 5 minutes ago, called 'the flight rescheduled'
definitions
    set 'the bag loaded' to a bag loaded event;
if
    'the flight rescheduled' is after 'the bag loaded'
then
    print "The flight is rescheduled, please unload the bags from the plane";