Skip to content

Commit cb21446

Browse files
committed
* VStructure (appendFeatureValue): Insert " " or " = " if the text of
the feature value does not have any spaces.
1 parent 21ad318 commit cb21446

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

org.omg.sysml.plantuml/src/org/omg/sysml/plantuml/VStructure.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
package org.omg.sysml.plantuml;
2828

2929
import java.util.List;
30+
import java.util.regex.Matcher;
31+
import java.util.regex.Pattern;
3032

3133
import org.omg.sysml.expressions.util.EvaluationUtil;
3234
import org.omg.sysml.lang.sysml.ActorMembership;
@@ -111,6 +113,8 @@ protected boolean addEvaluatedResults(Element elem) {
111113
return true;
112114
}
113115

116+
private static Pattern patEqFeatureValue = Pattern.compile("^\\s*=");
117+
114118
protected boolean appendFeatureValue(FeatureValue fv) {
115119
Expression ex = fv.getValue();
116120
String text = getText(fv);
@@ -121,6 +125,12 @@ protected boolean appendFeatureValue(FeatureValue fv) {
121125
if (pos >= 0) {
122126
text = text.substring(pos + "default".length()); //
123127
}
128+
} else {
129+
append(' '); // appendText() trims the text.
130+
Matcher m = patEqFeatureValue.matcher(text);
131+
if (!m.matches()) {
132+
text = "= " + text;
133+
}
124134
}
125135
boolean flag = appendText(text, true);
126136
return addEvaluatedResults(ex) || flag;

0 commit comments

Comments
 (0)