svn commit: r17437 - trunk/src/argouml-core-model-euml/src/org/argouml/model/euml/ExtensionMechanismsHelperEUMLImpl.java

Thomas Neustupny <[email protected]>
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: thn
Date: 2009-10-30 16:40:32-0700
New Revision: 17437

Modified:
   trunk/src/argouml-core-model-euml/src/org/argouml/model/euml/ExtensionMechanismsHelperEUMLImpl.java

Log:
implement some more eUML methods

Modified: trunk/src/argouml-core-model-euml/src/org/argouml/model/euml/ExtensionMechanismsHelperEUMLImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-model-euml/src/org/argouml/model/euml/ExtensionMechanismsHelperEUMLImpl.java?view=diff&pathrev=17437&r1=17436&r2=17437
==============================================================================
--- trunk/src/argouml-core-model-euml/src/org/argouml/model/euml/ExtensionMechanismsHelperEUMLImpl.java	(original)
+++ trunk/src/argouml-core-model-euml/src/org/argouml/model/euml/ExtensionMechanismsHelperEUMLImpl.java	2009-10-30 16:40:32-0700
@@ -26,8 +26,10 @@
 
 package org.argouml.model.euml;
 
+import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
 
 import org.argouml.model.ExtensionMechanismsHelper;
 import org.eclipse.emf.common.util.URI;
@@ -106,8 +108,15 @@
 
     public Collection getAllPossibleStereotypes(Collection models,
             Object modelElement) {
-        // TODO: Auto-generated method stub
-        return Collections.emptySet();
+        List<Stereotype> ret = new ArrayList<Stereotype>();
+        if (modelElement instanceof Element) {
+            for (Stereotype stereo : getStereotypes(models)) {
+                if (((Element) modelElement).isStereotypeApplicable(stereo)) {
+                    ret.add(stereo);
+                }
+            }
+        }
+        return ret;
     }
 
     public String getMetaModelName(Object m) {
@@ -136,13 +145,30 @@
     }
 
     public Collection getStereotypes(Object ns) {
-        // TODO: Auto-generated method stub
-        return Collections.emptySet();
+        List<Stereotype> l = new ArrayList<Stereotype>();
+        if (ns instanceof Profile) {
+            Iterator iter = ((Profile) ns).getOwnedStereotypes().iterator();
+            while (iter.hasNext()) {
+                l.add((Stereotype) iter.next());
+            }
+        }
+        return l;
     }
 
-    public Collection getStereotypes(Collection models) {
-        // TODO: Auto-generated method stub
-        return Collections.emptySet();
+    public Collection<Stereotype> getStereotypes(Collection models) {
+        List<Stereotype> l = new ArrayList<Stereotype>();
+        if (models != null) {
+            for (Object ns : models) {
+                if (ns instanceof Profile) {
+                    Iterator iter =
+                        ((Profile) ns).getOwnedStereotypes().iterator();
+                    while (iter.hasNext()) {
+                        l.add((Stereotype) iter.next());
+                    }
+                }
+            }
+        }
+        return l;
     }
 
     public boolean hasStereotype(Object handle, String name) {

------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=5905&dsMessageId=2413151

To unsubscribe from this discussion, e-mail: [[email protected]].
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.