/**
   * This method returns all Classifiers of which this class is a direct subtype.
   *
   * @param cls the class you want to have the parents for
   * @return a collection of the parents, each of which is a {@link MGeneralizableElement
   *     MGeneralizableElement}
   */
  public Collection getSupertypes(MClassifier cls) {

    Collection result = new HashSet();
    Collection gens = cls.getGeneralizations();
    Iterator genIterator = gens.iterator();

    while (genIterator.hasNext()) {
      MGeneralization next = (MGeneralization) genIterator.next();
      result.add(next.getParent());
    }
    return result;
  }
 /**
  * Returns all attributes of some classifier clazz and of its parents
  *
  * @param clazz
  * @return Collection
  */
 public Collection getAllAttributes(MClassifier clazz) {
   if (clazz == null) return new ArrayList();
   List list = new ArrayList();
   Iterator it = clazz.getFeatures().iterator();
   while (it.hasNext()) {
     MFeature element = (MFeature) it.next();
     if (element instanceof MAttribute) {
       list.add(element);
     }
   }
   it = clazz.getGeneralizations().iterator();
   while (it.hasNext()) {
     list.addAll(getAllAttributes((MClassifier) it.next()));
   }
   return list;
 }
 /**
  * Returns the contents (owned elements) of this classifier and all its parents as specified in
  * section 2.5.3.8 of the UML 1.3 spec
  *
  * @param clazz
  * @return Collection
  */
 public Collection getAllContents(MClassifier clazz) {
   if (clazz == null) return new ArrayList();
   List list = new ArrayList();
   Iterator it = clazz.getOwnedElements().iterator();
   while (it.hasNext()) {
     MModelElement element = (MModelElement) it.next();
     if (element.getVisibility().equals(MVisibilityKind.PUBLIC)
         || element.getVisibility().equals(MVisibilityKind.PROTECTED)) {
       list.add(element);
     }
   }
   it = clazz.getGeneralizations().iterator();
   while (it.hasNext()) {
     list.addAll(getAllContents((MClassifier) it.next()));
   }
   return list;
 }