This repository has been archived by the owner on Feb 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathAdapter_Class.puml
71 lines (57 loc) · 1.69 KB
/
Adapter_Class.puml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
@startuml
package animalAPI #DDDDDD {
interface Animal {
+ {abstract} int walk(int steps)
+ {abstract} int rest(int recoveredSteps)
+ {abstract} int remainingSteps()
}
class Horse implements Animal {
- int remainingSteps
+ Horse(int remainingSteps)
+ Horse()
+ int walk(int steps)
+ int rest(int recoveredSteps)
+ int remainingSteps()
}
note bottom of Horse : Class originally not\ndesigned to act as\na game gun
}
package gameAPI #aaceee {
interface GameObject {
+ {abstract} double takeDamage(double damage)
+ {abstract} double takeLife(double damage)
+ {abstract} double remainingLife()
}
class GameObjectSoldier implements GameObject {
- double life
- String name
+ GameObjectSoldier(String name)
+ double takeDamage(double damage)
+ double takeLife(double life)
+ double remainingLife()
+ String toString()
}
interface Gun {
+ {abstract} double fire(GameObject... targetObjects)
}
class GunBlast implements Gun {
- double ammo
- double blastPower
+ GunBlast(double blastPower)
+ GunBlast()
+ double fire(GameObject... targetObjects)
}
}
class HorseToGunAdapter extends Horse implements Gun {
- double wasteDamage
- int firePower
+ HorseToGunAdapter(double firePower)
+ HorseToGunAdapter()
+ double fire(GameObject... targetObjects)
}
note top of HorseToGunAdapter : Adapts a <i>Horse</i>\nto act as a <i>Gun</i>
class PlayerBoard
PlayerBoard o.. HorseToGunAdapter
PlayerBoard o.. Gun
PlayerBoard o.. GameObject
hide empty members
@enduml