58 lines
1.1 KiB
Plaintext
58 lines
1.1 KiB
Plaintext
@startuml
|
|
|
|
package RealWorldExample{
|
|
abstract DrawingElement {
|
|
# name: string
|
|
+ DrawingElement(name: string)
|
|
|
|
+ virutal Add(DrawingElement)
|
|
+ virutal Remove(DrawingElement)
|
|
+ virutal Display(indent: int)
|
|
}
|
|
|
|
class PrimitiveElement extends DrawingElement{
|
|
+ PrimitiveElement(name: string)
|
|
+ Add(DrawingElement)
|
|
+ Remove(DrawingElement)
|
|
+ Display(indent: int)
|
|
}
|
|
|
|
class CompositeElement extends DrawingElement{
|
|
+ CompositeElement(name: string)
|
|
|
|
- elements: List<DrawingElement>
|
|
|
|
+ Add(DrawingElement)
|
|
+ Remove(DrawingElement)
|
|
+ Display(indent: int)
|
|
}
|
|
class Program
|
|
Program -l-> DrawingElement: " "
|
|
CompositeElement "1" o-l--- "*" PrimitiveElement: " "
|
|
}
|
|
|
|
|
|
package basico {
|
|
|
|
class Leaf extends Component
|
|
|
|
class Composite {
|
|
+ Operation()
|
|
+ Add(Component)
|
|
+ Remove(Component)
|
|
+ GetChildren(index): Component
|
|
}
|
|
|
|
class Component {
|
|
+ Operation()
|
|
+ Add(Component)
|
|
+ Remove(Component)
|
|
+ GetChildren(index): Component
|
|
}
|
|
|
|
Composite "1" o-l- "*" Component: Children
|
|
Composite -u-|> Component
|
|
class Client
|
|
Client -r-> Component
|
|
}
|
|
@enduml |