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(); }