示例#1
0
 public void getAllComposite(IDeclaration current, IDeclaration currentsuperclass) {
   boolean flag = true;
   for (IPattern cp : current.getPatterns()) {
     if (cp.getType().equals("Composite")) {
       flag = false;
     }
   }
   if (flag) {
     if (currentsuperclass != null) {
       for (IPattern p : currentsuperclass.getPatterns()) {
         if (p.getType().equals("Composite")) {
           if (p.getComponent().equals("Component")) {
             Composite leaf =
                 new Composite(current.getName(), currentsuperclass.getName(), "Leaf");
             current.addPattern(leaf);
           } else if (p.getComponent().equals("Composite")) {
             Composite composite =
                 new Composite(current.getName(), currentsuperclass.getName(), "Composite");
             current.addPattern(composite);
             for (IDeclaration d : this._model.getAllClasses()) {
               if (d.getSuperClass().equals(current.getName())) {
                 getAllComposite(d, current);
               }
             }
           }
         }
       }
     }
   }
 }