190 likes | 294 Views
1. Service Representative. Customer. :Mark I Vending Machine (MIVM) System. 1..*. 1. customer. supplier. 1..*. 1. servicer. vending machine. 4. Client Interface Layer. Coordination Layer. The model layer contains 2 packages: Role package Dispenser package. Model Layer.
E N D
1 Service Representative Customer :Mark I Vending Machine (MIVM) System 1..* 1 customer supplier 1..* 1 servicer vending machine
4 Client Interface Layer Coordination Layer • The model layer contains • 2 packages: • Role package • Dispenser package Model Layer Server Interface Layer Foundation Layer
CurrentModeProxy currentMode valid (aBill) valid (aCoin) doorLocked () selected (aLetter) selected (anInteger) changeMode () refund () 5 BillValidator inserted (aBill) CoinValidator inserted (aCoin) RefundButton pressed () LetterSelectionButtons pressed () NumberSelectionButtons pressed () ModeButton pressed () DoorSwitch tripped () Door locked () CustomOperatingSystemInterrupts event (aString) CLIENT INTERFACE 10 8
CurrentModeProxy curentMode valid (aBill) valid (aCoin) doorLocked () selected (aString) selected (anInteger) changeMode () refund () 6 DispenseItemMode displayMessages () refund () reset () selected (anInteger) selected (aLetter) valid (aMoney) Customer displayMessages () refund () reset () selected (anInteger) selected (aLetter) valid (aMoney) SetPricemode refund () reset () selected (anInteger) selected (aLetter) valid (aMoney) DisplayHistoryMode refund () reset () selected (anInteger) selected (aLetter) valid (aMoney) ServiceRepresentative coinDispenserAssemblyLoaded () displayTotalIncome () displayTotalItemsSold () reset () selected (anInteger) selected (aLetter) MainDisplay display (currentMode) COORDINATION {contains}
8 CoinDispensingPolicy dispense () isPractical (aPrice) ItemDispensers dispense () price () price (aMoney) CoinSolenoid push () ItemStepperMode step (360) ItemDisplay display (aLocation,aPrice) ItemDispenserassembly dispenseAt (aLocation) priceAt (aLocation) priceAt (aLocation,aPrice) getTotalIncome () getTotalItemsSold () CoinDispenserAssembly isWarningNeeded () dispense (aMoney) inserted (aCoin) loaded () isPractical (aPrice) CoinDispensers haveCoin () coinInserted () next () coinType () dispense () DISPENSER {contains} 3 80 {contains} {contains}
9 CustomOperatingSystemCalls dispenseCoinFrom (aPort) dispenseItemFrom (aPort) itemDisplay (aString,aPort) mainDisplay (aString) CoinSolenoid push () ItemStepperMotor step (360) ItemDisplay display (aLocation,aPrice) MainDisplay display (aString) SERVER INTERFACE
11 Precondition: The mode is “DispenseItem”. Postcondition: The mode is “DispenseItem”. Make a Payment. :MIVM Software Insert a Valid Bill Insert a Valid Coin
12 Precondition: currentMode = dispenseItemMode Customer Inserts a Valid Bill. :Custom- OperatingSystem Interrupts :Custom- Operating- SystemCalls :Bill- Validator :Current- ModeProxy :Dispense- Item- Mode :Customer :Customer- Credit :Customer- Selection :Main- Display inserted (aBill) valid (aBill) valid (aBill) valid (aBill) add (aBill) creditIncremented () [itemSelected] Attempt to Dispense [no itemSelected] display () display (amount) displayMain (amount)
:Coin- Dispenser- Assembly :Coin- Dispensing- Policy 13 Dispense Changes. :Customer- Credit dispense (credit) dispense (credit) [credit >= Money.none () ] Dispense Quarters [credit >= Money.none () ] Dispense Dimes [credit >= Money.none () ] Dispense Nickels Display Greeting
:Coin- Dispensing- Policy :Coin- Dispensers :CustomOperating- SystemCalls aCoin- Dispenser :Coin- Solenoid 14 amountToDispense = credit.amount () Dispense Quarters. If a quarter was dispensed, then amountToDispense = amountToDispense – Coin.quarter () * [amountToDispense >= quarter] next () coinType () * [amountToDispense >= quarter and coinType () = Coin.quarter ()] dispense () push () dispenseCoinFrom (aPort) [quarter = not dispensed] FailedException NoCoinException CouldNotDispenseException
16 Hacer un Pago. :Software- MEA 1a: Insertar un Billete Válido 1b: Insertar una Moneda Válido
17 Precondition: currentMode = dispenseItemMode Insert a Valid Bill. :Custom- OperatingSystem- Interrupts 1: inserted (aBill) :Bill- Validator 1.1: valid (aBill) :Current- ModeProxy 1.1.1: valid (aBill) 1.1.1.1.2: credit- Incremented () :Customer- Selection :Customer 1.1.1.1: valid (aBill) :Dispense- Item- Mode 1.1.1.1.1: add (aBill) 1.1.1.1.2.2 [no itemSelected]: display () 1.1.1.1.2.2.1: display (amount) :Customer- Credit :Main- Display 1.1.1.1.2.1 [itemSelected]: 1.1.1.1.2.2.1.1: displayMain (amount) Attempt to Dispense :Custom- Operating- SystemCalls
Dispense Changes. 18 :Coin- Dispenser- Assembly :Customer- Credit 1: dispense (credit) 1.1: dispense (credit) :Coin- Dispensing- Policy 1.1.1 [credit >= Money.none () ]: Dispense Quarters 1.1.2 [credit >= Money.none () ]: Dispense Dimes 1.1.3 [credit >= Money.none () ]: Dispense Nickels 1.1.4: Display Greeting
19 amountToDispense = credit.amount () Dispense Quarters. If a quarter was dispensed, then amountToDispense = amountToDispense – Coin.quarter () 2: coinType () 3 * [amountToDispense >= quarter and coinType () = Money.quarter ()]: dispense () :Coin- Dispensing- Policy aCoin- Dispenser 3.1.1.1.1.1: CouldNot-DispenseException 3.1.1.1.1: NoCoin-Exception 3.1: push () 1 * [amountToDispense >= quarter]: next () :CustomOperating- SystemCalls 3.1.1: dispenseCoinFrom (aPort) :Coin- Solenoid :Coin- Dispensers 3.1.1.1 [quarter = not dispensed]: FailedException