-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnew_base.puml
424 lines (329 loc) · 9.12 KB
/
new_base.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
Composition *--
Aggregation o--
Extension <|--
Instantiates -. >
' ---Class name overview
' ---Car related classes---
abstract class Car{}
class CabrioCar{}
class TankCar{}
class CrossoverCar{}
class SedanCar{}
class SUVCar{}
interface Armoring{}
class BombproofArmoring extends Armoring{}
class ElectronicArmoring extends Armoring{}
class GasResistantArmoring extends Armoring{}
class BulletproofArmoring extends Armoring{}
(?)interface ArmoredParts implements Part, Armoring{}
interface Part{}
interface Engine implements Part{}
abstract class LiquidEngine implements Engine{}
class PetrolEngine extends LiquidEngine{}
class DieselEgine extends LiquidEngine{}
abstract class GaseousEngine implements Engine{}
class LNGEngine extends GaseousEngine{}
class HydrogenEngine extends GaseousEngine{}
class ElectricEngine implements Engine{}
interface FuelStorage implements Part{}
class LiquidFuelStorage implements FuelStorage{}
class GaseousFuelStorage implements FuelStorage{}
class ElectricFuelStorage implements FuelStorage{}
' Extra's
interface Rim implements Part{}
class DefaultRim implements Rim{}
class ChromeRim implements Rim{}
interface Seat implements Part{}
class FabricSeat implements Seat{}
class LeatherSet implements Set{}
interface Fuel{}
abstract class LiquidFuel implements Fuel{}
class PetrolLiquidFuel extends LiquidFuel{}
class ieselLiquidFuel extends LiquidFuel{}
abstract class GaseousFuel implements Fuel{}
class LNGGaseousFuel extends GaseousFuel{}
class HydrogenGaseousFuel extends GaseousFuel{}
class ElectricFuel implements Fuel{}
' ---Factory classes
class Factory implements Owner{}
' ---AbstractFactory class
interface DriveFactory
class ElectricDriveFactory implements CarFactory{}
class DieselDriveFactory implements CarFactory{}
class LNGDriveFactory implements CarFactory{}
class HydrogenDriveFactory implements CarFactory{}
interface CarFactory
class SUVCarFactory implements CarFactory{}
class CabrioCarFactory implements CarFactory{}
class CrossoverCarFactory implements CarFactory{}
class SedanCarFactory implements CarFactory{}
' ---Dealer classes
class Dealer implements Owner{}
' ---Customer classes
class Customer implements Owner{}
' ---Helper classes
interface Owner{}
interface Order{}
class CarOrder implements Order{}
class FactoryOrder implements Order{}
class PartOrder implements Order{}
@startuml
' ---Visual effects
skinparam SequenceMessageTextAlignment center
skinparam SequenceMessageAlignment center
skinparam rectangleBorderThickness 1
skinparam defaultTextAlignment center
skinparam lifelineStrategy solid
skinparam wrapMessageWidth 100
' left to right direction
skinparam linetype polyline
skinparam linetype ortho
' ---Dark mode
' skinparam monochrome reverse
' ---Car classes
together $vehicle {
abstract class Vehicle{
- Owner owner
- nrOfSeats : int
- nrOfDoors : int
+ Vehicle(driveTrain : DriveTrain)
- Part[] parts
- FuelStorage[] fuel
- Armoring armor
- DriveTrain driveTrain
rangeLeft()
fill(Fuel)
+ drive()
+ brake()
removePart(Part)
addPart(Part)
}
class Cabrio extends CivilCar{
openroof()
closeroof()
}
class F1 extends RaceCar{}
class Nascar extends RaceCar{}
class InfantryTank extends Tank{}
class Sedan extends CivilCar{}
class SUV extends CivilCar{}
}
abstract class CivilCar extends Vehicle{
+void print()
}
abstract class Tank extends Vehicle{
+void print()
}
abstract class RaceCar extends Vehicle{
+void print()
}
' ---Armoring uses decorator
together $armor{
interface Armoring{
int health
activate()
}
class Armor implements Armoring{
activate()
}
class ArmorDecorator implements Armoring{
activate(previous)
}
class BombproofArmoring extends ArmorDecorator{
int maxExplosiveForce
activate()
}
class ElectronicArmoring extends ArmorDecorator{
activate()
}
class GasResistantArmoring extends ArmorDecorator{
activate()
}
class BulletproofArmoring extends ArmorDecorator{
int maxCalibre
activate()
}
}
together $part{
interface Part{
Date made
+print()
}
interface Engine implements Part{
int torque
int pk
float efficiency
insertFuel(Fuel)
}
abstract class LiquidEngine implements Engine{
inject()
}
class PetrolEngine extends LiquidEngine{}
class DieselEgine extends LiquidEngine{}
abstract class GaseousEngine implements Engine{
inject()
}
class LNGEngine extends GaseousEngine{}
class HydrogenEngine extends GaseousEngine{}
class ElectricEngine implements Engine{
regen()
}
interface FuelStorage implements Part{
Fuel[] fuel
float capacity
bool checkFuel(Fuel f)
bool checkFull()
removeFuel(float a)
addFuel(Fuel f)
}
class LiquidFuelStorage implements FuelStorage{
LiquidFuel[] fuel
}
class GaseousFuelStorage implements FuelStorage{
GaseousFuel[] fuel
}
class ElectricFuelStorage implements FuelStorage{
ElectricFuel[] fuel
float minVolt
float maxVolt
float minAmpere
float maxAmpere
}
interface Rim implements Part{}
class DefaultRim implements Rim{}
class ChromeRim implements Rim{}
interface Seat implements Part{}
class FabricSeat implements Seat{}
class LeatherSeat implements Seat{}
}
together $DriveTrain {
class DriveTrain{
-Engine engine
-FuelStorage storage
+accelerate()
+fill(Fuel)
}
}
together $fuel {
interface Fuel{
float kwh
float amount
use(float amount)
}
abstract class LiquidFuel implements Fuel{
float litre
}
class PetrolLiquidFuel extends LiquidFuel{}
class DieselLiquidFuel extends LiquidFuel{}
abstract class GaseousFuel implements Fuel{
float litre
}
class LNGGaseousFuel extends GaseousFuel{}
class HydrogenGaseousFuel extends GaseousFuel{}
class ElectricFuel implements Fuel{
float volt
float ampere
}
}
' ---Factory classes
together $market{
class Factory implements Owner{
FactoryOrder[] incoming_orders
Part[] parts
Vehicle[] unfinished_vehicles
makePart()
makeVehicle()
buyPart()
sellPart()
}
interface DriveFactory{
+makeEngine()
+makeFuelStorage()
+makeDriveTrain()
}
class ElectricDriveFactory implements DriveFactory{}
class DieselDriveFactory implements DriveFactory{}
class PetrolDriveFactory implements DriveFactory{}
class LNGDriveFactory implements DriveFactory{}
class HydrogenDriveFactory implements DriveFactory{}
interface AbstractCarFactory{
-DriveTrain makeDriveParts()
-Seat makeSeats()
-Rim makeRims()
+Vehicle makeCar()
}
class SUVCarFactory implements AbstractCarFactory{}
class CabrioCarFactory implements AbstractCarFactory{}
class CrossoverCarFactory implements AbstractCarFactory{}
class SedanCarFactory implements AbstractCarFactory{}
' ---Dealer classes
class Dealer implements Owner{
-FactoryOrder[] outgoing_orders
-CarOrder[] incoming_orders
-Part[] parts
-list<Vehicle, float price, float discount> discount_car_catalogue
-list<Vehicle, float price> car_catalogue
+showCatalogue()
+showDiscountCatalogue()
+orderCar()
' Return the car with added features
+Vehicle refurbishCar(Vehicle v)
-changePrice()
}
' ---Customer classes
class Customer implements Owner{
CarOrder[] outgoing_orders
}
' ---Helpingclasses
interface Owner{
Vehicle[] Vehicles
int money
void sell(Vehicle)
void buy(Vehicle)
}
}
together $order {
interface Order{
Owner buyer
Owner seller
int price
Date start
Date end
bool completed
send()
accept()
}
class VehicleOrder implements Order{
Vehicle vehicle
}
class FactoryOrder implements Order{
Vehicle vehicle
int quantity
class PartOrder implements Order{
Part part
int quantity
}
}
' ---Relations
' ---Market relations
Owner -.> Order : "Makes an order"
Vehicle "0..inf"--o "1" Customer
Vehicle "0..inf"--o "1" Dealer
Vehicle "0..inf"--o "1" Factory
Vehicle <.- Factory : "Produces"
Dealer <.- Customer : "Buys from"
Dealer -.> Factory : "Buys from"
Vehicle "0..inf" *--o "1" Owner : "has"
' ---Car relations to its parts and features
Vehicle --o Part : "has"
Vehicle --o "0..1" Armoring : "can have"
' ---Fuel relation with Engine
DriveTrain -o "1" Engine
DriveTrain -o "1" FuelStorage
Engine -o Fuel : "burns"
' ---Fuel relation with FuelStorage
FuelStorage --o Fuel : "stores"
' ---Part relations to the factory
Factory -.> Part : "produces"
' hide $order
@enduml