diff --git a/pom.xml b/pom.xml
index 85aeca85b..16dbc0ebc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -35,7 +35,7 @@
net.sourceforge.plantuml
plantuml
- 1.2019.7-SNAPSHOT
+ 1.2019.8-SNAPSHOT
jar
PlantUML
diff --git a/src/net/sourceforge/plantuml/AlignmentParam.java b/src/net/sourceforge/plantuml/AlignmentParam.java
index e7a45d6c3..ed1bbdfd0 100644
--- a/src/net/sourceforge/plantuml/AlignmentParam.java
+++ b/src/net/sourceforge/plantuml/AlignmentParam.java
@@ -41,6 +41,7 @@ import net.sourceforge.plantuml.graphic.HorizontalAlignment;
public enum AlignmentParam {
arrowMessageAlignment(HorizontalAlignment.LEFT),
+ stateMessageAlignment(HorizontalAlignment.CENTER),
sequenceMessageAlignment(HorizontalAlignment.LEFT),
sequenceMessageTextAlignment(HorizontalAlignment.LEFT),
sequenceReferenceAlignment(HorizontalAlignment.CENTER),
diff --git a/src/net/sourceforge/plantuml/BlockUml.java b/src/net/sourceforge/plantuml/BlockUml.java
index 73102e17b..9b448360a 100644
--- a/src/net/sourceforge/plantuml/BlockUml.java
+++ b/src/net/sourceforge/plantuml/BlockUml.java
@@ -104,13 +104,14 @@ public class BlockUml {
public BlockUml(List strings, Defines defines, ISkinSimple skinParam, PreprocessorModeSet mode) {
this.localDefines = defines;
this.skinParam = skinParam;
- final String s0 = strings.get(0).getStringTrimmed();
+ final String s0 = strings.get(0).getTrimmed().getString();
if (StartUtils.startsWithSymbolAnd("start", s0) == false) {
throw new IllegalArgumentException();
}
if (mode != null && mode.getPreprocessorMode() == PreprocessorMode.V2_NEW_TIM) {
this.pmode = mode.getPreprocessorMode();
- final TimLoader timLoader = new TimLoader(mode.getImportedFiles(), defines, mode.getCharset());
+ final TimLoader timLoader = new TimLoader(mode.getImportedFiles(), defines, mode.getCharset(),
+ (DefinitionsContainer) mode);
timLoader.load(strings);
this.data = timLoader.getResult();
this.debug = timLoader.getDebug();
@@ -201,6 +202,17 @@ public class BlockUml {
return Collections.unmodifiableList(data2.subList(1, data2.size() - 1));
}
+ public List getDefinition2(boolean withHeader) {
+ final List data2 = new ArrayList();
+ for (StringLocated s : debug) {
+ data2.add(s.getString());
+ }
+ if (withHeader) {
+ return Collections.unmodifiableList(data2);
+ }
+ return Collections.unmodifiableList(data2.subList(1, data2.size() - 1));
+ }
+
public Defines getLocalDefines() {
return localDefines;
}
diff --git a/src/net/sourceforge/plantuml/BlockUmlBuilder.java b/src/net/sourceforge/plantuml/BlockUmlBuilder.java
index 6048abe71..c25cb7a33 100644
--- a/src/net/sourceforge/plantuml/BlockUmlBuilder.java
+++ b/src/net/sourceforge/plantuml/BlockUmlBuilder.java
@@ -139,7 +139,7 @@ public final class BlockUmlBuilder implements DefinitionsContainer {
return Collections.unmodifiableSet(usedFiles);
}
- public List getDefinition(String name) {
+ public List getDefinition1(String name) {
for (BlockUml block : blocks) {
if (block.isStartDef(name)) {
this.defines.importFrom(block.getLocalDefines());
@@ -149,6 +149,15 @@ public final class BlockUmlBuilder implements DefinitionsContainer {
return Collections.emptyList();
}
+ public List getDefinition2(String name) {
+ for (BlockUml block : blocks) {
+ if (block.isStartDef(name)) {
+ return block.getDefinition2(false);
+ }
+ }
+ return Collections.emptyList();
+ }
+
public PreprocessorMode getPreprocessorMode() {
return mode;
}
diff --git a/src/net/sourceforge/plantuml/ColorParam.java b/src/net/sourceforge/plantuml/ColorParam.java
index ff0f2d8ce..b1b8b0b9c 100644
--- a/src/net/sourceforge/plantuml/ColorParam.java
+++ b/src/net/sourceforge/plantuml/ColorParam.java
@@ -52,6 +52,7 @@ public enum ColorParam {
activityEnd(HtmlColorUtils.BLACK),
activityBar(HtmlColorUtils.BLACK),
swimlaneBorder(HtmlColorUtils.BLACK),
+ swimlaneTitleBackground(null),
usecaseBorder(HtmlColorUtils.MY_RED, ColorType.LINE),
usecaseBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK),
diff --git a/src/net/sourceforge/plantuml/DefinitionsContainer.java b/src/net/sourceforge/plantuml/DefinitionsContainer.java
index 5640191a8..0c9517710 100644
--- a/src/net/sourceforge/plantuml/DefinitionsContainer.java
+++ b/src/net/sourceforge/plantuml/DefinitionsContainer.java
@@ -41,6 +41,7 @@ import net.sourceforge.plantuml.preproc2.PreprocessorModeSet;
public interface DefinitionsContainer extends PreprocessorModeSet {
- public List getDefinition(String name);
+ public List getDefinition1(String name);
+ public List getDefinition2(String name);
}
diff --git a/src/net/sourceforge/plantuml/ISkinParam.java b/src/net/sourceforge/plantuml/ISkinParam.java
index 14e5422b1..2dda7edfd 100644
--- a/src/net/sourceforge/plantuml/ISkinParam.java
+++ b/src/net/sourceforge/plantuml/ISkinParam.java
@@ -43,6 +43,7 @@ import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.SkinParameter;
import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.skin.ArrowDirection;
+import net.sourceforge.plantuml.svek.ConditionEndStyle;
import net.sourceforge.plantuml.svek.ConditionStyle;
import net.sourceforge.plantuml.svek.PackageStyle;
import net.sourceforge.plantuml.ugraphic.UFont;
@@ -117,6 +118,8 @@ public interface ISkinParam extends ISkinSimple {
public ConditionStyle getConditionStyle();
+ public ConditionEndStyle getConditionEndStyle();
+
public double minClassWidth();
public boolean sameClassWidth();
diff --git a/src/net/sourceforge/plantuml/LineLocationImpl.java b/src/net/sourceforge/plantuml/LineLocationImpl.java
index 9fa9fbde4..f90701dd3 100644
--- a/src/net/sourceforge/plantuml/LineLocationImpl.java
+++ b/src/net/sourceforge/plantuml/LineLocationImpl.java
@@ -63,13 +63,6 @@ public class LineLocationImpl implements LineLocation {
return new LineLocationImpl(desc, parent, position + 1);
}
- public static LineLocation fromLine(CharSequence cs) {
- if (cs instanceof StringLocated) {
- return ((StringLocated) cs).getLocation();
- }
- return null;
- }
-
public int getPosition() {
return position;
}
diff --git a/src/net/sourceforge/plantuml/Log.java b/src/net/sourceforge/plantuml/Log.java
index ad5d3086f..d5172e72d 100644
--- a/src/net/sourceforge/plantuml/Log.java
+++ b/src/net/sourceforge/plantuml/Log.java
@@ -35,7 +35,6 @@
*/
package net.sourceforge.plantuml;
-
public abstract class Log {
private static final long start = System.currentTimeMillis();
@@ -60,7 +59,7 @@ public abstract class Log {
// final HealthCheck healthCheck = Performance.getHealthCheck();
// final long cpu = healthCheck.jvmCpuTime() / 1000L / 1000L;
// final long dot = healthCheck.dotTime().getSum();
-
+
final long freeMemory = Runtime.getRuntime().freeMemory();
final long maxMemory = Runtime.getRuntime().maxMemory();
final long totalMemory = Runtime.getRuntime().totalMemory();
@@ -72,19 +71,19 @@ public abstract class Log {
sb.append(delta / 1000L);
sb.append(".");
sb.append(String.format("%03d", delta % 1000L));
-// if (cpu != -1) {
-// sb.append(" - ");
-// sb.append(cpu / 1000L);
-// sb.append(".");
-// sb.append(String.format("%03d", cpu % 1000L));
-// }
-// sb.append(" - ");
-// sb.append(dot / 1000L);
-// sb.append(".");
-// sb.append(String.format("%03d", dot % 1000L));
-// sb.append("(");
-// sb.append(healthCheck.dotTime().getNb());
-// sb.append(")");
+ // if (cpu != -1) {
+ // sb.append(" - ");
+ // sb.append(cpu / 1000L);
+ // sb.append(".");
+ // sb.append(String.format("%03d", cpu % 1000L));
+ // }
+ // sb.append(" - ");
+ // sb.append(dot / 1000L);
+ // sb.append(".");
+ // sb.append(String.format("%03d", dot % 1000L));
+ // sb.append("(");
+ // sb.append(healthCheck.dotTime().getNb());
+ // sb.append(")");
sb.append(" - ");
final long total = totalMemory / 1024 / 1024;
final long free = freeMemory / 1024 / 1024;
diff --git a/src/net/sourceforge/plantuml/PSystemBuilder.java b/src/net/sourceforge/plantuml/PSystemBuilder.java
index 03de86db0..62d7e1774 100644
--- a/src/net/sourceforge/plantuml/PSystemBuilder.java
+++ b/src/net/sourceforge/plantuml/PSystemBuilder.java
@@ -45,6 +45,7 @@ import net.sourceforge.plantuml.activitydiagram3.ActivityDiagramFactory3;
import net.sourceforge.plantuml.api.PSystemFactory;
import net.sourceforge.plantuml.bpm.BpmDiagramFactory;
import net.sourceforge.plantuml.classdiagram.ClassDiagramFactory;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.compositediagram.CompositeDiagramFactory;
import net.sourceforge.plantuml.core.Diagram;
import net.sourceforge.plantuml.core.DiagramType;
@@ -135,6 +136,8 @@ public class PSystemBuilder {
if (result != null && OptionFlags.getInstance().isEnableStats()) {
StatsUtilsIncrement.onceMoreParse(System.currentTimeMillis() - now, result.getClass());
}
+ Log.info("Compilation duration " + (System.currentTimeMillis() - now));
+ RegexConcat.printCacheInfo();
}
}
@@ -144,12 +147,12 @@ public class PSystemBuilder {
factories.add(new PSystemWelcomeFactory());
factories.add(new PSystemColorsFactory());
factories.add(new SequenceDiagramFactory(skinParam));
- factories.add(new ClassDiagramFactory());
- factories.add(new ActivityDiagramFactory());
- factories.add(new DescriptionDiagramFactory());
- factories.add(new StateDiagramFactory());
- factories.add(new ActivityDiagramFactory3());
- factories.add(new CompositeDiagramFactory());
+ factories.add(new ClassDiagramFactory(skinParam));
+ factories.add(new ActivityDiagramFactory(skinParam));
+ factories.add(new DescriptionDiagramFactory(skinParam));
+ factories.add(new StateDiagramFactory(skinParam));
+ factories.add(new ActivityDiagramFactory3(skinParam));
+ factories.add(new CompositeDiagramFactory(skinParam));
factories.add(new BpmDiagramFactory(DiagramType.BPM));
// factories.add(new PostIdDiagramFactory());
factories.add(new PSystemLicenseFactory());
diff --git a/src/net/sourceforge/plantuml/Run.java b/src/net/sourceforge/plantuml/Run.java
index 05f17f7f3..03c25594a 100644
--- a/src/net/sourceforge/plantuml/Run.java
+++ b/src/net/sourceforge/plantuml/Run.java
@@ -337,12 +337,12 @@ public class Run {
private static void managePattern() {
printPattern(new SequenceDiagramFactory(null));
- printPattern(new ClassDiagramFactory());
- printPattern(new ActivityDiagramFactory());
- printPattern(new DescriptionDiagramFactory());
+ printPattern(new ClassDiagramFactory(null));
+ printPattern(new ActivityDiagramFactory(null));
+ printPattern(new DescriptionDiagramFactory(null));
// printPattern(new ComponentDiagramFactory());
- printPattern(new StateDiagramFactory());
- printPattern(new ObjectDiagramFactory());
+ printPattern(new StateDiagramFactory(null));
+ printPattern(new ObjectDiagramFactory(null));
}
private static void printPattern(UmlDiagramFactory factory) {
@@ -387,6 +387,7 @@ public class Run {
final List files = new ArrayList();
for (String s : option.getResult()) {
if (option.isDecodeurl()) {
+ error.goOk();
final Transcoder transcoder = TranscoderUtil.getDefaultTranscoder();
System.out.println("@startuml");
System.out.println(transcoder.decode(s));
@@ -465,6 +466,7 @@ public class Run {
System.out.println(f);
// new Metadata().readAndDisplayMetadata(f);
System.out.println();
+ error.goOk();
final String data = new MetadataTag(f, "plantuml").getData();
// File file = new File("tmp.txt");
// PrintWriter pw = new PrintWriter(file, "UTF-8");
@@ -486,12 +488,14 @@ public class Run {
sourceFileReader.setCheckMetadata(option.isCheckMetadata());
if (option.isComputeurl()) {
+ error.goOk();
for (BlockUml s : sourceFileReader.getBlocks()) {
System.out.println(s.getEncodedUrl());
}
return;
}
if (option.isCheckOnly()) {
+ error.goOk();
final boolean hasError = sourceFileReader.hasError();
if (hasError) {
error.goWithError();
diff --git a/src/net/sourceforge/plantuml/SkinParam.java b/src/net/sourceforge/plantuml/SkinParam.java
index c55465dea..9036e1bca 100644
--- a/src/net/sourceforge/plantuml/SkinParam.java
+++ b/src/net/sourceforge/plantuml/SkinParam.java
@@ -62,6 +62,7 @@ import net.sourceforge.plantuml.graphic.IHtmlColorSet;
import net.sourceforge.plantuml.graphic.SkinParameter;
import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.skin.ArrowDirection;
+import net.sourceforge.plantuml.svek.ConditionEndStyle;
import net.sourceforge.plantuml.svek.ConditionStyle;
import net.sourceforge.plantuml.svek.PackageStyle;
import net.sourceforge.plantuml.ugraphic.ColorMapper;
@@ -415,6 +416,7 @@ public class SkinParam implements ISkinParam {
result.add("Style");
result.add("SequenceParticipant");
result.add("ConditionStyle");
+ result.add("ConditionEndStyle");
result.add("SameClassWidth");
result.add("HyperlinkUnderline");
result.add("Padding");
@@ -535,6 +537,8 @@ public class SkinParam implements ISkinParam {
final HorizontalAlignment result = HorizontalAlignment.fromString(value);
if (result == null && param == AlignmentParam.noteTextAlignment) {
return getDefaultTextAlignment(HorizontalAlignment.LEFT);
+ } else if (result == null && param == AlignmentParam.stateMessageAlignment) {
+ return getDefaultTextAlignment(HorizontalAlignment.CENTER);
} else if (result == null) {
return param.getDefaultValue();
}
@@ -847,6 +851,15 @@ public class SkinParam implements ISkinParam {
return p;
}
+ public ConditionEndStyle getConditionEndStyle() {
+ final String value = getValue("conditionEndStyle");
+ final ConditionEndStyle p = ConditionEndStyle.fromString(value);
+ if (p == null) {
+ return ConditionEndStyle.DIAMOND;
+ }
+ return p;
+ }
+
public double minClassWidth() {
final String value = getValue("minclasswidth");
if (value != null && value.matches("\\d+")) {
diff --git a/src/net/sourceforge/plantuml/SkinParamDelegator.java b/src/net/sourceforge/plantuml/SkinParamDelegator.java
index c09d5adfe..535ea752e 100644
--- a/src/net/sourceforge/plantuml/SkinParamDelegator.java
+++ b/src/net/sourceforge/plantuml/SkinParamDelegator.java
@@ -46,6 +46,7 @@ import net.sourceforge.plantuml.graphic.IHtmlColorSet;
import net.sourceforge.plantuml.graphic.SkinParameter;
import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.skin.ArrowDirection;
+import net.sourceforge.plantuml.svek.ConditionEndStyle;
import net.sourceforge.plantuml.svek.ConditionStyle;
import net.sourceforge.plantuml.svek.PackageStyle;
import net.sourceforge.plantuml.ugraphic.ColorMapper;
@@ -178,6 +179,10 @@ public class SkinParamDelegator implements ISkinParam {
return skinParam.getConditionStyle();
}
+ public ConditionEndStyle getConditionEndStyle() {
+ return skinParam.getConditionEndStyle();
+ }
+
public double minClassWidth() {
return skinParam.minClassWidth();
}
diff --git a/src/net/sourceforge/plantuml/StringLocated.java b/src/net/sourceforge/plantuml/StringLocated.java
index ad60720be..e0949efc4 100644
--- a/src/net/sourceforge/plantuml/StringLocated.java
+++ b/src/net/sourceforge/plantuml/StringLocated.java
@@ -35,7 +35,9 @@
*/
package net.sourceforge.plantuml;
-public class StringLocated {
+import net.sourceforge.plantuml.command.regex.FoxSignature;
+
+final public class StringLocated {
private final String s;
private final LineLocation location;
@@ -68,8 +70,15 @@ public class StringLocated {
this.getPreprocessorError());
}
- public String getStringTrimmed() {
- return StringUtils.trin(this.getString());
+ private StringLocated trimmed;
+
+ public StringLocated getTrimmed() {
+ if (trimmed == null) {
+ this.trimmed = new StringLocated(StringUtils.trin(this.getString()), location, preprocessorError);
+ trimmed.fox = this.fox;
+ trimmed.trimmed = trimmed;
+ }
+ return trimmed;
}
public StringLocated removeInnerComment() {
@@ -114,4 +123,12 @@ public class StringLocated {
return preprocessorError;
}
+ private long fox = -1;
+
+ public long getFoxSignature() {
+ if (fox == -1) {
+ fox = FoxSignature.getFoxSignature(getString());
+ }
+ return fox;
+ }
}
diff --git a/src/net/sourceforge/plantuml/StringUtils.java b/src/net/sourceforge/plantuml/StringUtils.java
index 24e0996e4..f439d59ca 100644
--- a/src/net/sourceforge/plantuml/StringUtils.java
+++ b/src/net/sourceforge/plantuml/StringUtils.java
@@ -460,9 +460,6 @@ public class StringUtils {
}
public static String trinNoTrace(CharSequence s) {
-// if (s instanceof CharSequence2) {
-// return ((CharSequence2) s).getString().trim();
-// }
return s.toString().trim();
}
diff --git a/src/net/sourceforge/plantuml/UmlDiagram.java b/src/net/sourceforge/plantuml/UmlDiagram.java
index 0da77ac8f..e177a673c 100644
--- a/src/net/sourceforge/plantuml/UmlDiagram.java
+++ b/src/net/sourceforge/plantuml/UmlDiagram.java
@@ -451,5 +451,9 @@ public abstract class UmlDiagram extends TitledDiagram implements Diagram, Annot
}
return i;
}
+
+ public void setHideEmptyDescription(boolean hideEmptyDescription) {
+ }
+
}
diff --git a/src/net/sourceforge/plantuml/activitydiagram/ActivityDiagram.java b/src/net/sourceforge/plantuml/activitydiagram/ActivityDiagram.java
index 65224ce9c..2bf836ef3 100644
--- a/src/net/sourceforge/plantuml/activitydiagram/ActivityDiagram.java
+++ b/src/net/sourceforge/plantuml/activitydiagram/ActivityDiagram.java
@@ -39,6 +39,7 @@ import java.util.Arrays;
import java.util.List;
import net.sourceforge.plantuml.Direction;
+import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.core.DiagramDescription;
import net.sourceforge.plantuml.cucadiagram.Code;
@@ -58,6 +59,10 @@ public class ActivityDiagram extends CucaDiagram {
private IEntity lastEntityBrancheConsulted;
private ConditionalContext currentContext;
+ public ActivityDiagram(ISkinSimple skinParam) {
+ super(skinParam);
+ }
+
public ILeaf getOrCreateLeaf(Code code, LeafType type, USymbol symbol) {
return getOrCreateLeafDefault(code, type, symbol);
}
diff --git a/src/net/sourceforge/plantuml/activitydiagram/ActivityDiagramFactory.java b/src/net/sourceforge/plantuml/activitydiagram/ActivityDiagramFactory.java
index b3dc2c628..2c5146cb7 100644
--- a/src/net/sourceforge/plantuml/activitydiagram/ActivityDiagramFactory.java
+++ b/src/net/sourceforge/plantuml/activitydiagram/ActivityDiagramFactory.java
@@ -38,6 +38,7 @@ package net.sourceforge.plantuml.activitydiagram;
import java.util.ArrayList;
import java.util.List;
+import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.activitydiagram.command.CommandElse;
import net.sourceforge.plantuml.activitydiagram.command.CommandEndPartition;
import net.sourceforge.plantuml.activitydiagram.command.CommandEndif;
@@ -55,9 +56,16 @@ import net.sourceforge.plantuml.command.note.FactoryNoteOnLinkCommand;
public class ActivityDiagramFactory extends UmlDiagramFactory {
+ private final ISkinSimple skinParam;
+
+ public ActivityDiagramFactory(ISkinSimple skinParam) {
+ this.skinParam = skinParam;
+ }
+
+
@Override
public ActivityDiagram createEmptyDiagram() {
- return new ActivityDiagram();
+ return new ActivityDiagram(skinParam);
}
@Override
diff --git a/src/net/sourceforge/plantuml/activitydiagram/command/CommandElse.java b/src/net/sourceforge/plantuml/activitydiagram/command/CommandElse.java
index a7d1812df..72ef72d7b 100644
--- a/src/net/sourceforge/plantuml/activitydiagram/command/CommandElse.java
+++ b/src/net/sourceforge/plantuml/activitydiagram/command/CommandElse.java
@@ -35,21 +35,31 @@
*/
package net.sourceforge.plantuml.activitydiagram.command;
-import java.util.List;
-
+import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram.ActivityDiagram;
import net.sourceforge.plantuml.command.CommandExecutionResult;
-import net.sourceforge.plantuml.command.SingleLineCommand;
+import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.IRegex;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.IEntity;
-public class CommandElse extends SingleLineCommand {
+public class CommandElse extends SingleLineCommand2 {
public CommandElse() {
- super("(?i)^else$");
+ super(getRegexConcat());
+ }
+
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandElse.class.getName(), //
+ RegexLeaf.start(), //
+ new RegexLeaf("else"), //
+ RegexLeaf.end()); //
}
@Override
- protected CommandExecutionResult executeArg(ActivityDiagram system, List arg) {
+ protected CommandExecutionResult executeArg(ActivityDiagram system, LineLocation location, RegexResult arg) {
if (system.getLastEntityConsulted() == null) {
return CommandExecutionResult.error("No if for this else");
}
diff --git a/src/net/sourceforge/plantuml/activitydiagram/command/CommandEndPartition.java b/src/net/sourceforge/plantuml/activitydiagram/command/CommandEndPartition.java
index 210824fda..b45e12670 100644
--- a/src/net/sourceforge/plantuml/activitydiagram/command/CommandEndPartition.java
+++ b/src/net/sourceforge/plantuml/activitydiagram/command/CommandEndPartition.java
@@ -35,21 +35,36 @@
*/
package net.sourceforge.plantuml.activitydiagram.command;
-import java.util.List;
-
+import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram.ActivityDiagram;
import net.sourceforge.plantuml.command.CommandExecutionResult;
-import net.sourceforge.plantuml.command.SingleLineCommand;
+import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.IRegex;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexOr;
+import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.IEntity;
-public class CommandEndPartition extends SingleLineCommand {
+public class CommandEndPartition extends SingleLineCommand2 {
public CommandEndPartition() {
- super("(?i)^(end[%s]?partition|\\})$");
+ super(getRegexConcat());
+ }
+
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandEndPartition.class.getName(), RegexLeaf.start(), //
+ new RegexOr( //
+ new RegexConcat( //
+ new RegexLeaf("end"), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexLeaf("partition")), //
+ new RegexLeaf("\\}")), //
+ RegexLeaf.end()); //
}
@Override
- protected CommandExecutionResult executeArg(ActivityDiagram diagram, List arg) {
+ protected CommandExecutionResult executeArg(ActivityDiagram diagram, LineLocation location, RegexResult arg) {
final IEntity currentPackage = diagram.getCurrentGroup();
if (currentPackage == null) {
return CommandExecutionResult.error("No partition defined");
diff --git a/src/net/sourceforge/plantuml/activitydiagram/command/CommandEndif.java b/src/net/sourceforge/plantuml/activitydiagram/command/CommandEndif.java
index 434a9fdb5..bcf4c4439 100644
--- a/src/net/sourceforge/plantuml/activitydiagram/command/CommandEndif.java
+++ b/src/net/sourceforge/plantuml/activitydiagram/command/CommandEndif.java
@@ -35,20 +35,32 @@
*/
package net.sourceforge.plantuml.activitydiagram.command;
-import java.util.List;
-
+import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram.ActivityDiagram;
import net.sourceforge.plantuml.command.CommandExecutionResult;
-import net.sourceforge.plantuml.command.SingleLineCommand;
+import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.IRegex;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexResult;
-public class CommandEndif extends SingleLineCommand {
+public class CommandEndif extends SingleLineCommand2 {
public CommandEndif() {
- super("(?i)^end[%s]?if$");
+ super(getRegexConcat());
+ }
+
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandEndif.class.getName(), //
+ RegexLeaf.start(), //
+ new RegexLeaf("end"), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexLeaf("if"), //
+ RegexLeaf.end()); //
}
@Override
- protected CommandExecutionResult executeArg(ActivityDiagram diagram, List arg) {
+ protected CommandExecutionResult executeArg(ActivityDiagram diagram, LineLocation location, RegexResult arg) {
if (diagram.getLastEntityConsulted() == null) {
return CommandExecutionResult.error("No if for this endif");
}
diff --git a/src/net/sourceforge/plantuml/activitydiagram/command/CommandIf.java b/src/net/sourceforge/plantuml/activitydiagram/command/CommandIf.java
index 5acadb3ba..8db8a86f6 100644
--- a/src/net/sourceforge/plantuml/activitydiagram/command/CommandIf.java
+++ b/src/net/sourceforge/plantuml/activitydiagram/command/CommandIf.java
@@ -41,6 +41,7 @@ import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.activitydiagram.ActivityDiagram;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexOptional;
@@ -59,23 +60,25 @@ public class CommandIf extends SingleLineCommand2 {
super(getRegexConcat());
}
- static RegexConcat getRegexConcat() {
- return new RegexConcat(new RegexLeaf("^"), //
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandIf.class.getName(), RegexLeaf.start(), //
new RegexOptional(//
new RegexOr("FIRST", //
new RegexLeaf("STAR", "(\\(\\*(top)?\\))"), //
new RegexLeaf("CODE", "([\\p{L}0-9_.]+)"), //
new RegexLeaf("BAR", "(?:==+)[%s]*([\\p{L}0-9_.]+)[%s]*(?:==+)"), //
new RegexLeaf("QUOTED", "[%g]([^%g]+)[%g](?:[%s]+as[%s]+([\\p{L}0-9_.]+))?"))), //
- new RegexLeaf("[%s]*"), //
+ RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("ARROW", "([=-]+(?:(left|right|up|down|le?|ri?|up?|do?)(?=[-=.]))?[=-]*\\>)?"), //
- new RegexLeaf("[%s]*"), //
- new RegexLeaf("BRACKET", "(?:\\[([^\\]*]+[^\\]]*)\\])?"), //
- new RegexLeaf("[%s]*"), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexOptional(new RegexLeaf("BRACKET", "\\[([^\\]*]+[^\\]]*)\\]")), //
+ RegexLeaf.spaceZeroOrMore(), //
new RegexOr(//
new RegexLeaf("IF1", "if[%s]*[%g]([^%g]*)[%g][%s]*(?:as[%s]+([\\p{L}0-9_.]+)[%s]+)?"), //
- new RegexLeaf("IF2", "if[%s]+(.+?)[%s]*")), //
- new RegexLeaf("(?:then)?$"));
+ new RegexLeaf("IF2", "if[%s]+(.+?)")), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexOptional(new RegexLeaf("then")), //
+ RegexLeaf.end());
}
@Override
diff --git a/src/net/sourceforge/plantuml/activitydiagram/command/CommandInnerConcurrent.java b/src/net/sourceforge/plantuml/activitydiagram/command/CommandInnerConcurrent.java
index fd816f20c..67a5e0710 100644
--- a/src/net/sourceforge/plantuml/activitydiagram/command/CommandInnerConcurrent.java
+++ b/src/net/sourceforge/plantuml/activitydiagram/command/CommandInnerConcurrent.java
@@ -35,25 +35,36 @@
*/
package net.sourceforge.plantuml.activitydiagram.command;
-import java.util.List;
-
+import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram.ActivityDiagram;
import net.sourceforge.plantuml.command.CommandExecutionResult;
-import net.sourceforge.plantuml.command.SingleLineCommand;
+import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.IRegex;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.EntityUtils;
-public class CommandInnerConcurrent extends SingleLineCommand {
+public class CommandInnerConcurrent extends SingleLineCommand2 {
public CommandInnerConcurrent() {
- super("(?i)^--\\s*(.*)$");
+ super(getRegexConcat());
+ }
+
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandInnerConcurrent.class.getName(), RegexLeaf.start(), //
+ new RegexLeaf("--"), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexLeaf("NAME", "(.*)"), //
+ RegexLeaf.end()); //
}
@Override
- protected CommandExecutionResult executeArg(ActivityDiagram diagram, List arg) {
+ protected CommandExecutionResult executeArg(ActivityDiagram diagram, LineLocation location, RegexResult arg) {
if (EntityUtils.groupRoot(diagram.getCurrentGroup())) {
return CommandExecutionResult.error("No inner activity");
}
- diagram.concurrentActivity(arg.get(0));
+ diagram.concurrentActivity(arg.get("NAME", 0));
return CommandExecutionResult.ok();
}
diff --git a/src/net/sourceforge/plantuml/activitydiagram/command/CommandLinkActivity.java b/src/net/sourceforge/plantuml/activitydiagram/command/CommandLinkActivity.java
index 83b331c6e..4e5381ad6 100644
--- a/src/net/sourceforge/plantuml/activitydiagram/command/CommandLinkActivity.java
+++ b/src/net/sourceforge/plantuml/activitydiagram/command/CommandLinkActivity.java
@@ -45,6 +45,7 @@ import net.sourceforge.plantuml.activitydiagram.ActivityDiagram;
import net.sourceforge.plantuml.classdiagram.command.CommandLinkClass;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexOptional;
@@ -71,19 +72,19 @@ public class CommandLinkActivity extends SingleLineCommand2 {
super(getRegexConcat());
}
- private static RegexConcat getRegexConcat() {
- return new RegexConcat(new RegexLeaf("^"), //
+ private static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandLinkActivity.class.getName(), RegexLeaf.start(), //
new RegexOptional(//
new RegexOr("FIRST", //
new RegexLeaf("STAR", "(\\(\\*(top)?\\))"), //
new RegexLeaf("CODE", "([\\p{L}0-9][\\p{L}0-9_.]*)"), //
new RegexLeaf("BAR", "(?:==+)[%s]*([\\p{L}0-9_.]+)[%s]*(?:==+)"), //
new RegexLeaf("QUOTED", "[%g]([^%g]+)[%g](?:[%s]+as[%s]+([\\p{L}0-9_.]+))?"))), //
- new RegexLeaf("[%s]*"), //
+ RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREOTYPE", "(\\<\\<.*\\>\\>)?"), //
- new RegexLeaf("[%s]*"), //
+ RegexLeaf.spaceZeroOrMore(), //
ColorParser.exp2(), //
- new RegexLeaf("[%s]*"), //
+ RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), //
new RegexLeaf("ARROW_BODY1", "([-.]+)"), //
@@ -92,9 +93,9 @@ public class CommandLinkActivity extends SingleLineCommand2 {
new RegexLeaf("ARROW_STYLE2", "(?:\\[(" + CommandLinkElement.LINE_STYLE + ")\\])?"), //
new RegexLeaf("ARROW_BODY2", "([-.]*)\\>"), //
- new RegexLeaf("[%s]*"), //
- new RegexLeaf("BRACKET", "(?:\\[([^\\]*]+[^\\]]*)\\])?"), //
- new RegexLeaf("[%s]*"), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexOptional(new RegexLeaf("BRACKET", "\\[([^\\]*]+[^\\]]*)\\]")), //
+ RegexLeaf.spaceZeroOrMore(), //
new RegexOr("FIRST2", //
new RegexLeaf("STAR2", "(\\(\\*(top|\\d+)?\\))"), //
new RegexLeaf("OPENBRACKET2", "(\\{)"), //
@@ -102,13 +103,18 @@ public class CommandLinkActivity extends SingleLineCommand2 {
new RegexLeaf("BAR2", "(?:==+)[%s]*([\\p{L}0-9_.]+)[%s]*(?:==+)"), //
new RegexLeaf("QUOTED2", "[%g]([^%g]+)[%g](?:[%s]+as[%s]+([\\p{L}0-9][\\p{L}0-9_.]*))?"), //
new RegexLeaf("QUOTED_INVISIBLE2", "(\\w.*?)")), //
- new RegexLeaf("[%s]*"), //
+ RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREOTYPE2", "(\\<\\<.*\\>\\>)?"), //
- new RegexLeaf("[%s]*"), //
- new RegexLeaf("PARTITION2", "(?:in[%s]+([%g][^%g]+[%g]|\\S+))?"), //
- new RegexLeaf("[%s]*"), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexOptional( //
+ new RegexConcat( //
+ new RegexLeaf("in"), //
+ RegexLeaf.spaceOneOrMore(), //
+ new RegexLeaf("PARTITION2", "([%g][^%g]+[%g]|\\S+)") //
+ )), //
+ RegexLeaf.spaceZeroOrMore(), //
ColorParser.exp3(), //
- new RegexLeaf("$"));
+ RegexLeaf.end());
}
@Override
diff --git a/src/net/sourceforge/plantuml/activitydiagram/command/CommandLinkLongActivity.java b/src/net/sourceforge/plantuml/activitydiagram/command/CommandLinkLongActivity.java
index 041cb0ad8..9f5889bd6 100644
--- a/src/net/sourceforge/plantuml/activitydiagram/command/CommandLinkLongActivity.java
+++ b/src/net/sourceforge/plantuml/activitydiagram/command/CommandLinkLongActivity.java
@@ -50,6 +50,7 @@ import net.sourceforge.plantuml.command.BlocLines;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.CommandMultilines2;
import net.sourceforge.plantuml.command.MultilinesStrategy;
+import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.MyPattern;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
@@ -80,19 +81,19 @@ public class CommandLinkLongActivity extends CommandMultilines2
return "(?i)^[%s]*([^%g]*)[%g](?:[%s]+as[%s]+([\\p{L}0-9][\\p{L}0-9_.]*))?[%s]*(\\<\\<.*\\>\\>)?[%s]*(?:in[%s]+([%g][^%g]+[%g]|\\S+))?[%s]*(#\\w+)?$";
}
- static RegexConcat getRegexConcat() {
- return new RegexConcat(new RegexLeaf("^"), //
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandLinkLongActivity.class.getName(), RegexLeaf.start(), //
new RegexOptional(//
new RegexOr("FIRST", //
new RegexLeaf("STAR", "(\\(\\*(top)?\\))"), //
new RegexLeaf("CODE", "([\\p{L}0-9][\\p{L}0-9_.]*)"), //
new RegexLeaf("BAR", "(?:==+)[%s]*([\\p{L}0-9_.]+)[%s]*(?:==+)"), //
new RegexLeaf("QUOTED", "[%g]([^%g]+)[%g](?:[%s]+as[%s]+([\\p{L}0-9_.]+))?"))), //
- new RegexLeaf("[%s]*"), //
+ RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREOTYPE", "(\\<\\<.*\\>\\>)?"), //
- new RegexLeaf("[%s]*"), //
+ RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("BACKCOLOR", "(#\\w+)?"), //
- new RegexLeaf("[%s]*"), //
+ RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), //
new RegexLeaf("ARROW_BODY1", "([-.]+)"), //
@@ -101,17 +102,17 @@ public class CommandLinkLongActivity extends CommandMultilines2
new RegexLeaf("ARROW_STYLE2", "(?:\\[(" + CommandLinkElement.LINE_STYLE + ")\\])?"), //
new RegexLeaf("ARROW_BODY2", "([-.]*)\\>"), //
- new RegexLeaf("[%s]*"), //
- new RegexLeaf("BRACKET", "(?:\\[([^\\]*]+[^\\]]*)\\])?"), //
- new RegexLeaf("[%s]*"), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexOptional(new RegexLeaf("BRACKET", "\\[([^\\]*]+[^\\]]*)\\]")), //
+ RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("DESC", "[%g]([^%g]*?)"), //
- new RegexLeaf("[%s]*"), //
- new RegexLeaf("$"));
+ RegexLeaf.spaceZeroOrMore(), //
+ RegexLeaf.end());
}
protected CommandExecutionResult executeNow(final ActivityDiagram diagram, BlocLines lines) {
lines = lines.trim(false);
- final RegexResult line0 = getStartingPattern().matcher(lines.getFirst499().getStringTrimmed());
+ final RegexResult line0 = getStartingPattern().matcher(lines.getFirst499().getTrimmed().getString());
final IEntity entity1 = CommandLinkActivity.getEntity(diagram, line0, true);
if (entity1 == null) {
@@ -121,9 +122,10 @@ public class CommandLinkLongActivity extends CommandMultilines2
if (line0.get("STEREOTYPE", 0) != null) {
entity1.setStereotype(new Stereotype(line0.get("STEREOTYPE", 0)));
}
- if (line0.get("BACKCOLOR", 0) != null) {
+ final String stringColor = line0.get("BACKCOLOR", 0);
+ if (stringColor != null) {
entity1.setSpecificColorTOBEREMOVED(ColorType.BACK, diagram.getSkinParam().getIHtmlColorSet()
- .getColorIfValid(line0.get("BACKCOLOR", 0)));
+ .getColorIfValid(stringColor));
}
final StringBuilder sb = new StringBuilder();
diff --git a/src/net/sourceforge/plantuml/activitydiagram/command/CommandPartition.java b/src/net/sourceforge/plantuml/activitydiagram/command/CommandPartition.java
index 16a80b577..3a59f2961 100644
--- a/src/net/sourceforge/plantuml/activitydiagram/command/CommandPartition.java
+++ b/src/net/sourceforge/plantuml/activitydiagram/command/CommandPartition.java
@@ -40,6 +40,7 @@ import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.activitydiagram.ActivityDiagram;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexOr;
@@ -60,17 +61,18 @@ public class CommandPartition extends SingleLineCommand2 {
super(getRegexConcat());
}
- private static RegexConcat getRegexConcat() {
- return new RegexConcat(//
- new RegexLeaf("^"), //
+ private static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandPartition.class.getName(), RegexLeaf.start(), //
new RegexLeaf("partition"), //
- new RegexLeaf("[%s]+"), //
+ RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("NAME", "([%g][^%g]+[%g]|\\S+)"), //
- new RegexLeaf("[%s]*"), //
+ RegexLeaf.spaceZeroOrMore(), //
new RegexOr(//
color().getRegex(), //
new RegexLeaf("LEGACYCOLORIGNORED", "(#[0-9a-fA-F]{6}|#?\\w+)?")), //
- new RegexLeaf("[%s]*\\{?$"));
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexLeaf("\\{?"),
+ RegexLeaf.end());
}
private static ColorParser color() {
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagram3.java b/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagram3.java
index fd37e2388..250a262f7 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagram3.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagram3.java
@@ -43,6 +43,7 @@ import net.sourceforge.plantuml.AnnotatedWorker;
import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.FileFormatOption;
import net.sourceforge.plantuml.ISkinParam;
+import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.Scale;
import net.sourceforge.plantuml.UmlDiagram;
import net.sourceforge.plantuml.UmlDiagramType;
@@ -74,6 +75,11 @@ public class ActivityDiagram3 extends UmlDiagram {
private SwimlaneStrategy swimlaneStrategy;
private final SwimlanesC swinlanes = new SwimlanesC(getSkinParam(), getPragma());
+
+ public ActivityDiagram3(ISkinSimple skinParam) {
+ super(skinParam);
+ }
+
private void manageSwimlaneStrategy() {
if (swimlaneStrategy == null) {
@@ -319,10 +325,10 @@ public class ActivityDiagram3 extends UmlDiagram {
return CommandExecutionResult.error("Cannot find switch");
}
- public void startIf(Display test, Display whenThen, HtmlColor color) {
+ public void startIf(Display test, Display whenThen, HtmlColor color, Url url) {
manageSwimlaneStrategy();
final InstructionIf instructionIf = new InstructionIf(swinlanes.getCurrentSwimlane(), current(), test,
- whenThen, nextLinkRenderer(), color, getSkinParam());
+ whenThen, nextLinkRenderer(), color, getSkinParam(), url);
current().add(instructionIf);
setNextLinkRendererInternal(LinkRendering.none());
setCurrent(instructionIf);
@@ -379,7 +385,7 @@ public class ActivityDiagram3 extends UmlDiagram {
if (current() instanceof InstructionRepeat) {
final InstructionRepeat instructionRepeat = (InstructionRepeat) current();
final LinkRendering back = new LinkRendering(linkColor).withDisplay(linkLabel);
- instructionRepeat.setTest(label, yes, out, nextLinkRenderer(), back);
+ instructionRepeat.setTest(label, yes, out, nextLinkRenderer(), back, swinlanes.getCurrentSwimlane());
setCurrent(instructionRepeat.getParent());
this.setNextLinkRendererInternal(LinkRendering.none());
return CommandExecutionResult.ok();
@@ -393,7 +399,7 @@ public class ActivityDiagram3 extends UmlDiagram {
if (current() instanceof InstructionRepeat) {
final InstructionRepeat instructionRepeat = (InstructionRepeat) current();
// final LinkRendering back = new LinkRendering(linkColor).withDisplay(linkLabel);
- instructionRepeat.setBackward(label);
+ instructionRepeat.setBackward(label, swinlanes.getCurrentSwimlane());
// setCurrent(instructionRepeat.getParent());
// this.setNextLinkRendererInternal(LinkRendering.none());
return CommandExecutionResult.ok();
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagramFactory3.java b/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagramFactory3.java
index 87d993e07..2a83e2060 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagramFactory3.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagramFactory3.java
@@ -38,6 +38,7 @@ package net.sourceforge.plantuml.activitydiagram3;
import java.util.ArrayList;
import java.util.List;
+import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.activitydiagram3.command.CommandActivity3;
import net.sourceforge.plantuml.activitydiagram3.command.CommandActivityLegacy1;
import net.sourceforge.plantuml.activitydiagram3.command.CommandActivityLong3;
@@ -89,6 +90,12 @@ import net.sourceforge.plantuml.command.UmlDiagramFactory;
public class ActivityDiagramFactory3 extends UmlDiagramFactory {
+ private final ISkinSimple skinParam;
+
+ public ActivityDiagramFactory3(ISkinSimple skinParam) {
+ this.skinParam = skinParam;
+ }
+
@Override
protected List createCommands() {
@@ -157,7 +164,7 @@ public class ActivityDiagramFactory3 extends UmlDiagramFactory {
@Override
public ActivityDiagram3 createEmptyDiagram() {
- return new ActivityDiagram3();
+ return new ActivityDiagram3(skinParam);
}
}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/InstructionIf.java b/src/net/sourceforge/plantuml/activitydiagram3/InstructionIf.java
index 67cb1c66e..fc850eb0b 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/InstructionIf.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/InstructionIf.java
@@ -42,6 +42,7 @@ import java.util.List;
import java.util.Set;
import net.sourceforge.plantuml.ISkinParam;
+import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileDecorateWelding;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
@@ -60,6 +61,7 @@ public class InstructionIf extends WithNote implements Instruction, InstructionC
private Branch elseBranch;
private boolean endifCalled = false;
private final ISkinParam skinParam;
+ private final Url url;
private final Instruction parent;
@@ -82,7 +84,8 @@ public class InstructionIf extends WithNote implements Instruction, InstructionC
}
public InstructionIf(Swimlane swimlane, Instruction parent, Display labelTest, Display whenThen,
- LinkRendering inlinkRendering, HtmlColor color, ISkinParam skinParam) {
+ LinkRendering inlinkRendering, HtmlColor color, ISkinParam skinParam, Url url) {
+ this.url = url;
this.parent = parent;
this.skinParam = skinParam;
this.topInlinkRendering = inlinkRendering;
@@ -106,7 +109,7 @@ public class InstructionIf extends WithNote implements Instruction, InstructionC
this.elseBranch = new Branch(swimlane, Display.NULL, Display.NULL, null, Display.NULL);
}
elseBranch.updateFtile(factory);
- Ftile result = factory.createIf(swimlane, thens, elseBranch, afterEndwhile, topInlinkRendering);
+ Ftile result = factory.createIf(swimlane, thens, elseBranch, afterEndwhile, topInlinkRendering, url);
if (getPositionedNotes().size() > 0) {
result = FtileWithNoteOpale.create(result, getPositionedNotes(), skinParam, false);
}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/InstructionRepeat.java b/src/net/sourceforge/plantuml/activitydiagram3/InstructionRepeat.java
index ff2a18dd7..ef21f3b56 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/InstructionRepeat.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/InstructionRepeat.java
@@ -54,6 +54,7 @@ public class InstructionRepeat implements Instruction {
private final Instruction parent;
private final LinkRendering nextLinkRenderer;
private final Swimlane swimlane;
+ private Swimlane swimlaneOut;
private final HtmlColor color;
private boolean killed = false;
@@ -65,12 +66,11 @@ public class InstructionRepeat implements Instruction {
private boolean testCalled = false;
private LinkRendering endRepeatLinkRendering = LinkRendering.none();
private LinkRendering backRepeatLinkRendering = LinkRendering.none();
-
+
public boolean containsBreak() {
return repeatList.containsBreak();
}
-
public InstructionRepeat(Swimlane swimlane, Instruction parent, LinkRendering nextLinkRenderer, HtmlColor color,
Display startLabel) {
this.startLabel = startLabel;
@@ -90,8 +90,9 @@ public class InstructionRepeat implements Instruction {
return false;
}
- public void setBackward(Display label) {
+ public void setBackward(Display label, Swimlane swimlaneOut) {
this.backward = label;
+ this.swimlaneOut = swimlaneOut;
}
public void add(Instruction ins) {
@@ -101,7 +102,7 @@ public class InstructionRepeat implements Instruction {
public Ftile createFtile(FtileFactory factory) {
final Ftile back = Display.isNull(backward) ? null : factory.activity(backward, swimlane, BoxStyle.PLAIN,
Colors.empty());
- final Ftile result = factory.repeat(swimlane, repeatList.getSwimlaneOut(), startLabel,
+ final Ftile result = factory.repeat(swimlane, swimlaneOut, startLabel,
factory.decorateOut(repeatList.createFtile(factory), endRepeatLinkRendering), test, yes, out, color,
backRepeatLinkRendering, back, isLastOfTheParent());
if (killed) {
@@ -115,7 +116,8 @@ public class InstructionRepeat implements Instruction {
}
public void setTest(Display test, Display yes, Display out, LinkRendering endRepeatLinkRendering,
- LinkRendering backRepeatLinkRendering) {
+ LinkRendering backRepeatLinkRendering, Swimlane swimlaneOut) {
+ this.swimlaneOut = swimlaneOut;
this.test = test;
this.yes = yes;
this.out = out;
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivity3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivity3.java
index da784205e..88e2f04b5 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivity3.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivity3.java
@@ -43,6 +43,7 @@ import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.activitydiagram3.ftile.BoxStyle;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
@@ -59,15 +60,15 @@ public class CommandActivity3 extends SingleLineCommand2 {
super(getRegexConcat());
}
- static RegexConcat getRegexConcat() {
- return new RegexConcat(new RegexLeaf("^"), //
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandActivity3.class.getName(), RegexLeaf.start(), //
new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), //
color().getRegex(), //
- new RegexLeaf("[%s]*"), //
+ RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf(":"), //
new RegexLeaf("LABEL", "(.*)"), //
new RegexLeaf("STYLE", ENDING_GROUP), //
- new RegexLeaf("$"));
+ RegexLeaf.end());
}
private static ColorParser color() {
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivityLegacy1.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivityLegacy1.java
index a39fa2c00..fdf22a979 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivityLegacy1.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivityLegacy1.java
@@ -40,6 +40,7 @@ import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.activitydiagram3.ftile.BoxStyle;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
@@ -52,11 +53,11 @@ public class CommandActivityLegacy1 extends SingleLineCommand2
super(getRegexConcat());
}
- static RegexConcat getRegexConcat() {
- return new RegexConcat(new RegexLeaf("^"), //
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandActivityLegacy1.class.getName(), RegexLeaf.start(), //
new RegexLeaf("-"), //
new RegexLeaf("LABEL", "(.*)"), //
- new RegexLeaf("$"));
+ RegexLeaf.end());
}
@Override
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivityLong3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivityLong3.java
index 62fb98ea3..67b7288f0 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivityLong3.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivityLong3.java
@@ -41,6 +41,7 @@ import net.sourceforge.plantuml.command.BlocLines;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.CommandMultilines2;
import net.sourceforge.plantuml.command.MultilinesStrategy;
+import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
@@ -63,17 +64,17 @@ public class CommandActivityLong3 extends CommandMultilines2 {
return ColorParser.simpleColor(ColorType.BACK);
}
- static RegexConcat getRegexConcat() {
- return new RegexConcat(new RegexLeaf("^"), //
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandActivityLong3.class.getName(), RegexLeaf.start(), //
color().getRegex(), //
new RegexLeaf(":"), //
new RegexLeaf("DATA", "(.*)"), //
- new RegexLeaf("$"));
+ RegexLeaf.end());
}
protected CommandExecutionResult executeNow(ActivityDiagram3 diagram, BlocLines lines) {
lines = lines.removeEmptyColumns();
- final RegexResult line0 = getStartingPattern().matcher(lines.getFirst499().getStringTrimmed());
+ final RegexResult line0 = getStartingPattern().matcher(lines.getFirst499().getTrimmed().getString());
final Colors colors = color().getColor(line0, diagram.getSkinParam().getIHtmlColorSet());
// final HtmlColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(line0.get("COLOR", 0));
final BoxStyle style = BoxStyle.fromChar(lines.getLastChar());
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandArrow3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandArrow3.java
index d9d9217fb..19f893308 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandArrow3.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandArrow3.java
@@ -39,6 +39,7 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexOr;
@@ -53,16 +54,16 @@ public class CommandArrow3 extends SingleLineCommand2 {
super(getRegexConcat());
}
- static RegexConcat getRegexConcat() {
- return new RegexConcat(new RegexLeaf("^"), //
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandArrow3.class.getName(), RegexLeaf.start(), //
new RegexOr(//
new RegexLeaf("->"), //
new RegexLeaf("COLOR", CommandLinkElement.STYLE_COLORS_MULTIPLES)), //
- new RegexLeaf("[%s]*"), //
+ RegexLeaf.spaceZeroOrMore(), //
new RegexOr(//
new RegexLeaf("LABEL", "(.*);"), //
new RegexLeaf("")), //
- new RegexLeaf("$"));
+ RegexLeaf.end());
}
@Override
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandArrowLong3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandArrowLong3.java
index 3d9649192..3c7397c1c 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandArrowLong3.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandArrowLong3.java
@@ -42,6 +42,7 @@ import net.sourceforge.plantuml.command.BlocLines;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.CommandMultilines2;
import net.sourceforge.plantuml.command.MultilinesStrategy;
+import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexOr;
@@ -60,19 +61,19 @@ public class CommandArrowLong3 extends CommandMultilines2 {
return "^(.*);$";
}
- static RegexConcat getRegexConcat() {
- return new RegexConcat(new RegexLeaf("^"), //
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandArrowLong3.class.getName(), RegexLeaf.start(), //
new RegexOr(//
new RegexLeaf("->"), //
new RegexLeaf("COLOR", CommandLinkElement.STYLE_COLORS_MULTIPLES)), //
- new RegexLeaf("[%s]*"), //
+ RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("LABEL", "(.*)"), //
- new RegexLeaf("$"));
+ RegexLeaf.end());
}
protected CommandExecutionResult executeNow(ActivityDiagram3 diagram, BlocLines lines) {
lines = lines.removeEmptyColumns();
- final RegexResult line0 = getStartingPattern().matcher(lines.getFirst499().getStringTrimmed());
+ final RegexResult line0 = getStartingPattern().matcher(lines.getFirst499().getTrimmed().getString());
// final HtmlColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(line0.get("COLOR", 0));
// diagram.setColorNextArrow(HtmlColorAndStyle.fromColor(color));
final String colorString = line0.get("COLOR", 0);
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandBackward3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandBackward3.java
index 434e5bdfa..42bb41326 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandBackward3.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandBackward3.java
@@ -39,6 +39,7 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
@@ -50,13 +51,14 @@ public class CommandBackward3 extends SingleLineCommand2 {
super(getRegexConcat());
}
- static RegexConcat getRegexConcat() {
- return new RegexConcat(new RegexLeaf("^"), //
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandBackward3.class.getName(), RegexLeaf.start(), //
new RegexLeaf("backward"), //
- new RegexLeaf("[%s]*"), //
+ RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf(":"), //
new RegexLeaf("LABEL", "(.*)"), //
- new RegexLeaf(";$"));
+ new RegexLeaf(";"), //
+ RegexLeaf.end());
}
@Override
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandBreak.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandBreak.java
index c09744f93..1bdf9fb08 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandBreak.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandBreak.java
@@ -39,6 +39,7 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
@@ -49,11 +50,12 @@ public class CommandBreak extends SingleLineCommand2 {
super(getRegexConcat());
}
- static RegexConcat getRegexConcat() {
- return new RegexConcat(//
- new RegexLeaf("^"), //
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandBreak.class.getName(), //
+ RegexLeaf.start(), //
new RegexLeaf("break"), //
- new RegexLeaf(";?$"));
+ new RegexLeaf(";?"), //
+ RegexLeaf.end());
}
@Override
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandCase.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandCase.java
index 0c79e6479..c9026392a 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandCase.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandCase.java
@@ -39,6 +39,7 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
@@ -50,13 +51,13 @@ public class CommandCase extends SingleLineCommand2 {
super(getRegexConcat());
}
- static RegexConcat getRegexConcat() {
- return new RegexConcat(new RegexLeaf("^"), //
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandCase.class.getName(), RegexLeaf.start(), //
new RegexLeaf("case"), //
- new RegexLeaf("[%s]*"), //
+ RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("TEST", "\\((.*?)\\)"), //
- new RegexLeaf("[%s]*"), //
- new RegexLeaf("$"));
+ RegexLeaf.spaceZeroOrMore(), //
+ RegexLeaf.end());
}
@Override
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandCircleSpot3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandCircleSpot3.java
index 38a8fb88c..ade877b10 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandCircleSpot3.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandCircleSpot3.java
@@ -39,6 +39,7 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
@@ -49,11 +50,11 @@ public class CommandCircleSpot3 extends SingleLineCommand2 {
super(getRegexConcat());
}
- static RegexConcat getRegexConcat() {
- return new RegexConcat(//
- new RegexLeaf("^"), //
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandCircleSpot3.class.getName(), RegexLeaf.start(), //
new RegexLeaf("SPOT", "\\((\\S)\\)"), //
- new RegexLeaf(";?$"));
+ new RegexLeaf(";?"), //
+ RegexLeaf.end());
}
@Override
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandElse3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandElse3.java
index 6cedc53d2..5ab2e5c4c 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandElse3.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandElse3.java
@@ -39,8 +39,10 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexOptional;
import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Display;
@@ -50,12 +52,16 @@ public class CommandElse3 extends SingleLineCommand2 {
super(getRegexConcat());
}
- static RegexConcat getRegexConcat() {
- return new RegexConcat(//
- new RegexLeaf("^"), //
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandElse3.class.getName(), RegexLeaf.start(), //
new RegexLeaf("else"), //
- new RegexLeaf("WHEN", "(?:[%s]*(?:\\(([^()]*)\\))?)?"), //
- new RegexLeaf(";?$"));
+ new RegexOptional( //
+ new RegexConcat( //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexLeaf("WHEN", "(?:\\(([^()]*)\\))?") //
+ )), //
+ new RegexLeaf(";?"), //
+ RegexLeaf.end());
}
@Override
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandElseIf2.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandElseIf2.java
index 9f1415296..540dc7cf2 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandElseIf2.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandElseIf2.java
@@ -39,8 +39,10 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexOptional;
import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.HtmlColor;
@@ -52,18 +54,26 @@ public class CommandElseIf2 extends SingleLineCommand2 {
super(getRegexConcat());
}
- static RegexConcat getRegexConcat() {
- return new RegexConcat(new RegexLeaf("^"), //
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandElseIf2.class.getName(), RegexLeaf.start(), //
ColorParser.exp4(), //
- new RegexLeaf("[%s]*"), //
- new RegexLeaf("INLABEL", "(?:\\((.+?)\\))?"), //
- new RegexLeaf("[%s]*"), //
- new RegexLeaf("else[%s]*if"), //
- new RegexLeaf("[%s]*"), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexOptional(new RegexLeaf("INLABEL", "\\((.+?)\\)")), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexLeaf("else"), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexLeaf("if"), //
+ RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("TEST", "\\((.*?)\\)"), //
- new RegexLeaf("[%s]*"), //
- new RegexLeaf("WHEN", "(?:then[%s]*(?:\\((.+?)\\))?)?"), //
- new RegexLeaf(";?$"));
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexOptional( //
+ new RegexConcat( //
+ new RegexLeaf("then"), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexOptional(new RegexLeaf("WHEN", "\\((.+?)\\)")) //
+ )), //
+ new RegexLeaf(";?"), //
+ RegexLeaf.end());
}
@Override
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandElseLegacy1.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandElseLegacy1.java
index fe14df79c..17a8880c9 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandElseLegacy1.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandElseLegacy1.java
@@ -39,6 +39,7 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
@@ -50,12 +51,15 @@ public class CommandElseLegacy1 extends SingleLineCommand2 {
super(getRegexConcat());
}
- static RegexConcat getRegexConcat() {
- return new RegexConcat(//
- new RegexLeaf("^"), //
- new RegexLeaf("else[%s]when"), //
- new RegexLeaf("WHEN", "[%s]+(.*)"), //
- new RegexLeaf(";?$"));
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandElseLegacy1.class.getName(), RegexLeaf.start(), //
+ new RegexLeaf("else"), //
+ RegexLeaf.spaceOneOrMore(), //
+ new RegexLeaf("when"), //
+ RegexLeaf.spaceOneOrMore(), //
+ new RegexLeaf("WHEN", "(.*)"), //
+ new RegexLeaf(";?"), //
+ RegexLeaf.end());
}
@Override
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandEnd3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandEnd3.java
index c52410dba..2d7b8f037 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandEnd3.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandEnd3.java
@@ -39,6 +39,7 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
@@ -49,11 +50,11 @@ public class CommandEnd3 extends SingleLineCommand2 {
super(getRegexConcat());
}
- static RegexConcat getRegexConcat() {
- return new RegexConcat(//
- new RegexLeaf("^"), //
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandEnd3.class.getName(), RegexLeaf.start(), //
new RegexLeaf("end"), //
- new RegexLeaf(";?$"));
+ new RegexLeaf(";?"), //
+ RegexLeaf.end());
}
@Override
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandEndPartition3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandEndPartition3.java
index 6f318e61e..30c1b9149 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandEndPartition3.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandEndPartition3.java
@@ -35,24 +35,34 @@
*/
package net.sourceforge.plantuml.activitydiagram3.command;
-import java.util.List;
-
+import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult;
-import net.sourceforge.plantuml.command.SingleLineCommand;
+import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.IRegex;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexResult;
-public class CommandEndPartition3 extends SingleLineCommand {
+public class CommandEndPartition3 extends SingleLineCommand2 {
public CommandEndPartition3() {
- super("(?i)^(\\})$");
+ super(getRegexConcat());
+ }
+
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandEndPartition3.class.getName(), //
+ RegexLeaf.start(), //
+ new RegexLeaf("(\\})"), //
+ RegexLeaf.end()); //
}
@Override
- protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, List arg) {
-// final IEntity currentPackage = diagram.getCurrentGroup();
-// if (currentPackage == null) {
-// return CommandExecutionResult.error("No partition defined");
-// }
+ protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) {
+ // final IEntity currentPackage = diagram.getCurrentGroup();
+ // if (currentPackage == null) {
+ // return CommandExecutionResult.error("No partition defined");
+ // }
return diagram.endGroup();
}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandEndSwitch.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandEndSwitch.java
index 137d49e3b..402f90b1b 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandEndSwitch.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandEndSwitch.java
@@ -39,6 +39,7 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
@@ -49,11 +50,11 @@ public class CommandEndSwitch extends SingleLineCommand2 {
super(getRegexConcat());
}
- static RegexConcat getRegexConcat() {
- return new RegexConcat(new RegexLeaf("^"), //
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandEndSwitch.class.getName(), RegexLeaf.start(), //
new RegexLeaf("endswitch"), //
- new RegexLeaf("[%s]*"), //
- new RegexLeaf("$"));
+ RegexLeaf.spaceZeroOrMore(), //
+ RegexLeaf.end());
}
@Override
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandEndif3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandEndif3.java
index 7453363a5..dd1b8c985 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandEndif3.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandEndif3.java
@@ -39,6 +39,7 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
@@ -49,11 +50,12 @@ public class CommandEndif3 extends SingleLineCommand2 {
super(getRegexConcat());
}
- static RegexConcat getRegexConcat() {
- return new RegexConcat(//
- new RegexLeaf("^"), //
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandEndif3.class.getName(), //
+ RegexLeaf.start(), //
new RegexLeaf("endif"), //
- new RegexLeaf(";?$"));
+ new RegexLeaf(";?"), //
+ RegexLeaf.end());
}
@Override
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandFork3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandFork3.java
index 7b2c3e0bc..9228f141d 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandFork3.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandFork3.java
@@ -39,6 +39,7 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
@@ -49,11 +50,11 @@ public class CommandFork3 extends SingleLineCommand2 {
super(getRegexConcat());
}
- static RegexConcat getRegexConcat() {
- return new RegexConcat(//
- new RegexLeaf("^"), //
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandFork3.class.getName(), RegexLeaf.start(), //
new RegexLeaf("fork"), //
- new RegexLeaf(";?$"));
+ new RegexLeaf(";?"), //
+ RegexLeaf.end());
}
@Override
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandForkAgain3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandForkAgain3.java
index 25d180806..231a517d8 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandForkAgain3.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandForkAgain3.java
@@ -39,6 +39,7 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
@@ -49,11 +50,13 @@ public class CommandForkAgain3 extends SingleLineCommand2 {
super(getRegexConcat());
}
- static RegexConcat getRegexConcat() {
- return new RegexConcat(//
- new RegexLeaf("^"), //
- new RegexLeaf("fork[%s]?again"), //
- new RegexLeaf(";?$"));
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandForkAgain3.class.getName(), RegexLeaf.start(), //
+ new RegexLeaf("fork"), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexLeaf("again"), //
+ new RegexLeaf(";?"), //
+ RegexLeaf.end());
}
@Override
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandForkEnd3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandForkEnd3.java
index 9f818abd8..47c4c883c 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandForkEnd3.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandForkEnd3.java
@@ -40,8 +40,10 @@ import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.activitydiagram3.ForkStyle;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexOr;
import net.sourceforge.plantuml.command.regex.RegexResult;
public class CommandForkEnd3 extends SingleLineCommand2 {
@@ -50,13 +52,30 @@ public class CommandForkEnd3 extends SingleLineCommand2 {
super(getRegexConcat());
}
- static RegexConcat getRegexConcat() {
- return new RegexConcat(//
- new RegexLeaf("^"), //
- new RegexLeaf("STYLE", "(end[%s]?fork|fork[%s]?end|end[%s]?merge)"), //
- new RegexLeaf("\\s*"), //
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandForkEnd3.class.getName(), //
+ RegexLeaf.start(), //
+ new RegexOr("STYLE", //
+ new RegexConcat( //
+ new RegexLeaf("end"), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexLeaf("fork") //
+ ), //
+ new RegexConcat( //
+ new RegexLeaf("fork"), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexLeaf("end") //
+ ), //
+ new RegexConcat( //
+ new RegexLeaf("end"), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexLeaf("merge") //
+ ) //
+ ), //
+ RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("LABEL", "(\\{.+\\})?"), //
- new RegexLeaf(";?$"));
+ new RegexLeaf(";?"), //
+ RegexLeaf.end());
}
@Override
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandGoto.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandGoto.java
index 97e8f3253..fe27174ac 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandGoto.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandGoto.java
@@ -39,6 +39,7 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
@@ -49,13 +50,13 @@ public class CommandGoto extends SingleLineCommand2 {
super(getRegexConcat());
}
- static RegexConcat getRegexConcat() {
- return new RegexConcat(new RegexLeaf("^"), //
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandGoto.class.getName(), RegexLeaf.start(), //
new RegexLeaf("goto"), //
- new RegexLeaf("[%s]+"), //
+ RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("NAME", "([\\p{L}0-9_.]+)"), //
new RegexLeaf(";?"), //
- new RegexLeaf("$"));
+ RegexLeaf.end());
}
@Override
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandGroup3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandGroup3.java
index ae1c5dfce..f0eab11c2 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandGroup3.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandGroup3.java
@@ -39,6 +39,7 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
@@ -51,12 +52,13 @@ public class CommandGroup3 extends SingleLineCommand2 {
super(getRegexConcat());
}
- static RegexConcat getRegexConcat() {
- return new RegexConcat(new RegexLeaf("^"), //
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandGroup3.class.getName(), RegexLeaf.start(), //
new RegexLeaf("group"), //
- new RegexLeaf("\\s*"), //
+ RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("NAME", "(.*)"), //
- new RegexLeaf(";?$"));
+ new RegexLeaf(";?"), //
+ RegexLeaf.end());
}
@Override
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandGroupEnd3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandGroupEnd3.java
index d40b1194e..9aa1ddd7b 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandGroupEnd3.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandGroupEnd3.java
@@ -39,6 +39,7 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
@@ -49,10 +50,11 @@ public class CommandGroupEnd3 extends SingleLineCommand2 {
super(getRegexConcat());
}
- static RegexConcat getRegexConcat() {
- return new RegexConcat(new RegexLeaf("^"), //
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandGroupEnd3.class.getName(), RegexLeaf.start(), //
new RegexLeaf("(end ?group|group ?end)"), //
- new RegexLeaf(";?$"));
+ new RegexLeaf(";?"), //
+ RegexLeaf.end());
}
@Override
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIf2.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIf2.java
index 932b12089..70a459732 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIf2.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIf2.java
@@ -36,11 +36,16 @@
package net.sourceforge.plantuml.activitydiagram3.command;
import net.sourceforge.plantuml.LineLocation;
+import net.sourceforge.plantuml.Url;
+import net.sourceforge.plantuml.UrlBuilder;
+import net.sourceforge.plantuml.UrlBuilder.ModeUrl;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexOptional;
import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.HtmlColor;
@@ -52,15 +57,22 @@ public class CommandIf2 extends SingleLineCommand2 {
super(getRegexConcat());
}
- static RegexConcat getRegexConcat() {
- return new RegexConcat(new RegexLeaf("^"), //
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandIf2.class.getName(), RegexLeaf.start(), //
+ new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), //
ColorParser.exp4(), //
new RegexLeaf("if"), //
- new RegexLeaf("[%s]*"), //
+ RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("TEST", "\\((.*?)\\)"), //
- new RegexLeaf("[%s]*"), //
- new RegexLeaf("WHEN", "(?:then[%s]*(?:\\((.+?)\\))?)?"), //
- new RegexLeaf(";?$"));
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexOptional( //
+ new RegexConcat( //
+ new RegexLeaf("then"), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexOptional(new RegexLeaf("WHEN", "\\((.+?)\\)")) //
+ )), //
+ new RegexLeaf(";?"), //
+ RegexLeaf.end());
}
@Override
@@ -72,7 +84,15 @@ public class CommandIf2 extends SingleLineCommand2 {
test = null;
}
- diagram.startIf(Display.getWithNewlines(test), Display.getWithNewlines(arg.get("WHEN", 0)), color);
+ final Url url;
+ if (arg.get("URL", 0) == null) {
+ url = null;
+ } else {
+ final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), ModeUrl.STRICT);
+ url = urlBuilder.getUrl(arg.get("URL", 0));
+ }
+
+ diagram.startIf(Display.getWithNewlines(test), Display.getWithNewlines(arg.get("WHEN", 0)), color, url);
return CommandExecutionResult.ok();
}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIf4.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIf4.java
index 348bf0cfb..e0281dd3c 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIf4.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIf4.java
@@ -39,6 +39,7 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
@@ -52,16 +53,21 @@ public class CommandIf4 extends SingleLineCommand2 {
super(getRegexConcat());
}
- static RegexConcat getRegexConcat() {
- return new RegexConcat(new RegexLeaf("^"), //
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandIf4.class.getName(), RegexLeaf.start(), //
ColorParser.exp4(), //
new RegexLeaf("if"), //
- new RegexLeaf("[%s]*"), //
+ RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("TEST", "\\((.*?)\\)"), //
- new RegexLeaf("[%s]*(is|equals?)[%s]*"), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexLeaf("(is|equals?)"), //
+ RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("WHEN", "\\((.+?)\\)"), //
- new RegexLeaf("[%s]*then[%s]*"), //
- new RegexLeaf(";?$"));
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexLeaf("then"), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexLeaf(";?"), //
+ RegexLeaf.end());
}
@Override
@@ -72,7 +78,7 @@ public class CommandIf4 extends SingleLineCommand2 {
if (test.length() == 0) {
test = null;
}
- diagram.startIf(Display.getWithNewlines(test), Display.getWithNewlines(arg.get("WHEN", 0)), color);
+ diagram.startIf(Display.getWithNewlines(test), Display.getWithNewlines(arg.get("WHEN", 0)), color, null);
return CommandExecutionResult.ok();
}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIfLegacy1.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIfLegacy1.java
index ddf24a2a2..12f3b64fe 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIfLegacy1.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIfLegacy1.java
@@ -39,6 +39,7 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
@@ -50,20 +51,25 @@ public class CommandIfLegacy1 extends SingleLineCommand2 {
super(getRegexConcat());
}
- static RegexConcat getRegexConcat() {
- return new RegexConcat(new RegexLeaf("^"), //
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandIfLegacy1.class.getName(), RegexLeaf.start(), //
new RegexLeaf("if"), //
- new RegexLeaf("[%s]*"), //
+ RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("TEST", "\\((.+?)\\)"), //
- new RegexLeaf("[%s]*"), //
- new RegexLeaf("WHEN", "then[%s]when[%s]+(.*)"), //
- new RegexLeaf(";?$"));
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexLeaf("then"), //
+ RegexLeaf.spaceOneOrMore(), //
+ new RegexLeaf("when"), //
+ RegexLeaf.spaceOneOrMore(), //
+ new RegexLeaf("WHEN", "(.*)"), //
+ new RegexLeaf(";?"), //
+ RegexLeaf.end());
}
@Override
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) {
- diagram.startIf(Display.getWithNewlines(arg.get("TEST", 0)), Display.getWithNewlines(arg.get("WHEN", 0)), null);
+ diagram.startIf(Display.getWithNewlines(arg.get("TEST", 0)), Display.getWithNewlines(arg.get("WHEN", 0)), null, null);
return CommandExecutionResult.ok();
}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandKill3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandKill3.java
index caeca28dc..a104e2674 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandKill3.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandKill3.java
@@ -39,6 +39,7 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
@@ -49,11 +50,11 @@ public class CommandKill3 extends SingleLineCommand2 {
super(getRegexConcat());
}
- static RegexConcat getRegexConcat() {
- return new RegexConcat(//
- new RegexLeaf("^"), //
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandKill3.class.getName(), //
+ RegexLeaf.start(), //
new RegexLeaf("kill|detach"), //
- new RegexLeaf(";?$"));
+ new RegexLeaf(";?"), RegexLeaf.end());
}
@Override
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandLabel.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandLabel.java
index 0f9696bb9..a26b5d038 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandLabel.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandLabel.java
@@ -39,6 +39,7 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
@@ -49,13 +50,13 @@ public class CommandLabel extends SingleLineCommand2 {
super(getRegexConcat());
}
- static RegexConcat getRegexConcat() {
- return new RegexConcat(new RegexLeaf("^"), //
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandLabel.class.getName(), RegexLeaf.start(), //
new RegexLeaf("label"), //
- new RegexLeaf("[%s]+"), //
+ RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("NAME", "([\\p{L}0-9_.]+)"), //
new RegexLeaf(";?"), //
- new RegexLeaf("$"));
+ RegexLeaf.end());
}
@Override
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandLink3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandLink3.java
index bddc6147f..c2f364433 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandLink3.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandLink3.java
@@ -39,6 +39,7 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
@@ -51,12 +52,13 @@ public class CommandLink3 extends SingleLineCommand2 {
super(getRegexConcat());
}
- static RegexConcat getRegexConcat() {
- return new RegexConcat(new RegexLeaf("^"), //
- new RegexLeaf("link[%s]+"), //
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandLink3.class.getName(), RegexLeaf.start(), //
+ new RegexLeaf("link"), //
+ RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("COLOR", "(#\\w+)"), //
new RegexLeaf(";?"), //
- new RegexLeaf("$"));
+ RegexLeaf.end());
}
@Override
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandNolink.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandNolink.java
index 584f92f83..4dbc8e99a 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandNolink.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandNolink.java
@@ -39,6 +39,7 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
@@ -50,11 +51,11 @@ public class CommandNolink extends SingleLineCommand2 {
super(getRegexConcat());
}
- static RegexConcat getRegexConcat() {
- return new RegexConcat(new RegexLeaf("^"), //
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandNolink.class.getName(), RegexLeaf.start(), //
new RegexLeaf("nolink"), //
new RegexLeaf(";?"), //
- new RegexLeaf("$"));
+ RegexLeaf.end());
}
@Override
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandNote3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandNote3.java
index 35f9e06da..6a32573e4 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandNote3.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandNote3.java
@@ -39,6 +39,7 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
@@ -54,21 +55,23 @@ public class CommandNote3 extends SingleLineCommand2 {
public CommandNote3() {
super(getRegexConcat());
}
-
+
private static ColorParser color() {
return ColorParser.simpleColor(ColorType.BACK);
}
-
- static RegexConcat getRegexConcat() {
- return new RegexConcat(new RegexLeaf("^"), //
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandNote3.class.getName(), RegexLeaf.start(), //
new RegexLeaf("TYPE", "(note|floating note)"), //
- new RegexLeaf("POSITION", "[%s]*(left|right)?"), //
- new RegexLeaf("[%s]*"), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexLeaf("POSITION", "(left|right)?"), //
+ RegexLeaf.spaceZeroOrMore(), //
color().getRegex(), //
- new RegexLeaf("[%s]*:[%s]*"), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexLeaf(":"), //
+ RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("NOTE", "(.*)"), //
- new RegexLeaf("$"));
+ RegexLeaf.end());
}
@Override
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandNoteLong3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandNoteLong3.java
index ccc8cd094..7ec7f946c 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandNoteLong3.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandNoteLong3.java
@@ -40,6 +40,7 @@ import net.sourceforge.plantuml.command.BlocLines;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.CommandMultilines2;
import net.sourceforge.plantuml.command.MultilinesStrategy;
+import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
@@ -55,19 +56,18 @@ public class CommandNoteLong3 extends CommandMultilines2 {
public CommandNoteLong3() {
super(getRegexConcat(), MultilinesStrategy.REMOVE_STARTING_QUOTE);
}
-
+
private static ColorParser color() {
return ColorParser.simpleColor(ColorType.BACK);
}
-
public String getPatternEnd() {
return "(?i)^end[%s]?note$";
}
protected CommandExecutionResult executeNow(final ActivityDiagram3 diagram, BlocLines lines) {
// final List extends CharSequence> in = StringUtils.removeEmptyColumns2(lines.subList(1, lines.size() - 1));
- final RegexResult line0 = getStartingPattern().matcher(lines.getFirst499().getStringTrimmed());
+ final RegexResult line0 = getStartingPattern().matcher(lines.getFirst499().getTrimmed().getString());
lines = lines.subExtract(1, 1);
lines = lines.removeEmptyColumns();
final NotePosition position = NotePosition.defaultLeft(line0.get("POSITION", 0));
@@ -77,13 +77,13 @@ public class CommandNoteLong3 extends CommandMultilines2 {
return diagram.addNote(note, position, type, colors);
}
- static RegexConcat getRegexConcat() {
- return new RegexConcat(new RegexLeaf("^"), //
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandNoteLong3.class.getName(), RegexLeaf.start(), //
new RegexLeaf("TYPE", "(note|floating note)"), //
- new RegexLeaf("POSITION", "[%s]*(left|right)?"), //
- new RegexLeaf("[%s]*"), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexLeaf("POSITION", "(left|right)?"), //
+ RegexLeaf.spaceZeroOrMore(), //
color().getRegex(), //
- new RegexLeaf("$"));
+ RegexLeaf.end());
}
-
}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandPartition3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandPartition3.java
index bb6289686..aa4478fe4 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandPartition3.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandPartition3.java
@@ -41,6 +41,7 @@ import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexOptional;
@@ -60,23 +61,24 @@ public class CommandPartition3 extends SingleLineCommand2 {
super(getRegexConcat());
}
- static RegexConcat getRegexConcat() {
- return new RegexConcat(new RegexLeaf("^"), //
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandPartition3.class.getName(), RegexLeaf.start(), //
new RegexLeaf("TYPE", "(partition|package|rectangle|card)"), //
- new RegexLeaf("[%s]+"), //
+ RegexLeaf.spaceOneOrMore(), //
new RegexOptional(//
new RegexConcat( //
color("BACK1").getRegex(),//
- new RegexLeaf("[%s]+"))), //
+ RegexLeaf.spaceOneOrMore())), //
new RegexLeaf("NAME", "([%g][^%g]+[%g]|\\S+)"), //
new RegexOptional(//
new RegexConcat( //
- new RegexLeaf("[%s]+"), //
+ RegexLeaf.spaceOneOrMore(), //
color("BACK2").getRegex())), //
- new RegexLeaf("[%s]*"), //
+ RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREO", "(\\<{2}.*\\>{2})?"), //
- new RegexLeaf("[%s]*"), //
- new RegexLeaf("\\{?$"));
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexLeaf("\\{?"), //
+ RegexLeaf.end());
}
private USymbol getUSymbol(String type) {
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandRepeat3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandRepeat3.java
index 0bb76c32d..1f9dfff74 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandRepeat3.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandRepeat3.java
@@ -39,8 +39,10 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexOptional;
import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.HtmlColor;
@@ -52,13 +54,14 @@ public class CommandRepeat3 extends SingleLineCommand2 {
super(getRegexConcat());
}
- static RegexConcat getRegexConcat() {
- return new RegexConcat(new RegexLeaf("^"), //
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandRepeat3.class.getName(), RegexLeaf.start(), //
ColorParser.exp4(), //
new RegexLeaf("repeat"), //
- new RegexLeaf("[%s]*"), //
- new RegexLeaf("LABEL", "(?::(.*?))?"), //
- new RegexLeaf(";?$"));
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexOptional(new RegexLeaf("LABEL", ":(.*?)")), //
+ new RegexLeaf(";?"), //
+ RegexLeaf.end());
}
@Override
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandRepeatWhile3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandRepeatWhile3.java
index 53f37fe99..2f9fccbc2 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandRepeatWhile3.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandRepeatWhile3.java
@@ -39,6 +39,7 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexOptional;
@@ -54,37 +55,48 @@ public class CommandRepeatWhile3 extends SingleLineCommand2 {
super(getRegexConcat());
}
- static RegexConcat getRegexConcat() {
- return new RegexConcat(//
- new RegexLeaf("^"), //
- new RegexLeaf("repeat[%s]?while"), //
- new RegexLeaf("[%s]*"), //
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandRepeatWhile3.class.getName(), //
+ RegexLeaf.start(), //
+ new RegexLeaf("repeat"), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexLeaf("while"), //
+ RegexLeaf.spaceZeroOrMore(), //
new RegexOr(//
new RegexConcat(new RegexLeaf("TEST3", "\\((.*?)\\)"), //
- new RegexLeaf("[%s]*(is|equals?)[%s]*"), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexLeaf("(is|equals?)"), //
+ RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("WHEN3", "\\((.+?)\\)"), //
- new RegexLeaf("[%s]*(not)[%s]*"), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexLeaf("(not)"), //
+ RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("OUT3", "\\((.+?)\\)")), //
new RegexConcat(new RegexLeaf("TEST4", "\\((.*?)\\)"), //
- new RegexLeaf("[%s]*(not)[%s]*"), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexLeaf("(not)"), //
+ RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("OUT4", "\\((.+?)\\)")), //
new RegexConcat(new RegexLeaf("TEST2", "\\((.*?)\\)"), //
- new RegexLeaf("[%s]*(is|equals?)[%s]*"), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexLeaf("(is|equals?)"), //
+ RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("WHEN2", "\\((.+?)\\)") //
), //
- new RegexLeaf("TEST1", "(?:\\((.*)\\))?") //
+ new RegexOptional(new RegexLeaf("TEST1", "\\((.*)\\)")) //
), //
- new RegexLeaf("[%s]*"), //
+ RegexLeaf.spaceZeroOrMore(), //
new RegexOptional(new RegexConcat( //
new RegexOr(//
new RegexLeaf("->"), //
new RegexLeaf("COLOR", CommandLinkElement.STYLE_COLORS_MULTIPLES)), //
- new RegexLeaf("[%s]*"), //
+ RegexLeaf.spaceZeroOrMore(), //
new RegexOr(//
new RegexLeaf("LABEL", "(.*)"), //
new RegexLeaf("")) //
)), //
- new RegexLeaf(";?$"));
+ new RegexLeaf(";?"), //
+ RegexLeaf.end());
}
@Override
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandRepeatWhile3Multilines.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandRepeatWhile3Multilines.java
index 70bf3a596..285eeff46 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandRepeatWhile3Multilines.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandRepeatWhile3Multilines.java
@@ -45,6 +45,7 @@ import net.sourceforge.plantuml.command.BlocLines;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.CommandMultilines3;
import net.sourceforge.plantuml.command.MultilinesStrategy;
+import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.MyPattern;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
@@ -62,16 +63,19 @@ public class CommandRepeatWhile3Multilines extends CommandMultilines3 {
super(getRegexConcat());
}
- static RegexConcat getRegexConcat() {
- return new RegexConcat(//
- new RegexLeaf("^"), //
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandSplit3.class.getName(), //
+ RegexLeaf.start(), //
new RegexLeaf("split"), //
- new RegexLeaf(";?$"));
+ new RegexLeaf(";?"), RegexLeaf.end());
}
@Override
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSplitAgain3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSplitAgain3.java
index af76eb168..2d6de0a2e 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSplitAgain3.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSplitAgain3.java
@@ -39,6 +39,7 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
@@ -49,11 +50,13 @@ public class CommandSplitAgain3 extends SingleLineCommand2 {
super(getRegexConcat());
}
- static RegexConcat getRegexConcat() {
- return new RegexConcat(//
- new RegexLeaf("^"), //
- new RegexLeaf("split[%s]?again"), //
- new RegexLeaf(";?$"));
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandSplitAgain3.class.getName(), //
+ RegexLeaf.start(), //
+ new RegexLeaf("split"), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexLeaf("again"), //
+ new RegexLeaf(";?"), RegexLeaf.end());
}
@Override
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSplitEnd3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSplitEnd3.java
index 44bfc09a7..49b696509 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSplitEnd3.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSplitEnd3.java
@@ -39,8 +39,10 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexOr;
import net.sourceforge.plantuml.command.regex.RegexResult;
public class CommandSplitEnd3 extends SingleLineCommand2 {
@@ -49,11 +51,22 @@ public class CommandSplitEnd3 extends SingleLineCommand2 {
super(getRegexConcat());
}
- static RegexConcat getRegexConcat() {
- return new RegexConcat(//
- new RegexLeaf("^"), //
- new RegexLeaf("(end[%s]?split|split[%s]?end)"), //
- new RegexLeaf(";?$"));
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandSplitEnd3.class.getName(), RegexLeaf.start(), //
+ new RegexOr( //
+ new RegexConcat( //
+ new RegexLeaf("end"), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexLeaf("split") //
+ ), //
+ new RegexConcat( //
+ new RegexLeaf("split"), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexLeaf("end") //
+ ) //
+ ), //
+ new RegexLeaf(";?"), //
+ RegexLeaf.end());
}
@Override
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandStart3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandStart3.java
index eeaf29a34..b9633caff 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandStart3.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandStart3.java
@@ -39,6 +39,7 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
@@ -49,11 +50,11 @@ public class CommandStart3 extends SingleLineCommand2 {
super(getRegexConcat());
}
- static RegexConcat getRegexConcat() {
- return new RegexConcat(//
- new RegexLeaf("^"), //
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandStart3.class.getName(), RegexLeaf.start(), //
new RegexLeaf("start"), //
- new RegexLeaf(";?$"));
+ new RegexLeaf(";?"), //
+ RegexLeaf.end());
}
@Override
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandStop3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandStop3.java
index 7f8c33a3d..4997d69f0 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandStop3.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandStop3.java
@@ -39,6 +39,7 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
@@ -49,11 +50,11 @@ public class CommandStop3 extends SingleLineCommand2 {
super(getRegexConcat());
}
- static RegexConcat getRegexConcat() {
- return new RegexConcat(//
- new RegexLeaf("^"), //
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandStop3.class.getName(), RegexLeaf.start(), //
new RegexLeaf("stop"), //
- new RegexLeaf(";?$"));
+ new RegexLeaf(";?"), //
+ RegexLeaf.end());
}
@Override
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSwimlane.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSwimlane.java
index 9bfb2c1ff..15b580bbc 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSwimlane.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSwimlane.java
@@ -39,6 +39,7 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
@@ -52,14 +53,14 @@ public class CommandSwimlane extends SingleLineCommand2 {
super(getRegexConcat());
}
- static RegexConcat getRegexConcat() {
- return new RegexConcat(new RegexLeaf("^"), //
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandSwimlane.class.getName(), RegexLeaf.start(), //
new RegexLeaf("\\|"), //
ColorParser.exp6(), //
new RegexLeaf("SWIMLANE", "([^|]+)"), //
new RegexLeaf("\\|"), //
new RegexLeaf("LABEL", "([^|]+)?"), //
- new RegexLeaf("$"));
+ RegexLeaf.end());
}
@Override
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSwimlane2.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSwimlane2.java
index 289f71edb..5a1ba1462 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSwimlane2.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSwimlane2.java
@@ -39,8 +39,10 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexOptional;
import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.HtmlColor;
@@ -52,14 +54,21 @@ public class CommandSwimlane2 extends SingleLineCommand2 {
super(getRegexConcat());
}
- static RegexConcat getRegexConcat() {
- return new RegexConcat(new RegexLeaf("^"), //
- new RegexLeaf("swimlane[%s]+"), //
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandSwimlane2.class.getName(), RegexLeaf.start(), //
+ new RegexLeaf("swimlane"), //
+ RegexLeaf.spaceOneOrMore(), //
ColorParser.exp7(), //
- new RegexLeaf("[%s]*"), //
+ RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("SWIMLANE", "([^|]+)"), //
- new RegexLeaf("LABEL", "(?:[%s]+as[%s]+([^|]+))?"), //
- new RegexLeaf("$"));
+ new RegexOptional( //
+ new RegexConcat( //
+ RegexLeaf.spaceOneOrMore(), //
+ new RegexLeaf("as"), //
+ RegexLeaf.spaceOneOrMore(), //
+ new RegexLeaf("LABEL", "([^|]+)") //
+ )), //
+ RegexLeaf.end());
}
@Override
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSwitch.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSwitch.java
index 9fa90f023..2fe67d5af 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSwitch.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSwitch.java
@@ -39,6 +39,7 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
@@ -52,14 +53,14 @@ public class CommandSwitch extends SingleLineCommand2 {
super(getRegexConcat());
}
- static RegexConcat getRegexConcat() {
- return new RegexConcat(new RegexLeaf("^"), //
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandSwitch.class.getName(), RegexLeaf.start(), //
ColorParser.exp4(), //
new RegexLeaf("switch"), //
- new RegexLeaf("[%s]*"), //
+ RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("TEST", "\\((.*?)\\)"), //
- new RegexLeaf("[%s]*"), //
- new RegexLeaf("$"));
+ RegexLeaf.spaceZeroOrMore(), //
+ RegexLeaf.end());
}
@Override
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandWhile3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandWhile3.java
index ab454f1b5..7d7426f01 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandWhile3.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandWhile3.java
@@ -39,6 +39,7 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexOptional;
@@ -53,16 +54,19 @@ public class CommandWhile3 extends SingleLineCommand2 {
super(getRegexConcat());
}
- static RegexConcat getRegexConcat() {
- return new RegexConcat(//
- new RegexLeaf("^"), //
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandWhile3.class.getName(), RegexLeaf.start(), //
ColorParser.exp4(), //
new RegexLeaf("while"), //
- new RegexLeaf("TEST", "[%s]*\\((.*?)\\)"), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexLeaf("TEST", "\\((.*?)\\)"), //
new RegexOptional(new RegexConcat(//
- new RegexLeaf("[%s]*(is|equals?)[%s]*"), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexLeaf("(is|equals?)"), //
+ RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("YES", "\\((.+?)\\)"))), //
- new RegexLeaf(";?$"));
+ new RegexLeaf(";?"), //
+ RegexLeaf.end());
}
@Override
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandWhileEnd3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandWhileEnd3.java
index e021634ba..146b3b76c 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandWhileEnd3.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandWhileEnd3.java
@@ -39,8 +39,11 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexOptional;
+import net.sourceforge.plantuml.command.regex.RegexOr;
import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Display;
@@ -50,11 +53,24 @@ public class CommandWhileEnd3 extends SingleLineCommand2 {
super(getRegexConcat());
}
- static RegexConcat getRegexConcat() {
- return new RegexConcat(new RegexLeaf("^"), //
- new RegexLeaf("(end[%s]?while|while[%s]?end)"), //
- new RegexLeaf("OUT", "[%s]*(?:\\((.+?)\\))?"), //
- new RegexLeaf(";?$"));
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandWhileEnd3.class.getName(), RegexLeaf.start(), //
+ new RegexOr( //
+ new RegexConcat( //
+ new RegexLeaf("end"), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexLeaf("while") //
+ ), //
+ new RegexConcat( //
+ new RegexLeaf("while"), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexLeaf("end") //
+ ) //
+ ), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexOptional(new RegexLeaf("OUT", "\\((.+?)\\)")), //
+ new RegexLeaf(";?"), //
+ RegexLeaf.end());
}
@Override
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactory.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactory.java
index a25828c02..8683a4a74 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactory.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactory.java
@@ -85,7 +85,7 @@ public interface FtileFactory {
LinkRendering afterEndwhile, HtmlColor color, Instruction specialOut);
public Ftile createIf(Swimlane swimlane, List thens, Branch elseBranch, LinkRendering afterEndwhile,
- LinkRendering topInlinkRendering);
+ LinkRendering topInlinkRendering, Url url);
public Ftile createSwitch(Swimlane swimlane, List branches, LinkRendering afterEndwhile,
LinkRendering topInlinkRendering, Display labelTest);
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactoryDelegator.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactoryDelegator.java
index 05fe465e4..fcbf080c9 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactoryDelegator.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactoryDelegator.java
@@ -159,8 +159,8 @@ public class FtileFactoryDelegator implements FtileFactory {
}
public Ftile createIf(Swimlane swimlane, List thens, Branch elseBranch, LinkRendering afterEndwhile,
- LinkRendering topInlinkRendering) {
- return factory.createIf(swimlane, thens, elseBranch, afterEndwhile, topInlinkRendering);
+ LinkRendering topInlinkRendering, Url url) {
+ return factory.createIf(swimlane, thens, elseBranch, afterEndwhile, topInlinkRendering, url);
}
public Ftile createSwitch(Swimlane swimlane, List branches, LinkRendering afterEndwhile,
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileGeometry.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileGeometry.java
index 6c7bdf894..7e2f714d1 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileGeometry.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileGeometry.java
@@ -76,7 +76,7 @@ public class FtileGeometry extends Dimension2D {
}
return new Point2D.Double(0, (inY + outY) / 2);
}
-
+
public Point2D getPointOut() {
if (outY == Double.MIN_NORMAL) {
throw new UnsupportedOperationException();
@@ -84,8 +84,6 @@ public class FtileGeometry extends Dimension2D {
return new Point2D.Double(left, outY);
}
-
-
public FtileGeometry(Dimension2D dim, double left, double inY) {
this(dim.getWidth(), dim.getHeight(), left, inY);
}
@@ -145,6 +143,10 @@ public class FtileGeometry extends Dimension2D {
return left;
}
+ public final double getRight() {
+ return width - left;
+ }
+
public double getOutY() {
return outY;
}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/Snake.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/Snake.java
index bf20b18be..23f2d56a0 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/Snake.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/Snake.java
@@ -63,6 +63,7 @@ public class Snake implements UShape {
private UPolygon endDecoration;
private final Rainbow color;
private TextBlock textBlock;
+ private String textBlockPosition;
private MergeStrategy mergeable = MergeStrategy.FULL;
private Direction emphasizeDirection;
private final HorizontalAlignment horizontalAlignment;
@@ -110,6 +111,11 @@ public class Snake implements UShape {
this(null, horizontalAlignment, color, null);
}
+ public void setLabel(TextBlock label, String position) {
+ this.textBlock = label;
+ this.textBlockPosition = position;
+ }
+
public void setLabel(TextBlock label) {
this.textBlock = label;
}
@@ -206,7 +212,9 @@ public class Snake implements UShape {
double x = Math.max(pt1.getX(), pt2.getX()) + 4;
final boolean zigzag = worm.getDirectionsCode().startsWith("DLD") || worm.getDirectionsCode().startsWith("DRD");
double y = (pt1.getY() + pt2.getY()) / 2 - dim.getHeight() / 2;
- if (horizontalAlignment == HorizontalAlignment.CENTER && zigzag) {
+ if ("bottom".equalsIgnoreCase(textBlockPosition)) {
+ x = worm.getLast().getX();
+ } else if (horizontalAlignment == HorizontalAlignment.CENTER && zigzag) {
final Point2D pt3 = worm.get(2);
x = (pt2.getX() + pt3.getX()) / 2 - dim.getWidth() / 2;
} else if (horizontalAlignment == HorizontalAlignment.RIGHT && zigzag) {
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/SwimlanesB.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/SwimlanesB.java
index 9edded76e..1f4e9edbb 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/SwimlanesB.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/SwimlanesB.java
@@ -35,15 +35,21 @@
*/
package net.sourceforge.plantuml.activitydiagram3.ftile;
+import net.sourceforge.plantuml.ColorParam;
import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.Pragma;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
+import net.sourceforge.plantuml.graphic.HtmlColor;
+import net.sourceforge.plantuml.graphic.HtmlColorUtils;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock;
+import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
+import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UGraphic;
+import net.sourceforge.plantuml.ugraphic.URectangle;
import net.sourceforge.plantuml.ugraphic.UTranslate;
import net.sourceforge.plantuml.utils.MathUtils;
@@ -59,6 +65,13 @@ public class SwimlanesB extends SwimlanesA {
double x2 = 0;
final StringBounder stringBounder = ug.getStringBounder();
+
+ final HtmlColor color = skinParam.getHtmlColor(ColorParam.swimlaneTitleBackground, null, false);
+ if (color != null) {
+ final double titleHeight = getTitlesHeight(stringBounder);
+ final URectangle back = new URectangle(getTitlesWidth(stringBounder), titleHeight);
+ ug.apply(new UChangeBackColor(color)).apply(new UChangeColor(color)).draw(back);
+ }
for (Swimlane swimlane : swimlanes) {
final TextBlock swTitle = getTitle(swimlane);
final double titleWidth = swTitle.calculateDimension(stringBounder).getWidth();
@@ -68,6 +81,14 @@ public class SwimlanesB extends SwimlanesA {
}
}
+ private double getTitlesWidth(StringBounder stringBounder) {
+ double x2 = 0;
+ for (Swimlane swimlane : swimlanes) {
+ x2 += swimlane.getActualWidth();
+ }
+ return x2;
+ }
+
private TextBlock getTitle(Swimlane swimlane) {
final FontConfiguration fontConfiguration = new FontConfiguration(skinParam, FontParam.SWIMLANE_TITLE, null);
@@ -101,12 +122,17 @@ public class SwimlanesB extends SwimlanesA {
@Override
protected UTranslate getTitleHeightTranslate(final StringBounder stringBounder) {
+ double titlesHeight = getTitlesHeight(stringBounder);
+ return new UTranslate(0, titlesHeight > 0 ? titlesHeight + 5 : 0);
+ }
+
+ private double getTitlesHeight(StringBounder stringBounder) {
double titlesHeight = 0;
for (Swimlane swimlane : swimlanes) {
final TextBlock swTitle = getTitle(swimlane);
titlesHeight = Math.max(titlesHeight, swTitle.calculateDimension(stringBounder).getHeight());
}
- return new UTranslate(0, titlesHeight);
+ return titlesHeight;
}
}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorIf.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorIf.java
index 67a480425..dcd2437c5 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorIf.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorIf.java
@@ -40,6 +40,7 @@ import java.util.List;
import net.sourceforge.plantuml.ColorParam;
import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.Pragma;
+import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.activitydiagram3.Branch;
import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
@@ -51,6 +52,7 @@ import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.HtmlColorAndStyle;
import net.sourceforge.plantuml.graphic.Rainbow;
+import net.sourceforge.plantuml.svek.ConditionEndStyle;
import net.sourceforge.plantuml.svek.ConditionStyle;
public class FtileFactoryDelegatorIf extends FtileFactoryDelegator {
@@ -64,9 +66,10 @@ public class FtileFactoryDelegatorIf extends FtileFactoryDelegator {
@Override
public Ftile createIf(Swimlane swimlane, List thens, Branch elseBranch, LinkRendering afterEndwhile,
- LinkRendering topInlinkRendering) {
+ LinkRendering topInlinkRendering, Url url) {
final ConditionStyle conditionStyle = skinParam().getConditionStyle();
+ final ConditionEndStyle conditionEndStyle = skinParam().getConditionEndStyle();
final Branch branch0 = thens.get(0);
final HtmlColor borderColor = getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBorder);
@@ -89,7 +92,7 @@ public class FtileFactoryDelegatorIf extends FtileFactoryDelegator {
conditionStyle, thens, elseBranch, fcArrow, topInlinkRendering, afterEndwhile, fcTest);
}
return ConditionalBuilder.create(swimlane, borderColor, backColor, arrowColor, getFactory(), conditionStyle,
- thens.get(0), elseBranch, skinParam(), getStringBounder(), fcArrow, fcTest);
+ conditionEndStyle, thens.get(0), elseBranch, skinParam(), getStringBounder(), fcArrow, fcTest, url);
}
private HtmlColor fontColor(FontParam param) {
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorSwitch.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorSwitch.java
index dee9622be..1507edec9 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorSwitch.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorSwitch.java
@@ -70,23 +70,6 @@ public class FtileFactoryDelegatorSwitch extends FtileFactoryDelegator {
@Override
public Ftile createSwitch(Swimlane swimlane, List branches, LinkRendering afterEndwhile,
LinkRendering topInlinkRendering, Display labelTest) {
- // final ConditionStyle conditionStyle = skinParam().getConditionStyle();
- //
- // final HtmlColor borderColor = getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBorder);
- // final HtmlColor backColor = getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBackground);
- // final Rainbow arrowColor = HtmlColorAndStyle.build(skinParam());
- //
- // final FontConfiguration fcArrow = new FontConfiguration(skinParam(), FontParam.ARROW, null);
- //
- // final FontParam testParam = conditionStyle == ConditionStyle.INSIDE ? FontParam.ACTIVITY_DIAMOND
- // : FontParam.ARROW;
- // final FontConfiguration fcTest = new FontConfiguration(skinParam(), testParam, null)
- // .changeColor(fontColor(FontParam.ACTIVITY_DIAMOND));
- //
- // return FtileSwitch.create(swimlane, borderColor, backColor, arrowColor, getFactory(), conditionStyle,
- // branches,
- // fcArrow, topInlinkRendering, afterEndwhile, fcTest);
-
// return createNude(swimlane, branches);
// return createWithDiamonds(swimlane, branches, labelTest);
return createWithLinks(swimlane, branches, labelTest);
@@ -113,11 +96,11 @@ public class FtileFactoryDelegatorSwitch extends FtileFactoryDelegator {
private Ftile createWithLinks(Swimlane swimlane, List branches, Display labelTest) {
final List ftiles = new ArrayList();
+ final Ftile diamond1 = getDiamond1(swimlane, branches.get(0), labelTest);
+ final Ftile diamond2 = getDiamond2(swimlane, branches.get(0));
for (Branch branch : branches) {
ftiles.add(new FtileMinWidth(branch.getFtile(), 30));
}
- final Ftile diamond1 = getDiamond1(swimlane, branches.get(0), labelTest);
- final Ftile diamond2 = getDiamond2(swimlane, branches.get(0));
final Rainbow arrowColor = HtmlColorAndStyle.build(skinParam());
if (ftiles.size() == 1) {
final FtileSwitchWithOneLink result = new FtileSwitchWithOneLink(ftiles, branches, swimlane, diamond1,
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfDown.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfDown.java
index a53f77ab2..a0739c312 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfDown.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfDown.java
@@ -56,12 +56,14 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.FtileEmpty;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileUtils;
+import net.sourceforge.plantuml.activitydiagram3.ftile.MergeStrategy;
import net.sourceforge.plantuml.activitydiagram3.ftile.Snake;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamond;
import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamondInside;
import net.sourceforge.plantuml.graphic.Rainbow;
import net.sourceforge.plantuml.graphic.StringBounder;
+import net.sourceforge.plantuml.svek.ConditionEndStyle;
import net.sourceforge.plantuml.ugraphic.UEmpty;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate;
@@ -72,6 +74,7 @@ public class FtileIfDown extends AbstractFtile {
private final Ftile diamond1;
private final Ftile diamond2;
private final Ftile optionalStop;
+ private final ConditionEndStyle conditionEndStyle;
@Override
public Collection getMyChildren() {
@@ -98,27 +101,34 @@ public class FtileIfDown extends AbstractFtile {
return thenBlock.getSwimlaneOut();
}
- private FtileIfDown(Ftile thenBlock, Ftile diamond1, Ftile diamond2, Ftile optionalStop) {
+ private FtileIfDown(Ftile thenBlock, Ftile diamond1, Ftile diamond2, Ftile optionalStop,
+ ConditionEndStyle conditionEndStyle) {
super(thenBlock.skinParam());
this.thenBlock = thenBlock;
this.diamond1 = diamond1;
this.diamond2 = diamond2;
this.optionalStop = optionalStop;
+ this.conditionEndStyle = conditionEndStyle;
}
public static Ftile create(Ftile diamond1, Ftile diamond2, Swimlane swimlane, Ftile thenBlock, Rainbow arrowColor,
- FtileFactory ftileFactory, Ftile optionalStop, Rainbow elseColor) {
+ ConditionEndStyle conditionEndStyle, FtileFactory ftileFactory, Ftile optionalStop, Rainbow elseColor) {
elseColor = elseColor.withDefault(arrowColor);
final FtileIfDown result = new FtileIfDown(thenBlock, diamond1, optionalStop == null ? diamond2
- : new FtileEmpty(ftileFactory.skinParam()), optionalStop);
+ : new FtileEmpty(ftileFactory.skinParam()), optionalStop, conditionEndStyle);
final List conns = new ArrayList();
conns.add(result.new ConnectionIn(thenBlock.getInLinkRendering().getRainbow(arrowColor)));
final boolean hasPointOut1 = thenBlock.calculateDimension(ftileFactory.getStringBounder()).hasPointOut();
if (optionalStop == null) {
if (hasPointOut1) {
- conns.add(result.new ConnectionElse(elseColor));
+ if (conditionEndStyle == ConditionEndStyle.DIAMOND) {
+ conns.add(result.new ConnectionElse(elseColor));
+ } else if (conditionEndStyle == ConditionEndStyle.HLINE) {
+ conns.add(result.new ConnectionElseHline(elseColor));
+ conns.add(result.new ConnectionHline(elseColor));
+ }
} else {
conns.add(result.new ConnectionElseNoDiamond(elseColor));
}
@@ -228,6 +238,14 @@ public class FtileIfDown extends AbstractFtile {
getFtile2().calculateDimension(stringBounder).getPointIn());
}
+ private Point2D getP2hline(final StringBounder stringBounder) {
+ final FtileGeometry dimDiamond2 = getFtile2().calculateDimension(stringBounder);
+ final double x = dimDiamond2.getWidth();
+ final double half = (dimDiamond2.getOutY() - dimDiamond2.getInY()) / 2;
+ return getTranslateDiamond2(stringBounder)
+ .getTranslated(new Point2D.Double(x, dimDiamond2.getInY() + half));
+ }
+
public void drawU(UGraphic ug) {
final StringBounder stringBounder = ug.getStringBounder();
@@ -237,7 +255,12 @@ public class FtileIfDown extends AbstractFtile {
final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown());
snake.addPoint(getP1(stringBounder));
- snake.addPoint(getP2(stringBounder));
+
+ if (conditionEndStyle == ConditionEndStyle.DIAMOND) {
+ snake.addPoint(getP2(stringBounder));
+ } else if (conditionEndStyle == ConditionEndStyle.HLINE) {
+ snake.addPoint(getP2hline(stringBounder));
+ }
ug.draw(snake);
}
@@ -271,7 +294,7 @@ public class FtileIfDown extends AbstractFtile {
this.endInlinkColor = endInlinkColor;
}
- private Point2D getP1(StringBounder stringBounder) {
+ protected Point2D getP1(StringBounder stringBounder) {
final FtileGeometry dimDiamond1 = diamond1.calculateDimension(stringBounder);
final double x = dimDiamond1.getWidth();
final double half = (dimDiamond1.getOutY() - dimDiamond1.getInY()) / 2;
@@ -290,7 +313,6 @@ public class FtileIfDown extends AbstractFtile {
public void drawU(UGraphic ug) {
final StringBounder stringBounder = ug.getStringBounder();
- final Snake snake = new Snake(arrowHorizontalAlignment(), endInlinkColor, Arrows.asToLeft());
final Point2D p1 = getP1(stringBounder);
if (calculateDimension(stringBounder).hasPointOut() == false) {
return;
@@ -302,24 +324,72 @@ public class FtileIfDown extends AbstractFtile {
final double x2 = p2.getX();
final double y2 = p2.getY();
- snake.addPoint(x1, y1);
-
final FtileGeometry thenGeom = thenBlock.calculateDimension(stringBounder);
final double xmax = Math.max(x1 + Diamond.diamondHalfSize, getTranslateForThen(stringBounder).getDx()
+ thenGeom.getWidth());
+ final Snake snake = new Snake(arrowHorizontalAlignment(), endInlinkColor, Arrows.asToLeft());
+ snake.addPoint(x1, y1);
snake.addPoint(xmax, y1);
snake.addPoint(xmax, y2);
snake.addPoint(x2, y2);
snake.emphasizeDirection(Direction.DOWN);
ug.apply(new UTranslate(x2, y2 - Diamond.diamondHalfSize)).draw(new UEmpty(5, Diamond.diamondHalfSize));
-
ug.draw(snake);
}
}
+ class ConnectionElseHline extends ConnectionElse {
+ private final Rainbow endInlinkColor;
+
+ public ConnectionElseHline(Rainbow endInlinkColor) {
+ super(endInlinkColor);
+ this.endInlinkColor = endInlinkColor;
+ }
+
+ @Override
+ public void drawU(UGraphic ug) {
+ final StringBounder stringBounder = ug.getStringBounder();
+
+ final Point2D p1 = getP1(stringBounder);
+ if (calculateDimension(stringBounder).hasPointOut() == false) {
+ return;
+ }
+ final Point2D p2 = getP2(stringBounder);
+
+ final double x1 = p1.getX();
+ final double y1 = p1.getY();
+ final double x2 = p2.getX();
+ final double y2 = p2.getY();
+
+ final FtileGeometry thenGeom = thenBlock.calculateDimension(stringBounder);
+ final double xmax = Math.max(x1 + Diamond.diamondHalfSize, getTranslateForThen(stringBounder).getDx()
+ + thenGeom.getWidth());
+
+ /*
+ * if( conditionEndStyle == ConditionEndStyle.DIAMOND ) { final Snake snake = new
+ * Snake(arrowHorizontalAlignment(), endInlinkColor, Arrows.asToLeft()); snake.addPoint(x1, y1);
+ * snake.addPoint(xmax, y1); snake.addPoint(xmax, y2); snake.addPoint(x2, y2);
+ * snake.emphasizeDirection(Direction.DOWN); ug.apply(new UTranslate(x2, y2 -
+ * Diamond.diamondHalfSize)).draw(new UEmpty(5, Diamond.diamondHalfSize)); ug.draw(snake); }
+ */
+ final Snake snake = new Snake(arrowHorizontalAlignment(), endInlinkColor, Arrows.asToDown());
+ snake.addPoint(x1, y1);
+ snake.addPoint(xmax, y1);
+ snake.addPoint(xmax, y2);
+ ug.apply(new UTranslate(xmax, y2 - Diamond.diamondHalfSize)).draw(new UEmpty(5, Diamond.diamondHalfSize));
+ ug.draw(snake);
+ /*
+ * final Snake snake2 = new Snake(arrowHorizontalAlignment(), endInlinkColor); snake2.addPoint(xmax, y2);
+ * snake2.addPoint(x2, y2); ug.draw(snake2);
+ */
+
+ }
+
+ }
+
class ConnectionElseNoDiamond extends ConnectionElse {
public ConnectionElseNoDiamond(Rainbow endInlinkColor) {
@@ -333,6 +403,72 @@ public class FtileIfDown extends AbstractFtile {
}
+ // copied from FtileIfLongHorizontal to use with ConditionEndStyle.HLINE
+ class ConnectionHline extends AbstractConnection {
+ private final Rainbow endInlinkColor;
+
+ public ConnectionHline(Rainbow endInlinkColor) {
+ super(diamond1, diamond2);
+ this.endInlinkColor = endInlinkColor;
+ }
+
+ private Point2D getP1(StringBounder stringBounder) {
+ final FtileGeometry dimDiamond1 = diamond1.calculateDimension(stringBounder);
+ final double x = dimDiamond1.getWidth();
+ final double half = (dimDiamond1.getOutY() - dimDiamond1.getInY()) / 2;
+ return getTranslateDiamond1(stringBounder)
+ .getTranslated(new Point2D.Double(x, dimDiamond1.getInY() + half));
+ }
+
+ protected Point2D getP2(final StringBounder stringBounder) {
+ final FtileGeometry dimDiamond2 = diamond2.calculateDimension(stringBounder);
+ final double x = dimDiamond2.getWidth();
+ final double half = (dimDiamond2.getOutY() - dimDiamond2.getInY()) / 2;
+ return getTranslateDiamond2(stringBounder)
+ .getTranslated(new Point2D.Double(x, dimDiamond2.getInY() + half));
+ }
+
+ // the bottom or south point of the diamond that we omitted
+ protected Point2D getP3(final StringBounder stringBounder) {
+ final FtileGeometry dimDiamond2 = diamond2.calculateDimension(stringBounder);
+ final double x = dimDiamond2.getWidth();
+ return getTranslateDiamond2(stringBounder).getTranslated(new Point2D.Double(x, dimDiamond2.getOutY()));
+ }
+
+ public void drawU(UGraphic ug) {
+ final StringBounder stringBounder = ug.getStringBounder();
+
+ final Point2D p1 = getP1(stringBounder);
+ if (calculateDimension(stringBounder).hasPointOut() == false) {
+ return;
+ }
+ final Point2D p2 = getP2(stringBounder);
+ final Point2D p3 = getP3(stringBounder);
+
+ final double x1 = p1.getX();
+ final double y1 = p1.getY();
+ final double x2 = p2.getX();
+ final double y2 = p2.getY();
+
+ final double x3 = p3.getX();
+ final double y3 = p3.getY();
+
+ final FtileGeometry thenGeom = thenBlock.calculateDimension(stringBounder);
+ final double xmax = Math.max(x1 + Diamond.diamondHalfSize, getTranslateForThen(stringBounder).getDx()
+ + thenGeom.getWidth());
+
+ final Snake snake = new Snake(arrowHorizontalAlignment(), endInlinkColor);
+ snake.addPoint(xmax, y2);
+ // ug.apply(new UTranslate(xmax, y2 - Diamond.diamondHalfSize)).draw(new UEmpty(5,
+ // Diamond.diamondHalfSize));
+ snake.addPoint(x2, y2);
+ snake.addPoint(x3, y3);
+ snake.goUnmergeable(MergeStrategy.NONE);
+ ug.draw(snake);
+
+ }
+ }
+
public void drawU(UGraphic ug) {
final StringBounder stringBounder = ug.getStringBounder();
ug.apply(getTranslateForThen(stringBounder)).draw(thenBlock);
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileRepeat.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileRepeat.java
index 339806304..323e3ace0 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileRepeat.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileRepeat.java
@@ -73,6 +73,7 @@ import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.svek.ConditionStyle;
import net.sourceforge.plantuml.ugraphic.UGraphic;
+import net.sourceforge.plantuml.ugraphic.UPolygon;
import net.sourceforge.plantuml.ugraphic.UTranslate;
class FtileRepeat extends AbstractFtile {
@@ -124,6 +125,7 @@ class FtileRepeat extends AbstractFtile {
final TextBlock outTb = out.create(fcArrow, HorizontalAlignment.LEFT, spriteContainer);
final Ftile diamond1;
+ assert swimlane == repeat.getSwimlaneIn();
if (backStart == null) {
diamond1 = new FtileDiamond(repeat.skinParam(), backColor, borderColor, repeat.getSwimlaneIn());
} else {
@@ -159,7 +161,7 @@ class FtileRepeat extends AbstractFtile {
final Display backLink1 = backRepeatLinkRendering.getDisplay();
final TextBlock tbbackLink1 = backLink1 == null ? null : backLink1.create(fcArrow, HorizontalAlignment.LEFT,
spriteContainer, CreoleMode.SIMPLE_LINE);
- if (repeat.getSwimlaneIn() == repeat.getSwimlaneOut()) {
+ if (repeat.getSwimlaneIn() == swimlaneOut) {
if (backward == null) {
conns.add(result.new ConnectionBackSimple(backRepeatLinkRendering.getRainbow(arrowColor), tbbackLink1));
} else {
@@ -295,8 +297,6 @@ class FtileRepeat extends AbstractFtile {
public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
final StringBounder stringBounder = ug.getStringBounder();
- final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToLeft());
- snake.emphasizeDirection(Direction.UP);
final Dimension2D dimRepeat = repeat.calculateDimension(stringBounder);
Point2D p1 = getP1(stringBounder);
@@ -306,11 +306,20 @@ class FtileRepeat extends AbstractFtile {
final Dimension2D dimDiamond1 = diamond1.calculateDimension(stringBounder);
final Dimension2D dimDiamond2 = diamond2.calculateDimension(stringBounder);
final double y1 = p1.getY() + dimDiamond2.getHeight() / 2;
- final double x2 = p2.getX() + dimDiamond1.getWidth();
+ double x2 = p2.getX() + dimDiamond1.getWidth();
final double y2 = p2.getY() + dimDiamond1.getHeight() / 2;
final double xmax = p1.getX() + dimDiamond2.getWidth() / 2 + dimRepeat.getWidth() / 2
+ Diamond.diamondHalfSize;
+
+ UPolygon arrow = Arrows.asToLeft();
+ if (xmax < x2) {
+ arrow = Arrows.asToRight();
+ x2 = p2.getX();
+ }
+ final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, arrow);
+ snake.emphasizeDirection(Direction.UP);
+
snake.addPoint(xmax, y1);
snake.addPoint(xmax, y2);
snake.addPoint(x2, y2);
@@ -434,7 +443,7 @@ class FtileRepeat extends AbstractFtile {
}
- class ConnectionBackSimple extends AbstractConnection {
+ class ConnectionBackSimple extends AbstractConnection implements ConnectionTranslatable {
private final Rainbow arrowColor;
private final TextBlock tbback;
@@ -477,6 +486,34 @@ class FtileRepeat extends AbstractFtile {
ug.draw(snake);
}
+ public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
+ final StringBounder stringBounder = ug.getStringBounder();
+ final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToLeft());
+ snake.setLabel(tbback);
+ snake.emphasizeDirection(Direction.UP);
+ final Dimension2D dimRepeat = repeat.calculateDimension(stringBounder);
+
+ Point2D p1 = getP1(stringBounder);
+ Point2D p2 = getP2(stringBounder);
+ p1 = translate1.getTranslated(p1);
+ p2 = translate2.getTranslated(p2);
+ final Dimension2D dimDiamond1 = diamond1.calculateDimension(stringBounder);
+ final Dimension2D dimDiamond2 = diamond2.calculateDimension(stringBounder);
+ final double x1 = p1.getX() + dimDiamond2.getWidth();
+ final double y1 = p1.getY() + dimDiamond2.getHeight() / 2;
+ final double x2 = p2.getX() + dimDiamond1.getWidth();
+ final double y2 = p2.getY() + dimDiamond1.getHeight() / 2;
+
+ snake.addPoint(x1, y1);
+ final double xmax = p1.getX() + dimDiamond2.getWidth() / 2 + dimRepeat.getWidth() / 2
+ + Diamond.diamondHalfSize;
+ snake.addPoint(xmax, y1);
+ snake.addPoint(xmax, y2);
+ snake.addPoint(x2, y2);
+
+ ug.draw(snake);
+ }
+
}
public void drawU(UGraphic ug) {
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/VCompactFactory.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/VCompactFactory.java
index 34c91ace8..fb35db333 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/VCompactFactory.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/VCompactFactory.java
@@ -136,7 +136,7 @@ public class VCompactFactory implements FtileFactory {
}
public Ftile createIf(Swimlane swimlane, List thens, Branch elseBranch, LinkRendering afterEndwhile,
- LinkRendering topInlinkRendering) {
+ LinkRendering topInlinkRendering, Url url) {
final List ftiles = new ArrayList();
for (Branch branch : thens) {
ftiles.add(branch.getFtile());
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/ConditionalBuilder.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/ConditionalBuilder.java
index 16438ea65..fc0d75573 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/ConditionalBuilder.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/ConditionalBuilder.java
@@ -39,6 +39,7 @@ import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.LineBreakStrategy;
+import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.activitydiagram3.Branch;
import net.sourceforge.plantuml.activitydiagram3.ftile.Diamond;
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
@@ -46,6 +47,7 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.FtileEmpty;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileMinWidth;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileUtils;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileWithUrl;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.FtileIfDown;
import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamond;
@@ -62,6 +64,7 @@ import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.Rainbow;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock;
+import net.sourceforge.plantuml.svek.ConditionEndStyle;
import net.sourceforge.plantuml.svek.ConditionStyle;
public class ConditionalBuilder {
@@ -72,6 +75,7 @@ public class ConditionalBuilder {
private final Rainbow arrowColor;
private final FtileFactory ftileFactory;
private final ConditionStyle conditionStyle;
+ private final ConditionEndStyle conditionEndStyle;
private final Branch branch1;
private final Branch branch2;
private final ISkinParam skinParam;
@@ -81,22 +85,26 @@ public class ConditionalBuilder {
private final Ftile tile1;
private final Ftile tile2;
+ private final Url url;
public ConditionalBuilder(Swimlane swimlane, HtmlColor borderColor, HtmlColor backColor, Rainbow arrowColor,
- FtileFactory ftileFactory, ConditionStyle conditionStyle, Branch branch1, Branch branch2,
- ISkinParam skinParam, StringBounder stringBounder, FontConfiguration fontArrow, FontConfiguration fontTest) {
+ FtileFactory ftileFactory, ConditionStyle conditionStyle, ConditionEndStyle conditionEndStyle,
+ Branch branch1, Branch branch2, ISkinParam skinParam, StringBounder stringBounder,
+ FontConfiguration fontArrow, FontConfiguration fontTest, Url url) {
this.swimlane = swimlane;
this.borderColor = borderColor;
this.backColor = backColor;
this.arrowColor = arrowColor;
this.ftileFactory = ftileFactory;
this.conditionStyle = conditionStyle;
+ this.conditionEndStyle = conditionEndStyle;
this.branch1 = branch1;
this.branch2 = branch2;
this.skinParam = skinParam;
this.stringBounder = stringBounder;
this.fontArrow = fontArrow;
this.fontTest = fontTest;
+ this.url = url;
this.tile1 = new FtileMinWidth(branch1.getFtile(), 30);
this.tile2 = new FtileMinWidth(branch2.getFtile(), 30);
@@ -104,10 +112,12 @@ public class ConditionalBuilder {
}
static public Ftile create(Swimlane swimlane, HtmlColor borderColor, HtmlColor backColor, Rainbow arrowColor,
- FtileFactory ftileFactory, ConditionStyle conditionStyle, Branch branch1, Branch branch2,
- ISkinParam skinParam, StringBounder stringBounder, FontConfiguration fcArrow, FontConfiguration fcTest) {
+ FtileFactory ftileFactory, ConditionStyle conditionStyle, ConditionEndStyle conditionEndStyle,
+ Branch branch1, Branch branch2, ISkinParam skinParam, StringBounder stringBounder,
+ FontConfiguration fcArrow, FontConfiguration fcTest, Url url) {
final ConditionalBuilder builder = new ConditionalBuilder(swimlane, borderColor, backColor, arrowColor,
- ftileFactory, conditionStyle, branch1, branch2, skinParam, stringBounder, fcArrow, fcTest);
+ ftileFactory, conditionStyle, conditionEndStyle, branch1, branch2, skinParam, stringBounder, fcArrow,
+ fcTest, url);
if (isEmptyOrOnlySingleStopOrSpot(branch2) && isEmptyOrOnlySingleStopOrSpot(branch1) == false) {
return builder.createDown(builder.branch1, builder.branch2);
}
@@ -138,18 +148,20 @@ public class ConditionalBuilder {
final Ftile diamond2 = getDiamond2(branch1, branch2, true);
if (branch2.isOnlySingleStopOrSpot()) {
return FtileIfDown.create(diamond1, diamond2, swimlane, FtileUtils.addHorizontalMargin(tile1, 10),
- arrowColor, ftileFactory, branch2.getFtile(), branch2.getInlinkRenderingColorAndStyle());
+ arrowColor, conditionEndStyle, ftileFactory, branch2.getFtile(),
+ branch2.getInlinkRenderingColorAndStyle());
}
if (branch1.isOnlySingleStopOrSpot()) {
return FtileIfDown.create(diamond1, diamond2, swimlane, FtileUtils.addHorizontalMargin(tile2, 10),
- arrowColor, ftileFactory, branch1.getFtile(), branch1.getInlinkRenderingColorAndStyle());
+ arrowColor, conditionEndStyle, ftileFactory, branch1.getFtile(),
+ branch1.getInlinkRenderingColorAndStyle());
}
if (branch1.isEmpty()) {
return FtileIfDown.create(diamond1, diamond2, swimlane, FtileUtils.addHorizontalMargin(tile2, 10),
- arrowColor, ftileFactory, null, null);
+ arrowColor, conditionEndStyle, ftileFactory, null, null);
}
return FtileIfDown.create(diamond1, diamond2, swimlane, FtileUtils.addHorizontalMargin(tile1, 10), arrowColor,
- ftileFactory, null, branch2.getInlinkRenderingColorAndStyle());
+ conditionEndStyle, ftileFactory, null, branch2.getInlinkRenderingColorAndStyle());
}
private Ftile createNude() {
@@ -173,12 +185,15 @@ public class ConditionalBuilder {
}
private Ftile createWithLinks() {
- final Ftile diamond1 = getDiamond1(true);
+ Ftile diamond1 = getDiamond1(true);
+ if (url != null) {
+ diamond1 = new FtileWithUrl(diamond1, url);
+ }
final Ftile diamond2 = getDiamond2(branch1, branch2, false);
final Ftile tmp1 = FtileUtils.addHorizontalMargin(tile1, 10);
final Ftile tmp2 = FtileUtils.addHorizontalMargin(tile2, 10);
final FtileIfWithLinks ftile = new FtileIfWithLinks(diamond1, tmp1, tmp2, diamond2, swimlane, arrowColor,
- stringBounder);
+ conditionEndStyle, stringBounder);
final Dimension2D label1 = getLabelPositive(branch1).calculateDimension(stringBounder);
final Dimension2D label2 = getLabelPositive(branch2).calculateDimension(stringBounder);
final double diff1 = ftile.computeMarginNeedForBranchLabe1(stringBounder, label1);
@@ -232,6 +247,10 @@ public class ConditionalBuilder {
private Ftile getDiamond2(Branch branch1, Branch branch2, boolean useNorth) {
final Ftile diamond2;
+ if (conditionEndStyle == ConditionEndStyle.HLINE) {
+ return new FtileEmpty(tile1.skinParam(), 0, Diamond.diamondHalfSize, swimlane, swimlane);
+ }
+ // else use default ConditionEndStyle.DIAMOND
if (hasTwoBranches()) {
final Display out1 = branch1.getFtile().getOutLinkRendering().getDisplay();
final TextBlock tbout1 = out1 == null ? null : out1.create(fontArrow, HorizontalAlignment.LEFT,
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileIfWithLinks.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileIfWithLinks.java
index c6b55621a..afcf468f3 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileIfWithLinks.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileIfWithLinks.java
@@ -54,20 +54,25 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.FtileUtils;
import net.sourceforge.plantuml.activitydiagram3.ftile.MergeStrategy;
import net.sourceforge.plantuml.activitydiagram3.ftile.Snake;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
+import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.UGraphicInterceptorOneSwimlane;
import net.sourceforge.plantuml.graphic.Rainbow;
import net.sourceforge.plantuml.graphic.StringBounder;
+import net.sourceforge.plantuml.graphic.TextBlock;
+import net.sourceforge.plantuml.svek.ConditionEndStyle;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UPolygon;
import net.sourceforge.plantuml.ugraphic.UTranslate;
public class FtileIfWithLinks extends FtileIfWithDiamonds {
+ private final ConditionEndStyle conditionEndStyle;
private final Rainbow arrowColor;
public FtileIfWithLinks(Ftile diamond1, Ftile tile1, Ftile tile2, Ftile diamond2, Swimlane in, Rainbow arrowColor,
- StringBounder stringBounder) {
+ ConditionEndStyle conditionEndStyle, StringBounder stringBounder) {
super(diamond1, tile1, tile2, diamond2, in, stringBounder);
this.arrowColor = arrowColor;
+ this.conditionEndStyle = conditionEndStyle;
if (arrowColor.size() == 0) {
throw new IllegalArgumentException();
}
@@ -369,25 +374,149 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds {
}
+ // copied from FtileIfLongHorizontal to use with ConditionEndStyle.HLINE
+ class ConnectionVerticalOut extends AbstractConnection {
+
+ private final Rainbow color;
+ private final TextBlock out2;
+
+ public ConnectionVerticalOut(Ftile tile, Rainbow color, TextBlock out2) {
+ super(tile, null);
+ this.color = color;
+ this.out2 = out2;
+ }
+
+ public void drawU(UGraphic ug) {
+ final StringBounder stringBounder = ug.getStringBounder();
+
+ final FtileGeometry geo = getFtile1().calculateDimension(stringBounder);
+ if (geo.hasPointOut() == false) {
+ return;
+ }
+
+ final Point2D p1 = geo.translate(translate(stringBounder)).getPointOut();
+
+ final double totalHeight = calculateDimensionInternal(stringBounder).getHeight();
+ // final Point2D p1 = getP1(stringBounder);
+ if (p1 == null) {
+ return;
+ }
+ final Point2D p2 = new Point2D.Double(p1.getX(), totalHeight);
+
+ final Snake snake = new Snake(arrowHorizontalAlignment(), color, Arrows.asToDown());
+ snake.setLabel(out2);
+ snake.addPoint(p1);
+ snake.addPoint(p2);
+ ug.draw(snake);
+ }
+
+ private UTranslate translate(StringBounder stringBounder) {
+ if (getFtile1() == tile1) {
+ return getTranslate1(stringBounder);
+ }
+ if (getFtile1() == tile2) {
+ return getTranslate2(stringBounder);
+ }
+ throw new IllegalStateException();
+ }
+ /*
+ * private Point2D getP1(StringBounder stringBounder) {
+ *
+ * final FtileGeometry geo = getFtile1().calculateDimension(stringBounder); if (geo.hasPointOut() == false) {
+ * return null; } final Point2D p = geo.getPointOut(); return getTranslate1(stringBounder).getTranslated(p); }
+ */
+ }
+
+ // copied from FtileIfLongHorizontal to use with ConditionEndStyle.HLINE
+ class ConnectionHline extends AbstractConnection {
+
+ private final Rainbow arrowColor;
+
+ public ConnectionHline(Rainbow arrowColor) {
+ super(null, null);
+ this.arrowColor = arrowColor;
+ }
+
+ public void drawU(UGraphic ug) {
+ final StringBounder stringBounder = ug.getStringBounder();
+ final Dimension2D totalDim = calculateDimensionInternal(stringBounder);
+
+ final Swimlane intoSw;
+ if (ug instanceof UGraphicInterceptorOneSwimlane) {
+ intoSw = ((UGraphicInterceptorOneSwimlane) ug).getSwimlane();
+ } else {
+ intoSw = null;
+ }
+
+ final List all = new ArrayList();
+ all.add(tile1);
+ all.add(tile2);
+ double minX = totalDim.getWidth() / 2;
+ double maxX = totalDim.getWidth() / 2;
+ boolean atLeastOne = false;
+ for (Ftile tmp : all) {
+ if (tmp.calculateDimension(stringBounder).hasPointOut() == false) {
+ continue;
+ }
+ if (intoSw != null && tmp.getSwimlanes().contains(intoSw) == false) {
+ continue;
+ }
+ if (intoSw != null && tmp.getSwimlaneOut() != intoSw) {
+ continue;
+ }
+ atLeastOne = true;
+ final UTranslate ut = getTranslateFor(tmp, stringBounder);
+ final double out = tmp.calculateDimension(stringBounder).translate(ut).getLeft();
+ minX = Math.min(minX, out);
+ maxX = Math.max(maxX, out);
+ }
+ if (atLeastOne == false) {
+ return;
+ }
+
+ final Snake s = new Snake(arrowHorizontalAlignment(), arrowColor);
+ s.goUnmergeable(MergeStrategy.NONE);
+ final double height = totalDim.getHeight();
+ s.addPoint(minX, height);
+ s.addPoint(maxX, height);
+ ug.draw(s);
+ }
+ }
+
public Ftile addLinks(Branch branch1, Branch branch2, StringBounder stringBounder) {
final List conns = new ArrayList();
conns.add(new ConnectionHorizontalThenVertical(tile1, branch1));
conns.add(new ConnectionHorizontalThenVertical(tile2, branch2));
final boolean hasPointOut1 = tile1.calculateDimension(stringBounder).hasPointOut();
final boolean hasPointOut2 = tile2.calculateDimension(stringBounder).hasPointOut();
- if (hasPointOut1 && hasPointOut2) {
- conns.add(new ConnectionVerticalThenHorizontal(tile1, branch1.getInlinkRenderingColorAndStyle(), branch1
- .isEmpty()));
- conns.add(new ConnectionVerticalThenHorizontal(tile2, branch2.getInlinkRenderingColorAndStyle(), branch2
- .isEmpty()));
- } else if (hasPointOut1 && hasPointOut2 == false) {
- conns.add(new ConnectionVerticalThenHorizontalDirect(tile1, branch1.getInlinkRenderingColorAndStyle(),
- branch1.isEmpty()));
- } else if (hasPointOut1 == false && hasPointOut2) {
- conns.add(new ConnectionVerticalThenHorizontalDirect(tile2, branch2.getInlinkRenderingColorAndStyle(),
- branch2.isEmpty()));
+ if (conditionEndStyle == ConditionEndStyle.DIAMOND) {
+ if (hasPointOut1 && hasPointOut2) {
+ conns.add(new ConnectionVerticalThenHorizontal(tile1, branch1.getInlinkRenderingColorAndStyle(),
+ branch1.isEmpty()));
+ conns.add(new ConnectionVerticalThenHorizontal(tile2, branch2.getInlinkRenderingColorAndStyle(),
+ branch2.isEmpty()));
+ } else if (hasPointOut1 && hasPointOut2 == false) {
+ conns.add(new ConnectionVerticalThenHorizontalDirect(tile1, branch1.getInlinkRenderingColorAndStyle(),
+ branch1.isEmpty()));
+ } else if (hasPointOut1 == false && hasPointOut2) {
+ conns.add(new ConnectionVerticalThenHorizontalDirect(tile2, branch2.getInlinkRenderingColorAndStyle(),
+ branch2.isEmpty()));
+ }
+ } else if (conditionEndStyle == ConditionEndStyle.HLINE) {
+ if (hasPointOut1 && hasPointOut2) {
+ conns.add(new ConnectionVerticalOut(tile1, arrowColor, null));
+ conns.add(new ConnectionVerticalOut(tile2, arrowColor, null));
+ conns.add(new ConnectionHline(arrowColor));
+ } else if (hasPointOut1 && hasPointOut2 == false) {
+ // this is called when the "else" has a break statement
+ conns.add(new ConnectionVerticalThenHorizontalDirect(tile1, branch1.getInlinkRenderingColorAndStyle(),
+ branch1.isEmpty()));
+ } else if (hasPointOut1 == false && hasPointOut2) {
+ // this is called when the "if" has a break statement
+ conns.add(new ConnectionVerticalThenHorizontalDirect(tile2, branch2.getInlinkRenderingColorAndStyle(),
+ branch2.isEmpty()));
+ }
}
-
return FtileUtils.addConnection(this, conns);
}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileSwitchNude.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileSwitchNude.java
index 094191b59..347ad7615 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileSwitchNude.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileSwitchNude.java
@@ -52,7 +52,7 @@ import net.sourceforge.plantuml.ugraphic.UTranslate;
public class FtileSwitchNude extends FtileDimensionMemoize {
- protected final double xSeparation = 20;
+ protected double xSeparation = 20;
protected final List tiles;
private final Swimlane in;
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileSwitchWithDiamonds.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileSwitchWithDiamonds.java
index a6ea5a6cc..f69ffd62a 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileSwitchWithDiamonds.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileSwitchWithDiamonds.java
@@ -55,9 +55,18 @@ import net.sourceforge.plantuml.ugraphic.UTranslate;
public class FtileSwitchWithDiamonds extends FtileSwitchNude {
+ private static final double SUPP15 = 15;
+
+ static enum Mode {
+ BIG_DIAMOND, SMALL_DIAMOND
+ };
+
protected final Ftile diamond1;
protected final Ftile diamond2;
protected final List branches;
+ private Mode mode;
+ private final double w13;
+ private final double w9;
public FtileSwitchWithDiamonds(List tiles, List branches, Swimlane in, Ftile diamond1,
Ftile diamond2, StringBounder stringBounder) {
@@ -65,6 +74,24 @@ public class FtileSwitchWithDiamonds extends FtileSwitchNude {
this.branches = branches;
this.diamond1 = diamond1;
this.diamond2 = diamond2;
+
+ w13 = diamond1.calculateDimension(stringBounder).getWidth()
+ - tiles.get(0).calculateDimension(stringBounder).getRight()
+ - tiles.get(tiles.size() - 1).calculateDimension(stringBounder).getLeft();
+ w9 = getW9(stringBounder);
+ if (w13 > w9) {
+ mode = Mode.BIG_DIAMOND;
+ } else {
+ mode = Mode.SMALL_DIAMOND;
+ }
+ }
+
+ private double getW9(StringBounder stringBounder) {
+ double result = 0;
+ for (int i = 1; i < tiles.size() - 1; i++) {
+ result += tiles.get(i).calculateDimension(stringBounder).getWidth();
+ }
+ return result;
}
@Override
@@ -75,11 +102,11 @@ public class FtileSwitchWithDiamonds extends FtileSwitchNude {
return Collections.unmodifiableCollection(result);
}
- public int getYdelta1a(StringBounder stringBounder) {
+ public double getYdelta1a(StringBounder stringBounder) {
return 20;
}
- public int getYdelta1b(StringBounder stringBounder) {
+ public double getYdelta1b(StringBounder stringBounder) {
return 10;
}
@@ -88,11 +115,21 @@ public class FtileSwitchWithDiamonds extends FtileSwitchNude {
final FtileGeometry dim1 = diamond1.calculateDimension(stringBounder);
final FtileGeometry dim2 = diamond2.calculateDimension(stringBounder);
- final FtileGeometry dimNude = super.calculateDimensionInternalSlow(stringBounder);
+ final double nudeHeight = super.calculateDimensionInternalSlow(stringBounder).getHeight();
- final FtileGeometry all = dim1.appendBottom(dimNude).appendBottom(dim2);
+ if (mode == Mode.BIG_DIAMOND) {
+ final double height = dim1.getHeight() + nudeHeight + dim2.getHeight() + getYdelta1a(stringBounder)
+ + getYdelta1b(stringBounder);
+ final FtileGeometry tile0 = tiles.get(0).calculateDimension(stringBounder);
+ final double width = tile0.getWidth() + SUPP15 + w13 + SUPP15
+ + +tiles.get(tiles.size() - 1).calculateDimension(stringBounder).getWidth();
+ return new FtileGeometry(width, height, tile0.getLeft() + SUPP15 + dim1.getLeft(), 0, height);
- return all.addDim(0, getYdelta1a(stringBounder) + getYdelta1b(stringBounder));
+ } else {
+ final FtileGeometry dimNude = super.calculateDimensionInternalSlow(stringBounder);
+ final FtileGeometry all = dim1.appendBottom(dimNude).appendBottom(dim2);
+ return all.addDim(0, getYdelta1a(stringBounder) + getYdelta1b(stringBounder));
+ }
}
@@ -101,13 +138,42 @@ public class FtileSwitchWithDiamonds extends FtileSwitchNude {
final StringBounder stringBounder = ug.getStringBounder();
ug.apply(getTranslateDiamond1(stringBounder)).draw(diamond1);
- super.drawU(ug.apply(getTranslateMain(stringBounder)));
+ if (mode == Mode.BIG_DIAMOND) {
+ for (Ftile tile : tiles) {
+ tile.drawU(ug.apply(getTranslateOf(tile, stringBounder)));
+ }
+ } else {
+ super.drawU(ug.apply(getTranslateMain(stringBounder)));
+ }
ug.apply(getTranslateDiamond2(stringBounder)).draw(diamond2);
}
+ protected UTranslate getTranslateOf(Ftile tile, StringBounder stringBounder) {
+ final UTranslate main = getTranslateMain(stringBounder);
+ if (mode == Mode.BIG_DIAMOND) {
+ double dx = 0;
+ final double suppx = (w13 - w9) / (tiles.size() - 1);
+ for (int i = 0; i < tiles.size() - 1; i++) {
+ if (tile == tiles.get(i)) {
+ return main.compose(new UTranslate(dx, 0));
+ }
+ dx += tiles.get(i).calculateDimension(stringBounder).getWidth() + suppx;
+
+ }
+ if (tile == tiles.get(tiles.size() - 1)) {
+ final double dx9 = tiles.get(0).calculateDimension(stringBounder).getWidth() + w13 + SUPP15 + SUPP15;
+ return main.compose(new UTranslate(dx9, 0));
+ }
+ throw new IllegalArgumentException();
+
+ }
+ return getTranslateNude(tile, stringBounder).compose(main);
+ }
+
protected UTranslate getTranslateMain(StringBounder stringBounder) {
final FtileGeometry dimDiamond1 = diamond1.calculateDimension(stringBounder);
- return new UTranslate(0, dimDiamond1.getHeight() + getYdelta1a(stringBounder));
+ final double dy1 = dimDiamond1.getHeight() + getYdelta1a(stringBounder);
+ return new UTranslate(0, dy1);
}
protected UTranslate getTranslateDiamond1(StringBounder stringBounder) {
@@ -126,15 +192,9 @@ public class FtileSwitchWithDiamonds extends FtileSwitchNude {
return new UTranslate(x2, y2);
}
- protected UTranslate getTranslateOf(Ftile tile, StringBounder stringBounder) {
- return getTranslateNude(tile, stringBounder).compose(getTranslateMain(stringBounder));
- }
-
protected TextBlock getLabelPositive(Branch branch) {
final FontConfiguration fcArrow = new FontConfiguration(skinParam(), FontParam.ARROW, null);
return branch.getLabelPositive().create(fcArrow, HorizontalAlignment.LEFT, skinParam(), CreoleMode.SIMPLE_LINE);
}
-
-
}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileSwitchWithManyLinks.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileSwitchWithManyLinks.java
index cb43d0b09..3cf2ce70c 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileSwitchWithManyLinks.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileSwitchWithManyLinks.java
@@ -162,10 +162,10 @@ public class FtileSwitchWithManyLinks extends FtileSwitchWithDiamonds {
}
- protected UTranslate getTranslateOf(Ftile tile, StringBounder stringBounder) {
- return getTranslateNude(tile, stringBounder).compose(getTranslateMain(stringBounder));
-
- }
+ // protected UTranslate getTranslateOf(Ftile tile, StringBounder stringBounder) {
+ // return getTranslateNude(tile, stringBounder).compose(getTranslateMain(stringBounder));
+ //
+ // }
class ConnectionVerticalTop extends AbstractConnection {
@@ -189,7 +189,7 @@ public class FtileSwitchWithManyLinks extends FtileSwitchWithDiamonds {
final double y2 = p2.getY();
final Snake snake = new Snake(null, arrowHorizontalAlignment(), arrowColor, Arrows.asToDown());
- snake.setLabel(getLabelPositive(branch));
+ snake.setLabel(getLabelPositive(branch), "BOTTOM");
if (x2 < p1d.getX() - margin || x2 > p1b.getX() + margin) {
snake.addPoint(x2, p1d.getY());
snake.addPoint(x2, y2);
@@ -263,6 +263,14 @@ public class FtileSwitchWithManyLinks extends FtileSwitchWithDiamonds {
}
+ public double getYdelta1a(StringBounder stringBounder) {
+ double max = 10;
+ for (Branch branch : branches) {
+ max = Math.max(max, getLabelPositive(branch).calculateDimension(stringBounder).getHeight());
+ }
+ return max + 10;
+ }
+
public Ftile addLinks() {
final List conns = new ArrayList();
conns.add(new ConnectionHorizontalThenVertical(tiles.get(0), branches.get(0)));
diff --git a/src/net/sourceforge/plantuml/bpm/CommandDockedEvent.java b/src/net/sourceforge/plantuml/bpm/CommandDockedEvent.java
index 0f75f491e..2cd4e05e7 100644
--- a/src/net/sourceforge/plantuml/bpm/CommandDockedEvent.java
+++ b/src/net/sourceforge/plantuml/bpm/CommandDockedEvent.java
@@ -38,6 +38,7 @@ package net.sourceforge.plantuml.bpm;
import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
@@ -48,12 +49,12 @@ public class CommandDockedEvent extends SingleLineCommand2 {
super(getRegexConcat());
}
- static RegexConcat getRegexConcat() {
- return new RegexConcat(new RegexLeaf("^"), //
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandDockedEvent.class.getName(), RegexLeaf.start(), //
new RegexLeaf(":"), //
new RegexLeaf("LABEL", "(.*)"), //
new RegexLeaf("STYLE", ";"), //
- new RegexLeaf("$"));
+ RegexLeaf.end());
}
@Override
diff --git a/src/net/sourceforge/plantuml/bpm/CommandElseBranch.java b/src/net/sourceforge/plantuml/bpm/CommandElseBranch.java
index dbdc9ea3d..22e167f06 100644
--- a/src/net/sourceforge/plantuml/bpm/CommandElseBranch.java
+++ b/src/net/sourceforge/plantuml/bpm/CommandElseBranch.java
@@ -38,6 +38,7 @@ package net.sourceforge.plantuml.bpm;
import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
@@ -48,10 +49,10 @@ public class CommandElseBranch extends SingleLineCommand2 {
super(getRegexConcat());
}
- static RegexConcat getRegexConcat() {
- return new RegexConcat(new RegexLeaf("^"), //
- new RegexLeaf("else"), //
- new RegexLeaf("$"));
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandElseBranch.class.getName(), //
+ RegexLeaf.start(), //
+ new RegexLeaf("else"), RegexLeaf.end());
}
@Override
diff --git a/src/net/sourceforge/plantuml/bpm/CommandEndBranch.java b/src/net/sourceforge/plantuml/bpm/CommandEndBranch.java
index 42543dc70..19b327b78 100644
--- a/src/net/sourceforge/plantuml/bpm/CommandEndBranch.java
+++ b/src/net/sourceforge/plantuml/bpm/CommandEndBranch.java
@@ -38,6 +38,7 @@ package net.sourceforge.plantuml.bpm;
import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
@@ -48,10 +49,10 @@ public class CommandEndBranch extends SingleLineCommand2 {
super(getRegexConcat());
}
- static RegexConcat getRegexConcat() {
- return new RegexConcat(new RegexLeaf("^"), //
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandEndBranch.class.getName(), RegexLeaf.start(), //
new RegexLeaf("end branch"), //
- new RegexLeaf("$"));
+ RegexLeaf.end());
}
@Override
diff --git a/src/net/sourceforge/plantuml/bpm/CommandGoto.java b/src/net/sourceforge/plantuml/bpm/CommandGoto.java
index b2395a0ec..ab373af36 100644
--- a/src/net/sourceforge/plantuml/bpm/CommandGoto.java
+++ b/src/net/sourceforge/plantuml/bpm/CommandGoto.java
@@ -38,6 +38,7 @@ package net.sourceforge.plantuml.bpm;
import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
@@ -48,12 +49,12 @@ public class CommandGoto extends SingleLineCommand2 {
super(getRegexConcat());
}
- static RegexConcat getRegexConcat() {
- return new RegexConcat(new RegexLeaf("^"), //
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandGoto.class.getName(), RegexLeaf.start(), //
new RegexLeaf("goto"), //
- new RegexLeaf("[%s]+"), //
+ RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("ID", "([\\p{L}0-9_.@]+)"), //
- new RegexLeaf("$"));
+ RegexLeaf.end());
}
@Override
diff --git a/src/net/sourceforge/plantuml/bpm/CommandMerge.java b/src/net/sourceforge/plantuml/bpm/CommandMerge.java
index eb125332e..20c2d4549 100644
--- a/src/net/sourceforge/plantuml/bpm/CommandMerge.java
+++ b/src/net/sourceforge/plantuml/bpm/CommandMerge.java
@@ -38,6 +38,7 @@ package net.sourceforge.plantuml.bpm;
import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
@@ -48,12 +49,12 @@ public class CommandMerge extends SingleLineCommand2 {
super(getRegexConcat());
}
- static RegexConcat getRegexConcat() {
- return new RegexConcat(new RegexLeaf("^"), //
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandMerge.class.getName(), RegexLeaf.start(), //
new RegexLeaf("ID", "([\\p{L}0-9_.@]+)"), //
new RegexLeaf(":?"), //
new RegexLeaf("\\<\\+\\>"), //
- new RegexLeaf("$"));
+ RegexLeaf.end());
}
@Override
diff --git a/src/net/sourceforge/plantuml/bpm/CommandNewBranch.java b/src/net/sourceforge/plantuml/bpm/CommandNewBranch.java
index 1664095d0..536fa6d21 100644
--- a/src/net/sourceforge/plantuml/bpm/CommandNewBranch.java
+++ b/src/net/sourceforge/plantuml/bpm/CommandNewBranch.java
@@ -38,6 +38,7 @@ package net.sourceforge.plantuml.bpm;
import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
@@ -48,10 +49,10 @@ public class CommandNewBranch extends SingleLineCommand2 {
super(getRegexConcat());
}
- static RegexConcat getRegexConcat() {
- return new RegexConcat(new RegexLeaf("^"), //
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandNewBranch.class.getName(), RegexLeaf.start(), //
new RegexLeaf("new branch"), //
- new RegexLeaf("$"));
+ RegexLeaf.end());
}
@Override
diff --git a/src/net/sourceforge/plantuml/bpm/CommandResume.java b/src/net/sourceforge/plantuml/bpm/CommandResume.java
index cb57fa684..69ca85fb6 100644
--- a/src/net/sourceforge/plantuml/bpm/CommandResume.java
+++ b/src/net/sourceforge/plantuml/bpm/CommandResume.java
@@ -38,6 +38,7 @@ package net.sourceforge.plantuml.bpm;
import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
@@ -48,12 +49,12 @@ public class CommandResume extends SingleLineCommand2 {
super(getRegexConcat());
}
- static RegexConcat getRegexConcat() {
- return new RegexConcat(new RegexLeaf("^"), //
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandResume.class.getName(), RegexLeaf.start(), //
new RegexLeaf("resume"), //
- new RegexLeaf("[%s]+"), //
+ RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("ID", "([\\p{L}0-9_.@]+)"), //
- new RegexLeaf("$"));
+ RegexLeaf.end());
}
@Override
diff --git a/src/net/sourceforge/plantuml/classdiagram/AbstractEntityDiagram.java b/src/net/sourceforge/plantuml/classdiagram/AbstractEntityDiagram.java
index f5b33e3b3..a219e41ed 100644
--- a/src/net/sourceforge/plantuml/classdiagram/AbstractEntityDiagram.java
+++ b/src/net/sourceforge/plantuml/classdiagram/AbstractEntityDiagram.java
@@ -40,11 +40,16 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
+import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.core.DiagramDescription;
import net.sourceforge.plantuml.cucadiagram.CucaDiagram;
public abstract class AbstractEntityDiagram extends CucaDiagram {
+ public AbstractEntityDiagram(ISkinSimple orig) {
+ super(orig);
+ }
+
final protected List getDotStrings() {
final List def = Arrays.asList("nodesep=.35;", "ranksep=0.8;", "edge [fontsize=11,labelfontsize=11];",
"node [fontsize=11,height=.35,width=.55];");
diff --git a/src/net/sourceforge/plantuml/classdiagram/ClassDiagram.java b/src/net/sourceforge/plantuml/classdiagram/ClassDiagram.java
index 5b20ddc83..fc24089bc 100644
--- a/src/net/sourceforge/plantuml/classdiagram/ClassDiagram.java
+++ b/src/net/sourceforge/plantuml/classdiagram/ClassDiagram.java
@@ -39,6 +39,7 @@ import java.io.IOException;
import java.io.OutputStream;
import net.sourceforge.plantuml.FileFormatOption;
+import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.core.ImageData;
import net.sourceforge.plantuml.creole.CreoleMode;
@@ -58,6 +59,10 @@ import net.sourceforge.plantuml.ugraphic.ImageBuilder;
public class ClassDiagram extends AbstractClassOrObjectDiagram {
+ public ClassDiagram(ISkinSimple skinParam) {
+ super(skinParam);
+ }
+
private final String getNamespace(Code fullyCode) {
return getNamespace(fullyCode, fullyCode.getSeparator());
}
diff --git a/src/net/sourceforge/plantuml/classdiagram/ClassDiagramFactory.java b/src/net/sourceforge/plantuml/classdiagram/ClassDiagramFactory.java
index aaf88693a..dbe7568ce 100644
--- a/src/net/sourceforge/plantuml/classdiagram/ClassDiagramFactory.java
+++ b/src/net/sourceforge/plantuml/classdiagram/ClassDiagramFactory.java
@@ -38,6 +38,7 @@ package net.sourceforge.plantuml.classdiagram;
import java.util.ArrayList;
import java.util.List;
+import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.classdiagram.command.CommandAddMethod;
import net.sourceforge.plantuml.classdiagram.command.CommandAllowMixing;
@@ -77,10 +78,15 @@ import net.sourceforge.plantuml.objectdiagram.command.CommandCreateEntityObjectM
public class ClassDiagramFactory extends UmlDiagramFactory {
+ private final ISkinSimple skinParam;
+
+ public ClassDiagramFactory(ISkinSimple skinParam) {
+ this.skinParam = skinParam;
+ }
+
@Override
public ClassDiagram createEmptyDiagram() {
- return new ClassDiagram();
-
+ return new ClassDiagram(skinParam);
}
@Override
@@ -93,7 +99,7 @@ public class ClassDiagramFactory extends UmlDiagramFactory {
cmds.add(new CommandPage());
cmds.add(new CommandAddMethod());
-
+
addCommonHides(cmds);
cmds.add(new CommandHideShow2());
@@ -110,7 +116,7 @@ public class ClassDiagramFactory extends UmlDiagramFactory {
cmds.add(new CommandEndPackage());
cmds.add(new CommandPackageEmpty());
cmds.add(new CommandPackageWithUSymbol());
-
+
cmds.add(new CommandCreateElementFull2(Mode.NORMAL_KEYWORD));
cmds.add(new CommandCreateElementFull2(Mode.WITH_MIX_PREFIX));
final FactoryNoteCommand factoryNoteCommand = new FactoryNoteCommand();
@@ -124,13 +130,13 @@ public class ClassDiagramFactory extends UmlDiagramFactory {
cmds.add(new CommandImport());
- final FactoryTipOnEntityCommand factoryTipOnEntityCommand = new FactoryTipOnEntityCommand(new RegexLeaf(
+ final FactoryTipOnEntityCommand factoryTipOnEntityCommand = new FactoryTipOnEntityCommand("a", new RegexLeaf(
"ENTITY", "(" + CommandCreateClass.CODE_NO_DOTDOT + "|[%g][^%g]+[%g])::([%g][^%g]+[%g]|[^%s]+)"));
cmds.add(factoryTipOnEntityCommand.createMultiLine(true));
cmds.add(factoryTipOnEntityCommand.createMultiLine(false));
- final FactoryNoteOnEntityCommand factoryNoteOnEntityCommand = new FactoryNoteOnEntityCommand(new RegexLeaf(
- "ENTITY", "(" + CommandCreateClass.CODE + "|[%g][^%g]+[%g])"));
+ final FactoryNoteOnEntityCommand factoryNoteOnEntityCommand = new FactoryNoteOnEntityCommand("class",
+ new RegexLeaf("ENTITY", "(" + CommandCreateClass.CODE + "|[%g][^%g]+[%g])"));
cmds.add(factoryNoteOnEntityCommand.createSingleLine());
cmds.add(new CommandUrl());
diff --git a/src/net/sourceforge/plantuml/classdiagram/command/CommandAddMethod.java b/src/net/sourceforge/plantuml/classdiagram/command/CommandAddMethod.java
index 926c2587f..65d200f40 100644
--- a/src/net/sourceforge/plantuml/classdiagram/command/CommandAddMethod.java
+++ b/src/net/sourceforge/plantuml/classdiagram/command/CommandAddMethod.java
@@ -35,26 +35,39 @@
*/
package net.sourceforge.plantuml.classdiagram.command;
-import java.util.List;
-
+import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.classdiagram.ClassDiagram;
import net.sourceforge.plantuml.command.CommandExecutionResult;
-import net.sourceforge.plantuml.command.SingleLineCommand;
+import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.IRegex;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.skin.VisibilityModifier;
-public class CommandAddMethod extends SingleLineCommand {
+public class CommandAddMethod extends SingleLineCommand2 {
public CommandAddMethod() {
- super("(?i)^([\\p{L}0-9_.]+|[%g][^%g]+[%g])[%s]+:[%s]+(.*)$");
+ super(getRegexConcat());
+ }
+
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandAddMethod.class.getName(), RegexLeaf.start(), //
+ new RegexLeaf("NAME", "([\\p{L}0-9_.]+|[%g][^%g]+[%g])"), //
+ RegexLeaf.spaceOneOrMore(), //
+ new RegexLeaf(":"), //
+ RegexLeaf.spaceOneOrMore(), //
+ new RegexLeaf("DATA", "(.*)"), //
+ RegexLeaf.end()); //
}
@Override
- protected CommandExecutionResult executeArg(ClassDiagram system, List arg) {
- final IEntity entity = system.getOrCreateLeaf(Code.of(arg.get(0)), null, null);
+ protected CommandExecutionResult executeArg(ClassDiagram system, LineLocation location, RegexResult arg) {
+ final IEntity entity = system.getOrCreateLeaf(Code.of(arg.get("NAME", 0)), null, null);
- final String field = arg.get(1);
+ final String field = arg.get("DATA", 0);
if (field.length() > 0 && VisibilityModifier.isVisibilityCharacter(field)) {
system.setVisibilityModifierPresent(true);
}
diff --git a/src/net/sourceforge/plantuml/classdiagram/command/CommandAllowMixing.java b/src/net/sourceforge/plantuml/classdiagram/command/CommandAllowMixing.java
index 3665869e9..9028fded5 100644
--- a/src/net/sourceforge/plantuml/classdiagram/command/CommandAllowMixing.java
+++ b/src/net/sourceforge/plantuml/classdiagram/command/CommandAllowMixing.java
@@ -39,6 +39,7 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.classdiagram.ClassDiagram;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
@@ -49,11 +50,11 @@ public class CommandAllowMixing extends SingleLineCommand2 {
super(getRegexConcat());
}
- private static RegexConcat getRegexConcat() {
+ private static IRegex getRegexConcat() {
- return new RegexConcat(new RegexLeaf("^"), //
+ return RegexConcat.build(CommandAllowMixing.class.getName(), RegexLeaf.start(), //
new RegexLeaf("allow_?mixing"), //
- new RegexLeaf("$"));
+ RegexLeaf.end());
}
@Override
diff --git a/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClass.java b/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClass.java
index 2c8d8eab1..828cad7e2 100644
--- a/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClass.java
+++ b/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClass.java
@@ -44,8 +44,10 @@ import net.sourceforge.plantuml.UrlBuilder.ModeUrl;
import net.sourceforge.plantuml.classdiagram.ClassDiagram;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexOptional;
import net.sourceforge.plantuml.command.regex.RegexOr;
import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Code;
@@ -73,35 +75,39 @@ public class CommandCreateClass extends SingleLineCommand2 {
super(getRegexConcat());
}
- private static RegexConcat getRegexConcat() {
- return new RegexConcat(new RegexLeaf("^"), //
+ private static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandCreateClass.class.getName(), RegexLeaf.start(), //
new RegexLeaf("TYPE", //
"(interface|enum|annotation|abstract[%s]+class|abstract|class|entity|circle|diamond)[%s]+"), //
new RegexOr(//
new RegexConcat(//
new RegexLeaf("DISPLAY1", DISPLAY_WITH_GENERIC), //
- new RegexLeaf("[%s]+as[%s]+"), //
+ RegexLeaf.spaceOneOrMore(), //
+ new RegexLeaf("as"), //
+ RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("CODE1", "(" + CODE + ")")), //
new RegexConcat(//
new RegexLeaf("CODE2", "(" + CODE + ")"), //
- new RegexLeaf("[%s]+as[%s]+"), // //
+ RegexLeaf.spaceOneOrMore(), //
+ new RegexLeaf("as"), //
+ RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("DISPLAY2", DISPLAY_WITH_GENERIC)), //
new RegexLeaf("CODE3", "(" + CODE + ")"), //
new RegexLeaf("CODE4", "[%g]([^%g]+)[%g]")), //
- new RegexLeaf("GENERIC", "(?:[%s]*\\<(" + GenericRegexProducer.PATTERN + ")\\>)?"), //
- new RegexLeaf("[%s]*"), //
+ new RegexOptional(new RegexConcat(RegexLeaf.spaceZeroOrMore(), new RegexLeaf("GENERIC", "\\<(" + GenericRegexProducer.PATTERN + ")\\>"))), //
+ RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREO", "(\\<{2}.*\\>{2})?"), //
- new RegexLeaf("[%s]*"), //
+ RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("TAGS", Stereotag.pattern() + "?"), //
- new RegexLeaf("[%s]*"), //
+ RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), //
- new RegexLeaf("[%s]*"), //
+ RegexLeaf.spaceZeroOrMore(), //
color().getRegex(), //
- new RegexLeaf("[%s]*"), //
- new RegexLeaf("LINECOLOR", "(?:##(?:\\[(dotted|dashed|bold)\\])?(\\w+)?)?"), //
- new RegexLeaf("EXTENDS", "([%s]+(extends)[%s]+(" + CommandCreateClassMultilines.CODES + "))?"), //
- new RegexLeaf("IMPLEMENTS", "([%s]+(implements)[%s]+(" + CommandCreateClassMultilines.CODES + "))?"), //
- new RegexLeaf("$"));
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexOptional(new RegexConcat(new RegexLeaf("##"), new RegexLeaf("LINECOLOR", "(?:\\[(dotted|dashed|bold)\\])?(\\w+)?"))), //
+ new RegexOptional(new RegexConcat(RegexLeaf.spaceOneOrMore(), new RegexLeaf("EXTENDS", "(extends)[%s]+(" + CommandCreateClassMultilines.CODES + ")"))), //
+ new RegexOptional(new RegexConcat(RegexLeaf.spaceOneOrMore(), new RegexLeaf("IMPLEMENTS", "(implements)[%s]+(" + CommandCreateClassMultilines.CODES + ")"))), //
+ RegexLeaf.end());
}
private static ColorParser color() {
diff --git a/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClassMultilines.java b/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClassMultilines.java
index 78cef5920..8fb68e0e9 100644
--- a/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClassMultilines.java
+++ b/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClassMultilines.java
@@ -46,8 +46,10 @@ import net.sourceforge.plantuml.command.BlocLines;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.CommandMultilines2;
import net.sourceforge.plantuml.command.MultilinesStrategy;
+import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexOptional;
import net.sourceforge.plantuml.command.regex.RegexOr;
import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Code;
@@ -85,35 +87,44 @@ public class CommandCreateClassMultilines extends CommandMultilines2)?"), //
- new RegexLeaf("[%s]*"), //
+ new RegexOptional(new RegexConcat(RegexLeaf.spaceZeroOrMore(), new RegexLeaf("GENERIC", "\\<(" + GenericRegexProducer.PATTERN + ")\\>"))), //
+ RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREO", "(\\<\\<.+\\>\\>)?"), //
- new RegexLeaf("[%s]*"), //
+ RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("TAGS", Stereotag.pattern() + "?"), //
- new RegexLeaf("[%s]*"), //
+ RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), //
- new RegexLeaf("[%s]*"), //
+ RegexLeaf.spaceZeroOrMore(), //
color().getRegex(), //
- new RegexLeaf("[%s]*"), //
- new RegexLeaf("LINECOLOR", "(?:##(?:\\[(dotted|dashed|bold)\\])?(\\w+)?)?"), //
- new RegexLeaf("EXTENDS", "([%s]+(extends)[%s]+(" + CODES + "))?"), //
- new RegexLeaf("IMPLEMENTS", "([%s]+(implements)[%s]+(" + CODES + "))?"), //
- new RegexLeaf("[%s]*\\{[%s]*$"));
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexOptional(new RegexConcat(new RegexLeaf("##"), new RegexLeaf("LINECOLOR", "(?:\\[(dotted|dashed|bold)\\])?(\\w+)?"))), //
+ new RegexOptional(new RegexConcat(RegexLeaf.spaceOneOrMore(), new RegexLeaf("EXTENDS", "(extends)[%s]+(" + CommandCreateClassMultilines.CODES + ")"))), //
+ new RegexOptional(new RegexConcat(RegexLeaf.spaceOneOrMore(), new RegexLeaf("IMPLEMENTS", "(implements)[%s]+(" + CommandCreateClassMultilines.CODES + ")"))), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexLeaf("\\{"), //
+ RegexLeaf.spaceZeroOrMore(), //
+ RegexLeaf.end() //
+ );
}
@Override
@@ -127,7 +138,7 @@ public class CommandCreateClassMultilines extends CommandMultilines2
if (mode == Mode.WITH_MIX_PREFIX) {
regex = "mix_" + regex;
}
- return new RegexConcat(new RegexLeaf("^"), //
+ return RegexConcat.build(CommandCreateElementFull2.class.getName() + mode, RegexLeaf.start(), //
new RegexLeaf("SYMBOL", regex), //
- new RegexLeaf("[%s]*"), //
+ RegexLeaf.spaceZeroOrMore(), //
new RegexOr(//
new RegexLeaf("CODE1", CommandCreateElementFull.CODE_WITH_QUOTE), //
new RegexConcat(//
new RegexLeaf("DISPLAY2", CommandCreateElementFull.DISPLAY), //
- new RegexLeaf("STEREOTYPE2", "(?:[%s]+(\\<\\<.+\\>\\>))?"), //
- new RegexLeaf("[%s]*as[%s]+"), //
+ new RegexOptional( //
+ new RegexConcat( //
+ RegexLeaf.spaceOneOrMore(), //
+ new RegexLeaf("STEREOTYPE2", "(\\<\\<.+\\>\\>)") //
+ )), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexLeaf("as"), //
+ RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("CODE2", CommandCreateElementFull.CODE)) //
), //
- new RegexLeaf("STEREOTYPE", "(?:[%s]*(\\<\\<.+\\>\\>))?"), //
- new RegexLeaf("[%s]*"), //
+ new RegexOptional( //
+ new RegexConcat( //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexLeaf("STEREOTYPE", "(\\<\\<.+\\>\\>)")//
+ )), //
+ RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("TAGS", Stereotag.pattern() + "?"), //
- new RegexLeaf("[%s]*"), //
+ RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), //
- new RegexLeaf("[%s]*"), //
- ColorParser.exp1(), //
- new RegexLeaf("$"));
+ RegexLeaf.spaceZeroOrMore(), //
+ ColorParser.exp1(), RegexLeaf.end());
}
-
-
@Override
final protected boolean isForbidden(CharSequence line) {
if (line.toString().matches("^[\\p{L}0-9_.]+$")) {
@@ -113,8 +121,7 @@ public class CommandCreateElementFull2 extends SingleLineCommand2
@Override
protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg) {
if (mode == Mode.NORMAL_KEYWORD && diagram.isAllowMixing() == false) {
- return CommandExecutionResult
- .error("Use 'allowmixing' if you want to mix classes and other UML elements.");
+ return CommandExecutionResult.error("Use 'allowmixing' if you want to mix classes and other UML elements.");
}
String codeRaw = arg.getLazzy("CODE", 0);
final String displayRaw = arg.getLazzy("DISPLAY", 0);
diff --git a/src/net/sourceforge/plantuml/classdiagram/command/CommandDiamondAssociation.java b/src/net/sourceforge/plantuml/classdiagram/command/CommandDiamondAssociation.java
index cd94dead4..d684d8b85 100644
--- a/src/net/sourceforge/plantuml/classdiagram/command/CommandDiamondAssociation.java
+++ b/src/net/sourceforge/plantuml/classdiagram/command/CommandDiamondAssociation.java
@@ -35,26 +35,37 @@
*/
package net.sourceforge.plantuml.classdiagram.command;
-import java.util.List;
-
+import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.classdiagram.ClassDiagram;
import net.sourceforge.plantuml.command.CommandExecutionResult;
-import net.sourceforge.plantuml.command.SingleLineCommand;
+import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.IRegex;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.LeafType;
-public class CommandDiamondAssociation extends SingleLineCommand {
+public class CommandDiamondAssociation extends SingleLineCommand2 {
public CommandDiamondAssociation() {
- super("(?i)^\\<\\>[%s]*([\\p{L}0-9_.]+)$");
+ super(getRegexConcat());
+ }
+
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandDiamondAssociation.class.getName(), RegexLeaf.start(), //
+ new RegexLeaf("\\<\\>"), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexLeaf("CODE", "([\\p{L}0-9_.]+)"), //
+ RegexLeaf.end()); //
}
@Override
- protected CommandExecutionResult executeArg(ClassDiagram diagram, List arg) {
- final Code code = Code.of(arg.get(0));
+ protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg) {
+ final Code code = Code.of(arg.get("CODE", 0));
if (diagram.leafExist(code)) {
- return CommandExecutionResult.error("Already existing : "+code.getFullName());
+ return CommandExecutionResult.error("Already existing : " + code.getFullName());
}
diagram.createLeaf(code, Display.NULL, LeafType.ASSOCIATION, null);
diff --git a/src/net/sourceforge/plantuml/classdiagram/command/CommandHideShow2.java b/src/net/sourceforge/plantuml/classdiagram/command/CommandHideShow2.java
index 295273c3e..2750991a2 100644
--- a/src/net/sourceforge/plantuml/classdiagram/command/CommandHideShow2.java
+++ b/src/net/sourceforge/plantuml/classdiagram/command/CommandHideShow2.java
@@ -38,6 +38,7 @@ package net.sourceforge.plantuml.classdiagram.command;
import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
@@ -49,12 +50,12 @@ public class CommandHideShow2 extends SingleLineCommand2 {
super(getRegexConcat());
}
- static RegexConcat getRegexConcat() {
- return new RegexConcat(new RegexLeaf("^"), //
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandHideShow2.class.getName(), RegexLeaf.start(), //
new RegexLeaf("COMMAND", "(hide|hide-class|show|show-class)"), //
- new RegexLeaf("[%s]+"), //
+ RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("WHAT", "(.+)"), //
- new RegexLeaf("$"));
+ RegexLeaf.end());
}
@Override
diff --git a/src/net/sourceforge/plantuml/classdiagram/command/CommandHideShowByGender.java b/src/net/sourceforge/plantuml/classdiagram/command/CommandHideShowByGender.java
index 727a54b3b..d214a8dd1 100644
--- a/src/net/sourceforge/plantuml/classdiagram/command/CommandHideShowByGender.java
+++ b/src/net/sourceforge/plantuml/classdiagram/command/CommandHideShowByGender.java
@@ -43,8 +43,10 @@ import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.UmlDiagram;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexOptional;
import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.EntityGender;
@@ -68,15 +70,19 @@ public class CommandHideShowByGender extends SingleLineCommand2 {
super(getRegexConcat());
}
- static RegexConcat getRegexConcat() {
- return new RegexConcat(new RegexLeaf("^"), //
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandHideShowByGender.class.getName(), RegexLeaf.start(), //
new RegexLeaf("COMMAND", "(hide|show)"), //
- new RegexLeaf("[%s]+"), //
+ RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("GENDER",
"(?:(class|object|interface|enum|annotation|abstract|[\\p{L}0-9_.]+|[%g][^%g]+[%g]|\\<\\<.*\\>\\>)[%s]+)*?"), //
- new RegexLeaf("EMPTY", "(?:(empty)[%s]+)?"), //
+ new RegexOptional( //
+ new RegexConcat( //
+ new RegexLeaf("EMPTY", "(empty)"), //
+ RegexLeaf.spaceOneOrMore()) //
+ ), //
new RegexLeaf("PORTION", "(members?|attributes?|fields?|methods?|circle\\w*|stereotypes?)"), //
- new RegexLeaf("$"));
+ RegexLeaf.end());
}
private final EntityGender emptyByGender(Set portion) {
diff --git a/src/net/sourceforge/plantuml/classdiagram/command/CommandHideShowByVisibility.java b/src/net/sourceforge/plantuml/classdiagram/command/CommandHideShowByVisibility.java
index af8a73a46..f9823fe19 100644
--- a/src/net/sourceforge/plantuml/classdiagram/command/CommandHideShowByVisibility.java
+++ b/src/net/sourceforge/plantuml/classdiagram/command/CommandHideShowByVisibility.java
@@ -45,6 +45,7 @@ import net.sourceforge.plantuml.UmlDiagram;
import net.sourceforge.plantuml.classdiagram.ClassDiagram;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
@@ -62,17 +63,16 @@ public class CommandHideShowByVisibility extends SingleLineCommand2
super(getRegexConcat());
}
- static RegexConcat getRegexConcat() {
- return new RegexConcat(new RegexLeaf("^"), //
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandHideShowByVisibility.class.getName(), RegexLeaf.start(), //
new RegexLeaf("COMMAND", "(hide|show)"), //
- new RegexLeaf("[%s]+"), //
+ RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("VISIBILITY",
"((?:public|private|protected|package)?(?:[,%s]+(?:public|private|protected|package))*)"), //
- new RegexLeaf("[%s]+"), //
- new RegexLeaf("PORTION", "(members?|attributes?|fields?|methods?)"), //
- new RegexLeaf("$"));
+ RegexLeaf.spaceOneOrMore(), //
+ new RegexLeaf("PORTION", "(members?|attributes?|fields?|methods?)"), RegexLeaf.end());
}
-
+
@Override
protected CommandExecutionResult executeArg(UmlDiagram classDiagram, LineLocation location, RegexResult arg) {
if (classDiagram instanceof ClassDiagram) {
@@ -82,7 +82,6 @@ public class CommandHideShowByVisibility extends SingleLineCommand2
return CommandExecutionResult.ok();
}
-
private CommandExecutionResult executeArgClass(ClassDiagram classDiagram, RegexResult arg) {
final Set portion = getEntityPortion(arg.get("PORTION", 0));
diff --git a/src/net/sourceforge/plantuml/classdiagram/command/CommandHideShowSpecificClass.java b/src/net/sourceforge/plantuml/classdiagram/command/CommandHideShowSpecificClass.java
index 484ff4f94..c6fc0fe02 100644
--- a/src/net/sourceforge/plantuml/classdiagram/command/CommandHideShowSpecificClass.java
+++ b/src/net/sourceforge/plantuml/classdiagram/command/CommandHideShowSpecificClass.java
@@ -38,6 +38,7 @@ package net.sourceforge.plantuml.classdiagram.command;
import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
@@ -49,34 +50,33 @@ public class CommandHideShowSpecificClass extends SingleLineCommand2\\>)"), //
- new RegexLeaf("$"));
+ RegexLeaf.spaceOneOrMore(), //
+ new RegexLeaf("STEREOTYPE", "(\\<\\<.*\\>\\>)"), RegexLeaf.end());
}
@Override
protected CommandExecutionResult executeArg(CucaDiagram diagram, LineLocation location, RegexResult arg) {
-// final String stereotype = arg.get("STEREOTYPE", 0);
-// diagram.hideOrShow(new Stereotype(stereotype), arg.get("COMMAND", 0).equalsIgnoreCase("show"));
-//
-// return CommandExecutionResult.ok();
+ // final String stereotype = arg.get("STEREOTYPE", 0);
+ // diagram.hideOrShow(new Stereotype(stereotype), arg.get("COMMAND", 0).equalsIgnoreCase("show"));
+ //
+ // return CommandExecutionResult.ok();
throw new UnsupportedOperationException();
}
}
diff --git a/src/net/sourceforge/plantuml/classdiagram/command/CommandImport.java b/src/net/sourceforge/plantuml/classdiagram/command/CommandImport.java
index 2f5c58092..0fd64eb09 100644
--- a/src/net/sourceforge/plantuml/classdiagram/command/CommandImport.java
+++ b/src/net/sourceforge/plantuml/classdiagram/command/CommandImport.java
@@ -37,13 +37,17 @@ package net.sourceforge.plantuml.classdiagram.command;
import java.io.File;
import java.io.IOException;
-import java.util.List;
import net.sourceforge.plantuml.FileSystem;
+import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.classdiagram.ClassDiagram;
import net.sourceforge.plantuml.command.CommandExecutionResult;
-import net.sourceforge.plantuml.command.SingleLineCommand;
+import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.IRegex;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.IEntity;
@@ -51,22 +55,32 @@ import net.sourceforge.plantuml.cucadiagram.Link;
import net.sourceforge.plantuml.cucadiagram.LinkDecor;
import net.sourceforge.plantuml.cucadiagram.LinkType;
-public class CommandImport extends SingleLineCommand {
+public class CommandImport extends SingleLineCommand2 {
public CommandImport() {
- super("(?i)^import[%s]+[%g]?([^%g]+)[%g]?$");
+ super(getRegexConcat());
+ }
+
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandImport.class.getName(), //
+ RegexLeaf.start(), //
+ new RegexLeaf("import"), //
+ RegexLeaf.spaceOneOrMore(), //
+ new RegexLeaf("[%g]?"), //
+ new RegexLeaf("NAME", "([^%g]+)"), //
+ new RegexLeaf("[%g]?"), RegexLeaf.end()); //
}
@Override
- protected CommandExecutionResult executeArg(ClassDiagram classDiagram, List arg) {
- final String arg0 = arg.get(0);
+ protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg) {
+ final String arg0 = arg.get("NAME", 0);
try {
final File f = FileSystem.getInstance().getFile(arg0);
if (f.isFile()) {
- includeSimpleFile(classDiagram, f);
+ includeSimpleFile(diagram, f);
} else if (f.isDirectory()) {
- includeDirectory(classDiagram, f);
+ includeDirectory(diagram, f);
}
} catch (IOException e) {
e.printStackTrace();
diff --git a/src/net/sourceforge/plantuml/classdiagram/command/CommandLayoutNewLine.java b/src/net/sourceforge/plantuml/classdiagram/command/CommandLayoutNewLine.java
index b77eccbde..290913d73 100644
--- a/src/net/sourceforge/plantuml/classdiagram/command/CommandLayoutNewLine.java
+++ b/src/net/sourceforge/plantuml/classdiagram/command/CommandLayoutNewLine.java
@@ -39,6 +39,7 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.classdiagram.ClassDiagram;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
@@ -49,11 +50,11 @@ public class CommandLayoutNewLine extends SingleLineCommand2 {
super(getRegexConcat());
}
- private static RegexConcat getRegexConcat() {
+ private static IRegex getRegexConcat() {
- return new RegexConcat(new RegexLeaf("^"), //
+ return RegexConcat.build(CommandLayoutNewLine.class.getName(), RegexLeaf.start(), //
new RegexLeaf("layout_new_line"), //
- new RegexLeaf("$"));
+ RegexLeaf.end());
}
@Override
diff --git a/src/net/sourceforge/plantuml/classdiagram/command/CommandLinkClass.java b/src/net/sourceforge/plantuml/classdiagram/command/CommandLinkClass.java
index b1abad29e..d4426f0d4 100644
--- a/src/net/sourceforge/plantuml/classdiagram/command/CommandLinkClass.java
+++ b/src/net/sourceforge/plantuml/classdiagram/command/CommandLinkClass.java
@@ -49,6 +49,7 @@ import net.sourceforge.plantuml.command.regex.MyPattern;
import net.sourceforge.plantuml.command.regex.Pattern2;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexOptional;
import net.sourceforge.plantuml.command.regex.RegexOr;
import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Code;
@@ -73,12 +74,18 @@ final public class CommandLinkClass extends SingleLineCommand2*+^\\{]|\\|[>\\]]|o\\{|\\|\\{|o\\||\\|\\|)?")), //
-
- new RegexLeaf("[%s]*"), //
- new RegexLeaf("SECOND_LABEL", "(?:[%g]([^%g]+)[%g])?"), new RegexLeaf("[%s]*"), //
+ RegexLeaf.spaceZeroOrMore(), new RegexOptional(new RegexLeaf("SECOND_LABEL", "[%g]([^%g]+)[%g]")), //
+ RegexLeaf.spaceZeroOrMore(), //
new RegexOr( //
new RegexLeaf("ENT2", getClassIdentifier()), //
new RegexLeaf("COUPLE2", COUPLE)), //
- new RegexLeaf("[%s]*"), //
+ RegexLeaf.spaceZeroOrMore(), //
color().getRegex(), //
- new RegexLeaf("URL", "[%s]*(" + UrlBuilder.getRegexp() + ")?"), //
- new RegexLeaf("[%s]*"), //
- new RegexLeaf("LABEL_LINK", "(?::[%s]*(.+))?"), //
- new RegexLeaf("$"));
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexOptional( //
+ new RegexConcat( //
+ new RegexLeaf(":"), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexLeaf("LABEL_LINK", "(.+)") //
+ )), RegexLeaf.end());
}
private static ColorParser color() {
@@ -134,7 +145,8 @@ final public class CommandLinkClass extends SingleLineCommand2\\>)?"), //
- new RegexLeaf("[%s]*"), //
- new RegexLeaf("FIRST_LABEL", "(?:[%g]([^%g]+)[%g])?"), //
- new RegexLeaf("[%s]*"), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexOptional(new RegexLeaf("FIRST_LABEL", "[%g]([^%g]+)[%g]")), //
+ RegexLeaf.spaceZeroOrMore(), //
new RegexOr(new RegexLeaf("LOL_THEN_ENT", "([()]\\))([-=.]+)"), //
new RegexLeaf("ENT_THEN_LOL", "([-=.]+)(\\([()])")), //
- new RegexLeaf("[%s]*"), //
- new RegexLeaf("SECOND_LABEL", "(?:[%g]([^%g]+)[%g])?"), //
- new RegexLeaf("[%s]*"), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexOptional(new RegexLeaf("SECOND_LABEL", "[%g]([^%g]+)[%g]")), //
+ RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("ENT2", "(?:" + optionalKeywords(umlDiagramType) + "[%s]+)?"
+ "(\\.?[\\p{L}0-9_]+(?:\\.[\\p{L}0-9_]+)*|[%g][^%g]+[%g])[%s]*(\\<\\<.*\\>\\>)?"), //
- new RegexLeaf("[%s]*"), //
- new RegexLeaf("LABEL_LINK", "(?::[%s]*(.+))?"), //
- new RegexLeaf("$"));
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexOptional( //
+ new RegexConcat( //
+ new RegexLeaf(":"), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexLeaf("LABEL_LINK", "(.+)") //
+ )), RegexLeaf.end());
}
private static String optionalKeywords(UmlDiagramType type) {
diff --git a/src/net/sourceforge/plantuml/classdiagram/command/CommandNamespaceSeparator.java b/src/net/sourceforge/plantuml/classdiagram/command/CommandNamespaceSeparator.java
index 288b99878..9daa623db 100644
--- a/src/net/sourceforge/plantuml/classdiagram/command/CommandNamespaceSeparator.java
+++ b/src/net/sourceforge/plantuml/classdiagram/command/CommandNamespaceSeparator.java
@@ -35,21 +35,34 @@
*/
package net.sourceforge.plantuml.classdiagram.command;
-import java.util.List;
-
-import net.sourceforge.plantuml.classdiagram.ClassDiagram;
+import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.command.CommandExecutionResult;
-import net.sourceforge.plantuml.command.SingleLineCommand;
+import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.IRegex;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexResult;
+import net.sourceforge.plantuml.cucadiagram.CucaDiagram;
-public class CommandNamespaceSeparator extends SingleLineCommand {
+public class CommandNamespaceSeparator extends SingleLineCommand2 {
public CommandNamespaceSeparator() {
- super("(?i)^set[%s]namespaceseparator[%s](\\S+)$");
+ super(getRegexConcat());
+ }
+
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandNamespaceSeparator.class.getName(), //
+ RegexLeaf.start(), //
+ new RegexLeaf("set"), //
+ RegexLeaf.spaceOneOrMore(), //
+ new RegexLeaf("namespaceseparator"), //
+ RegexLeaf.spaceOneOrMore(), //
+ new RegexLeaf("SEPARATOR", "(\\S+)"), RegexLeaf.end()); //
}
@Override
- protected CommandExecutionResult executeArg(ClassDiagram diagram, List arg) {
- final String s = arg.get(0);
+ protected CommandExecutionResult executeArg(CucaDiagram diagram, LineLocation location, RegexResult arg) {
+ final String s = arg.get("SEPARATOR", 0);
if ("none".equalsIgnoreCase(s)) {
diagram.setNamespaceSeparator(null);
} else {
diff --git a/src/net/sourceforge/plantuml/classdiagram/command/CommandRemoveRestore.java b/src/net/sourceforge/plantuml/classdiagram/command/CommandRemoveRestore.java
index 3423fdc33..967d5d361 100644
--- a/src/net/sourceforge/plantuml/classdiagram/command/CommandRemoveRestore.java
+++ b/src/net/sourceforge/plantuml/classdiagram/command/CommandRemoveRestore.java
@@ -38,6 +38,7 @@ package net.sourceforge.plantuml.classdiagram.command;
import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
@@ -49,12 +50,11 @@ public class CommandRemoveRestore extends SingleLineCommand2 {
super(getRegexConcat());
}
- static RegexConcat getRegexConcat() {
- return new RegexConcat(new RegexLeaf("^"), //
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandRemoveRestore.class.getName(), RegexLeaf.start(), //
new RegexLeaf("COMMAND", "(remove|restore)"), //
- new RegexLeaf("[%s]+"), //
- new RegexLeaf("WHAT", "(.+)"), //
- new RegexLeaf("$"));
+ RegexLeaf.spaceOneOrMore(), //
+ new RegexLeaf("WHAT", "(.+)"), RegexLeaf.end());
}
@Override
diff --git a/src/net/sourceforge/plantuml/classdiagram/command/CommandStereotype.java b/src/net/sourceforge/plantuml/classdiagram/command/CommandStereotype.java
index 60197d474..484f975f7 100644
--- a/src/net/sourceforge/plantuml/classdiagram/command/CommandStereotype.java
+++ b/src/net/sourceforge/plantuml/classdiagram/command/CommandStereotype.java
@@ -35,29 +35,41 @@
*/
package net.sourceforge.plantuml.classdiagram.command;
-import java.util.List;
-
import net.sourceforge.plantuml.FontParam;
+import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.classdiagram.ClassDiagram;
import net.sourceforge.plantuml.command.CommandExecutionResult;
-import net.sourceforge.plantuml.command.SingleLineCommand;
+import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.IRegex;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
-public class CommandStereotype extends SingleLineCommand {
+public class CommandStereotype extends SingleLineCommand2 {
public CommandStereotype() {
- super("(?i)^([\\p{L}0-9_.]+|[%g][^%g]+[%g])[%s]*(\\<\\<.*\\>\\>)$");
+ super(getRegexConcat());
+ }
+
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandStereotype.class.getName(), //
+ RegexLeaf.start(), //
+ new RegexLeaf("NAME", "([\\p{L}0-9_.]+|[%g][^%g]+[%g])"), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexLeaf("STEREO", "(\\<\\<.*\\>\\>)"), RegexLeaf.end()); //
}
@Override
- protected CommandExecutionResult executeArg(ClassDiagram diagram, List arg) {
- final Code code = Code.of(arg.get(0));
- final String stereotype = arg.get(1);
+ protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg) {
+ final Code code = Code.of(arg.get("NAME", 0));
+ final String stereotype = arg.get("STEREO", 0);
final IEntity entity = diagram.getOrCreateLeaf(code, null, null);
entity.setStereotype(new Stereotype(stereotype, diagram.getSkinParam().getCircledCharacterRadius(), diagram
- .getSkinParam().getFont(null, false, FontParam.CIRCLED_CHARACTER), diagram.getSkinParam().getIHtmlColorSet()));
+ .getSkinParam().getFont(null, false, FontParam.CIRCLED_CHARACTER), diagram.getSkinParam()
+ .getIHtmlColorSet()));
return CommandExecutionResult.ok();
}
diff --git a/src/net/sourceforge/plantuml/classdiagram/command/CommandUrl.java b/src/net/sourceforge/plantuml/classdiagram/command/CommandUrl.java
index 0cdec5037..5861c570f 100644
--- a/src/net/sourceforge/plantuml/classdiagram/command/CommandUrl.java
+++ b/src/net/sourceforge/plantuml/classdiagram/command/CommandUrl.java
@@ -35,27 +35,45 @@
*/
package net.sourceforge.plantuml.classdiagram.command;
-import java.util.List;
-
+import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.UrlBuilder;
import net.sourceforge.plantuml.UrlBuilder.ModeUrl;
import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram;
import net.sourceforge.plantuml.command.CommandExecutionResult;
-import net.sourceforge.plantuml.command.SingleLineCommand;
+import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.IRegex;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexOptional;
+import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.IEntity;
-public class CommandUrl extends SingleLineCommand {
+public class CommandUrl extends SingleLineCommand2 {
public CommandUrl() {
- super("(?i)^url[%s]*(?:of|for)?[%s]+([\\p{L}0-9_.]+|[%g][^%g]+[%g])[%s]+(?:is)?[%s]*(" + UrlBuilder.getRegexp() + ")$");
+ super(getRegexConcat());
+ }
+
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandUrl.class.getName(), //
+ RegexLeaf.start(), //
+ new RegexLeaf("url"), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexOptional(new RegexLeaf("of|for")), //
+ RegexLeaf.spaceOneOrMore(), //
+ new RegexLeaf("CODE", "([\\p{L}0-9_.]+|[%g][^%g]+[%g])"), //
+ RegexLeaf.spaceOneOrMore(), //
+ new RegexOptional(new RegexLeaf("is")), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")"), RegexLeaf.end()); //
}
@Override
- protected CommandExecutionResult executeArg(AbstractEntityDiagram diagram, List arg) {
- final Code code = Code.of(arg.get(0));
- final String urlString = arg.get(1);
+ protected CommandExecutionResult executeArg(AbstractEntityDiagram diagram, LineLocation location, RegexResult arg) {
+ final Code code = Code.of(arg.get("CODE", 0));
+ final String urlString = arg.get("URL", 0);
final IEntity entity;
if (diagram.leafExist(code)) {
entity = diagram.getOrCreateLeaf(code, null, null);
diff --git a/src/net/sourceforge/plantuml/command/BlocLines.java b/src/net/sourceforge/plantuml/command/BlocLines.java
index 24114d8a6..9e82a399f 100644
--- a/src/net/sourceforge/plantuml/command/BlocLines.java
+++ b/src/net/sourceforge/plantuml/command/BlocLines.java
@@ -193,7 +193,7 @@ public class BlocLines implements Iterable {
final List copy = new ArrayList(lines);
for (int i = 0; i < copy.size(); i++) {
final StringLocated s = copy.get(i);
- copy.set(i, new StringLocated(s.getStringTrimmed(), s.getLocation()));
+ copy.set(i, new StringLocated(s.getTrimmed().getString(), s.getLocation()));
}
if (removeEmptyLines) {
for (final Iterator it = copy.iterator(); it.hasNext();) {
@@ -319,8 +319,8 @@ public class BlocLines implements Iterable {
if (size() < 2) {
return this;
}
- final String first = getFirst499().getStringTrimmed();
- final String second = get499(1).getStringTrimmed();
+ final String first = getFirst499().getTrimmed().getString();
+ final String second = get499(1).getTrimmed().getString();
if (first.endsWith("{") == false && second.equals("{")) {
final String vline = first + " {";
final List result = new ArrayList();
diff --git a/src/net/sourceforge/plantuml/command/CommandAffineTransform.java b/src/net/sourceforge/plantuml/command/CommandAffineTransform.java
index ae26aa80d..56bff1058 100644
--- a/src/net/sourceforge/plantuml/command/CommandAffineTransform.java
+++ b/src/net/sourceforge/plantuml/command/CommandAffineTransform.java
@@ -36,19 +36,30 @@
package net.sourceforge.plantuml.command;
import java.util.Collections;
-import java.util.List;
+import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.UmlDiagram;
+import net.sourceforge.plantuml.command.regex.IRegex;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexResult;
-public class CommandAffineTransform extends SingleLineCommand {
+public class CommandAffineTransform extends SingleLineCommand2 {
public CommandAffineTransform() {
- super("(?i)^!transformation[%s]+([^{}]*)$");
+ super(getRegexConcat());
+ }
+
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandAffineTransform.class.getName(), RegexLeaf.start(), //
+ new RegexLeaf("!transformation"), //
+ RegexLeaf.spaceOneOrMore(), //
+ new RegexLeaf("ANIMATION", "([^{}]*)"), RegexLeaf.end()); //
}
@Override
- protected CommandExecutionResult executeArg(UmlDiagram diagram, List arg) {
- final CharSequence value = arg.get(0);
+ protected CommandExecutionResult executeArg(UmlDiagram diagram, LineLocation location, RegexResult arg) {
+ final CharSequence value = arg.get("ANIMATION", 0);
diagram.setAnimation(Collections.singletonList(value));
return CommandExecutionResult.ok();
}
diff --git a/src/net/sourceforge/plantuml/command/CommandCaption.java b/src/net/sourceforge/plantuml/command/CommandCaption.java
index 3144dc5ff..e05583db6 100644
--- a/src/net/sourceforge/plantuml/command/CommandCaption.java
+++ b/src/net/sourceforge/plantuml/command/CommandCaption.java
@@ -35,24 +35,35 @@
*/
package net.sourceforge.plantuml.command;
-import java.util.List;
-
+import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.TitledDiagram;
+import net.sourceforge.plantuml.command.regex.IRegex;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.DisplayPositionned;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.VerticalAlignment;
-public class CommandCaption extends SingleLineCommand {
+public class CommandCaption extends SingleLineCommand2 {
public CommandCaption() {
- super("(?i)^caption(?:[%s]*:[%s]*|[%s]+)(.*[\\p{L}0-9_.].*)$");
+ super(getRegexConcat());
+ }
+
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandCaption.class.getName(), //
+ RegexLeaf.start(), //
+ new RegexLeaf("caption"), //
+ new RegexLeaf("(?:[%s]*:[%s]*|[%s]+)"), //
+ new RegexLeaf("DISPLAY", "(.*[\\p{L}0-9_.].*)"), RegexLeaf.end()); //
}
@Override
- protected CommandExecutionResult executeArg(TitledDiagram diagram, List arg) {
- diagram.setCaption(DisplayPositionned.single(Display.getWithNewlines(arg.get(0)), HorizontalAlignment.CENTER,
- VerticalAlignment.BOTTOM));
+ protected CommandExecutionResult executeArg(TitledDiagram diagram, LineLocation location, RegexResult arg) {
+ diagram.setCaption(DisplayPositionned.single(Display.getWithNewlines(arg.get("DISPLAY", 0)),
+ HorizontalAlignment.CENTER, VerticalAlignment.BOTTOM));
return CommandExecutionResult.ok();
}
diff --git a/src/net/sourceforge/plantuml/command/CommandEndPackage.java b/src/net/sourceforge/plantuml/command/CommandEndPackage.java
index 4ff7d21ef..047a0152d 100644
--- a/src/net/sourceforge/plantuml/command/CommandEndPackage.java
+++ b/src/net/sourceforge/plantuml/command/CommandEndPackage.java
@@ -35,20 +35,29 @@
*/
package net.sourceforge.plantuml.command;
-import java.util.List;
-
+import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram;
+import net.sourceforge.plantuml.command.regex.IRegex;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.EntityUtils;
import net.sourceforge.plantuml.cucadiagram.IGroup;
-public class CommandEndPackage extends SingleLineCommand {
+public class CommandEndPackage extends SingleLineCommand2 {
public CommandEndPackage() {
- super("(?i)^\\}$");
+ super(getRegexConcat());
+ }
+
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandEndPackage.class.getName(), RegexLeaf.start(), //
+ new RegexLeaf("\\}"), //
+ RegexLeaf.end()); //
}
@Override
- protected CommandExecutionResult executeArg(AbstractEntityDiagram diagram, List arg) {
+ protected CommandExecutionResult executeArg(AbstractEntityDiagram diagram, LineLocation location, RegexResult arg) {
final IGroup currentPackage = diagram.getCurrentGroup();
if (EntityUtils.groupRoot(currentPackage)) {
return CommandExecutionResult.error("No package or namespace defined");
diff --git a/src/net/sourceforge/plantuml/command/CommandFootboxIgnored.java b/src/net/sourceforge/plantuml/command/CommandFootboxIgnored.java
index edc3082eb..2bcdd7ccd 100644
--- a/src/net/sourceforge/plantuml/command/CommandFootboxIgnored.java
+++ b/src/net/sourceforge/plantuml/command/CommandFootboxIgnored.java
@@ -35,18 +35,28 @@
*/
package net.sourceforge.plantuml.command;
-import java.util.List;
-
+import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.UmlDiagram;
+import net.sourceforge.plantuml.command.regex.IRegex;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexResult;
-public class CommandFootboxIgnored extends SingleLineCommand {
+public class CommandFootboxIgnored extends SingleLineCommand2 {
public CommandFootboxIgnored() {
- super("(?i)^(hide|show)?[%s]*footbox$");
+ super(getRegexConcat());
+ }
+
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandFootboxIgnored.class.getName(), RegexLeaf.start(), //
+ new RegexLeaf("(hide|show)?"), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexLeaf("footbox"), RegexLeaf.end()); //
}
@Override
- protected CommandExecutionResult executeArg(UmlDiagram diagram, List arg) {
+ protected CommandExecutionResult executeArg(UmlDiagram diagram, LineLocation location, RegexResult arg) {
return CommandExecutionResult.ok();
}
}
diff --git a/src/net/sourceforge/plantuml/command/CommandFooter.java b/src/net/sourceforge/plantuml/command/CommandFooter.java
index 61b337fc7..9a4d66692 100644
--- a/src/net/sourceforge/plantuml/command/CommandFooter.java
+++ b/src/net/sourceforge/plantuml/command/CommandFooter.java
@@ -35,22 +35,39 @@
*/
package net.sourceforge.plantuml.command;
-import java.util.List;
-
+import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.TitledDiagram;
+import net.sourceforge.plantuml.command.regex.IRegex;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexOptional;
+import net.sourceforge.plantuml.command.regex.RegexOr;
+import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
-public class CommandFooter extends SingleLineCommand {
+public class CommandFooter extends SingleLineCommand2 {
public CommandFooter() {
- super("(?i)^(?:(left|right|center)?[%s]*)footer(?:[%s]*:[%s]*|[%s]+)(.*[\\p{L}0-9_.].*)$");
+ super(getRegexConcat());
+ }
+
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandFooter.class.getName(), //
+ RegexLeaf.start(), //
+ new RegexOptional(new RegexLeaf("POSITION", "(left|right|center)")), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexLeaf("footer"), //
+ new RegexOr( //
+ new RegexConcat(RegexLeaf.spaceZeroOrMore(), new RegexLeaf(":"), RegexLeaf.spaceZeroOrMore()), //
+ RegexLeaf.spaceOneOrMore()), //
+ new RegexLeaf("LABEL", "(.*[\\p{L}0-9_.].*)"), RegexLeaf.end()); //
}
@Override
- protected CommandExecutionResult executeArg(TitledDiagram diagram, List arg) {
- final String align = arg.get(0);
- diagram.getFooter().put(Display.getWithNewlines(arg.get(1)),
+ protected CommandExecutionResult executeArg(TitledDiagram diagram, LineLocation location, RegexResult arg) {
+ final String align = arg.get("POSITION", 0);
+ diagram.getFooter().put(Display.getWithNewlines(arg.get("LABEL", 0)),
HorizontalAlignment.fromString(align, HorizontalAlignment.CENTER));
return CommandExecutionResult.ok();
}
diff --git a/src/net/sourceforge/plantuml/command/CommandHeader.java b/src/net/sourceforge/plantuml/command/CommandHeader.java
index 97e9a367c..a909b1900 100644
--- a/src/net/sourceforge/plantuml/command/CommandHeader.java
+++ b/src/net/sourceforge/plantuml/command/CommandHeader.java
@@ -35,22 +35,41 @@
*/
package net.sourceforge.plantuml.command;
-import java.util.List;
-
+import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.TitledDiagram;
+import net.sourceforge.plantuml.command.regex.IRegex;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexOptional;
+import net.sourceforge.plantuml.command.regex.RegexOr;
+import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
-public class CommandHeader extends SingleLineCommand {
+public class CommandHeader extends SingleLineCommand2 {
public CommandHeader() {
- super("(?i)^(?:(left|right|center)?[%s]*)header(?:[%s]*:[%s]*|[%s]+)(.*[\\p{L}0-9_.].*)$");
+ super(getRegexConcat());
+ }
+
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandHeader.class.getName(), RegexLeaf.start(), //
+ new RegexOptional(new RegexLeaf("POSITION", "(left|right|center)")), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexLeaf("header"), //
+ new RegexOr( //
+ new RegexConcat( //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexLeaf(":"), //
+ RegexLeaf.spaceZeroOrMore()), //
+ RegexLeaf.spaceOneOrMore()), //
+ new RegexLeaf("LABEL", "(.*[\\p{L}0-9_.].*)"), RegexLeaf.end()); //
}
@Override
- protected CommandExecutionResult executeArg(TitledDiagram diagram, List arg) {
- final String align = arg.get(0);
- diagram.getHeader().put(Display.getWithNewlines(arg.get(1)),
+ protected CommandExecutionResult executeArg(TitledDiagram diagram, LineLocation location, RegexResult arg) {
+ final String align = arg.get("POSITION", 0);
+ diagram.getHeader().put(Display.getWithNewlines(arg.get("LABEL", 0)),
HorizontalAlignment.fromString(align, HorizontalAlignment.RIGHT));
return CommandExecutionResult.ok();
}
diff --git a/src/net/sourceforge/plantuml/command/CommandHideUnlinked.java b/src/net/sourceforge/plantuml/command/CommandHideUnlinked.java
index 6fdebc696..fb9de180a 100644
--- a/src/net/sourceforge/plantuml/command/CommandHideUnlinked.java
+++ b/src/net/sourceforge/plantuml/command/CommandHideUnlinked.java
@@ -35,19 +35,29 @@
*/
package net.sourceforge.plantuml.command;
-import java.util.List;
-
+import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.UmlDiagram;
+import net.sourceforge.plantuml.command.regex.IRegex;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexResult;
-public class CommandHideUnlinked extends SingleLineCommand {
+public class CommandHideUnlinked extends SingleLineCommand2 {
public CommandHideUnlinked() {
- super("(?i)^(hide|show)[%s]+unlinked$");
+ super(getRegexConcat());
+ }
+
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandHideUnlinked.class.getName(), RegexLeaf.start(), //
+ new RegexLeaf("HIDE", "(hide|show)"), //
+ RegexLeaf.spaceOneOrMore(), //
+ new RegexLeaf("unlinked"), RegexLeaf.end()); //
}
@Override
- protected CommandExecutionResult executeArg(UmlDiagram diagram, List arg) {
- diagram.setHideUnlinkedData(arg.get(0).equalsIgnoreCase("hide"));
+ protected CommandExecutionResult executeArg(UmlDiagram diagram, LineLocation location, RegexResult arg) {
+ diagram.setHideUnlinkedData(arg.get("HIDE", 0).equalsIgnoreCase("hide"));
return CommandExecutionResult.ok();
}
diff --git a/src/net/sourceforge/plantuml/command/CommandMainframe.java b/src/net/sourceforge/plantuml/command/CommandMainframe.java
index 784fc1b83..033732dbc 100644
--- a/src/net/sourceforge/plantuml/command/CommandMainframe.java
+++ b/src/net/sourceforge/plantuml/command/CommandMainframe.java
@@ -35,20 +35,33 @@
*/
package net.sourceforge.plantuml.command;
-import java.util.List;
-
+import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.TitledDiagram;
+import net.sourceforge.plantuml.command.regex.IRegex;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexOr;
+import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Display;
-public class CommandMainframe extends SingleLineCommand {
+public class CommandMainframe extends SingleLineCommand2 {
public CommandMainframe() {
- super("(?i)^mainframe(?:[%s]*:[%s]*|[%s]+)(.*[\\p{L}0-9_.].*)$");
+ super(getRegexConcat());
+ }
+
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandMainframe.class.getName(), RegexLeaf.start(), //
+ new RegexLeaf("mainframe"), //
+ new RegexOr( //
+ new RegexConcat(RegexLeaf.spaceZeroOrMore(), new RegexLeaf(":"), RegexLeaf.spaceZeroOrMore()), //
+ RegexLeaf.spaceOneOrMore()), //
+ new RegexLeaf("LABEL", "(.*[\\p{L}0-9_.].*)"), RegexLeaf.end()); //
}
@Override
- protected CommandExecutionResult executeArg(TitledDiagram diagram, List arg) {
- final Display label = Display.getWithNewlines(arg.get(0));
+ protected CommandExecutionResult executeArg(TitledDiagram diagram, LineLocation location, RegexResult arg) {
+ final Display label = Display.getWithNewlines(arg.get("LABEL", 0));
diagram.setMainFrame(label);
return CommandExecutionResult.ok();
}
diff --git a/src/net/sourceforge/plantuml/command/CommandMinwidth.java b/src/net/sourceforge/plantuml/command/CommandMinwidth.java
index 5e2ac8bfc..518acc625 100644
--- a/src/net/sourceforge/plantuml/command/CommandMinwidth.java
+++ b/src/net/sourceforge/plantuml/command/CommandMinwidth.java
@@ -35,21 +35,30 @@
*/
package net.sourceforge.plantuml.command;
-import java.util.List;
-
+import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.UmlDiagram;
+import net.sourceforge.plantuml.command.regex.IRegex;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexResult;
-public class CommandMinwidth extends SingleLineCommand {
+public class CommandMinwidth extends SingleLineCommand2 {
public CommandMinwidth() {
- super("(?i)^minwidth[%s]+(\\d+)$");
+ super(getRegexConcat());
+ }
+
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandMinwidth.class.getName(), RegexLeaf.start(), //
+ new RegexLeaf("minwidth"), //
+ RegexLeaf.spaceOneOrMore(), //
+ new RegexLeaf("VALUE", "(\\d+)"), RegexLeaf.end()); //
}
@Override
- protected CommandExecutionResult executeArg(UmlDiagram system, List arg) {
-
- final int minwidth = Integer.parseInt(arg.get(0));
- system.setMinwidth(minwidth);
+ protected CommandExecutionResult executeArg(UmlDiagram diagram, LineLocation location, RegexResult arg) {
+ final int minwidth = Integer.parseInt(arg.get("VALUE", 0));
+ diagram.setMinwidth(minwidth);
return CommandExecutionResult.ok();
}
diff --git a/src/net/sourceforge/plantuml/command/CommandMultilines.java b/src/net/sourceforge/plantuml/command/CommandMultilines.java
index 23b4658e2..ad6386b88 100644
--- a/src/net/sourceforge/plantuml/command/CommandMultilines.java
+++ b/src/net/sourceforge/plantuml/command/CommandMultilines.java
@@ -61,7 +61,7 @@ public abstract class CommandMultilines implements Command
if (isCommandForbidden()) {
return CommandControl.NOT_OK;
}
- Matcher2 m1 = starting.matcher(lines.getFirst499().getStringTrimmed());
+ Matcher2 m1 = starting.matcher(lines.getFirst499().getTrimmed().getString());
if (m1.matches() == false) {
return CommandControl.NOT_OK;
}
@@ -69,7 +69,7 @@ public abstract class CommandMultilines implements Command
return CommandControl.OK_PARTIAL;
}
- m1 = MyPattern.cmpile(getPatternEnd()).matcher(lines.getLast499().getStringTrimmed());
+ m1 = MyPattern.cmpile(getPatternEnd()).matcher(lines.getLast499().getTrimmed().getString());
if (m1.matches() == false) {
return CommandControl.OK_PARTIAL;
}
diff --git a/src/net/sourceforge/plantuml/command/CommandMultilines2.java b/src/net/sourceforge/plantuml/command/CommandMultilines2.java
index c6e78a598..c13bcb9cf 100644
--- a/src/net/sourceforge/plantuml/command/CommandMultilines2.java
+++ b/src/net/sourceforge/plantuml/command/CommandMultilines2.java
@@ -37,18 +37,18 @@ package net.sourceforge.plantuml.command;
import net.sourceforge.plantuml.StringLocated;
import net.sourceforge.plantuml.StringUtils;
+import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.Matcher2;
import net.sourceforge.plantuml.command.regex.MyPattern;
-import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.core.Diagram;
public abstract class CommandMultilines2 implements Command {
- private final RegexConcat starting;
+ private final IRegex starting;
private final MultilinesStrategy strategy;
- public CommandMultilines2(RegexConcat patternStart, MultilinesStrategy strategy) {
+ public CommandMultilines2(IRegex patternStart, MultilinesStrategy strategy) {
if (patternStart.getPattern().startsWith("^") == false || patternStart.getPattern().endsWith("$") == false) {
throw new IllegalArgumentException("Bad pattern " + patternStart.getPattern());
}
@@ -72,7 +72,7 @@ public abstract class CommandMultilines2 implements Command implements Command implements Command implements Command implements Command {
- private final RegexConcat starting;
+ private final IRegex starting;
private final MultilinesStrategy strategy;
- public CommandMultilines3(RegexConcat patternStart, MultilinesStrategy strategy) {
+ public CommandMultilines3(IRegex patternStart, MultilinesStrategy strategy) {
if (patternStart.getPattern().startsWith("^") == false || patternStart.getPattern().endsWith("$") == false) {
throw new IllegalArgumentException("Bad pattern " + patternStart.getPattern());
}
@@ -69,7 +69,7 @@ public abstract class CommandMultilines3 implements Command implements Command implements Command implements Com
if (isCommandForbidden()) {
return CommandControl.NOT_OK;
}
- final Matcher2 m1 = starting.matcher(lines.getFirst499().getStringTrimmed());
+ final Matcher2 m1 = starting.matcher(lines.getFirst499().getTrimmed().getString());
if (m1.matches() == false) {
return CommandControl.NOT_OK;
}
@@ -81,7 +81,7 @@ public abstract class CommandMultilinesBracket implements Com
int level = 1;
for (StringLocated cs : lines.subExtract(1, 0)) {
- final String s = cs.getStringTrimmed();
+ final String s = cs.getTrimmed().getString();
if (isLineConsistent(s, level) == false) {
return CommandControl.NOT_OK;
}
diff --git a/src/net/sourceforge/plantuml/command/CommandMultilinesFooter.java b/src/net/sourceforge/plantuml/command/CommandMultilinesFooter.java
index e0ae86bba..017a68a2a 100644
--- a/src/net/sourceforge/plantuml/command/CommandMultilinesFooter.java
+++ b/src/net/sourceforge/plantuml/command/CommandMultilinesFooter.java
@@ -53,7 +53,7 @@ public class CommandMultilinesFooter extends CommandMultilines {
public CommandExecutionResult execute(final TitledDiagram diagram, BlocLines lines) {
lines = lines.trim(false);
- final Matcher2 m = getStartingPattern().matcher(lines.getFirst499().getStringTrimmed());
+ final Matcher2 m = getStartingPattern().matcher(lines.getFirst499().getTrimmed().getString());
if (m.find() == false) {
throw new IllegalStateException();
}
diff --git a/src/net/sourceforge/plantuml/command/CommandMultilinesHeader.java b/src/net/sourceforge/plantuml/command/CommandMultilinesHeader.java
index e02f611b9..83d4c9c3f 100644
--- a/src/net/sourceforge/plantuml/command/CommandMultilinesHeader.java
+++ b/src/net/sourceforge/plantuml/command/CommandMultilinesHeader.java
@@ -53,7 +53,7 @@ public class CommandMultilinesHeader extends CommandMultilines {
public CommandExecutionResult execute(final TitledDiagram diagram, BlocLines lines) {
lines = lines.trim(false);
- final Matcher2 m = getStartingPattern().matcher(lines.getFirst499().getStringTrimmed());
+ final Matcher2 m = getStartingPattern().matcher(lines.getFirst499().getTrimmed().getString());
if (m.find() == false) {
throw new IllegalStateException();
}
diff --git a/src/net/sourceforge/plantuml/command/CommandMultilinesLegend.java b/src/net/sourceforge/plantuml/command/CommandMultilinesLegend.java
index d93134a39..86510af03 100644
--- a/src/net/sourceforge/plantuml/command/CommandMultilinesLegend.java
+++ b/src/net/sourceforge/plantuml/command/CommandMultilinesLegend.java
@@ -36,8 +36,10 @@
package net.sourceforge.plantuml.command;
import net.sourceforge.plantuml.TitledDiagram;
+import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexOptional;
import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.DisplayPositionned;
@@ -50,12 +52,19 @@ public class CommandMultilinesLegend extends CommandMultilines2 {
super(getRegexConcat(), MultilinesStrategy.REMOVE_STARTING_QUOTE);
}
- private static RegexConcat getRegexConcat() {
- return new RegexConcat(new RegexLeaf("^"), //
+ private static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandMultilinesLegend.class.getName(), RegexLeaf.start(), //
new RegexLeaf("legend"), //
- new RegexLeaf("VALIGN", "(?:[%s]+(top|bottom))?"), //
- new RegexLeaf("ALIGN", "(?:[%s]+(left|right|center))?"), //
- new RegexLeaf("$"));
+ new RegexOptional( //
+ new RegexConcat( //
+ RegexLeaf.spaceOneOrMore(), //
+ new RegexLeaf("VALIGN", "(top|bottom)") //
+ )), //
+ new RegexOptional( //
+ new RegexConcat( //
+ RegexLeaf.spaceOneOrMore(), //
+ new RegexLeaf("ALIGN", "(left|right|center)") //
+ )), RegexLeaf.end());
}
@Override
@@ -66,7 +75,7 @@ public class CommandMultilinesLegend extends CommandMultilines2 {
@Override
protected CommandExecutionResult executeNow(TitledDiagram diagram, BlocLines lines) {
lines = lines.trimSmart(1);
- final RegexResult line0 = getStartingPattern().matcher(lines.getFirst499().getStringTrimmed());
+ final RegexResult line0 = getStartingPattern().matcher(lines.getFirst499().getTrimmed().getString());
final String align = line0.get("ALIGN", 0);
final String valign = line0.get("VALIGN", 0);
lines = lines.subExtract(1, 1);
diff --git a/src/net/sourceforge/plantuml/command/CommandNamespace.java b/src/net/sourceforge/plantuml/command/CommandNamespace.java
index fbf6f1b04..672ccf48e 100644
--- a/src/net/sourceforge/plantuml/command/CommandNamespace.java
+++ b/src/net/sourceforge/plantuml/command/CommandNamespace.java
@@ -40,6 +40,7 @@ import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.UrlBuilder;
import net.sourceforge.plantuml.UrlBuilder.ModeUrl;
import net.sourceforge.plantuml.classdiagram.ClassDiagram;
+import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
@@ -59,23 +60,27 @@ public class CommandNamespace extends SingleLineCommand2 {
super(getRegexConcat());
}
- private static RegexConcat getRegexConcat() {
- return new RegexConcat(new RegexLeaf("^namespace[%s]+"), //
+ private static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandNamespace.class.getName(), RegexLeaf.start(), //
+ new RegexLeaf("namespace"), //
+ RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("NAME", "([\\p{L}0-9_][\\p{L}0-9_.:\\\\]*)"), //
- new RegexLeaf("[%s]*"), //
+ RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREOTYPE", "(\\<\\<.*\\>\\>)?"), //
- new RegexLeaf("[%s]*"), //
+ RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), //
- new RegexLeaf("[%s]*"), //
+ RegexLeaf.spaceZeroOrMore(), //
ColorParser.exp1(), //
- new RegexLeaf("[%s]*\\{$"));
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexLeaf("\\{"), RegexLeaf.end());
}
@Override
protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg) {
final Code code = Code.of(arg.get("NAME", 0));
final IGroup currentPackage = diagram.getCurrentGroup();
- diagram.gotoGroup2(code, Display.getWithNewlines(code), GroupType.PACKAGE, currentPackage, NamespaceStrategy.MULTIPLE);
+ diagram.gotoGroup2(code, Display.getWithNewlines(code), GroupType.PACKAGE, currentPackage,
+ NamespaceStrategy.MULTIPLE);
final IEntity p = diagram.getCurrentGroup();
final String stereotype = arg.get("STEREOTYPE", 0);
if (stereotype != null) {
diff --git a/src/net/sourceforge/plantuml/command/CommandNope.java b/src/net/sourceforge/plantuml/command/CommandNope.java
index 42661f335..789a2ed40 100644
--- a/src/net/sourceforge/plantuml/command/CommandNope.java
+++ b/src/net/sourceforge/plantuml/command/CommandNope.java
@@ -35,18 +35,27 @@
*/
package net.sourceforge.plantuml.command;
-import java.util.List;
-
+import net.sourceforge.plantuml.LineLocation;
+import net.sourceforge.plantuml.command.regex.IRegex;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.core.Diagram;
-public class CommandNope extends SingleLineCommand {
+public class CommandNope extends SingleLineCommand2 {
public CommandNope() {
- super("(?i)^[%s]*$");
+ super(getRegexConcat());
+ }
+
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandNope.class.getName(), RegexLeaf.start(), //
+ RegexLeaf.spaceZeroOrMore(), //
+ RegexLeaf.end()); //
}
@Override
- protected CommandExecutionResult executeArg(Diagram diagram, List arg) {
+ protected CommandExecutionResult executeArg(Diagram diagram, LineLocation location, RegexResult arg) {
return CommandExecutionResult.ok();
}
diff --git a/src/net/sourceforge/plantuml/command/CommandPackage.java b/src/net/sourceforge/plantuml/command/CommandPackage.java
index 050a244e6..b55eeeeb6 100644
--- a/src/net/sourceforge/plantuml/command/CommandPackage.java
+++ b/src/net/sourceforge/plantuml/command/CommandPackage.java
@@ -42,8 +42,10 @@ import net.sourceforge.plantuml.UrlBuilder;
import net.sourceforge.plantuml.UrlBuilder.ModeUrl;
import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram;
import net.sourceforge.plantuml.classdiagram.command.CommandCreateClassMultilines;
+import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexOptional;
import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.Display;
@@ -65,22 +67,27 @@ public class CommandPackage extends SingleLineCommand2 {
super(getRegexConcat());
}
- private static RegexConcat getRegexConcat() {
- return new RegexConcat(//
- new RegexLeaf("^"), //
+ private static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandPackage.class.getName(), RegexLeaf.start(), //
new RegexLeaf("TYPE", "(package|together)"), //
- new RegexLeaf("[%s]+"), //
+ RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("NAME", "([%g][^%g]+[%g]|[^#%s{}]*)"), //
- new RegexLeaf("AS", "(?:[%s]+as[%s]+([\\p{L}0-9_.]+))?"), //
- new RegexLeaf("[%s]*"), //
+ new RegexOptional( //
+ new RegexConcat( //
+ RegexLeaf.spaceOneOrMore(), //
+ new RegexLeaf("as"), //
+ RegexLeaf.spaceOneOrMore(), //
+ new RegexLeaf("AS", "([\\p{L}0-9_.]+)") //
+ )), //
+ RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREOTYPE", "(\\<\\<.*\\>\\>)?"), //
- new RegexLeaf("[%s]*"), //
+ RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("TAGS", Stereotag.pattern() + "?"), //
- new RegexLeaf("[%s]*"), //
+ RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), //
- new RegexLeaf("[%s]*"), //
+ RegexLeaf.spaceZeroOrMore(), //
color().getRegex(), //
- new RegexLeaf("[%s]*\\{$"));
+ RegexLeaf.spaceZeroOrMore(), new RegexLeaf("\\{"), RegexLeaf.end());
}
@Override
diff --git a/src/net/sourceforge/plantuml/command/CommandPackageEmpty.java b/src/net/sourceforge/plantuml/command/CommandPackageEmpty.java
index 30e639941..3437506e7 100644
--- a/src/net/sourceforge/plantuml/command/CommandPackageEmpty.java
+++ b/src/net/sourceforge/plantuml/command/CommandPackageEmpty.java
@@ -35,10 +35,14 @@
*/
package net.sourceforge.plantuml.command;
-import java.util.List;
-
+import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram;
+import net.sourceforge.plantuml.command.regex.IRegex;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexOptional;
+import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.GroupType;
@@ -48,34 +52,51 @@ import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.utils.UniqueSequence;
-public class CommandPackageEmpty extends SingleLineCommand {
+public class CommandPackageEmpty extends SingleLineCommand2 {
public CommandPackageEmpty() {
- super(
- "(?i)^package[%s]+([%g][^%g]+[%g]|[^#%s{}]*)(?:[%s]+as[%s]+([\\p{L}0-9_.]+))?[%s]*(#[0-9a-fA-F]{6}|#?\\w+)?[%s]*\\{[%s]*\\}$");
+ super(getRegexConcat());
+ }
+
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandPackageEmpty.class.getName(), RegexLeaf.start(), //
+ new RegexLeaf("package"), //
+ RegexLeaf.spaceOneOrMore(), //
+ new RegexLeaf("DISPLAY", "([%g][^%g]+[%g]|[^#%s{}]*)"), //
+ new RegexOptional( //
+ new RegexConcat( //
+ RegexLeaf.spaceOneOrMore(), //
+ new RegexLeaf("as"), //
+ RegexLeaf.spaceOneOrMore(), //
+ new RegexLeaf("CODE", "([\\p{L}0-9_.]+)") //
+ )), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexLeaf("COLOR", "(#[0-9a-fA-F]{6}|#?\\w+)?"), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexLeaf("\\{[%s]*\\}"), RegexLeaf.end()); //
}
@Override
- protected CommandExecutionResult executeArg(AbstractEntityDiagram diagram, List arg) {
+ protected CommandExecutionResult executeArg(AbstractEntityDiagram diagram, LineLocation location, RegexResult arg) {
final Code code;
final String display;
- if (arg.get(1) == null) {
- if (StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get(0)).length() == 0) {
+ if (arg.get("CODE", 0) == null) {
+ if (StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("DISPLAY", 0)).length() == 0) {
code = Code.of("##" + UniqueSequence.getValue());
display = null;
} else {
- code = Code.of(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get(0)));
+ code = Code.of(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("DISPLAY", 0)));
display = code.getFullName();
}
} else {
- display = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get(0));
- code = Code.of(arg.get(1));
+ display = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("DISPLAY", 0));
+ code = Code.of(arg.get("CODE", 0));
}
final IGroup currentPackage = diagram.getCurrentGroup();
diagram.gotoGroup2(code, Display.getWithNewlines(display), GroupType.PACKAGE, currentPackage,
NamespaceStrategy.SINGLE);
final IEntity p = diagram.getCurrentGroup();
- final String color = arg.get(2);
+ final String color = arg.get("COLOR", 0);
if (color != null) {
p.setSpecificColorTOBEREMOVED(ColorType.BACK,
diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(color));
diff --git a/src/net/sourceforge/plantuml/command/CommandPage.java b/src/net/sourceforge/plantuml/command/CommandPage.java
index 88f3626b4..8d31e417e 100644
--- a/src/net/sourceforge/plantuml/command/CommandPage.java
+++ b/src/net/sourceforge/plantuml/command/CommandPage.java
@@ -35,21 +35,36 @@
*/
package net.sourceforge.plantuml.command;
-import java.util.List;
-
+import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram;
+import net.sourceforge.plantuml.command.regex.IRegex;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexResult;
-public class CommandPage extends SingleLineCommand {
+public class CommandPage extends SingleLineCommand2 {
public CommandPage() {
- super("(?i)^page[%s]+(\\d+)[%s]*x[%s]*(\\d+)$");
+ super(getRegexConcat());
+ }
+
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandPage.class.getName(), RegexLeaf.start(), //
+ new RegexLeaf("page"), //
+ RegexLeaf.spaceOneOrMore(), //
+ new RegexLeaf("NB1", "(\\d+)"), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexLeaf("x*"), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexLeaf("NB2", "(\\d+)"), RegexLeaf.end()); //
}
@Override
- protected CommandExecutionResult executeArg(AbstractEntityDiagram classDiagram, List arg) {
+ protected CommandExecutionResult executeArg(AbstractEntityDiagram classDiagram, LineLocation location,
+ RegexResult arg) {
- final int horizontal = Integer.parseInt(arg.get(0));
- final int vertical = Integer.parseInt(arg.get(1));
+ final int horizontal = Integer.parseInt(arg.get("NB1", 0));
+ final int vertical = Integer.parseInt(arg.get("NB2", 0));
if (horizontal <= 0 || vertical <= 0) {
return CommandExecutionResult.error("Argument must be positive");
}
diff --git a/src/net/sourceforge/plantuml/command/CommandPragma.java b/src/net/sourceforge/plantuml/command/CommandPragma.java
index 215333abc..260772c09 100644
--- a/src/net/sourceforge/plantuml/command/CommandPragma.java
+++ b/src/net/sourceforge/plantuml/command/CommandPragma.java
@@ -35,22 +35,38 @@
*/
package net.sourceforge.plantuml.command;
-import java.util.List;
-
+import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.UmlDiagram;
+import net.sourceforge.plantuml.command.regex.IRegex;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexOptional;
+import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.dot.GraphvizUtils;
-public class CommandPragma extends SingleLineCommand {
+public class CommandPragma extends SingleLineCommand2 {
public CommandPragma() {
- super("(?i)^!pragma[%s]+([A-Za-z_][A-Za-z_0-9]*)(?:[%s]+(.*))?$");
+ super(getRegexConcat());
+ }
+
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandPragma.class.getName(), RegexLeaf.start(), //
+ new RegexLeaf("!pragma"), //
+ RegexLeaf.spaceOneOrMore(), //
+ new RegexLeaf("NAME", "([A-Za-z_][A-Za-z_0-9]*)"), //
+ new RegexOptional( //
+ new RegexConcat( //
+ RegexLeaf.spaceOneOrMore(), //
+ new RegexLeaf("VALUE", "(.*)") //
+ )), RegexLeaf.end()); //
}
@Override
- protected CommandExecutionResult executeArg(UmlDiagram system, List arg) {
- final String name = StringUtils.goLowerCase(arg.get(0));
- final String value = arg.get(1);
+ protected CommandExecutionResult executeArg(UmlDiagram system, LineLocation location, RegexResult arg) {
+ final String name = StringUtils.goLowerCase(arg.get("NAME", 0));
+ final String value = arg.get("VALUE", 0);
system.getPragma().define(name, value);
if (name.equalsIgnoreCase("graphviz_dot") && value.equalsIgnoreCase("jdot")) {
system.setUseJDot(true);
diff --git a/src/net/sourceforge/plantuml/command/CommandRankDir.java b/src/net/sourceforge/plantuml/command/CommandRankDir.java
index 017a8ca85..4794c453a 100644
--- a/src/net/sourceforge/plantuml/command/CommandRankDir.java
+++ b/src/net/sourceforge/plantuml/command/CommandRankDir.java
@@ -34,22 +34,32 @@
*/
package net.sourceforge.plantuml.command;
-import java.util.List;
-
+import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.SkinParam;
import net.sourceforge.plantuml.StringUtils;
+import net.sourceforge.plantuml.command.regex.IRegex;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.CucaDiagram;
import net.sourceforge.plantuml.cucadiagram.Rankdir;
-public class CommandRankDir extends SingleLineCommand {
+public class CommandRankDir extends SingleLineCommand2 {
public CommandRankDir() {
- super("(?i)^(left[%s]to[%s]right|top[%s]to[%s]bottom)[%s]+direction$");
+ super(getRegexConcat());
+ }
+
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandRankDir.class.getName(), RegexLeaf.start(), //
+ new RegexLeaf("DIRECTION", "(left[%s]to[%s]right|top[%s]to[%s]bottom)"), //
+ RegexLeaf.spaceOneOrMore(), //
+ new RegexLeaf("direction"), RegexLeaf.end()); //
}
@Override
- protected CommandExecutionResult executeArg(CucaDiagram diagram, List arg) {
- final String s = StringUtils.goUpperCase(arg.get(0)).replace(' ', '_');
+ protected CommandExecutionResult executeArg(CucaDiagram diagram, LineLocation location, RegexResult arg) {
+ final String s = StringUtils.goUpperCase(arg.get("DIRECTION", 0)).replace(' ', '_');
((SkinParam) diagram.getSkinParam()).setRankdir(Rankdir.valueOf(s));
// diagram.setRankdir(Rankdir.valueOf(s));
return CommandExecutionResult.ok();
diff --git a/src/net/sourceforge/plantuml/command/CommandRotate.java b/src/net/sourceforge/plantuml/command/CommandRotate.java
index 3b6c48f07..04cab0a66 100644
--- a/src/net/sourceforge/plantuml/command/CommandRotate.java
+++ b/src/net/sourceforge/plantuml/command/CommandRotate.java
@@ -35,19 +35,27 @@
*/
package net.sourceforge.plantuml.command;
-import java.util.List;
-
+import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.UmlDiagram;
+import net.sourceforge.plantuml.command.regex.IRegex;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexResult;
-public class CommandRotate extends SingleLineCommand {
+public class CommandRotate extends SingleLineCommand2 {
public CommandRotate() {
- super("(?i)^rotate$");
+ super(getRegexConcat());
+ }
+
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandRotate.class.getName(), RegexLeaf.start(), //
+ new RegexLeaf("rotate"), //
+ RegexLeaf.end()); //
}
@Override
- protected CommandExecutionResult executeArg(UmlDiagram diagram, List arg) {
-
+ protected CommandExecutionResult executeArg(UmlDiagram diagram, LineLocation location, RegexResult arg) {
diagram.setRotation(true);
return CommandExecutionResult.ok();
}
diff --git a/src/net/sourceforge/plantuml/command/CommandScale.java b/src/net/sourceforge/plantuml/command/CommandScale.java
index 29d0ad1a9..b0c647f97 100644
--- a/src/net/sourceforge/plantuml/command/CommandScale.java
+++ b/src/net/sourceforge/plantuml/command/CommandScale.java
@@ -35,25 +35,47 @@
*/
package net.sourceforge.plantuml.command;
-import java.util.List;
-
import net.sourceforge.plantuml.AbstractPSystem;
+import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.ScaleSimple;
+import net.sourceforge.plantuml.command.regex.IRegex;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexOptional;
+import net.sourceforge.plantuml.command.regex.RegexResult;
-public class CommandScale extends SingleLineCommand {
+public class CommandScale extends SingleLineCommand2 {
+
+ // public CommandScale() {
+ // super("(?i)^$");
+ // }
public CommandScale() {
- super("(?i)^scale[%s]+([0-9.]+)(?:[%s]*/[%s]*([0-9.]+))?$");
+ super(getRegexConcat());
+ }
+
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandScale.class.getName(), RegexLeaf.start(), //
+ new RegexLeaf("scale"), //
+ RegexLeaf.spaceOneOrMore(), //
+ new RegexLeaf("SCALE", "([0-9.]+)"), //
+ new RegexOptional( //
+ new RegexConcat( //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexLeaf("/"), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexLeaf("DIV", "([0-9.]+)") //
+ )), RegexLeaf.end()); //
}
@Override
- protected CommandExecutionResult executeArg(AbstractPSystem diagram, List arg) {
- double scale = Double.parseDouble(arg.get(0));
+ protected CommandExecutionResult executeArg(AbstractPSystem diagram, LineLocation location, RegexResult arg) {
+ double scale = Double.parseDouble(arg.get("SCALE", 0));
if (scale == 0) {
return CommandExecutionResult.error("Scale cannot be zero");
}
- if (arg.get(1) != null) {
- final double div = Double.parseDouble(arg.get(1));
+ if (arg.get("DIV", 0) != null) {
+ final double div = Double.parseDouble(arg.get("DIV", 0));
if (div == 0) {
return CommandExecutionResult.error("Scale cannot be zero");
}
diff --git a/src/net/sourceforge/plantuml/command/CommandScaleMaxHeight.java b/src/net/sourceforge/plantuml/command/CommandScaleMaxHeight.java
index 3b293c3bd..8614dbf5f 100644
--- a/src/net/sourceforge/plantuml/command/CommandScaleMaxHeight.java
+++ b/src/net/sourceforge/plantuml/command/CommandScaleMaxHeight.java
@@ -35,20 +35,34 @@
*/
package net.sourceforge.plantuml.command;
-import java.util.List;
-
import net.sourceforge.plantuml.AbstractPSystem;
+import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.ScaleMaxHeight;
+import net.sourceforge.plantuml.command.regex.IRegex;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexResult;
-public class CommandScaleMaxHeight extends SingleLineCommand {
+public class CommandScaleMaxHeight extends SingleLineCommand2 {
public CommandScaleMaxHeight() {
- super("(?i)^scale[%s]+max[%s]+([0-9.]+)[%s]+height$");
+ super(getRegexConcat());
+ }
+
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandScaleMaxHeight.class.getName(), RegexLeaf.start(), //
+ new RegexLeaf("scale"), //
+ RegexLeaf.spaceOneOrMore(), //
+ new RegexLeaf("max"), //
+ RegexLeaf.spaceOneOrMore(), //
+ new RegexLeaf("HEIGHT", "([0-9.]+)"), //
+ RegexLeaf.spaceOneOrMore(), //
+ new RegexLeaf("height"), RegexLeaf.end()); //
}
@Override
- protected CommandExecutionResult executeArg(AbstractPSystem diagram, List arg) {
- final double height = Double.parseDouble(arg.get(0));
+ protected CommandExecutionResult executeArg(AbstractPSystem diagram, LineLocation location, RegexResult arg) {
+ final double height = Double.parseDouble(arg.get("HEIGHT", 0));
diagram.setScale(new ScaleMaxHeight(height));
return CommandExecutionResult.ok();
}
diff --git a/src/net/sourceforge/plantuml/command/CommandScaleMaxWidth.java b/src/net/sourceforge/plantuml/command/CommandScaleMaxWidth.java
index fb524ecca..b807a53c7 100644
--- a/src/net/sourceforge/plantuml/command/CommandScaleMaxWidth.java
+++ b/src/net/sourceforge/plantuml/command/CommandScaleMaxWidth.java
@@ -35,20 +35,34 @@
*/
package net.sourceforge.plantuml.command;
-import java.util.List;
-
import net.sourceforge.plantuml.AbstractPSystem;
+import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.ScaleMaxWidth;
+import net.sourceforge.plantuml.command.regex.IRegex;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexResult;
-public class CommandScaleMaxWidth extends SingleLineCommand {
+public class CommandScaleMaxWidth extends SingleLineCommand2 {
public CommandScaleMaxWidth() {
- super("(?i)^scale[%s]+max[%s]+([0-9.]+)[%s]+width$");
+ super(getRegexConcat());
+ }
+
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandScaleMaxWidth.class.getName(), RegexLeaf.start(), //
+ new RegexLeaf("scale"), //
+ RegexLeaf.spaceOneOrMore(), //
+ new RegexLeaf("max"), //
+ RegexLeaf.spaceOneOrMore(), //
+ new RegexLeaf("WIDTH", "([0-9.]+)"), //
+ RegexLeaf.spaceOneOrMore(), //
+ new RegexLeaf("width"), RegexLeaf.end()); //
}
@Override
- protected CommandExecutionResult executeArg(AbstractPSystem diagram, List arg) {
- final double width = Double.parseDouble(arg.get(0));
+ protected CommandExecutionResult executeArg(AbstractPSystem diagram, LineLocation location, RegexResult arg) {
+ final double width = Double.parseDouble(arg.get("WIDTH", 0));
diagram.setScale(new ScaleMaxWidth(width));
return CommandExecutionResult.ok();
}
diff --git a/src/net/sourceforge/plantuml/command/CommandScaleMaxWidthAndHeight.java b/src/net/sourceforge/plantuml/command/CommandScaleMaxWidthAndHeight.java
index d7f5b570c..05ec0ed8b 100644
--- a/src/net/sourceforge/plantuml/command/CommandScaleMaxWidthAndHeight.java
+++ b/src/net/sourceforge/plantuml/command/CommandScaleMaxWidthAndHeight.java
@@ -35,21 +35,37 @@
*/
package net.sourceforge.plantuml.command;
-import java.util.List;
-
import net.sourceforge.plantuml.AbstractPSystem;
+import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.ScaleMaxWidthAndHeight;
+import net.sourceforge.plantuml.command.regex.IRegex;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexResult;
-public class CommandScaleMaxWidthAndHeight extends SingleLineCommand {
+public class CommandScaleMaxWidthAndHeight extends SingleLineCommand2 {
public CommandScaleMaxWidthAndHeight() {
- super("(?i)^scale[%s]+max[%s]+([0-9.]+)[%s]*[*x][%s]*([0-9.]+)$");
+ super(getRegexConcat());
+ }
+
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandScaleMaxWidthAndHeight.class.getName(), RegexLeaf.start(), //
+ new RegexLeaf("scale"), //
+ RegexLeaf.spaceOneOrMore(), //
+ new RegexLeaf("max"), //
+ RegexLeaf.spaceOneOrMore(), //
+ new RegexLeaf("WIDTH", "([0-9.]+)"), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexLeaf("[*x]"), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexLeaf("HEIGHT", "([0-9.]+)"), RegexLeaf.end()); //
}
@Override
- protected CommandExecutionResult executeArg(AbstractPSystem diagram, List arg) {
- final double width = Double.parseDouble(arg.get(0));
- final double height = Double.parseDouble(arg.get(1));
+ protected CommandExecutionResult executeArg(AbstractPSystem diagram, LineLocation location, RegexResult arg) {
+ final double width = Double.parseDouble(arg.get("WIDTH", 0));
+ final double height = Double.parseDouble(arg.get("HEIGHT", 0));
diagram.setScale(new ScaleMaxWidthAndHeight(width, height));
return CommandExecutionResult.ok();
}
diff --git a/src/net/sourceforge/plantuml/command/CommandScaleWidthAndHeight.java b/src/net/sourceforge/plantuml/command/CommandScaleWidthAndHeight.java
index a7328f0c5..43ff64eb4 100644
--- a/src/net/sourceforge/plantuml/command/CommandScaleWidthAndHeight.java
+++ b/src/net/sourceforge/plantuml/command/CommandScaleWidthAndHeight.java
@@ -35,21 +35,35 @@
*/
package net.sourceforge.plantuml.command;
-import java.util.List;
-
import net.sourceforge.plantuml.AbstractPSystem;
+import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.ScaleWidthAndHeight;
+import net.sourceforge.plantuml.command.regex.IRegex;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexResult;
-public class CommandScaleWidthAndHeight extends SingleLineCommand {
+public class CommandScaleWidthAndHeight extends SingleLineCommand2 {
public CommandScaleWidthAndHeight() {
- super("(?i)^scale[%s]+([0-9.]+)[%s]*[*x][%s]*([0-9.]+)$");
+ super(getRegexConcat());
+ }
+
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandScaleWidthAndHeight.class.getName(), RegexLeaf.start(), //
+ new RegexLeaf("scale"), //
+ RegexLeaf.spaceOneOrMore(), //
+ new RegexLeaf("WIDTH", "([0-9.]+)"), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexLeaf("[*x]"), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexLeaf("HEIGHT", "([0-9.]+)"), RegexLeaf.end()); //
}
@Override
- protected CommandExecutionResult executeArg(AbstractPSystem diagram, List arg) {
- final double width = Double.parseDouble(arg.get(0));
- final double height = Double.parseDouble(arg.get(1));
+ protected CommandExecutionResult executeArg(AbstractPSystem diagram, LineLocation location, RegexResult arg) {
+ final double width = Double.parseDouble(arg.get("WIDTH", 0));
+ final double height = Double.parseDouble(arg.get("HEIGHT", 0));
diagram.setScale(new ScaleWidthAndHeight(width, height));
return CommandExecutionResult.ok();
}
diff --git a/src/net/sourceforge/plantuml/command/CommandScaleWidthOrHeight.java b/src/net/sourceforge/plantuml/command/CommandScaleWidthOrHeight.java
index 8ecfc64c8..0ee37dca1 100644
--- a/src/net/sourceforge/plantuml/command/CommandScaleWidthOrHeight.java
+++ b/src/net/sourceforge/plantuml/command/CommandScaleWidthOrHeight.java
@@ -35,22 +35,34 @@
*/
package net.sourceforge.plantuml.command;
-import java.util.List;
-
import net.sourceforge.plantuml.AbstractPSystem;
+import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.ScaleHeight;
import net.sourceforge.plantuml.ScaleWidth;
+import net.sourceforge.plantuml.command.regex.IRegex;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexResult;
-public class CommandScaleWidthOrHeight extends SingleLineCommand {
+public class CommandScaleWidthOrHeight extends SingleLineCommand2 {
public CommandScaleWidthOrHeight() {
- super("(?i)^scale[%s]+([0-9.]+)[%s]+(width|height)$");
+ super(getRegexConcat());
+ }
+
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandScaleWidthOrHeight.class.getName(), RegexLeaf.start(), //
+ new RegexLeaf("scale"), //
+ RegexLeaf.spaceOneOrMore(), //
+ new RegexLeaf("VALUE", "([0-9.]+)"), //
+ RegexLeaf.spaceOneOrMore(), //
+ new RegexLeaf("WIDTH", "(width|height)"), RegexLeaf.end()); //
}
@Override
- protected CommandExecutionResult executeArg(AbstractPSystem diagram, List arg) {
- final double size = Double.parseDouble(arg.get(0));
- final boolean width = "width".equalsIgnoreCase(arg.get(1));
+ protected CommandExecutionResult executeArg(AbstractPSystem diagram, LineLocation location, RegexResult arg) {
+ final double size = Double.parseDouble(arg.get("VALUE", 0));
+ final boolean width = "width".equalsIgnoreCase(arg.get("WIDTH", 0));
if (width) {
diagram.setScale(new ScaleWidth(size));
} else {
diff --git a/src/net/sourceforge/plantuml/command/CommandSkinParam.java b/src/net/sourceforge/plantuml/command/CommandSkinParam.java
index 5e141951c..addbcc238 100644
--- a/src/net/sourceforge/plantuml/command/CommandSkinParam.java
+++ b/src/net/sourceforge/plantuml/command/CommandSkinParam.java
@@ -35,20 +35,32 @@
*/
package net.sourceforge.plantuml.command;
-import java.util.List;
-
+import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.UmlDiagram;
+import net.sourceforge.plantuml.command.regex.IRegex;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexResult;
-public class CommandSkinParam extends SingleLineCommand {
+public class CommandSkinParam extends SingleLineCommand2 {
public CommandSkinParam() {
- super("(?i)^(skinparam|skinparamlocked)[%s]+([\\w.]*(?:\\<\\<.*\\>\\>)?[\\w.]*)[%s]+([^{}]*)$");
+ super(getRegexConcat());
+ }
+
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandSkinParam.class.getName(), RegexLeaf.start(), //
+ new RegexLeaf("TYPE", "(skinparam|skinparamlocked)"), //
+ RegexLeaf.spaceOneOrMore(), //
+ new RegexLeaf("NAME", "([\\w.]*(?:\\<\\<.*\\>\\>)?[\\w.]*)"), //
+ RegexLeaf.spaceOneOrMore(), //
+ new RegexLeaf("VALUE", "([^{}]*)"), RegexLeaf.end()); //
}
@Override
- protected CommandExecutionResult executeArg(UmlDiagram diagram, List arg) {
- arg.get(0).endsWith("locked");
- diagram.setParam(arg.get(1), arg.get(2));
+ protected CommandExecutionResult executeArg(UmlDiagram diagram, LineLocation location, RegexResult arg) {
+ // arg.get(0).endsWith("locked");
+ diagram.setParam(arg.get("NAME", 0), arg.get("VALUE", 0));
return CommandExecutionResult.ok();
}
diff --git a/src/net/sourceforge/plantuml/command/CommandSkinParamMultilines.java b/src/net/sourceforge/plantuml/command/CommandSkinParamMultilines.java
index f0c1c454d..4f57e90c8 100644
--- a/src/net/sourceforge/plantuml/command/CommandSkinParamMultilines.java
+++ b/src/net/sourceforge/plantuml/command/CommandSkinParamMultilines.java
@@ -63,7 +63,7 @@ public class CommandSkinParamMultilines extends CommandMultilinesBracket {
super(getRegexConcat());
}
- private static RegexConcat getRegexConcat() {
- return new RegexConcat(new RegexLeaf("^"), //
- new RegexLeaf("sprite[%s]+\\$?"), //
- new RegexLeaf("NAME", "([\\p{L}0-9_]+)[%s]*"), //
- new RegexLeaf("[%s]+"), //
- new RegexLeaf("FILE", "(.*)"), //
- new RegexLeaf("$"));
+ private static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandSpriteFile.class.getName(), RegexLeaf.start(), //
+ new RegexLeaf("sprite"), //
+ RegexLeaf.spaceOneOrMore(), //
+ new RegexLeaf("\\$?"), //
+ new RegexLeaf("NAME", "([\\p{L}0-9_]+)"), //
+ RegexLeaf.spaceOneOrMore(), //
+ new RegexLeaf("FILE", "(.*)"), RegexLeaf.end());
}
@Override
diff --git a/src/net/sourceforge/plantuml/command/CommandTitle.java b/src/net/sourceforge/plantuml/command/CommandTitle.java
index 0e64e4b24..864af6c44 100644
--- a/src/net/sourceforge/plantuml/command/CommandTitle.java
+++ b/src/net/sourceforge/plantuml/command/CommandTitle.java
@@ -35,24 +35,35 @@
*/
package net.sourceforge.plantuml.command;
-import java.util.List;
-
+import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.TitledDiagram;
+import net.sourceforge.plantuml.command.regex.IRegex;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.DisplayPositionned;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.VerticalAlignment;
-public class CommandTitle extends SingleLineCommand {
+public class CommandTitle extends SingleLineCommand2 {
public CommandTitle() {
- super("(?i)^title(?:[%s]*:[%s]*|[%s]+)(.*[\\p{L}0-9_.].*)$");
+ super(getRegexConcat());
+ }
+
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandTitle.class.getName(), //
+ RegexLeaf.start(), //
+ new RegexLeaf("title"), //
+ new RegexLeaf("(?:[%s]*:[%s]*|[%s]+)"), //
+ new RegexLeaf("TITLE", "(.*[\\p{L}0-9_.].*)"), RegexLeaf.end()); //
}
@Override
- protected CommandExecutionResult executeArg(TitledDiagram diagram, List arg) {
- diagram.setTitle(DisplayPositionned.single(Display.getWithNewlines(arg.get(0)), HorizontalAlignment.CENTER,
- VerticalAlignment.TOP));
+ protected CommandExecutionResult executeArg(TitledDiagram diagram, LineLocation location, RegexResult arg) {
+ diagram.setTitle(DisplayPositionned.single(Display.getWithNewlines(arg.get("TITLE", 0)),
+ HorizontalAlignment.CENTER, VerticalAlignment.TOP));
return CommandExecutionResult.ok();
}
}
diff --git a/src/net/sourceforge/plantuml/command/FactorySpriteCommand.java b/src/net/sourceforge/plantuml/command/FactorySpriteCommand.java
index 9dcec7ed5..ab1bd6128 100644
--- a/src/net/sourceforge/plantuml/command/FactorySpriteCommand.java
+++ b/src/net/sourceforge/plantuml/command/FactorySpriteCommand.java
@@ -43,8 +43,10 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.WithSprite;
import net.sourceforge.plantuml.command.note.SingleMultiFactoryCommand;
+import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexOptional;
import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.ugraphic.sprite.Sprite;
import net.sourceforge.plantuml.ugraphic.sprite.SpriteColorBuilder4096;
@@ -52,23 +54,28 @@ import net.sourceforge.plantuml.ugraphic.sprite.SpriteGrayLevel;
public final class FactorySpriteCommand implements SingleMultiFactoryCommand {
- private RegexConcat getRegexConcatMultiLine() {
- return new RegexConcat(new RegexLeaf("^"), //
- new RegexLeaf("sprite[%s]+\\$?"), //
- new RegexLeaf("NAME", "([\\p{L}0-9_]+)[%s]*"), //
- new RegexLeaf("DIM", "(?:\\[(\\d+)x(\\d+)/(?:(\\d+)(z)?|(color))\\])?"), //
- new RegexLeaf("[%s]*\\{"), //
- new RegexLeaf("$"));
+ private IRegex getRegexConcatMultiLine() {
+ return RegexConcat.build(FactorySpriteCommand.class.getName() + "multi", RegexLeaf.start(), //
+ new RegexLeaf("sprite"), //
+ RegexLeaf.spaceOneOrMore(), //
+ new RegexLeaf("\\$?"), //
+ new RegexLeaf("NAME", "([\\p{L}0-9_]+)"), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexOptional(new RegexLeaf("DIM", "\\[(\\d+)x(\\d+)/(?:(\\d+)(z)?|(color))\\]")), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexLeaf("\\{"), RegexLeaf.end());
}
- private RegexConcat getRegexConcatSingleLine() {
- return new RegexConcat(new RegexLeaf("^"), //
- new RegexLeaf("sprite[%s]+\\$?"), //
- new RegexLeaf("NAME", "([\\p{L}0-9_]+)[%s]*"), //
- new RegexLeaf("DIM", "(?:\\[(\\d+)x(\\d+)/(?:(\\d+)(z)|(color))\\])?"), //
- new RegexLeaf("[%s]+"), //
- new RegexLeaf("DATA", "([-_A-Za-z0-9]+)"), //
- new RegexLeaf("$"));
+ private IRegex getRegexConcatSingleLine() {
+ return RegexConcat.build(FactorySpriteCommand.class.getName() + "single", RegexLeaf.start(), //
+ new RegexLeaf("sprite"), //
+ RegexLeaf.spaceOneOrMore(), //
+ new RegexLeaf("\\$?"), //
+ new RegexLeaf("NAME", "([\\p{L}0-9_]+)"), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexOptional(new RegexLeaf("DIM", "\\[(\\d+)x(\\d+)/(?:(\\d+)(z)|(color))\\]")), //
+ RegexLeaf.spaceOneOrMore(), //
+ new RegexLeaf("DATA", "([-_A-Za-z0-9]+)"), RegexLeaf.end());
}
public Command createSingleLine() {
@@ -92,7 +99,7 @@ public final class FactorySpriteCommand implements SingleMultiFactoryCommand