Coverage Report - org.argouml.profile.internal.ProfileUML
 
Classes in this File Line Coverage Branch Coverage Complexity
ProfileUML
67%
89/131
58%
7/12
3.167
ProfileUML$1
40%
2/5
N/A
3.167
 
 1  
 /* $Id: ProfileUML.java 18925 2010-12-19 08:57:33Z thn $
 2  
  *****************************************************************************
 3  
  * Copyright (c) 2008,2010 Contributors - see below
 4  
  * All rights reserved. This program and the accompanying materials
 5  
  * are made available under the terms of the Eclipse Public License v1.0
 6  
  * which accompanies this distribution, and is available at
 7  
  * http://www.eclipse.org/legal/epl-v10.html
 8  
  *
 9  
  * Contributors:
 10  
  *    maurelio1234 - Initial implementation
 11  
  *    thn
 12  
  *    Tom Morris - lazy loading
 13  
  *****************************************************************************
 14  
  *
 15  
  * Some portions of this file was previously release using the BSD License:
 16  
  */
 17  
 
 18  
 // Copyright (c) 1996-2009 The Regents of the University of California. All
 19  
 // Rights Reserved. Permission to use, copy, modify, and distribute this
 20  
 // software and its documentation without fee, and without a written
 21  
 // agreement is hereby granted, provided that the above copyright notice
 22  
 // and this paragraph appear in all copies.  This software program and
 23  
 // documentation are copyrighted by The Regents of the University of
 24  
 // California. The software program and documentation are supplied "AS
 25  
 // IS", without any accompanying services from The Regents. The Regents
 26  
 // does not warrant that the operation of the program will be
 27  
 // uninterrupted or error-free. The end-user understands that the program
 28  
 // was developed for research purposes and is advised not to rely
 29  
 // exclusively on the program for any reason.  IN NO EVENT SHALL THE
 30  
 // UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
 31  
 // SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
 32  
 // ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
 33  
 // THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
 34  
 // SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
 35  
 // WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 36  
 // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
 37  
 // PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
 38  
 // CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
 39  
 // UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 40  
 
 41  
 package org.argouml.profile.internal;
 42  
 
 43  
 import java.net.MalformedURLException;
 44  
 import java.util.ArrayList;
 45  
 import java.util.Collection;
 46  
 import java.util.Collections;
 47  
 import java.util.HashSet;
 48  
 import java.util.Set;
 49  
 
 50  
 import org.apache.log4j.Logger;
 51  
 import org.argouml.cognitive.Critic;
 52  
 import org.argouml.cognitive.ToDoItem;
 53  
 import org.argouml.cognitive.Translator;
 54  
 import org.argouml.model.Model;
 55  
 import org.argouml.profile.CoreProfileReference;
 56  
 import org.argouml.profile.DefaultTypeStrategy;
 57  
 import org.argouml.profile.FormatingStrategy;
 58  
 import org.argouml.profile.Profile;
 59  
 import org.argouml.profile.ProfileException;
 60  
 import org.argouml.profile.ProfileModelLoader;
 61  
 import org.argouml.profile.ProfileReference;
 62  
 import org.argouml.profile.ResourceModelLoader;
 63  
 import org.argouml.profile.internal.ocl.CrOCL;
 64  
 import org.argouml.profile.internal.ocl.InvalidOclException;
 65  
 import org.argouml.uml.cognitive.critics.CrAssocNameConflict;
 66  
 import org.argouml.uml.cognitive.critics.CrAttrNameConflict;
 67  
 import org.argouml.uml.cognitive.critics.CrCircularAssocClass;
 68  
 import org.argouml.uml.cognitive.critics.CrCircularInheritance;
 69  
 import org.argouml.uml.cognitive.critics.CrClassMustBeAbstract;
 70  
 import org.argouml.uml.cognitive.critics.CrCrossNamespaceAssoc;
 71  
 import org.argouml.uml.cognitive.critics.CrDupParamName;
 72  
 import org.argouml.uml.cognitive.critics.CrDupRoleNames;
 73  
 import org.argouml.uml.cognitive.critics.CrFinalSubclassed;
 74  
 import org.argouml.uml.cognitive.critics.CrForkOutgoingTransition;
 75  
 import org.argouml.uml.cognitive.critics.CrIllegalGeneralization;
 76  
 import org.argouml.uml.cognitive.critics.CrInterfaceAllPublic;
 77  
 import org.argouml.uml.cognitive.critics.CrInterfaceOperOnly;
 78  
 import org.argouml.uml.cognitive.critics.CrInvalidBranch;
 79  
 import org.argouml.uml.cognitive.critics.CrInvalidFork;
 80  
 import org.argouml.uml.cognitive.critics.CrInvalidHistory;
 81  
 import org.argouml.uml.cognitive.critics.CrInvalidInitial;
 82  
 import org.argouml.uml.cognitive.critics.CrInvalidJoin;
 83  
 import org.argouml.uml.cognitive.critics.CrInvalidJoinTriggerOrGuard;
 84  
 import org.argouml.uml.cognitive.critics.CrInvalidPseudoStateTrigger;
 85  
 import org.argouml.uml.cognitive.critics.CrInvalidSynch;
 86  
 import org.argouml.uml.cognitive.critics.CrJoinIncomingTransition;
 87  
 import org.argouml.uml.cognitive.critics.CrMultiComposite;
 88  
 import org.argouml.uml.cognitive.critics.CrMultipleAgg;
 89  
 import org.argouml.uml.cognitive.critics.CrMultipleDeepHistoryStates;
 90  
 import org.argouml.uml.cognitive.critics.CrMultipleShallowHistoryStates;
 91  
 import org.argouml.uml.cognitive.critics.CrNWayAgg;
 92  
 import org.argouml.uml.cognitive.critics.CrNameConflict;
 93  
 import org.argouml.uml.cognitive.critics.CrNameConflictAC;
 94  
 import org.argouml.uml.cognitive.critics.CrNameConfusion;
 95  
 import org.argouml.uml.cognitive.critics.CrOppEndConflict;
 96  
 import org.argouml.uml.cognitive.critics.CrOppEndVsAttr;
 97  
 
 98  
 /**
 99  
  * This class represents the default UML profile
 100  
  *
 101  
  * @author maurelio1234
 102  
  */
 103  7632
 public class ProfileUML extends Profile {
 104  
     
 105  900
     private static final Logger LOG = Logger.getLogger(ProfileUML.class);
 106  
     
 107  
     private static final String PROFILE_UML14_FILE = "default-uml14.xmi";
 108  
     private static final String PROFILE_UML22_FILE = "default-uml22.xmi";
 109  
 
 110  
     static final String NAME_UML14 = "UML 1.4";
 111  
     static final String NAME_UML22 = "UML 2.2";
 112  
     
 113  
     private FormatingStrategy formatingStrategy;
 114  
     private ProfileModelLoader profileModelLoader;
 115  
     private Collection model;
 116  
     
 117  900
     private Set<Critic> critics = null;
 118  
 
 119  900
     private ProfileReference profileReference = null;
 120  
 
 121  
     /**
 122  
      * Construct a Profile for UML modeling. 
 123  
      * @throws ProfileException 
 124  
      */
 125  
     @SuppressWarnings("unchecked")
 126  900
     ProfileUML() throws ProfileException {
 127  900
         formatingStrategy = new FormatingStrategyUML();
 128  
         try {
 129  900
             if (Model.getFacade().getUmlVersion().charAt(0) == '1') {
 130  900
                 profileReference =
 131  
                     new CoreProfileReference(PROFILE_UML14_FILE);
 132  
             } else {
 133  
                 //TODO: reference should be handled better
 134  0
                 CoreProfileReference.setProfileDirectory("uml22");
 135  0
                 profileReference =
 136  
                     new CoreProfileReference(PROFILE_UML22_FILE);
 137  
             }
 138  0
         } catch (MalformedURLException e) {
 139  0
             throw new ProfileException(
 140  
                 "Exception while creating profile reference.", e);
 141  900
         }
 142  900
     }
 143  
 
 144  
     private Collection getModel() {
 145  10494
         if (model == null) {
 146  900
             profileModelLoader = new ResourceModelLoader();
 147  
             try {
 148  900
                 model = profileModelLoader.loadModel(profileReference);
 149  0
            } catch (ProfileException e) {
 150  0
                 LOG.error("Error loading UML profile", e);
 151  900
             }
 152  
 
 153  900
             if (model == null) {
 154  0
                 model = new ArrayList();
 155  0
                 model.add(Model.getModelManagementFactory().createProfile());
 156  
             }
 157  
         }
 158  10494
         return model;
 159  
     }
 160  
 
 161  
     private void loadWellFormednessRules() {
 162  900
         critics = new HashSet<Critic>();
 163  
         
 164  900
         critics.add(new CrAssocNameConflict());
 165  900
         critics.add(new CrAttrNameConflict());
 166  900
         critics.add(new CrCircularAssocClass());
 167  900
         critics.add(new CrCircularInheritance());
 168  900
         critics.add(new CrClassMustBeAbstract());
 169  900
         critics.add(new CrCrossNamespaceAssoc());
 170  900
         critics.add(new CrDupParamName());
 171  900
         critics.add(new CrDupRoleNames());
 172  900
         critics.add(new CrNameConfusion());
 173  
 
 174  900
         critics.add(new CrInvalidHistory());
 175  900
         critics.add(new CrInvalidSynch());
 176  900
         critics.add(new CrInvalidJoinTriggerOrGuard());
 177  900
         critics.add(new CrInvalidPseudoStateTrigger());
 178  900
         critics.add(new CrInvalidInitial());
 179  
         
 180  900
         critics.add(new CrInvalidJoin());
 181  900
         critics.add(new CrInvalidFork());
 182  900
         critics.add(new CrInvalidBranch());
 183  
 
 184  900
         critics.add(new CrMultipleDeepHistoryStates());
 185  900
         critics.add(new CrMultipleShallowHistoryStates());
 186  900
         critics.add(new CrForkOutgoingTransition());
 187  900
         critics.add(new CrJoinIncomingTransition());
 188  
 
 189  900
         critics.add(new CrFinalSubclassed());
 190  900
         critics.add(new CrIllegalGeneralization());
 191  900
         critics.add(new CrInterfaceAllPublic());
 192  900
         critics.add(new CrInterfaceOperOnly());
 193  900
         critics.add(new CrMultipleAgg());
 194  900
         critics.add(new CrNWayAgg());
 195  900
         critics.add(new CrNameConflictAC());
 196  
         
 197  900
         critics.add(new CrOppEndConflict());
 198  900
         critics.add(new CrMultiComposite());
 199  900
         critics.add(new CrNameConflict());
 200  900
         critics.add(new CrOppEndVsAttr());
 201  
 
 202  
         // Missing WFRs
 203  
         
 204  
         // Association Class
 205  
         // 4.5.3.2 [1]
 206  
         /* Testing: does not fire. */
 207  
         try {
 208  900
             critics.add(new CrOCL("context AssociationClass inv:"
 209  
                     + "self.allConnections->"
 210  
                     + "forAll( ar | self.allFeatures->"
 211  
                     + "forAll( f | f.oclIsKindOf(StructuralFeature) "
 212  
                     + "implies ar.name <> f.name ))",
 213  
                     Translator.localize("wfr.UML142.AssociationClass.1-head"),
 214  
                     Translator.localize("wfr.UML142.AssociationClass.1-desc"),
 215  
                     ToDoItem.HIGH_PRIORITY, null, null, "http://www.uml.org/"));
 216  0
         } catch (InvalidOclException e) {
 217  0
             e.printStackTrace();
 218  900
         }
 219  
         
 220  
         // 4.5.3.2 [2]
 221  
         /* Testing: Works Ok. */
 222  
         try {
 223  900
             critics.add(new CrOCL("context AssociationClass inv:"
 224  
                     + "self.allConnections->"
 225  
                     + "forAll(ar | ar.participant <> self)",
 226  
                     Translator.localize("wfr.UML142.AssociationClass.2-head"),
 227  
                     Translator.localize("wfr.UML142.AssociationClass.2-desc"),
 228  
                     ToDoItem.HIGH_PRIORITY, null, null, "http://www.uml.org/"));
 229  0
         } catch (InvalidOclException e) {
 230  0
             e.printStackTrace();
 231  900
         }
 232  
         
 233  
         // Behavioral Feature
 234  
         // 4.5.3.5 [2]
 235  
 
 236  
         // it works, but a bug in namespace.contents prevents it from 
 237  
         // working when the type of the parameter comes from a profile         
 238  
 //        try {
 239  
 //            Agency.register(new CrOCL("context BehavioralFeature inv:"
 240  
 //                    + "self.parameter->"
 241  
 //                    + "forAll( p | self.owner.namespace.allContents->"
 242  
 //                    + "includes (p.type) )",
 243  
 //                    "The type of the Parameters should be "
 244  
 //                            + "included in the Namespace of the Classifier.",
 245  
 //                    null, ToDoItem.HIGH_PRIORITY, null, null,
 246  
 //                    "http://www.uml.org/"));
 247  
 //        } catch (InvalidOclException e) {
 248  
 //            e.printStackTrace();
 249  
 //        }
 250  
         
 251  
         // Classifier
 252  
         // 4.5.3.8 [5]
 253  
         /* TODO: Partly overlaps CrOppEndVsAttr. */
 254  
         /* Testing: does not fire. */
 255  
         try {
 256  900
             critics.add(new CrOCL("context Classifier inv:"
 257  
                     + "self.oppositeAssociationEnds->" 
 258  
                     + "forAll( o | not self.allAttributes->" 
 259  
                     + "union (self.allContents)->" 
 260  
                     + "collect ( q | q.name )->includes (o.name) )",
 261  
                 Translator.localize("wfr.UML142.Classifier.5-head"), 
 262  
                 Translator.localize("wfr.UML142.Classifier.5-desc"), 
 263  
                 ToDoItem.HIGH_PRIORITY, null, null, "http://www.uml.org/"));
 264  0
         } catch (InvalidOclException e) {
 265  0
             e.printStackTrace();
 266  900
         }
 267  
 
 268  
         // DataType
 269  
         // 4.5.3.12 [1]
 270  
         /* Tested with fabricated XMI - OK. */
 271  
         try {
 272  900
             critics.add(new CrOCL("context DataType inv:"
 273  
                     + "self.allFeatures->forAll(f | f.oclIsKindOf(Operation)"
 274  
                     + " and f.oclAsType(Operation).isQuery)",
 275  
                     Translator.localize("wfr.UML142.DataType.1-head"),
 276  
                     Translator.localize("wfr.UML142.DataType.1-desc"),
 277  
                     ToDoItem.HIGH_PRIORITY, null, null, "http://www.uml.org/"));
 278  0
         } catch (InvalidOclException e) {
 279  0
             e.printStackTrace();
 280  900
         }
 281  
 
 282  
         // GeneralizableElement
 283  
         // 4.5.3.20 [1]
 284  
         /* Testing: does not fire. */
 285  
         try {
 286  900
             critics.add(new CrOCL("context GeneralizableElement inv:"
 287  
                     + "self.isRoot implies self.generalization->isEmpty",
 288  
                     Translator.localize("wfr.UML142.GeneralizableElement.1-head"),
 289  
                     Translator.localize("wfr.UML142.GeneralizableElement.1-desc"),
 290  
                     ToDoItem.HIGH_PRIORITY, null, null, "http://www.uml.org/"));
 291  0
         } catch (InvalidOclException e) {
 292  0
             e.printStackTrace();
 293  900
         }
 294  
 
 295  
         // 4.5.3.20 [4]
 296  
         /* Testing: does not fire. */
 297  
         try {
 298  900
             critics.add(new CrOCL("context GeneralizableElement inv:"
 299  
                     + "self.generalization->"
 300  
                     + "forAll(g |self.namespace.allContents->"
 301  
                     + "includes(g.parent) )",
 302  
                     Translator.localize("wfr.UML142.GeneralizableElement.4-head"),
 303  
                     Translator.localize("wfr.UML142.GeneralizableElement.4-desc"),
 304  
                     ToDoItem.HIGH_PRIORITY, null, null, "http://www.uml.org/"));
 305  0
         } catch (InvalidOclException e) {
 306  0
             e.printStackTrace();
 307  900
         }
 308  
  
 309  
         // Namespace
 310  
         // 4.5.3.26 [2]
 311  
         /* Testing: Does not fire. Conflict with CrNameConflict. */
 312  
         try {
 313  900
             critics.add(new CrOCL("context Namespace inv:"
 314  
                     + "self.allContents -> "
 315  
                     + "select(x|x.oclIsKindOf(Association))->"
 316  
                     + "forAll(a1, a2 |a1.name = a2.name and "
 317  
                     + "a1.connection.participant = a2.connection.participant"
 318  
                     + " implies a1 = a2)",
 319  
                     Translator.localize("wfr.UML142.Namespace.2-head"),
 320  
                     Translator.localize("wfr.UML142.Namespace.2-desc"),
 321  
                     ToDoItem.HIGH_PRIORITY, null, null,
 322  
                     "http://www.uml.org/"));
 323  0
         } catch (InvalidOclException e) {
 324  0
             e.printStackTrace();
 325  900
         }
 326  
 
 327  
         // Actor
 328  
         // 4.11.3.1 [1]
 329  
         /* Testing: does not fire. */
 330  
         try {
 331  900
             critics.add(new CrOCL("context Actor inv: "
 332  
                     + "self.associations->forAll(a | "
 333  
                     + "a.connection->size = 2)",
 334  
                     Translator.localize("wfr.UML142.Actor.1a-head"),
 335  
                     Translator.localize("wfr.UML142.Actor.1a-desc"), 
 336  
                     ToDoItem.HIGH_PRIORITY, null, null,
 337  
                     "http://www.uml.org/"));
 338  0
         } catch (InvalidOclException e) {
 339  0
             e.printStackTrace();
 340  900
         }
 341  
         /* Testing: does not fire. */
 342  
         try {
 343  900
             critics.add(new CrOCL("context Actor inv: "
 344  
                     + "self.associations->forAll(a | "
 345  
 //                    + "a.allConnections->exists(r | r.type.oclIsKindOf(Actor)) and "
 346  
                     + "a.allConnections->exists(r | "
 347  
                     + "r.type.oclIsKindOf(UseCase) or "
 348  
                     + "r.type.oclIsKindOf(Subsystem) or "
 349  
                     + "r.type.oclIsKindOf(Class)))",
 350  
                     Translator.localize("wfr.UML142.Actor.1b-head"),
 351  
                     Translator.localize("wfr.UML142.Actor.1b-desc"), 
 352  
                     ToDoItem.HIGH_PRIORITY, null, null,
 353  
                     "http://www.uml.org/"));
 354  0
         } catch (InvalidOclException e) {
 355  0
             e.printStackTrace();
 356  900
         }
 357  
 
 358  
         // Actor
 359  
         // 4.11.3.1 [2]
 360  
         /* Tested with fabricated XMI - OK. */
 361  
         try {
 362  900
             critics.add(new CrOCL("context Actor inv:"
 363  
                     + "self.contents->isEmpty",
 364  
                     Translator.localize("wfr.UML142.Actor.2-head"),
 365  
                     Translator.localize("wfr.UML142.Actor.2-desc"), 
 366  
                     ToDoItem.HIGH_PRIORITY, null, null,
 367  
                     "http://www.uml.org/"));
 368  0
         } catch (InvalidOclException e) {
 369  0
             e.printStackTrace();
 370  900
         }
 371  
 
 372  
         // UseCase
 373  
         // 4.11.3.5 [1]
 374  
         /* Testing: does not fire. */
 375  
         try {
 376  900
             critics.add(new CrOCL("context UseCase inv:"
 377  
                     + "self.associations->forAll(a | a.connection->size = 2)",
 378  
                     Translator.localize("wfr.UML142.UseCase.1-head"),
 379  
                     Translator.localize("wfr.UML142.UseCase.1-desc"), 
 380  
                     ToDoItem.HIGH_PRIORITY, null, null,
 381  
                     "http://www.uml.org/"));
 382  0
         } catch (InvalidOclException e) {
 383  0
             e.printStackTrace();
 384  900
         }
 385  
 
 386  
         // UseCase
 387  
         // 4.11.3.5 [2]
 388  
         /* Testing: does not fire. */
 389  
         try {
 390  900
             critics.add(new CrOCL("context UseCase inv:"
 391  
                     + "self.associations->forAll(a | "
 392  
                     + "a.allConnections->forAll(s, o| "
 393  
                     + "(s.type.specificationPath->isEmpty and "
 394  
                     + "o.type.specificationPath->isEmpty ) "
 395  
                     + "or "
 396  
                     + "(not s.type.specificationPath->includesAll( "
 397  
                     + "o.type.specificationPath) and "
 398  
                     + "not o.type.specificationPath->includesAll( "
 399  
                     + "s.type.specificationPath)) "
 400  
                     + "))",
 401  
                     Translator.localize("wfr.UML142.UseCase.2-head"),
 402  
                     Translator.localize("wfr.UML142.UseCase.2-desc"), 
 403  
                     ToDoItem.HIGH_PRIORITY, null, null,
 404  
                     "http://www.uml.org/"));
 405  0
         } catch (InvalidOclException e) {
 406  0
             e.printStackTrace();
 407  900
         }
 408  
 
 409  
         // UseCase
 410  
         // 4.11.3.5 [3]
 411  
         /* Tested with fabricated XMI - OK. */
 412  
         try {
 413  900
             critics.add(new CrOCL("context UseCase inv:"
 414  
                     + "self.contents->isEmpty",
 415  
                     Translator.localize("wfr.UML142.UseCase.3-head"),
 416  
                     Translator.localize("wfr.UML142.UseCase.3-desc"), 
 417  
                     ToDoItem.HIGH_PRIORITY, null, null,
 418  
                     "http://www.uml.org/"));
 419  0
         } catch (InvalidOclException e) {
 420  0
             e.printStackTrace();
 421  900
         }
 422  
 
 423  
         // UseCase
 424  
         // 4.11.3.5 [4]
 425  
         /* Tested OK, except in some cases, depending on the 
 426  
          * sequence of the EPs. Probably the implementation of
 427  
          * "forAll (x, y | ..." does not cover all combinations. */
 428  
         try {
 429  900
             critics.add(new CrOCL("context UseCase inv:"
 430  
                     + "self.allExtensionPoints -> forAll (x, y | "
 431  
                     + "x.name = y.name implies x = y )",
 432  
                     Translator.localize("wfr.UML142.UseCase.4-head"),
 433  
                     Translator.localize("wfr.UML142.UseCase.4-desc"), 
 434  
                     ToDoItem.HIGH_PRIORITY, null, null,
 435  
                     "http://www.uml.org/"));
 436  0
         } catch (InvalidOclException e) {
 437  0
             e.printStackTrace();
 438  900
         }
 439  
 
 440  
         // ActionState
 441  
         // 4.13.3.2 [3]
 442  
         // Issue 715
 443  
         try {
 444  900
             critics.add(new CrOCL("context ActionState inv:"
 445  
                     + "self.outgoing->forAll(t | t.trigger->size = 0)",
 446  
                     Translator.localize("wfr.UML142.ActionState.3-head"),
 447  
                     Translator.localize("wfr.UML142.ActionState.3-desc"), 
 448  
                     ToDoItem.HIGH_PRIORITY, null, null,
 449  
                     "http://www.uml.org/"));
 450  0
         } catch (InvalidOclException e) {
 451  0
             e.printStackTrace();
 452  900
         }
 453  
 
 454  900
         setCritics(critics);
 455  900
     }
 456  
 
 457  
     @Override
 458  
     public FormatingStrategy getFormatingStrategy() {
 459  7632
         return formatingStrategy;
 460  
     }
 461  
 
 462  
     @Override
 463  
     public String getDisplayName() {
 464  1149
         if (Model.getFacade().getUmlVersion().charAt(0) == '1') {
 465  1149
             return NAME_UML14;
 466  
         }
 467  0
         return NAME_UML22;
 468  
     }
 469  
 
 470  
 
 471  
     @Override
 472  
     public Set<Critic> getCritics() {
 473  2846
         if (critics == null) {
 474  900
             loadWellFormednessRules();
 475  
         }
 476  2846
         return super.getCritics();
 477  
     }
 478  
     
 479  
     @Override
 480  
     public Collection getProfilePackages() {
 481  2862
         return Collections.unmodifiableCollection(getModel());
 482  
     }
 483  
     
 484  
 
 485  
     @Override
 486  
     public Collection<Object> getLoadedPackages() {
 487  0
         if (model == null) {
 488  0
             return Collections.emptyList();
 489  
         } else {
 490  0
             return Collections.unmodifiableCollection(model);
 491  
         }
 492  
     }
 493  
 
 494  
     @Override
 495  
     public DefaultTypeStrategy getDefaultTypeStrategy() {
 496  7632
         return new DefaultTypeStrategy() {
 497  7632
             private Collection model = getModel();
 498  
             public Object getDefaultAttributeType() {
 499  0
                 return ModelUtils.findTypeInModel("Integer", model.iterator()
 500  
                         .next());
 501  
             }
 502  
 
 503  
             public Object getDefaultParameterType() {
 504  0
                 return ModelUtils.findTypeInModel("Integer", model.iterator()
 505  
                         .next());
 506  
             }
 507  
 
 508  
             public Object getDefaultReturnType() {
 509  0
                 return null;
 510  
             }
 511  
 
 512  
         };
 513  
     }
 514  
 }