@startuml
'https://plantuml.com/class-diagram

  class Client

  note top
    클라이언트는 Component
    인터페이스를 사용해서
    복합객체 내의 객체들을 조작
  end note

  interface Component{
    operation()
    add(Component)
    remove(Component)
    getChild(int)
  }

  note top
    Component는 복합 객체 내에
    들어있는 모든 객체의 인터페이스를
    정의합니다.
    <i>복합 노드와 잎에 관한 메소드까지 정의</i>
    add remove getChild와 몇가지 작업의
    기본 행동을 정의 할 수도 있다
  end note

  class Leaf{
    operation()
  }

  note bottom
    Leaf는 그 안에 들어있는 원소의 행동의 정의
    Composite에서 지원하는 기능을 구현
  end note

  class Composite{
    operation()
    add(Component)
    remove(Component)
    getChild(int)
  }

  note bottom
    Composite는 자식이 있는 구성 요소의
    행동을 정의하고 자식 구성 요소를
    저장하는 역할을 맡는다.
    Composite에서 Leaf와 관련된
    기능도 구현해야 한다.
    그런 기능들이 복합 객체에게 별 쓸모가
    없다면 예외를 던지는 방법으로 처리
  end note

  Client -R-> Component
  Leaf -U-|> Component
  Composite -U-|> Component

@enduml