Author: tfmorris
Date: 2010-04-13 10:59:19-0700
New Revision: 18258
Modified:
trunk/src/argouml-app/src/org/argouml/uml/cognitive/critics/ProfileCodeGeneration.java
trunk/src/argouml-app/src/org/argouml/uml/cognitive/critics/ProfileGoodPractices.java
Log:
Lazy load critics
Modified: trunk/src/argouml-app/src/org/argouml/uml/cognitive/critics/ProfileCodeGeneration.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/cognitive/critics/ProfileCodeGeneration.java?view=diff&pathrev=18258&r1=18257&r2=18258
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/cognitive/critics/ProfileCodeGeneration.java (original)
+++ trunk/src/argouml-app/src/org/argouml/uml/cognitive/critics/ProfileCodeGeneration.java 2010-04-13 10:59:19-0700
@@ -53,7 +53,7 @@
*/
public class ProfileCodeGeneration extends Profile {
- private Set<Critic> critics = new HashSet<Critic>();
+ private Set<Critic> critics = null;
private static Critic crMissingClassName;
@@ -86,9 +86,14 @@
* @param profileGoodPractices the instance of the required profile
*/
public ProfileCodeGeneration(ProfileGoodPractices profileGoodPractices) {
-
crMissingClassName = profileGoodPractices.getCrMissingClassName();
+ addProfileDependency("GoodPractices");
+ }
+ private void loadCritics() {
+
+ critics = new HashSet<Critic>();
+
crCompoundConstructorNeeded = new CompoundCritic(
crMissingClassName, new CrConstructorNeeded());
@@ -133,8 +138,14 @@
critics.add(noTrans2);
this.setCritics(critics);
-
- addProfileDependency("GoodPractices");
+ }
+
+ @Override
+ public Set<Critic> getCritics() {
+ if (critics == null) {
+ loadCritics();
+ }
+ return super.getCritics();
}
@Override
Modified: trunk/src/argouml-app/src/org/argouml/uml/cognitive/critics/ProfileGoodPractices.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/cognitive/critics/ProfileGoodPractices.java?view=diff&pathrev=18258&r1=18257&r2=18258
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/cognitive/critics/ProfileGoodPractices.java (original)
+++ trunk/src/argouml-app/src/org/argouml/uml/cognitive/critics/ProfileGoodPractices.java 2010-04-13 10:59:19-0700
@@ -52,16 +52,20 @@
*/
public class ProfileGoodPractices extends Profile {
- private Set<Critic> critics = new HashSet<Critic>();
+ private Set<Critic> critics = null;
private CrMissingClassName crMissingClassName = new CrMissingClassName();
-
+
/**
* Default Constructor
*/
public ProfileGoodPractices() {
-
+ super();
+ }
+
+ private void loadCritics() {
// general
+ critics = new HashSet<Critic>();
critics.add(new CrEmptyPackage());
critics.add(new CrNodesOverlap());
critics.add(new CrZeroLengthEdge());
@@ -85,13 +89,20 @@
}
@Override
+ public Set<Critic> getCritics() {
+ if (critics == null ) {
+ loadCritics();
+ }
+ return super.getCritics();
+ }
+
+ @Override
public String getDisplayName() {
return "Critics for Good Practices";
}
- /*
- * @see org.argouml.profile.Profile#getProfileIdentifier()
- */
+
+ @Override
public String getProfileIdentifier() {
return "GoodPractices";
}
------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=5905&dsMessageId=2581075
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.