svn commit: r16495 - trunk/src/argouml-app/src/org/argouml/notation/providers/uml
Michiel van der Wulp <[email protected]>
| Newsgroups | gmane.comp.lang.uml.argouml.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: mvw
Date: 2009-01-03 14:24:23-0800
New Revision: 16495
Modified:
trunk/src/argouml-app/src/org/argouml/notation/providers/uml/MessageNotationUml.java
trunk/src/argouml-app/src/org/argouml/notation/providers/uml/SDMessageNotationUml.java
Log:
Reduce dependency on kernel.
Keep these 2 classes equal as much as possible.
Style, generics. Clarified by commenting.
Modified: trunk/src/argouml-app/src/org/argouml/notation/providers/uml/MessageNotationUml.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/notation/providers/uml/MessageNotationUml.java?view=diff&pathrev=16495&r1=16494&r2=16495
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/notation/providers/uml/MessageNotationUml.java (original)
+++ trunk/src/argouml-app/src/org/argouml/notation/providers/uml/MessageNotationUml.java 2009-01-03 14:24:23-0800
@@ -37,10 +37,9 @@
import org.argouml.application.events.ArgoEventTypes;
import org.argouml.application.events.ArgoHelpEvent;
import org.argouml.i18n.Translator;
-import org.argouml.kernel.Project;
import org.argouml.kernel.ProjectManager;
-import org.argouml.kernel.ProjectSettings;
import org.argouml.model.Model;
+import org.argouml.notation.Notation;
import org.argouml.notation.NotationSettings;
import org.argouml.notation.providers.MessageNotation;
import org.argouml.util.CustomSeparator;
@@ -760,12 +759,9 @@
guard = guard.insert(0, "*");
}
}
- Project project =
- ProjectManager.getManager().getCurrentProject();
- ProjectSettings ps = project.getProjectSettings();
Object expr =
Model.getDataTypesFactory().createIterationExpression(
- ps.getNotationLanguage(), guard.toString());
+ getExpressionLanguage(), guard.toString());
Model.getCommonBehaviorHelper().setRecurrence(
Model.getFacade().getAction(mes), expr);
}
@@ -821,10 +817,6 @@
}
}
- Project project =
- ProjectManager.getManager().getCurrentProject();
- ProjectSettings ps = project.getProjectSettings();
-
if (fname != null) {
String expr = fname.trim();
if (varname.length() > 0) {
@@ -839,7 +831,7 @@
Object e =
Model.getDataTypesFactory()
.createActionExpression(
- ps.getNotationLanguage(),
+ getExpressionLanguage(),
expr.trim());
Model.getCommonBehaviorHelper().setScript(
Model.getFacade().getAction(mes), e);
@@ -869,7 +861,7 @@
: "");
Object e =
Model.getDataTypesFactory().createExpression(
- ps.getNotationLanguage(),
+ getExpressionLanguage(),
value.trim());
Model.getCommonBehaviorHelper().setValue(arg, e);
}
@@ -1106,6 +1098,12 @@
}
}
+ // TODO: We are using the notation language here as the expression language.
+ // Is that sensible?
+ private String getExpressionLanguage() {
+ return Notation.DEFAULT_NOTATION;
+ }
+
/**
* Walks a call tree from a root node following the directions given in path
* to a destination node. If the destination node cannot be reached, then
@@ -1466,21 +1464,21 @@
}
/**
- * Finds the operations in Collection c with name name and params number of
+ * Finds the operations in Collection c with the given name and the given number of
* parameters. If no operation is found, one is created. The applicable
* operations are returned.
*
* @param c the collection of operations to be searched
* @param name the name of the operation to be found
* @param params the number of parameters of the operation to be found
- * @return the sought operation
+ * @return a list of the sought operations
*/
private List getOperation(Collection c, String name, int params) {
- List options = new ArrayList();
+ List<Object> ops = new ArrayList<Object>();
Iterator it;
if (name == null || name.length() == 0) {
- return options;
+ return ops;
}
it = c.iterator();
@@ -1501,11 +1499,11 @@
if (params != countParameters(op)) {
continue;
}
- options.add(op);
+ ops.add(op);
}
}
- if (options.size() > 0) {
- return options;
+ if (ops.size() > 0) {
+ return ops;
}
it = c.iterator();
@@ -1536,9 +1534,9 @@
pe);
}
- options.add(op);
+ ops.add(op);
}
- return options;
+ return ops;
}
/**
Modified: trunk/src/argouml-app/src/org/argouml/notation/providers/uml/SDMessageNotationUml.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/notation/providers/uml/SDMessageNotationUml.java?view=diff&pathrev=16495&r1=16494&r2=16495
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/notation/providers/uml/SDMessageNotationUml.java (original)
+++ trunk/src/argouml-app/src/org/argouml/notation/providers/uml/SDMessageNotationUml.java 2009-01-03 14:24:23-0800
@@ -41,6 +41,7 @@
import org.argouml.kernel.ProjectManager;
import org.argouml.kernel.ProjectSettings;
import org.argouml.model.Model;
+import org.argouml.notation.Notation;
import org.argouml.notation.NotationProvider;
import org.argouml.notation.NotationSettings;
import org.argouml.notation.SDNotationSettings;
@@ -761,7 +762,7 @@
Object expr =
Model.getDataTypesFactory().createIterationExpression(
- getNotationLanguage(), guard.toString());
+ getExpressionLanguage(), guard.toString());
Model.getCommonBehaviorHelper().setRecurrence(
Model.getFacade().getAction(mes), expr);
}
@@ -831,7 +832,7 @@
Object e =
Model.getDataTypesFactory()
.createActionExpression(
- getNotationLanguage(),
+ getExpressionLanguage(),
expr.trim());
Model.getCommonBehaviorHelper().setScript(
Model.getFacade().getAction(mes), e);
@@ -861,7 +862,7 @@
: "");
Object e =
Model.getDataTypesFactory().createExpression(
- getNotationLanguage(),
+ getExpressionLanguage(),
value.trim());
Model.getCommonBehaviorHelper().setValue(arg, e);
}
@@ -1098,13 +1099,10 @@
}
}
- // TODO: We know what our notation language is (and it's fixed)
- // Why are we looking it up in project settings?
- private String getNotationLanguage() {
- Project project =
- ProjectManager.getManager().getCurrentProject();
- ProjectSettings ps = project.getProjectSettings();
- return ps.getNotationLanguage();
+ // TODO: We are using the notation language here as the expression language.
+ // Is that sensible?
+ private String getExpressionLanguage() {
+ return Notation.DEFAULT_NOTATION;
}
/**
@@ -1467,21 +1465,21 @@
}
/**
- * Finds the operations in Collection c with name name and params number of
+ * Finds the operations in Collection c with the given name and the given number of
* parameters. If no operation is found, one is created. The applicable
* operations are returned.
*
* @param c the collection of operations to be searched
* @param name the name of the operation to be found
* @param params the number of parameters of the operation to be found
- * @return the sought operation
+ * @return a list of the sought operations
*/
private List getOperation(Collection c, String name, int params) {
- List options = new ArrayList();
+ List<Object> ops = new ArrayList<Object>();
Iterator it;
if (name == null || name.length() == 0) {
- return options;
+ return ops;
}
it = c.iterator();
@@ -1502,11 +1500,11 @@
if (params != countParameters(op)) {
continue;
}
- options.add(op);
+ ops.add(op);
}
}
- if (options.size() > 0) {
- return options;
+ if (ops.size() > 0) {
+ return ops;
}
it = c.iterator();
@@ -1537,9 +1535,9 @@
pe);
}
- options.add(op);
+ ops.add(op);
}
- return options;
+ return ops;
}
/**
------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=5905&dsMessageId=1001236
To unsubscribe from this discussion, e-mail: [[email protected]].