1 / 1

MACHINE SystemeDeReservation ( nbMaxVoiture , nbPlaces )

MACHINE SystemeDeReservation ( nbMaxVoiture , nbPlaces ) DEFINITIONS place == ( 1..nbPlaces ) ; SIEGE == ( ens_voiture ´ place ) CONSTRAINTS nbMaxVoiture Î NAT1 Ù nbPlaces Î NAT1 Ù nbMaxVoiture ´ nbPlaces Î NAT1 SETS VOITURES ; NUMEROS

jorn
Download Presentation

MACHINE SystemeDeReservation ( nbMaxVoiture , nbPlaces )

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. MACHINE SystemeDeReservation(nbMaxVoiture, nbPlaces) DEFINITIONS place == (1..nbPlaces) ; SIEGE == (ens_voiture´place) CONSTRAINTS nbMaxVoitureÎNAT1Ù nbPlacesÎNAT1Ù nbMaxVoiture´nbPlacesÎNAT1 SETS VOITURES; NUMEROS VARIABLES ens_reservation, ens_octroye, ens_voiture INVARIANT ens_reservationÍNUMEROSÙ ens_voitureÍVOITURESÙ card(ens_voiture) £nbMaxVoitureÙ card(place) £nbPlacesÙ card(ens_reservation) £card(ens_voiture) ´ nbPlacesÙ ens_octroyeÎens_reservationSIEGE INITIALISATION ens_reservation, ens_octroye := Æ,Æ || ANYvvWHEREvvÎVOITURES – ens_voiture THENens_voiture := {vv} END OPERATIONS  nv¬AjoutVoiture = PREcard(ens_voiture) < nbMaxVoiture THEN ANYvvWHEREvvÎVOITURES – ens_voiture THENens_voiture := ens_voitureÈ{vv} || nv := vv END END; ok,num¬Reservation =BEGIN IFcard(ens_reservation) = card(ens_voiture) ´ nbPlaces THENok := FALSE || num :ÎNUMEROS ELSE ok := TRUE || ANYnnWHEREnnÎNUMEROS - ens_reservation THENens_reservation := ens_reservationÈ{nn} || num := nn END END END; Annuler(num) = PREnumÎens_reservation THEN IFnumÎdom(ens_octroye) THENens_octroye := {num} ens_octroye || ens_reservation := ens_reservation - {num} ELSEens_reservation := ens_reservation - {num} END END; nv,np¬Confirmer(num) = PREnumÎens_reservationÙnumÏdom(ens_octroye) THEN ANYvo,plWHERE ((vo,pl) ÎSIEGE) Ù ((vo,pl) Ïran(ens_octroye)) THENens_octroye := ens_octroyeÈ {num|-> (vo,pl)} || nv := vo || np := pl END END END

More Related