svn commit: r13645 - trunk/src_new/org/argouml: language/java/generator notation/providers/uml

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: penyaskito
Date: 2007-10-07 09:02:57-0700
New Revision: 13645

Modified:
   trunk/src_new/org/argouml/language/java/generator/GeneratorJava.java
   trunk/src_new/org/argouml/notation/providers/uml/AssociationEndNameNotationUml.java
   trunk/src_new/org/argouml/notation/providers/uml/AttributeNotationUml.java
   trunk/src_new/org/argouml/notation/providers/uml/ClassifierRoleNotationUml.java
   trunk/src_new/org/argouml/notation/providers/uml/ComponentInstanceNotationUml.java
   trunk/src_new/org/argouml/notation/providers/uml/MessageNotationUml.java
   trunk/src_new/org/argouml/notation/providers/uml/ModelElementNameNotationUml.java

Log:
Removed string concatenation in loops, using instead StringBuilder.

Important consideration: If anyone gets thread-related exceptions, the StringBuilder must be changed by StringBuffer.

Modified: trunk/src_new/org/argouml/language/java/generator/GeneratorJava.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/language/java/generator/GeneratorJava.java?view=diff&rev=13645&p1=trunk/src_new/org/argouml/language/java/generator/GeneratorJava.java&p2=trunk/src_new/org/argouml/language/java/generator/GeneratorJava.java&r1=13644&r2=13645
==============================================================================
--- trunk/src_new/org/argouml/language/java/generator/GeneratorJava.java	(original)
+++ trunk/src_new/org/argouml/language/java/generator/GeneratorJava.java	2007-10-07 09:02:57-0700
@@ -157,8 +157,9 @@
         }
         Object classifier = modelElement;
         String filename = name + ".java";
+        StringBuilder sbPath = new StringBuilder(path);
         if (!path.endsWith(FILE_SEPARATOR)) {
-            path += FILE_SEPARATOR;
+            sbPath.append(FILE_SEPARATOR);
         }
 
         String packagePath =
@@ -166,7 +167,7 @@
 
         int lastIndex = -1;
         do {
-            File f = new File(path);
+            File f = new File(sbPath.toString());
             if (!f.isDirectory()) {
                 if (!f.mkdir()) {
                     LOG.error(" could not make directory " + path);
@@ -183,15 +184,15 @@
                 index = packagePath.length();
             }
 
-            path += packagePath.substring(lastIndex + 1, index)
-                + FILE_SEPARATOR;
+            sbPath.append(packagePath.substring(lastIndex + 1, index)
+                + FILE_SEPARATOR);
             lastIndex = index;
         } while (true);
 
-        String pathname = path + filename;
+        String pathname = sbPath.toString() + filename;
         //cat.info("-----" + pathname + "-----");
 
-        //now decide wether file exist and need an update or is to be
+        //now decide whether file exist and need an update or is to be
         //newly generated
         File f = new File(pathname);
         isFileGeneration = true; // used to produce method javadoc

Modified: trunk/src_new/org/argouml/notation/providers/uml/AssociationEndNameNotationUml.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/notation/providers/uml/AssociationEndNameNotationUml.java?view=diff&rev=13645&p1=trunk/src_new/org/argouml/notation/providers/uml/AssociationEndNameNotationUml.java&p2=trunk/src_new/org/argouml/notation/providers/uml/AssociationEndNameNotationUml.java&r1=13644&r2=13645
==============================================================================
--- trunk/src_new/org/argouml/notation/providers/uml/AssociationEndNameNotationUml.java	(original)
+++ trunk/src_new/org/argouml/notation/providers/uml/AssociationEndNameNotationUml.java	2007-10-07 09:02:57-0700
@@ -97,7 +97,7 @@
         MyTokenizer st;
 
         String name = null;
-        String stereotype = null;
+        StringBuilder stereotype = null;
         String token;
 
         try {
@@ -113,13 +113,13 @@
                         		st.getTokenIndex());
                     }
 
-                    stereotype = "";
+                    stereotype = new StringBuilder();
                     while (true) {
                         token = st.nextToken();
                         if (">>".equals(token) || "\u00BB".equals(token)) {
                             break;
                         }
-                        stereotype += token;
+                        stereotype.append(token);
                     }
                 } else {
                     if (name != null) {
@@ -167,7 +167,8 @@
             Model.getCoreHelper().setName(role, name);
         }
 
-        StereotypeUtility.dealWithStereotypes(role, stereotype, true);
+        StereotypeUtility.dealWithStereotypes(role, 
+                stereotype.toString(), true);
     }
 
     /*

Modified: trunk/src_new/org/argouml/notation/providers/uml/AttributeNotationUml.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/notation/providers/uml/AttributeNotationUml.java?view=diff&rev=13645&p1=trunk/src_new/org/argouml/notation/providers/uml/AttributeNotationUml.java&p2=trunk/src_new/org/argouml/notation/providers/uml/AttributeNotationUml.java&r1=13644&r2=13645
==============================================================================
--- trunk/src_new/org/argouml/notation/providers/uml/AttributeNotationUml.java	(original)
+++ trunk/src_new/org/argouml/notation/providers/uml/AttributeNotationUml.java	2007-10-07 09:02:57-0700
@@ -220,13 +220,13 @@
     protected void parseAttribute(
             String text,
             Object attribute) throws ParseException {
-        String multiplicity = null;
+        StringBuilder multiplicity = null;
         String name = null;
-        Vector properties = null;
-        String stereotype = null;
+        Vector<String> properties = null;
+        StringBuilder stereotype = null;
         String token;
         String type = null;
-        String value = null;
+        StringBuilder value = null;
         String visibility = null;
         boolean hasColon = false;
         boolean hasEq = false;
@@ -250,11 +250,11 @@
                 if (" ".equals(token) || "\t".equals(token)
                         || ",".equals(token)) {
                     if (hasEq) {
-                        value += token;
+                        value.append(token);
                     }
                 } else if ("<<".equals(token) || "\u00AB".equals(token)) {
                     if (hasEq) {
-                        value += token;
+                        value.append(token);
                     } else {
                         if (stereotype != null) {
                             String msg = 
@@ -262,18 +262,18 @@
                             throw new ParseException(Translator.localize(msg),
                                     st.getTokenIndex());
                         }
-                        stereotype = "";
+                        stereotype = new StringBuilder();
                         while (true) {
                             token = st.nextToken();
                             if (">>".equals(token) || "\u00BB".equals(token)) {
                                 break;
                             }
-                            stereotype += token;
+                            stereotype.append(token);
                         }
                     }
                 } else if ("[".equals(token)) {
                     if (hasEq) {
-                        value += token;
+                        value.append(token);
                     } else {
                         if (multiplicity != null) {
                             String msg = 
@@ -281,31 +281,31 @@
                             throw new ParseException(Translator.localize(msg),
                                     st.getTokenIndex());
                         }
-                        multiplicity = "";
+                        multiplicity = new StringBuilder();
                         multindex = st.getTokenIndex() + 1;
                         while (true) {
                             token = st.nextToken();
                             if ("]".equals(token)) {
                                 break;
                             }
-                            multiplicity += token;
+                            multiplicity.append(token);
                         }
                     }
                 } else if ("{".equals(token)) {
-                    String propname = "";
-                    String propvalue = null;
+                    StringBuilder propname = new StringBuilder();
+                    StringBuilder propvalue = null;
 
                     if (properties == null) {
-                        properties = new Vector();
+                        properties = new Vector<String>();
                     }
                     while (true) {
                         token = st.nextToken();
                         if (",".equals(token) || "}".equals(token)) {
                             if (propname.length() > 0) {
-                                properties.add(propname);
-                                properties.add(propvalue);
+                                properties.add(propname.toString());
+                                properties.add(propvalue.toString());
                             }
-                            propname = "";
+                            propname = new StringBuilder();
                             propvalue = null;
 
                             if ("}".equals(token)) {
@@ -320,16 +320,16 @@
                                 throw new ParseException(Translator.localize(
                                         msg, args), st.getTokenIndex());
                             }
-                            propvalue = "";
+                            propvalue = new StringBuilder();
                         } else if (propvalue == null) {
-                            propname += token;
+                            propname.append(token);
                         } else {
-                            propvalue += token;
+                            propvalue.append(token);
                         }
                     }
                     if (propname.length() > 0) {
-                        properties.add(propname);
-                        properties.add(propvalue);
+                        properties.add(propname.toString());
+                        properties.add(propvalue.toString());
                     }
                 } else if (":".equals(token)) {
                     hasColon = true;
@@ -341,7 +341,7 @@
                         throw new ParseException(Translator.localize(msg), st
                                 .getTokenIndex());
                     }
-                    value = "";
+                    value = new StringBuilder();
                     hasColon = false;
                     hasEq = true;
                 } else {
@@ -365,7 +365,7 @@
                         }
                         type = token;
                     } else if (hasEq) {
-                        value += token;
+                        value.append(token);
                     } else {
                         if (name != null && visibility != null) {
                             String msg = "parsing.error.attribute.extra-text";
@@ -406,15 +406,20 @@
         } catch (NoSuchElementException nsee) {
             String msg = "parsing.error.attribute.unexpected-end-attribute";
             throw new ParseException(Translator.localize(msg), text.length());
-        } catch (ParseException pre) {
-            throw pre;
+        } 
+        // catch & rethrow is not necessary if we don't do nothing (penyaskito)
+        // catch (ParseException pre) {
+        //      throw pre;
+        // }
+
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("ParseAttribute [name: " + name 
+                    + " visibility: " + visibility 
+                    + " type: " + type + " value: " + value.toString() 
+                    + " stereo: " + stereotype.toString() 
+                    + " mult: " + multiplicity.toString());
         }
-
-        LOG.debug("ParseAttribute [name: " + name + " visibility: "
-                + visibility + " type: " + type + " value: " + value
-                + " stereo: " + stereotype + " mult: " + multiplicity);
-
-        if (properties != null) {
+        if (properties != null && LOG.isDebugEnabled()) {
             for (int i = 0; i + 1 < properties.size(); i += 2) {
                 LOG.debug("\tProperty [name: " + properties.get(i) + " = "
                         + properties.get(i + 1) + "]");
@@ -450,16 +455,15 @@
                 ProjectManager.getManager().getCurrentProject();
             ProjectSettings ps = project.getProjectSettings();
             Object initExpr = Model.getDataTypesFactory().createExpression(
-                    ps.getNotationLanguage(), value.trim());
+                    ps.getNotationLanguage(), value.toString().trim());
             Model.getCoreHelper().setInitialValue(attribute, initExpr);
         }
 
         if (multiplicity != null) {
             try {
-                Model.getCoreHelper().setMultiplicity(
-                        attribute,
-                        Model.getDataTypesFactory()
-                                .createMultiplicity(multiplicity.trim()));
+                Model.getCoreHelper().setMultiplicity(attribute,
+                        Model.getDataTypesFactory().createMultiplicity(
+                                multiplicity.toString().trim()));
             } catch (IllegalArgumentException iae) {
                 String msg = "parsing.error.attribute.bad-multiplicity";
                 Object[] args = {iae};
@@ -474,7 +478,8 @@
                     NotationUtilityUml.attributeSpecialStrings);
         }
 
-        StereotypeUtility.dealWithStereotypes(attribute, stereotype, true);
+        StereotypeUtility.dealWithStereotypes(attribute, 
+                stereotype.toString(), true);
     }
 
     /*
@@ -528,12 +533,12 @@
                     changeableKind = "addOnly";
                 }
             }
-            StringBuffer properties = new StringBuffer();
+            StringBuilder properties = new StringBuilder();
             if (changeableKind.length() > 0) {
                 properties.append("{ ").append(changeableKind).append(" }");
             }
 
-            StringBuffer sb = new StringBuffer(20);
+            StringBuilder sb = new StringBuilder(20);
             if ((stereo != null) && (stereo.length() > 0)) {
                 sb.append(stereo).append(" ");
             }

Modified: trunk/src_new/org/argouml/notation/providers/uml/ClassifierRoleNotationUml.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/notation/providers/uml/ClassifierRoleNotationUml.java?view=diff&rev=13645&p1=trunk/src_new/org/argouml/notation/providers/uml/ClassifierRoleNotationUml.java&p2=trunk/src_new/org/argouml/notation/providers/uml/ClassifierRoleNotationUml.java&r1=13644&r2=13645
==============================================================================
--- trunk/src_new/org/argouml/notation/providers/uml/ClassifierRoleNotationUml.java	(original)
+++ trunk/src_new/org/argouml/notation/providers/uml/ClassifierRoleNotationUml.java	2007-10-07 09:02:57-0700
@@ -260,28 +260,33 @@
      */
     public String toString(Object modelElement, HashMap args) {
         String nameString = Model.getFacade().getName(modelElement);
-        if (nameString == null) nameString = "";
+        if (nameString == null) { 
+            nameString = "";
+        }
         nameString = nameString.trim();
-        String baseString = "";
+        StringBuilder baseString = new StringBuilder();
 
         // Loop through all base classes, building a comma separated list
 
         Collection c = Model.getFacade().getBases(modelElement);
         if (c != null && c.size() > 0) {
             Vector bases = new Vector(c);
-            baseString += Model.getFacade().getName(bases.elementAt(0));
+            baseString.append(Model.getFacade().getName(bases.elementAt(0)));
 
             for (int i = 1; i < bases.size(); i++) {
-                baseString +=
-                    ", " + Model.getFacade().getName(bases.elementAt(i));
+                baseString.append(
+                    ", " + Model.getFacade().getName(bases.elementAt(i)));
             }
         }
-        baseString = baseString.trim();
-
+        baseString = new StringBuilder(baseString.toString().trim());       
         // Build the final string
-        if (nameString.length() != 0) nameString = "/" + nameString;
-        if (baseString.length() != 0) baseString = ":" + baseString;
-        return nameString + baseString;
+        if (nameString.length() != 0) {
+            nameString = "/" + nameString;
+        }
+        if (baseString.length() != 0) {
+            baseString = baseString.insert(0, ":");
+        }
+        return nameString + baseString.toString();
     }
 
 }

Modified: trunk/src_new/org/argouml/notation/providers/uml/ComponentInstanceNotationUml.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/notation/providers/uml/ComponentInstanceNotationUml.java?view=diff&rev=13645&p1=trunk/src_new/org/argouml/notation/providers/uml/ComponentInstanceNotationUml.java&p2=trunk/src_new/org/argouml/notation/providers/uml/ComponentInstanceNotationUml.java&r1=13644&r2=13645
==============================================================================
--- trunk/src_new/org/argouml/notation/providers/uml/ComponentInstanceNotationUml.java	(original)
+++ trunk/src_new/org/argouml/notation/providers/uml/ComponentInstanceNotationUml.java	2007-10-07 09:02:57-0700
@@ -110,23 +110,23 @@
         }
 
         // construct bases string (comma separated)
-        String baseStr = "";
+        StringBuilder baseStr = new StringBuilder();
         Collection col = Model.getFacade().getClassifiers(modelElement);
         if (col != null && col.size() > 0) {
             Iterator it = col.iterator();
-            baseStr = Model.getFacade().getName(it.next());
+            baseStr = new StringBuilder(Model.getFacade().getName(it.next()));
             while (it.hasNext()) {
-                baseStr += ", " + Model.getFacade().getName(it.next());
+                baseStr.append(", " + Model.getFacade().getName(it.next()));
             }
         }
         if ((nameStr.length() == 0) && (baseStr.length() == 0)) {
             return "";
         }
-        baseStr = baseStr.trim();
+        baseStr = new StringBuilder(baseStr.toString().trim());
         if (baseStr.length() < 1) {
             return nameStr.trim();
         }
-        return nameStr.trim() + " : " + baseStr;
+        return nameStr.trim() + " : " + baseStr.toString();
     }
 
 }

Modified: trunk/src_new/org/argouml/notation/providers/uml/MessageNotationUml.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/notation/providers/uml/MessageNotationUml.java?view=diff&rev=13645&p1=trunk/src_new/org/argouml/notation/providers/uml/MessageNotationUml.java&p2=trunk/src_new/org/argouml/notation/providers/uml/MessageNotationUml.java&r1=13644&r2=13645
==============================================================================
--- trunk/src_new/org/argouml/notation/providers/uml/MessageNotationUml.java	(original)
+++ trunk/src_new/org/argouml/notation/providers/uml/MessageNotationUml.java	2007-10-07 09:02:57-0700
@@ -143,7 +143,7 @@
 
         String action = "";
         String number;
-        String predecessors = "";
+        StringBuilder predecessors = new StringBuilder();
         int lpn;
 
         if (modelElement == null) {
@@ -173,14 +173,15 @@
                 }
 
                 if (predecessors.length() > 0) {
-                    predecessors += ", ";
+                    predecessors.append(", ");
                 }
-                predecessors += generateMessageNumber(msg, ptr2.message, mpn);
+                predecessors.append(
+                        generateMessageNumber(msg, ptr2.message, mpn));
                 precnt++;
             }
 
             if (precnt > 0) {
-                predecessors += " / ";
+                predecessors.append(" / ");
             }
         }
 
@@ -343,7 +344,7 @@
         Collection arguments;
         Iterator it;
         String s;
-        String p;
+        StringBuilder p;
         boolean first;
 
         Object script = Model.getFacade().getScript(theAction);
@@ -354,7 +355,7 @@
             s = "";
         }
 
-        p = "";
+        p = new StringBuilder();
         arguments = Model.getFacade().getActualArguments(theAction);
         if (arguments != null) {
             it = arguments.iterator();
@@ -362,11 +363,12 @@
             while (it.hasNext()) {
                 Object arg = it.next();
                 if (!first) {
-                    p += ", ";
+                    p.append(", ");
                 }
 
                 if (Model.getFacade().getValue(arg) != null) {
-                    p += generateExpression(Model.getFacade().getValue(arg));
+                    p.append(generateExpression(
+                            Model.getFacade().getValue(arg)));
                 }
                 first = false;
             }
@@ -385,7 +387,7 @@
             return s;
         }
 
-        return s + " (" + p + ")";
+        return s + " (" + p.toString() + ")";
     }
 
     private String generateExpression(Object expr) {
@@ -453,10 +455,10 @@
      */
     protected void parseMessage(Object mes, String s) throws ParseException {
         String fname = null;
-        String guard = null;
+        StringBuilder guard = null;
         String paramExpr = null;
         String token;
-        String varname = null;
+        StringBuilder varname = null;
         Vector predecessors = new Vector();
         Vector seqno = null;
         Vector currentseq = new Vector();
@@ -483,7 +485,7 @@
                 if (" ".equals(token) || "\t".equals(token)) {
                     if (currentseq == null) {
                         if (varname != null && fname == null) {
-                            varname += token;
+                            varname.append(token);
                         }
                     }
                 } else if ("[".equals(token)) {
@@ -500,13 +502,13 @@
                                 st.getTokenIndex());
                     }
 
-                    guard = "";
+                    guard = new StringBuilder();
                     while (true) {
                         token = st.nextToken();
                         if ("]".equals(token)) {
                             break;
                         }
-                        guard += token;
+                        guard.append(token);
                     }
                 } else if ("*".equals(token)) {
                     if (mustBePre) {
@@ -634,10 +636,10 @@
                         hasPredecessors = true;
                     } else {
                         if (varname == null && fname != null) {
-                            varname = fname + token;
+                            varname = new StringBuilder(fname + token);
                             fname = null;
                         } else if (varname != null && fname == null) {
-                            varname += token;
+                            varname.append(token);
                         } else {
                             String msg = "parsing.error.message.found-comma";
                             throw new ParseException(
@@ -648,7 +650,7 @@
                 } else if ("=".equals(token) || ":=".equals(token)) {
                     if (currentseq == null) {
                         if (varname == null) {
-                            varname = fname;
+                            varname = new StringBuilder(fname);
                             fname = "";
                         } else {
                             fname = "";
@@ -669,11 +671,11 @@
                                     st.getTokenIndex());
                         }
                         if (varname == null) {
-                            varname = "";
+                            varname = new StringBuilder();
                         }
                         paramExpr = token.substring(1, token.length() - 1);
                     } else if (varname != null && fname == null) {
-                        varname += token;
+                        varname.append(token);
                     } else if (fname == null || fname.length() == 0) {
                         fname = token;
                     } else {
@@ -807,12 +809,12 @@
         }
 
         if (guard != null) {
-            guard = "[" + guard.trim() + "]";
+            guard = new StringBuilder("[" + guard.toString().trim() + "]");
             if (iterative) {
                 if (parallell) {
-                    guard = "*//" + guard;
+                    guard = guard.insert(0, "*//");
                 } else {
-                    guard = "*" + guard;
+                    guard = guard.insert(0, "*");
                 }
             }
             Project project =
@@ -820,7 +822,7 @@
             ProjectSettings ps = project.getProjectSettings();
             Object expr =
                 Model.getDataTypesFactory().createIterationExpression(
-                        ps.getNotationLanguage(), guard);
+                        ps.getNotationLanguage(), guard.toString());
             Model.getCommonBehaviorHelper().setRecurrence(
                     Model.getFacade().getAction(mes), expr);
         }
@@ -867,12 +869,12 @@
                 }
 
                 if (idx >= 0) {
-                    varname = body.substring(0, idx);
+                    varname = new StringBuilder(body.substring(0, idx));
                 } else {
-                    varname = "";
+                    varname = new StringBuilder();
                 }
             } else {
-                varname = "";
+                varname = new StringBuilder();
             }
         }
 
@@ -883,7 +885,7 @@
         if (fname != null) {
             String expr = fname.trim();
             if (varname.length() > 0) {
-                expr = varname.trim() + " := " + expr;
+                expr = varname.toString().trim() + " := " + expr;
             }
 
             if (Model.getFacade().getScript(
@@ -942,8 +944,8 @@
             Object/* MMessage */root;
             // Find the preceding message, if any, on either end of the
             // association.
-            String pname = "";
-            String mname = "";
+            StringBuilder pname = new StringBuilder();
+            StringBuilder mname = new StringBuilder();
             String gname = generateMessageNumber(mes);
             boolean swapRoles = false;
             int majval = 0;
@@ -972,23 +974,23 @@
                 }
 
                 if (i > 0) {
-                    mname += ".";
+                    mname.append(".");
                 }
-                mname += Integer.toString(bv) + (char) ('a' + sv);
+                mname.append(Integer.toString(bv) + (char) ('a' + sv));
 
                 if (i + 3 < seqno.size()) {
                     if (i > 0) {
-                        pname += ".";
+                        pname.append(".");
                     }
-                    pname += Integer.toString(bv) + (char) ('a' + sv);
+                    pname.append(Integer.toString(bv) + (char) ('a' + sv));
                 }
             }
 
             root = null;
             if (pname.length() > 0) {
-                root = findMsg(Model.getFacade().getSender(mes), pname);
+                root = findMsg(Model.getFacade().getSender(mes), pname.toString());
                 if (root == null) {
-                    root = findMsg(Model.getFacade().getReceiver(mes), pname);
+                    root = findMsg(Model.getFacade().getReceiver(mes), pname.toString());
                     if (root != null) {
                         swapRoles = true;
                     }
@@ -1000,9 +1002,9 @@
                 swapRoles = true;
             }
 
-            if (compareMsgNumbers(mname, gname)) {
+            if (compareMsgNumbers(mname.toString(), gname.toString())) {
                 // Do nothing
-            } else if (isMsgNumberStartOf(gname, mname)) {
+            } else if (isMsgNumberStartOf(gname.toString(), mname.toString())) {
             	String msg = "parsing.error.message.subtree-rooted-self";
                 throw new ParseException(Translator.localize(msg), 0);
             } else if (Model.getFacade().getPredecessors(mes).size() > 1
@@ -1563,15 +1565,15 @@
 
         it = c.iterator();
         if (it.hasNext()) {
-            String expr = name + "(";
+            StringBuilder expr = new StringBuilder(name + "(");
             int i;
             for (i = 0; i < params; i++) {
                 if (i > 0) {
-                    expr += ", ";
+                    expr.append(", ");
                 }
-                expr += "param" + (i + 1);
+                expr.append("param" + (i + 1));
             }
-            expr += ")";
+            expr.append(")");
             // Jaap Branderhorst 2002-23-09 added next lines to link
             // parameters and operations to the figs that represent
             // them
@@ -1582,7 +1584,8 @@
             Object op = Model.getCoreFactory().buildOperation(cls, returnType);
 
             try {
-                (new OperationNotationUml(op)).parseOperation(expr, op);
+                (new OperationNotationUml(op)).parseOperation(
+                        expr.toString(), op);
             } catch (ParseException pe) {
                 LOG.error("Unexpected ParseException in getOperation: " + pe,
                         pe);

Modified: trunk/src_new/org/argouml/notation/providers/uml/ModelElementNameNotationUml.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/notation/providers/uml/ModelElementNameNotationUml.java?view=diff&rev=13645&p1=trunk/src_new/org/argouml/notation/providers/uml/ModelElementNameNotationUml.java&p2=trunk/src_new/org/argouml/notation/providers/uml/ModelElementNameNotationUml.java&r1=13644&r2=13645
==============================================================================
--- trunk/src_new/org/argouml/notation/providers/uml/ModelElementNameNotationUml.java	(original)
+++ trunk/src_new/org/argouml/notation/providers/uml/ModelElementNameNotationUml.java	2007-10-07 09:02:57-0700
@@ -137,7 +137,7 @@
      * @return a string which represents the path
      */
     protected String generatePath(Object modelElement, HashMap args) {
-        String s = "";
+        StringBuilder s = new StringBuilder();
         if (isValue("pathVisible", args)) {
             Object p = modelElement;
             Stack stack = new Stack();
@@ -147,14 +147,14 @@
                 ns = Model.getFacade().getNamespace(ns);
             }
             while (!stack.isEmpty()) {
-                s += (String) stack.pop() + "::";
+                s.append((String) stack.pop() + "::");
             }
 
-            if (s.length() > 0 && !s.endsWith(":")) {
-                s += "::";
+            if (s.length() > 0 && !(s.lastIndexOf(":") == s.length() - 1)) {
+                s.append("::");
             }
         }
-        return s;
+        return s.toString();
     }
 
     /**
@@ -175,8 +175,7 @@
             s = NotationUtilityUml.generateVisibility(v);
             if (s.length() > 0) {
                 s = s + " ";
-            }
-            /* This for when nothing is generated: omit the space. */
+            }            
         }
         return s;
     }
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.