svn commit: r16531 - 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-06 07:49:13-0800
New Revision: 16531
Modified:
trunk/src/argouml-app/src/org/argouml/notation/providers/uml/AbstractMessageNotationUml.java
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:
More preparation for issue 5150.
Modified: trunk/src/argouml-app/src/org/argouml/notation/providers/uml/AbstractMessageNotationUml.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/notation/providers/uml/AbstractMessageNotationUml.java?view=diff&pathrev=16531&r1=16530&r2=16531
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/notation/providers/uml/AbstractMessageNotationUml.java (original)
+++ trunk/src/argouml-app/src/org/argouml/notation/providers/uml/AbstractMessageNotationUml.java 2009-01-06 07:49:13-0800
@@ -49,7 +49,38 @@
* It is extended by {@link MessageNotationUml}, with the
* notation of messages as seen in collaboration diagrams,
* and {@link SDMessageNotationUml}, with the notation of
- * messages as seen in sequence diagrams.
+ * messages as seen in sequence diagrams.<p>
+ *
+ * Parses a message line of the form:
+ *
+ * <pre>
+ * intno := integer|name
+ * seq := intno ['.' intno]*
+ * recurrance := '*'['//'] | '*'['//']'[' <i>iteration </i>']' | '['
+ * <i>condition </i>']'
+ * seqelem := {[intno] ['['recurrance']']}
+ * seq_expr := seqelem ['.' seqelem]*
+ * ret_list := lvalue [',' lvalue]*
+ * arg_list := rvalue [',' rvalue]*
+ * predecessor := seq [',' seq]* '/'
+ * message := [predecessor] seq_expr ':' [ret_list :=] name ([arg_list])
+ * </pre>
+ *
+ * Which is rather complex, so a few examples:<ul>
+ * <li> 2: display(x, y)
+ * <li> 1.3.1: p := find(specs)
+ * <li> [x < 0] 4: invert(color)
+ * <li> A3, B4/ C3.1*: update()
+ * </ul>
+ *
+ * This syntax is compatible with the UML 1.4.2 specification.<p>
+ *
+ * Actually, only a subset of this syntax is currently supported, and some
+ * is not even planned to be supported. The exceptions are intno, which
+ * allows a number possibly followed by a sequence of letters in the range
+ * 'a' - 'z', seqelem, which does not allow a recurrance, and message, which
+ * does allow one recurrance near seq_expr. (formerly: name: action )
+ *
*
* @see MessageNotationUml
* @see SDMessageNotationUml
@@ -73,6 +104,14 @@
public Object message;
}
+ /**
+ * @param message the UML Message object
+ */
+ public AbstractMessageNotationUml(Object message) {
+ super(message);
+ parameterCustomSep = initParameterSeparators();
+ }
+
protected List<CustomSeparator> initParameterSeparators() {
List<CustomSeparator> separators = new ArrayList<CustomSeparator>();
separators.add(MyTokenizer.SINGLE_QUOTED_SEPARATOR);
@@ -216,35 +255,6 @@
*
* TODO: - This method is too complex, lets break it up. <p>
*
- * Parses a message line of the form:
- *
- * <pre>
- * intno := integer|name
- * seq := intno ['.' intno]*
- * recurrance := '*'['//'] | '*'['//']'[' <i>iteration </i>']' | '['
- * <i>condition </i>']'
- * seqelem := {[intno] ['['recurrance']']}
- * seq_expr := seqelem ['.' seqelem]*
- * ret_list := lvalue [',' lvalue]*
- * arg_list := rvalue [',' rvalue]*
- * message := [seq [',' seq]* '/'] seq_expr ':' [ret_list :=] name ([arg_list])
- * </pre>
- *
- * Which is rather complex, so a few examples:<ul>
- * <li> 2: display(x, y)
- * <li> 1.3.1: p := find(specs)
- * <li> [x < 0] 4: invert(color)
- * <li> A3, B4/ C3.1*: update()
- * </ul>
- *
- * This syntax is compatible with the UML 1.4.2 specification.<p>
- *
- * Actually, only a subset of this syntax is currently supported, and some
- * is not even planned to be supported. The exceptions are intno, which
- * allows a number possibly followed by a sequence of letters in the range
- * 'a' - 'z', seqelem, which does not allow a recurrance, and message, which
- * does allow one recurrance near seq_expr. (formerly: name: action )
- *
* @param mes the MMessage to apply any changes to
* @param s the String to parse
* @throws ParseException
@@ -1186,14 +1196,6 @@
}
/**
- * @param message the UML Message object
- */
- public AbstractMessageNotationUml(Object message) {
- super(message);
- parameterCustomSep = initParameterSeparators();
- }
-
- /**
* Finds the message in ClassifierRole r that has the message number written
* in n. If it isn't found, null is returned.
*/
@@ -1397,6 +1399,44 @@
return count;
}
- protected abstract int recCountPredecessors(Object message, MsgPtr ptr);
+ /**
+ * Recursively count the number of predecessors of the given Message,
+ * and return (a pointer to) the first Message in the chain.
+ *
+ * @param message the UML Message to count the predecessors for
+ * @param ptr
+ * @return
+ */
+ protected int recCountPredecessors(Object message, MsgPtr ptr) {
+ int pre = 0;
+ int local = 0;
+ Object/*MMessage*/ maxmsg = null;
+ Object activator;
+
+ if (message == null) {
+ ptr.message = null;
+ return 0;
+ }
+
+ activator = Model.getFacade().getActivator(message);
+ for (Object predecessor : Model.getFacade().getPredecessors(message)) {
+ if (Model.getFacade().getActivator(predecessor)
+ != activator) {
+ continue;
+ }
+ int p = recCountPredecessors(predecessor, null) + 1;
+ if (p > pre) {
+ pre = p;
+ maxmsg = predecessor;
+ }
+ local++;
+ }
+
+ if (ptr != null) {
+ ptr.message = maxmsg;
+ }
+
+ return Math.max(pre, local);
+ }
}
\ No newline at end of file
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=16531&r1=16530&r2=16531
==============================================================================
--- 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-06 07:49:13-0800
@@ -47,7 +47,8 @@
* seq_expr := seqelem ['.' seqelem]*
* ret_list := lvalue [',' lvalue]*
* arg_list := rvalue [',' rvalue]*
- * message := [seq [',' seq]* '/'] seq_expr ':' [ret_list :=] name ([arg_list])
+ * predecessor := seq [',' seq]* '/'
+ * message := [predecessor] seq_expr ':' [ret_list :=] name ([arg_list])
* </pre> <p>
*
* Which is rather complex, so a few examples:<p><ul>
@@ -177,40 +178,4 @@
return predecessors + number + " : " + action;
}
- protected int recCountPredecessors(Object message, MsgPtr ptr) {
- Collection predecessors;
- Iterator it;
- int pre = 0;
- int local = 0;
- Object/*MMessage*/ maxmsg = null;
- Object activatorMessage;
-
- if (message == null) {
- ptr.message = null;
- return 0;
- }
-
- activatorMessage = Model.getFacade().getActivator(message);
- predecessors = Model.getFacade().getPredecessors(message);
- it = predecessors.iterator();
- while (it.hasNext()) {
- Object msg = it.next();
- if (Model.getFacade().getActivator(msg) != activatorMessage) {
- continue;
- }
- int p = recCountPredecessors(msg, null) + 1;
- if (p > pre) {
- pre = p;
- maxmsg = msg;
- }
- local++;
- }
-
- if (ptr != null) {
- ptr.message = maxmsg;
- }
-
- return Math.max(pre, local);
- }
-
}
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=16531&r1=16530&r2=16531
==============================================================================
--- 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-06 07:49:13-0800
@@ -49,7 +49,7 @@
* ret_list := lvalue [',' lvalue]*
* arg_list := rvalue [',' rvalue]*
* predecessor := seq [',' seq]* '/'
- * message := [seq [',' seq]* '/'] seq_expr ':' [ret_list :=] name ([arg_list])
+ * message := [predecessor] seq_expr ':' [ret_list :=] name ([arg_list])
* </pre> <p>
*
* Which is rather complex, so a few examples:<p><ul>
@@ -179,35 +179,4 @@
return predecessors + number + " : " + action;
}
- protected int recCountPredecessors(Object message, MsgPtr ptr) {
- int pre = 0;
- int local = 0;
- Object/*MMessage*/ maxmsg = null;
- Object activatorMessage;
-
- if (message == null) {
- ptr.message = null;
- return 0;
- }
-
- activatorMessage = Model.getFacade().getActivator(message);
- for (Object msg : Model.getFacade().getPredecessors(message)) {
- if (Model.getFacade().getActivator(msg) != activatorMessage) {
- continue;
- }
- int p = recCountPredecessors(msg, null) + 1;
- if (p > pre) {
- pre = p;
- maxmsg = msg;
- }
- local++;
- }
-
- if (ptr != null) {
- ptr.message = maxmsg;
- }
-
- return Math.max(pre, local);
- }
-
}
------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=5905&dsMessageId=1007748
To unsubscribe from this discussion, e-mail: [[email protected]].