Añadir Ingenieria de Software/Decorator.org
This commit is contained in:
49
Ingenieria de Software/Decorator.org
Normal file
49
Ingenieria de Software/Decorator.org
Normal file
@@ -0,0 +1,49 @@
|
||||
#+title: patron de diseño: decorator
|
||||
|
||||
#+begin_src plantuml :file /tmp/algo.png
|
||||
@startuml
|
||||
|
||||
hide abstract circle
|
||||
hide class circle
|
||||
|
||||
abstract LibraryItem <<Abstract>> {
|
||||
+ NumCopies: int
|
||||
- numCopies: int
|
||||
+ <<abstract>> Display(): void
|
||||
}
|
||||
|
||||
class Book extends LibraryItem{
|
||||
- author: string
|
||||
- title: string
|
||||
+ Book(string author, string title, int numCopies)
|
||||
+ <<override>> Display(): void
|
||||
}
|
||||
|
||||
class Video extends LibraryItem {
|
||||
- director: string
|
||||
- title: string
|
||||
- playTime: int
|
||||
+ Video(string director, string title, int numCopies, int playTime)
|
||||
+ <<override>> Display(): void
|
||||
}
|
||||
|
||||
abstract class Decorator extends LibraryItem {
|
||||
# libraryitem: LibraryItem;
|
||||
|
||||
+ Decorator(LibraryItem libraryItem)
|
||||
+ <<override>> Display(): void
|
||||
}
|
||||
|
||||
class Borrowable extends Decorator {
|
||||
# borrowers: List<string>
|
||||
|
||||
+ Borrowable(LibraryItem libraryItem): base(libraryItem)
|
||||
+ BorrowItem(string name): void
|
||||
+ ReturnItem(string name): void
|
||||
+ <<override>> Display(): void
|
||||
|
||||
}
|
||||
|
||||
Decorator o-d-> LibraryItem
|
||||
@enduml
|
||||
#+end_src
|
||||
Reference in New Issue
Block a user