svn commit: r17280 - trunk/src/argouml-app/src/org/argouml/profile/internal: . ocl ocl/uml14
Luis Sergio Oliveira <[email protected]>
| Newsgroups | gmane.comp.lang.uml.argouml.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: euluis
Date: 2009-08-18 01:15:53-0700
New Revision: 17280
Modified:
trunk/src/argouml-app/src/org/argouml/profile/internal/ProfileManagerImpl.java
trunk/src/argouml-app/src/org/argouml/profile/internal/ProfileUML.java
trunk/src/argouml-app/src/org/argouml/profile/internal/ocl/ContextApplicable.java
trunk/src/argouml-app/src/org/argouml/profile/internal/ocl/EvaluateExpression.java
trunk/src/argouml-app/src/org/argouml/profile/internal/ocl/uml14/ModelAccessModelInterpreter.java
trunk/src/argouml-app/src/org/argouml/profile/internal/ocl/uml14/Uml14ModelInterpreter.java
Log:
easy style cleanup in profile subsystem
Modified: trunk/src/argouml-app/src/org/argouml/profile/internal/ProfileManagerImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/profile/internal/ProfileManagerImpl.java?view=diff&pathrev=17280&r1=17279&r2=17280
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/profile/internal/ProfileManagerImpl.java (original)
+++ trunk/src/argouml-app/src/org/argouml/profile/internal/ProfileManagerImpl.java 2009-08-18 01:15:53-0700
@@ -133,8 +133,8 @@
.getString(KEY_DEFAULT_PROFILES);
if (defaultProfilesList.equals("")) {
// if the list does not exist
- // add the Java profile and the code generation and good practices
- // profiles as default
+ // add the Java profile and the code generation and good
+ // practices profiles as default
addToDefaultProfiles(profileGoodPractices);
addToDefaultProfiles(profileCodeGeneration);
@@ -437,14 +437,14 @@
for (Profile p : this.profiles) {
for (Critic c : p.getCritics()) {
c.setEnabled(false);
- Configuration.setBoolean(c.getCriticKey(), false);
+ Configuration.setBoolean(c.getCriticKey(), false);
}
}
for (Profile p : pc.getProfiles()) {
for (Critic c : p.getCritics()) {
c.setEnabled(true);
- Configuration.setBoolean(c.getCriticKey(), true);
+ Configuration.setBoolean(c.getCriticKey(), true);
}
}
}
Modified: trunk/src/argouml-app/src/org/argouml/profile/internal/ProfileUML.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/profile/internal/ProfileUML.java?view=diff&pathrev=17280&r1=17279&r2=17280
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/profile/internal/ProfileUML.java (original)
+++ trunk/src/argouml-app/src/org/argouml/profile/internal/ProfileUML.java 2009-08-18 01:15:53-0700
@@ -124,7 +124,7 @@
}
loadWellFormednessRules();
- }
+ }
private void loadWellFormednessRules() {
Set<Critic> critics = new HashSet<Critic>();
@@ -225,10 +225,10 @@
+ "forAll( o | not self.allAttributes->"
+ "union (self.allContents)->"
+ "collect ( q | q.name )->includes (o.name) )",
- "The name of an opposite AssociationEnd may not be the same "
- + "as the name of an Attribute or a ModelElement contained "
- + "in the Classifier.", null,
- ToDoItem.HIGH_PRIORITY, null, null, "http://www.uml.org/"));
+ "The name of an opposite AssociationEnd may not be the same "
+ + "as the name of an Attribute or a ModelElement contained "
+ + "in the Classifier.", null,
+ ToDoItem.HIGH_PRIORITY, null, null, "http://www.uml.org/"));
} catch (InvalidOclException e) {
e.printStackTrace();
}
@@ -274,7 +274,8 @@
// 4.5.3.26 [2]
try {
critics.add(new CrOCL("context Namespace inv:"
- + "self.allContents -> select(x|x.oclIsKindOf(Association))->"
+ + "self.allContents -> "
+ + "select(x|x.oclIsKindOf(Association))->"
+ "forAll(a1, a2 |a1.name = a2.name and "
+ "a1.connection.participant = a2.connection.participant"
+ " implies a1 = a2)",
Modified: trunk/src/argouml-app/src/org/argouml/profile/internal/ocl/ContextApplicable.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/profile/internal/ocl/ContextApplicable.java?view=diff&pathrev=17280&r1=17279&r2=17280
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/profile/internal/ocl/ContextApplicable.java (original)
+++ trunk/src/argouml-app/src/org/argouml/profile/internal/ocl/ContextApplicable.java 2009-08-18 01:15:53-0700
@@ -24,7 +24,6 @@
package org.argouml.profile.internal.ocl;
-import org.apache.log4j.Logger;
import org.argouml.model.Model;
import tudresden.ocl.parser.analysis.DepthFirstAdapter;
@@ -35,20 +34,18 @@
/**
* Checks the context clause of the OCL expression to verify if it is applicable
* to the given model element.
- *
+ *
* @author maurelio1234
*/
public class ContextApplicable extends DepthFirstAdapter {
- private static final Logger LOG = Logger.getLogger(ContextApplicable.class);
-
private boolean applicable = true;
private Object modelElement;
/**
- * Constructors
- *
+ * Constructor.
+ *
* @param element the model element
*/
public ContextApplicable(Object element) {
@@ -63,16 +60,17 @@
}
/**
- * @param node
+ * @param node the node visited
* @see tudresden.ocl.parser.analysis.DepthFirstAdapter#caseAClassifierContext(tudresden.ocl.parser.node.AClassifierContext)
*/
+ @Override
public void caseAClassifierContext(AClassifierContext node) {
String metaclass = ("" + node.getPathTypeName()).trim();
applicable &= Model.getFacade().isA(metaclass, modelElement);
}
/**
- * @param node
+ * @param node the node visited
* @see tudresden.ocl.parser.analysis.DepthFirstAdapter#inAPreStereotype(tudresden.ocl.parser.node.APreStereotype)
*/
public void inAPreStereotype(APreStereotype node) {
@@ -80,7 +78,7 @@
}
/**
- * @param node
+ * @param node the node visited
* @see tudresden.ocl.parser.analysis.DepthFirstAdapter#inAPostStereotype(tudresden.ocl.parser.node.APostStereotype)
*/
public void inAPostStereotype(APostStereotype node) {
Modified: trunk/src/argouml-app/src/org/argouml/profile/internal/ocl/EvaluateExpression.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/profile/internal/ocl/EvaluateExpression.java?view=diff&pathrev=17280&r1=17279&r2=17280
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/profile/internal/ocl/EvaluateExpression.java (original)
+++ trunk/src/argouml-app/src/org/argouml/profile/internal/ocl/EvaluateExpression.java 2009-08-18 01:15:53-0700
@@ -84,7 +84,7 @@
/**
* Evaluates OCL expressions, this class should not depend on the model
- * subsystem. This adapter assumes the ocl expression is syntacally and
+ * subsystem. This adapter assumes the ocl expression is syntatically and
* semantically correct.
*
* @author maurelio1234
@@ -236,9 +236,11 @@
if (op != null) {
if (op instanceof AAndLogicalOperator) {
- if (left != null && left instanceof Boolean && ((Boolean)left).booleanValue() == false) {
+ if (left != null && left instanceof Boolean
+ && !((Boolean) left)) {
val = false;
- } else if (right != null && right instanceof Boolean && ((Boolean)right).booleanValue() == false) {
+ } else if (right != null && right instanceof Boolean
+ && !((Boolean) right)) {
val = false;
} else {
val = asBoolean(left, node) && asBoolean(right, node);
@@ -246,9 +248,11 @@
} else if (op instanceof AImpliesLogicalOperator) {
val = !asBoolean(left, node) || asBoolean(right, node);
} else if (op instanceof AOrLogicalOperator) {
- if (left != null && left instanceof Boolean && ((Boolean)left).booleanValue() == true) {
+ if (left != null && left instanceof Boolean
+ && ((Boolean) left)) {
val = true;
- } else if (right != null && right instanceof Boolean && ((Boolean)right).booleanValue() == true) {
+ } else if (right != null && right instanceof Boolean
+ && ((Boolean) right)) {
val = true;
} else {
val = asBoolean(left, node) || asBoolean(right, node);
@@ -743,7 +747,6 @@
AListExpressionListOrRangeTail node)
{
// TODO support other kinds of tail
-
inAListExpressionListOrRangeTail(node);
{
List ret = new ArrayList();
@@ -758,7 +761,6 @@
outAListExpressionListOrRangeTail(node);
}
-
/*
* @see tudresden.ocl.parser.analysis.DepthFirstAdapter#caseAFeatureCall(tudresden.ocl.parser.node.AFeatureCall)
*/
@@ -806,8 +808,8 @@
node.getExpression().apply(this);
list.add(val);
}
- {
-
+ { // TODO: why is this inside a block? Forgotten else branch?!?
+ // Question by euluis @ 2009-08-16.
Object temp[] = node.getActualParameterListTail().toArray();
for (int i = 0; i < temp.length; i++) {
val = null;
Modified: trunk/src/argouml-app/src/org/argouml/profile/internal/ocl/uml14/ModelAccessModelInterpreter.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/profile/internal/ocl/uml14/ModelAccessModelInterpreter.java?view=diff&pathrev=17280&r1=17279&r2=17280
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/profile/internal/ocl/uml14/ModelAccessModelInterpreter.java (original)
+++ trunk/src/argouml-app/src/org/argouml/profile/internal/ocl/uml14/ModelAccessModelInterpreter.java 2009-08-18 01:15:53-0700
@@ -242,17 +242,16 @@
}
if (feature.equals("oppositeAssociationEnds")) {
- return internalOcl(
- subject,
- vt,
- "self.associations->select ( a | a.connection->select ( ae |"
- + "ae.participant = self ).size = 1 )->collect ( a |"
- + "a.connection->"
- + "select ( ae | ae.participant <> self ) )->union ("
- + "self.associations->select ( a | a.connection->select ( ae |"
- + "ae.participant = self ).size > 1 )->collect ( a |"
- + "a.connection) )");
- }
+ return internalOcl(subject, vt,
+ "self.associations->select ( a | a.connection->select "
+ + "( ae | ae.participant = self ).size = 1 )->"
+ + "collect ( a | a.connection->"
+ + "select ( ae | ae.participant <> self ) )->"
+ + "union ( self.associations->"
+ + "select ( a | a.connection->select ( ae |"
+ + "ae.participant = self ).size > 1 )->"
+ + "collect ( a | a.connection) )");
+ }
if (feature.equals("allOppositeAssociationEnds")) {
return internalOcl(
@@ -275,24 +274,21 @@
}
if (feature.equals("allContents")) {
- return internalOcl(
- subject,
- vt,
- "self.contents->union("
- + "self.parent.allContents->select(e |"
- + "e.elementOwnership.visibility = #public or true or "
- + " e.elementOwnership.visibility = #protected))");
+ return internalOcl(subject, vt,
+ "self.contents->union("
+ + "self.parent.allContents->select(e |"
+ + "e.elementOwnership.visibility = #public or true or "
+ + " e.elementOwnership.visibility = #protected))");
}
if (feature.equals("allDiscriminators")) {
- return internalOcl(
- subject,
- vt,
- "self.generalization.discriminator->"
- + "union(self.parent.oclAsType(Classifier).allDiscriminators)");
- }
+ return internalOcl(subject, vt,
+ "self.generalization.discriminator->"
+ + "union(self.parent.oclAsType(Classifier)."
+ + "allDiscriminators)");
+ }
}
- }
+ }
/* 4.5.2.11 Comment */
@@ -326,16 +322,15 @@
// Additional Operation in 4.5.3.9
if (feature.equals("allResidentElements")) {
- return internalOcl(
- subject,
- vt,
- "self.resident->union("
- + "self.parent.oclAsType(Component).allResidentElements->select( re |"
- + "re.elementResidence.visibility = #public or "
- + "re.elementResidence.visibility = #protected))");
- }
+ return internalOcl(subject, vt,
+ "self.resident->union("
+ + "self.parent.oclAsType(Component)."
+ + "allResidentElements->select( re |"
+ + "re.elementResidence.visibility = #public or "
+ + "re.elementResidence.visibility = #protected))");
+ }
}
- }
+ }
/* 4.5.2.13 Constraint */
Modified: trunk/src/argouml-app/src/org/argouml/profile/internal/ocl/uml14/Uml14ModelInterpreter.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/profile/internal/ocl/uml14/Uml14ModelInterpreter.java?view=diff&pathrev=17280&r1=17279&r2=17280
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/profile/internal/ocl/uml14/Uml14ModelInterpreter.java (original)
+++ trunk/src/argouml-app/src/org/argouml/profile/internal/ocl/uml14/Uml14ModelInterpreter.java 2009-08-18 01:15:53-0700
@@ -25,9 +25,7 @@
package org.argouml.profile.internal.ocl.uml14;
import java.util.Collection;
-import java.util.Map;
-import org.apache.log4j.Logger;
import org.argouml.model.Model;
import org.argouml.profile.internal.ocl.CompositeModelInterpreter;
@@ -39,12 +37,6 @@
public class Uml14ModelInterpreter extends CompositeModelInterpreter {
/**
- * Logger.
- */
- private static final Logger LOG = Logger
- .getLogger(Uml14ModelInterpreter.class);
-
- /**
* Default Constructor
*/
public Uml14ModelInterpreter() {
------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=5905&dsMessageId=2384653
To unsubscribe from this discussion, e-mail: [[email protected]].