Note: This website is archived. For up-to-date information about D projects and development, please visit wiki.dlang.org.

Changes between Version 2 and Version 3 of CompositePattern

Show
Ignore:
Author:
skotku (IP: 89.233.250.99)
Timestamp:
08/23/07 18:53:04 (14 years ago)
Comment:

clarifying interface naming convention

Legend:

Unmodified
Added
Removed
Modified
  • CompositePattern

    v2 v3  
    1313import std.stdio; 
    1414 
    15 interface GraphicsOperation /* Component */ { 
     15interface IGraphicsOperation /* Component */ { 
    1616    void print(); 
    1717} 
    1818 
    19 class Circle /* Leaf */ : GraphicsOperation { 
     19class Circle /* Leaf */ : IGraphicsOperation { 
    2020    void print() {writefln("Circle");} 
    2121} 
    2222 
    23 class Line /* Leaf */ : GraphicsOperation { 
     23class Line /* Leaf */ : IGraphicsOperation { 
    2424    void print() {writefln("Line");} 
    2525} 
    2626 
    27 class Drawing /* Composite */ : GraphicsOperation { 
    28     GraphicsOperation[] children; 
     27class Drawing /* Composite */ : IGraphicsOperation { 
     28    IGraphicsOperation[] children; 
    2929 
    3030    void print() { 
    3434    } 
    3535 
    36     void add(GraphicsOperation c) {  
     36    void add(IGraphicsOperation c) {  
    3737        children~=c; 
    3838    } 
    3939 
    40     void remove(GraphicsOperation c) { 
     40    void remove(IGraphicsOperation c) { 
    4141        for(uint i=0; i<children.length; i++) { 
    4242            if (children[i] == c) {