public boolean predicate2(Object dm, Designer dsgr) { MClass cls, c; if (!(dm instanceof MClass)) return false; cls = (MClass) dm; if (!cls.isAbstract()) return false; // original class was not abstract VectorSet derived = (new VectorSet(cls)).reachable(new ChildGenDerivedClasses()); java.util.Enumeration enum = derived.elements(); while (enum.hasMoreElements()) { c = (MClass) enum.nextElement(); if (!c.isAbstract()) return false; // found a concrete subclass } return true; // no concrete subclasses defined, this class is "useless" }
public java.util.Enumeration gen(Object o) { MClass c = (MClass) o; Vector specs = new Vector(c.getSpecializations()); if (specs == null) { return EnumerationEmpty.theInstance(); } // TODO: it would be nice to have a EnumerationXform // and a Functor object in uci.util Vector specClasses = new Vector(specs.size()); java.util.Enumeration enum = specs.elements(); while (enum.hasMoreElements()) { MGeneralization g = (MGeneralization) enum.nextElement(); MGeneralizableElement ge = g.getChild(); // assert: ge != null if (ge != null) specClasses.addElement(ge); } return specClasses.elements(); }
public Object makeNode() { Object newNode = super.makeNode(); MComponentInstance compspecType = (MComponentInstance) newNode; // neue ComponentInstance. System.err.println("makeNode() called"); compspecType.setName(orig.getName()); // Name ist gesetzt. MStereotype stereotype = new MStereotypeImpl(); // new Stereotype. stereotype.setName("comp spec"); // Sterotype Name auf "comp spec" gesetzt. compspecType.setStereotype(stereotype); // Stereotyp setzen. /*for (Iterator it = orig.getFeatures().iterator(); it.hasNext(); ) { Object f = it.next(); if (f instanceof MAttribute) { MAttribute origAttr = (MAttribute)f; MAttribute attr = compspecType.getFactory().createAttribute(); attr.setName(origAttr.getName()); attr.setType(origAttr.getType()); attr.setVisibility(origAttr.getVisibility()); compspecType.addFeature(attr); } } */ return newNode; }