| 1 |
Considering object completion on: |
| 2 |
rl [new-day] : < O : Calendar | date : F > => < O : Calendar | date : (F + 1) |
| 3 |
> . |
| 4 |
Transformed rule: |
| 5 |
rl [new-day] : < O : V:Calendar | date : F, Atts:AttributeSet > => < O : |
| 6 |
V:Calendar | date : (F + 1), Atts:AttributeSet > . |
| 7 |
|
| 8 |
Considering object completion on: |
| 9 |
crl [car-rental] : < U : Customer | cash : M, suspended : false > < I : Car | |
| 10 |
available : true, rate : Rt > < C : Calendar | date : Today > => < U : |
| 11 |
Customer | cash : (M - Amnt) > < I : Car | available : false > < C : |
| 12 |
Calendar | none > < A : Rental | pickUpDate : Today, dueDate : (Today + |
| 13 |
NumDays), car : I, deposit : Amnt, customer : U, rate : Rt > if Amnt := Rt |
| 14 |
* NumDays /\ M >= Amnt = true [nonexec] . |
| 15 |
Transformed rule: |
| 16 |
crl [car-rental] : < U : V3:Customer | cash : M, suspended : false, |
| 17 |
Atts3:AttributeSet > < I : V2:Car | available : true, rate : Rt, |
| 18 |
Atts2:AttributeSet > < C : V:Calendar | date : Today, Atts:AttributeSet > |
| 19 |
=> < U : V3:Customer | suspended : false, cash : (M - Amnt), |
| 20 |
Atts3:AttributeSet > < I : V2:Car | rate : Rt, available : false, |
| 21 |
Atts2:AttributeSet > < C : V:Calendar | date : Today, Atts:AttributeSet > < |
| 22 |
A : Rental | pickUpDate : Today, dueDate : (Today + NumDays), car : I, |
| 23 |
deposit : Amnt, customer : U, rate : Rt > if Amnt := Rt * NumDays /\ M >= |
| 24 |
Amnt = true [nonexec] . |
| 25 |
|
| 26 |
Considering object completion on: |
| 27 |
crl [on-date-car-return] : < U : Customer | cash : M > < I : Car | rate : Rt |
| 28 |
> < A : Rental | customer : U, car : I, pickUpDate : PDt, dueDate : DDt, |
| 29 |
deposit : Dpst > < C : Calendar | date : Today > => < U : Customer | cash : |
| 30 |
((M + Dpst) - Amnt) > < I : Car | available : true > < C : Calendar | none |
| 31 |
> if Today <= DDt = true /\ Amnt := Rt * (Today - PDt) [nonexec] . |
| 32 |
Transformed rule: |
| 33 |
crl [on-date-car-return] : < U : V4:Customer | cash : M, Atts4:AttributeSet > |
| 34 |
< I : V3:Car | available : A2:[Bool], rate : Rt, Atts3:AttributeSet > < A : |
| 35 |
V:Rental | deposit : Dpst, dueDate : DDt, pickUpDate : PDt, customer : U, |
| 36 |
car : I, Atts:AttributeSet > < C : V2:Calendar | date : Today, |
| 37 |
Atts2:AttributeSet > => < U : V4:Customer | cash : ((M + Dpst) - Amnt), |
| 38 |
Atts4:AttributeSet > < I : V3:Car | rate : Rt, available : true, |
| 39 |
Atts3:AttributeSet > < C : V2:Calendar | date : Today, Atts2:AttributeSet > |
| 40 |
if Today <= DDt = true /\ Amnt := Rt * (Today - PDt) [nonexec] . |
| 41 |
|
| 42 |
Considering object completion on: |
| 43 |
crl [late-car-return] : < U : Customer | debt : M > < I : Car | rate : Rt > < |
| 44 |
A : Rental | customer : U, car : I, pickUpDate : PDt, dueDate : DDt, |
| 45 |
deposit : Dpst > < C : Calendar | date : Today > => < U : Customer | debt : |
| 46 |
((M + Amnt) - Dpst) > < I : Car | available : true > < C : Calendar | none |
| 47 |
> if DDt < Today = true /\ Amnt := Rt * (DDt - PDt) + ((Rt * (Today - DDt)) |
| 48 |
* (100 + 20)) quo 100 [nonexec] . |
| 49 |
Transformed rule: |
| 50 |
crl [late-car-return] : < U : V4:Customer | debt : M, Atts4:AttributeSet > < |
| 51 |
I : V3:Car | available : A2:[Bool], rate : Rt, Atts3:AttributeSet > < A : |
| 52 |
V:Rental | deposit : Dpst, dueDate : DDt, pickUpDate : PDt, customer : U, |
| 53 |
car : I, Atts:AttributeSet > < C : V2:Calendar | date : Today, |
| 54 |
Atts2:AttributeSet > => < U : V4:Customer | debt : ((M + Amnt) - Dpst), |
| 55 |
Atts4:AttributeSet > < I : V3:Car | rate : Rt, available : true, |
| 56 |
Atts3:AttributeSet > < C : V2:Calendar | date : Today, Atts2:AttributeSet > |
| 57 |
if DDt < Today = true /\ Amnt := Rt * (DDt - PDt) + ((Rt * (Today - DDt)) * |
| 58 |
(100 + 20)) quo 100 [nonexec] . |
| 59 |
|
| 60 |
Considering object completion on: |
| 61 |
crl [pay-debt] : < U : Customer | debt : M, cash : N > => < U : Customer | |
| 62 |
debt : (M - Amnt), cash : (N - Amnt) > if 0 < Amnt = true /\ Amnt <= N = |
| 63 |
true /\ Amnt <= M = true [nonexec] . |
| 64 |
Transformed rule: |
| 65 |
crl [pay-debt] : < U : V:Customer | cash : N, debt : M, Atts:AttributeSet > |
| 66 |
=> < U : V:Customer | cash : (N - Amnt), debt : (M - Amnt), |
| 67 |
Atts:AttributeSet > if 0 < Amnt = true /\ Amnt <= N = true /\ Amnt <= M = |
| 68 |
true [nonexec] . |
| 69 |
|
| 70 |
Considering object completion on: |
| 71 |
crl [suspend-late-payers] : < U : Customer | debt : M, suspended : false > => |
| 72 |
< U : Customer | suspended : true > if M > 0 = true . |
| 73 |
Transformed rule: |
| 74 |
crl [suspend-late-payers] : < U : V:Customer | debt : M, suspended : false, |
| 75 |
Atts:AttributeSet > => < U : V:Customer | debt : M, suspended : true, |
| 76 |
Atts:AttributeSet > if M > 0 = true . |
| 77 |
|
| 78 |
Considering object completion on: |
| 79 |
crl [suspend-late-returns] : < U : Customer | suspended : false > < I : Car | |
| 80 |
none > < A : Rental | customer : U, car : I, dueDate : DDt > < C : Calendar |
| 81 |
| date : Today > => < U : Customer | suspended : true > < I : Car | none > |
| 82 |
< A : Rental | none > < C : Calendar | none > if DDt < Today = true . |
| 83 |
Transformed rule: |
| 84 |
crl [suspend-late-returns] : < U : V4:Customer | suspended : false, |
| 85 |
Atts4:AttributeSet > < I : V3:Car | Atts3:AttributeSet > < A : V:Rental | |
| 86 |
dueDate : DDt, customer : U, car : I, Atts:AttributeSet > < C : V2:Calendar |
| 87 |
| date : Today, Atts2:AttributeSet > => < U : V4:Customer | suspended : |
| 88 |
true, Atts4:AttributeSet > < I : V3:Car | Atts3:AttributeSet > < A : |
| 89 |
V:Rental | dueDate : DDt, customer : U, car : I, Atts:AttributeSet > < C : |
| 90 |
V2:Calendar | date : Today, Atts2:AttributeSet > if DDt < Today = true . |
| 91 |
|
| 92 |
op _`,_ left-identity collapse from AttributeSet to Attribute is unequal. |
| 93 |
op __ left-identity collapse from Configuration to Object is unequal. |
| 94 |
========================================== |
| 95 |
rewrite [100] in RENT-A-CAR-STORE-TEST : StoreConf . |
| 96 |
rewrites: 201 |
| 97 |
result Configuration: < 'A1 : EconomyCar | available : true, rate : 100 > < 'A3 |
| 98 |
: MidSizeCar | available : true, rate : 150 > < 'A5 : FullSizeCar | |
| 99 |
available : true, rate : 200 > < 'C : Calendar | date : 100 > < 'C1 : |
| 100 |
Customer | cash : 5000, debt : 0, suspended : false > < 'C2 : Customer | |
| 101 |
cash : 5000, debt : 0, suspended : false > |
| 102 |
Bye. |