Hi,

Shouldn't org.argouml.kernel.ProjectImpl.getModels() return "ret" instead of

"models" (see below)?

The specification of org.argouml.kernel.Project.getModels() is:

        /**
         * Returns all models, including the default model (default.xmi).
         *
         * @return A Collection containing all models.
         */
        public Collection getModels();

However the implementation returns only the same as
getUserDefinedModelList(), that is only the models created by the user:

        public Collection getModels() {
                Set ret = new HashSet();
                ret.addAll(models);
                ret.addAll(getProfileConfiguration().getProfiles());
                return Collections.unmodifiableCollection(models);
        }

Furthermore getProfileConfiguration().getProfiles() is incorrect, because it

returns a List<Profile> instead of a
List<org.omg.uml.modelmanagement.Model>.
Maybe this a good opportunity to parameterize the returned Collection, but
this involves changing the methods interface.

Here is what I believe to be the correct implementation (without changing
the method's interface):

public Collection getModels() {
        Set ret = new HashSet();
        ret.addAll(models);
        for (Profile profile : getProfileConfiguration().getProfiles()) {
                try {
                        ret.addAll(profile.getProfilePackages());
                } catch(org.argouml.uml.profile.ProfileException e) {}
        }
        // TODO: parameterize ret with org.omg.uml.modelmanagement.Model 
        // requires changing the method's interface
        return Collections.unmodifiableCollection(ret);
}

Regards,
Sergio Lopes.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to