svn commit: r16557 - trunk/src/argouml-app/src/org/argouml/notation/providers/uml/MessageNotationUml.java

Michiel van der Wulp <[email protected]>
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: mvw
Date: 2009-01-09 04:23:56-0800
New Revision: 16557

Modified:
   trunk/src/argouml-app/src/org/argouml/notation/providers/uml/MessageNotationUml.java

Log:
More preparation for issue 5150. No functional change.

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=16557&r1=16556&r2=16557
==============================================================================
--- 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-09 04:23:56-0800
@@ -41,8 +41,9 @@
  * <pre>
  * intno := integer|name
  * seq := intno ['.' intno]*
- * recurrance := '*'['//'] | '*'['//']'[' <code>iteration </code>']' | '['
- * <code>condition </code>']'
+ * recurrance := '*'['//'] 
+ *      | '*'['//']'[' <code>iteration </code>']' 
+ *      | '['<code>condition </code>']'
  * seqelem := {[intno] ['['recurrance']']}
  * seq_expr := seqelem ['.' seqelem]*
  * ret_list := lvalue [',' lvalue]*
@@ -59,6 +60,9 @@
  * </ul><p>
  *
  * This syntax is compatible with the UML 1.4.2 specification.<p>
+ * 
+ * TODO: The '//' in the recurrance should be '||' according the standard.
+See issue 5606. <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
@@ -103,28 +107,32 @@
         return toString(modelElement);
     }
 
-    private String toString(final Object modelElement) {
+    private String toString(final Object umlMessage) {
         Iterator it;
-        Collection pre;
-        Object act;
-        Object/*MMessage*/ rt;
+        Collection umlPredecessors;
+        Object umlAction;
+        Object umlActivator; // this is a Message UML object
         MsgPtr ptr;
+        int lpn;
 
+        /* Supported format: 
+         *     predecessors number ":" action
+         * The 3 parts of the string to generate: */
+        StringBuilder predecessors = new StringBuilder(); // includes the "/"
+        String number; // the "seq_expr" from the header javadoc
+        // the ":" is not included in "number" - it is always present
         String action = "";
-        String number;
-        StringBuilder predecessors = new StringBuilder();
-        int lpn;
 
-        if (modelElement == null) {
+        if (umlMessage == null) {
             return "";
         }
 
         ptr = new MsgPtr();
-        lpn = recCountPredecessors(modelElement, ptr) + 1;
-        rt = Model.getFacade().getActivator(modelElement);
+        lpn = recCountPredecessors(umlMessage, ptr) + 1;
+        umlActivator = Model.getFacade().getActivator(umlMessage);
 
-        pre = Model.getFacade().getPredecessors(modelElement);
-        it = (pre != null) ? pre.iterator() : null;
+        umlPredecessors = Model.getFacade().getPredecessors(umlMessage);
+        it = (umlPredecessors != null) ? umlPredecessors.iterator() : null;
         if (it != null && it.hasNext()) {
             MsgPtr ptr2 = new MsgPtr();
             int precnt = 0;
@@ -134,7 +142,7 @@
                 int mpn = recCountPredecessors(msg, ptr2) + 1;
 
                 if (mpn == lpn - 1
-                    && rt == Model.getFacade().getActivator(msg)
+                    && umlActivator == Model.getFacade().getActivator(msg)
                     && Model.getFacade().getPredecessors(msg).size() < 2
                     && (ptr2.message == null
                         || countSuccessors(ptr2.message) < 2)) {
@@ -154,18 +162,20 @@
             }
         }
 
-        number = generateMessageNumber(modelElement, ptr.message, lpn);
+        number = generateMessageNumber(umlMessage, ptr.message, lpn);
 
-        act = Model.getFacade().getAction(modelElement);
-        if (act != null) {
-            if (Model.getFacade().getRecurrence(act) != null) {
-                number =
-                    generateRecurrence(Model.getFacade().getRecurrence(act))
+        umlAction = Model.getFacade().getAction(umlMessage);
+        if (umlAction != null) {
+            if (Model.getFacade().getRecurrence(umlAction) != null) {
+                number = generateRecurrence(
+                        Model.getFacade().getRecurrence(umlAction))
                     + " "
                     + number;
+                /* TODO: The recurrence goes in front of the action? 
+                 * Does this not contradict the header JavaDoc? */
             }
 
-            action = NotationUtilityUml.generateActionSequence(act);
+            action = NotationUtilityUml.generateActionSequence(umlAction);
 
             /* Dirty fix for issue 1758 (Needs to be amended
              * when we start supporting parameters):

------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=5905&dsMessageId=1013649

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.