Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
design_pattern:composite_pattern [2017/10/29 13:08] ledyxdesign_pattern:composite_pattern [2021/02/07 03:25] (current) – [Composite Pattern] ledyx
Line 1: Line 1:
 = Composite Pattern = = Composite Pattern =
-그릇(복수)과 내용물(단수)을 동일시해서 재귀적인 구조 구축. (ex. Directory Entry)+그릇(<fc red>복수</fc>)과 내용물(<fc red>단수</fc>)을 동일시(= 혼합물, Composite)해서 재귀적인 구조 구축.
  
   * <fc red>Tree 구조의 Data(= 재귀적)</fc>   * <fc red>Tree 구조의 Data(= 재귀적)</fc>
Line 7: Line 7:
     * GUI 프로그래밍에서 View안에 자식 View를 갖는 경우     * GUI 프로그래밍에서 View안에 자식 View를 갖는 경우
  
-{{tag>Architecture Modeling DesignPattern Structural}}+{{tag>Architecture Modeling Design_Pattern Structural}}
  
 = Component = = Component =
Line 67: Line 67:
 그릇. Leaf나 Composite 역할을 넣을 수 있음. 그릇. Leaf나 Composite 역할을 넣을 수 있음.
  
-<sxh java ; highlight:[20-23]>+<sxh java ; highlight:[4, 21-24]>
 public class Directory extends Entry { public class Directory extends Entry {
  
Line 87: Line 87:
  }  }
   
 + /* Directory와 File을 같은 내용물로 간주 */
  public Entry add(Entry entry) {  public Entry add(Entry entry) {
  directory.add(entry);  directory.add(entry);
Line 125: Line 126:
     }     }
 } }
 +
 +
 +/*
 +/root (3)
 +/root/bin (2)
 +/root/bin/sub1 (10000)
 +/root/bin/sub2 (20000)
 +/root/tmp (0)
 +/root/usr (0)
 +*/
 </sxh> </sxh>
design_pattern/composite_pattern.1509282502.txt.gz · Last modified: 2021/02/07 03:15 (external edit)