Author: mvw
Date: 2008-11-09 23:36:35-0800
New Revision: 16003
Modified:
trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/ExtensionMechanismsHelperMDRImpl.java
trunk/src/argouml-core-model/src/org/argouml/model/ExtensionMechanismsHelper.java
Log:
Added comments about my evaluation of the current code related to the retrieval of stereotypes.
No functional change.
Loosely related to issue 5061.
Modified: trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/ExtensionMechanismsHelperMDRImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/ExtensionMechanismsHelperMDRImpl.java?view=diff&rev=16003&p1=trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/ExtensionMechanismsHelperMDRImpl.java&p2=trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/ExtensionMechanismsHelperMDRImpl.java&r1=16002&r2=16003
==============================================================================
--- trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/ExtensionMechanismsHelperMDRImpl.java (original)
+++ trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/ExtensionMechanismsHelperMDRImpl.java 2008-11-09 23:36:35-0800
@@ -1,5 +1,5 @@
// $Id$
-// Copyright (c) 1996-2007 The Regents of the University of California. All
+// Copyright (c) 1996-2008 The Regents of the University of California. All
// Rights Reserved. Permission to use, copy, modify, and distribute this
// software and its documentation without fee, and without a written
// agreement is hereby granted, provided that the above copyright notice
@@ -115,7 +115,9 @@
}
/* TODO: Make this work when the given stereotype
- * has more than one baseclass. */
+ * has more than one baseclass.
+ * TODO: Currently only works for stereotypes where the baseclass is
+ * equal to the given one - inheritance does not work.*/
public Object getStereotype(Object ns, Object stereo) {
if (!(ns instanceof Namespace)) {
throw new IllegalArgumentException("namespace");
@@ -364,6 +366,8 @@
if (isStereotype(object, name, base)) {
return true;
}
+ /* TODO: mvw: do we really look into super-types of the stereotype,
+ * or should we be looking into super-types of the baseclass? */
Iterator it =
modelImpl.getCoreHelper().getSupertypes(object).iterator();
while (it.hasNext()) {
Modified: trunk/src/argouml-core-model/src/org/argouml/model/ExtensionMechanismsHelper.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-model/src/org/argouml/model/ExtensionMechanismsHelper.java?view=diff&rev=16003&p1=trunk/src/argouml-core-model/src/org/argouml/model/ExtensionMechanismsHelper.java&p2=trunk/src/argouml-core-model/src/org/argouml/model/ExtensionMechanismsHelper.java&r1=16002&r2=16003
==============================================================================
--- trunk/src/argouml-core-model/src/org/argouml/model/ExtensionMechanismsHelper.java (original)
+++ trunk/src/argouml-core-model/src/org/argouml/model/ExtensionMechanismsHelper.java 2008-11-09 23:36:35-0800
@@ -1,5 +1,5 @@
// $Id$
-// Copyright (c) 2005-2006 The Regents of the University of California. All
+// Copyright (c) 2005-2008 The Regents of the University of California. All
// Rights Reserved. Permission to use, copy, modify, and distribute this
// software and its documentation without fee, and without a written
// agreement is hereby granted, provided that the above copyright notice
@@ -32,7 +32,8 @@
*/
public interface ExtensionMechanismsHelper {
/**
- * Returns all stereotypes in a namespace, but not those in a subnamespace.
+ * Returns all stereotypes in a given namespace,
+ * and all those in any sub-namespace of the given namespace.
*
* @param ns is the namespace.
* @return a Collection with the stereotypes.
@@ -40,13 +41,21 @@
Collection getStereotypes(Object ns);
/**
- * Finds a stereotype in some namespace, but not in its subnamespaces.
+ * Finds a stereotype in a given namespace,
+ * and all those in any sub-namespace of the given namespace.
* Returns null if no such stereotype is found.
- *
+ * <p>
* TODO: What if stereo.getName() or stereo.getBaseClass() is null?
* Then you know immediately that none will be found, but is that the
* correct answer?
- *
+ * Currently, null is returned in these cases. <p>
+ *
+ * TODO: This function should not take a stereotype object as parameter,
+ * but a name and a baseclass. <p>
+ * TODO: Currently only works for stereotypes with only one baseclass. <p>
+ * TODO: Currently only works for stereotypes where the baseclass is
+ * equal to the given one - inheritance does not work.
+ *
* @return the stereotype found or null.
* @param ns is the namespace.
* @param stereo is the stereotype.
@@ -55,11 +64,14 @@
/**
* Searches for a stereotype just like the given stereotype in all
- * given models.
+ * given models (and their sub-namespaces).
* The given stereotype can not have its namespace set yet;
* otherwise it will be returned itself!
*
- * TODO: Should it only search for stereotypes owned by the Model object?
+ * TODO: This function should not take a stereotype object as parameter,
+ * but a name and a baseclass. <p>
+ * TODO: Currently only works for stereotypes with only one baseclass. <p>
+ * TODO: Should it only search for stereotypes owned by the Model object?
*
* @param models a collection of models
* @param stereo is the given stereotype
@@ -117,10 +129,10 @@
boolean isValidStereotype(Object theModelElement, Object theStereotype);
/**
- * Get all stereotypes from all Models in the list.
- *
- * Finds only stereotypes owned by the Model objects themselves.
+ * Get all stereotypes from all Models in the list. <p>
*
+ * Finds also all stereotypes owned by any sub-namespaces of the Model.
+ *
* @return the collection of stereotypes in all models
* in the current project
* @param models the models to search
@@ -138,11 +150,12 @@
void addCopyStereotype(Object modelElement, Object stereotype);
/**
- * Tests if a stereotype is a stereotype with some name and base class.
+ * Tests if a stereotype has a given name and given base class.
+ * While comparing the baseclass, inheritance is not considered.
*
* @param object is the stereotype.
* @param name is the name of the stereotype.
- * @param base is the base class of the stereotype.
+ * @param base is a string representing the base class of the stereotype.
* @return true if object is a stereotype with the desired characteristics.
*/
boolean isStereotype(Object object, String name, String base);
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.