Comparando um ponto no tempo e um período
Verifique se um ponto no tempo ocorre antes, depois ou durante um período. Verifique se um período inclui um ponto no tempo ou se começa e termina em um determinado ponto no tempo.
Ponto no tempo comparado a um período
- antes
Um ponto no tempo é anterior a um período se esse ponto no tempo ocorrer antes do início do período.
- após
Um ponto no tempo é posterior a um período se esse ponto no tempo ocorrer depois ou no mesmo instante que o fim do período.
- durante
Um ponto no tempo acontece durante um período se ele ocorrer depois ou no mesmo instante que o horário de início e antes que o horário de encerramento.
Um ponto no tempo pode ser comparado com o início e o encerramento do período. Por exemplo, each purchase event is before the end of 'the trip'.
Também é possível comparar um ponto no tempo a um período de calendário, por exemplo:
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
Na regra a seguir, o período de voo é definido pela data de partida e a data de chegada agendadas.
when a purchase event occurs
definições
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';
se
this purchase event is during 'the flight period'
então
print "purchase on board";
Período comparado a ou incluindo um ponto no tempo
- antes
- após
- inclusões
Por exemplo, the period of two hours after the start of 'the business trip' includes 'the purchase event'
- starts at
- ends at
Por exemplo, 'the exceptional promotion period' ends at 'the purchase event'
A regra de trânsito pode ser expressa comparando o período ao ponto no tempo. Essa regra usa o operador includes.
when a flight arrival event occurs
se
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,
então
print "less than 1 hour of transit time.";
Ponto no tempo dentro de um período
Um ponto no tempo pode estar dentro de um período que é definido por uma duração antes ou depois de um ponto no tempo.
Por exemplo, 'the purchase event' is within 2 hours after the start of 'the business trip'. Essa expressão é equivalente a 'the purchase event' is during the period of 2 hours after the start of 'the business trip'.
A regra a seguir verifica se há outra partida de voo na hora posterior à chegada do voo atual.
when a flight arrival event occurs
se
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,
então
print "less than 1 hour of transit time.";
Ponto no tempo comparado a horários de início e de encerramento
O idioma contém vários operadores para testar se um ponto no tempo está entre um horário de início e um horário de encerramento. Uma comparação pode incluir ou excluir os horários de início e de encerramento.
Use os operadores a seguir para verificar um ponto no tempo entre um horário de início e um horário de encerramento:
- before ou after
Por exemplo, 'the purchase event' is after the start of 'the business trip' and before the arrival time of 'the flight'.
- on or before ou on or after
Por exemplo, 'the purchase event' is on or after the start of 'the business trip' and before the arrival time of 'the flight'