it = lines.iterator(); it.hasNext();) {
+ final StringLocated s = it.next();
if (hasStartingQuote(s)) {
it.remove();
}
}
}
- private boolean hasStartingQuote(CharSequence s) {
- return StringUtils.trinNoTrace(s).startsWith("\'");
+ private boolean hasStartingQuote(StringLocated s) {
+ return StringUtils.trinNoTrace(s.getString()).startsWith("\'");
}
}
diff --git a/src/net/sourceforge/plantuml/command/PSystemBasicFactory.java b/src/net/sourceforge/plantuml/command/PSystemBasicFactory.java
index 16bd5c488..f3a4ef7cd 100644
--- a/src/net/sourceforge/plantuml/command/PSystemBasicFactory.java
+++ b/src/net/sourceforge/plantuml/command/PSystemBasicFactory.java
@@ -36,10 +36,10 @@
package net.sourceforge.plantuml.command;
import net.sourceforge.plantuml.AbstractPSystem;
-import net.sourceforge.plantuml.CharSequence2;
import net.sourceforge.plantuml.ErrorUml;
import net.sourceforge.plantuml.ErrorUmlType;
import net.sourceforge.plantuml.PSystemError;
+import net.sourceforge.plantuml.StringLocated;
import net.sourceforge.plantuml.core.Diagram;
import net.sourceforge.plantuml.core.DiagramType;
import net.sourceforge.plantuml.core.UmlSource;
@@ -62,23 +62,23 @@ public abstract class PSystemBasicFactory extends PSy
return null;
}
- private boolean isEmptyLine(CharSequence2 result) {
- return result.trin().length() == 0;
+ private boolean isEmptyLine(StringLocated result) {
+ return result.getStringTrimmed().length() == 0;
}
final public Diagram createSystem(UmlSource source) {
source = source.removeInitialSkinparam();
final IteratorCounter2 it = source.iterator2();
- final CharSequence2 startLine = it.next();
- P system = init(startLine.toString2());
+ final StringLocated startLine = it.next();
+ P system = init(startLine.getString());
boolean first = true;
while (it.hasNext()) {
- final CharSequence2 s = it.next();
+ final StringLocated s = it.next();
if (first && s != null && isEmptyLine(s)) {
continue;
}
first = false;
- if (StartUtils.isArobaseEndDiagram(s)) {
+ if (StartUtils.isArobaseEndDiagram(s.getString())) {
if (source.getTotalLineCount() == 2 && source.isStartDef() == false) {
return buildEmptyError(source, s.getLocation());
}
@@ -87,7 +87,7 @@ public abstract class PSystemBasicFactory
extends PSy
}
return system;
}
- system = executeLine(system, s.toString2());
+ system = executeLine(system, s.getString());
if (system == null) {
final ErrorUml err = new ErrorUml(ErrorUmlType.SYNTAX_ERROR, "Syntax Error?", s.getLocation());
return new PSystemError(source, err, null);
diff --git a/src/net/sourceforge/plantuml/command/PSystemSingleLineFactory.java b/src/net/sourceforge/plantuml/command/PSystemSingleLineFactory.java
index dd9762179..4c964f121 100644
--- a/src/net/sourceforge/plantuml/command/PSystemSingleLineFactory.java
+++ b/src/net/sourceforge/plantuml/command/PSystemSingleLineFactory.java
@@ -36,10 +36,10 @@
package net.sourceforge.plantuml.command;
import net.sourceforge.plantuml.AbstractPSystem;
-import net.sourceforge.plantuml.CharSequence2;
import net.sourceforge.plantuml.ErrorUml;
import net.sourceforge.plantuml.ErrorUmlType;
import net.sourceforge.plantuml.PSystemError;
+import net.sourceforge.plantuml.StringLocated;
import net.sourceforge.plantuml.core.Diagram;
import net.sourceforge.plantuml.core.DiagramType;
import net.sourceforge.plantuml.core.UmlSource;
@@ -64,19 +64,19 @@ public abstract class PSystemSingleLineFactory extends PSystemAbstractFactory {
return buildEmptyError(source, it.peek().getLocation());
}
- final CharSequence2 startLine = it.next();
- if (StartUtils.isArobaseStartDiagram(startLine) == false) {
+ final StringLocated startLine = it.next();
+ if (StartUtils.isArobaseStartDiagram(startLine.getString()) == false) {
throw new UnsupportedOperationException();
}
if (it.hasNext() == false) {
return buildEmptyError(source, startLine.getLocation());
}
- final CharSequence2 s = it.next();
- if (StartUtils.isArobaseEndDiagram(s)) {
+ final StringLocated s = it.next();
+ if (StartUtils.isArobaseEndDiagram(s.getString())) {
return buildEmptyError(source, s.getLocation());
}
- final AbstractPSystem sys = executeLine(s.toString2());
+ final AbstractPSystem sys = executeLine(s.getString());
if (sys == null) {
final ErrorUml err = new ErrorUml(ErrorUmlType.SYNTAX_ERROR, "Syntax Error?",
/* it.currentNum() - 1, */s.getLocation());
diff --git a/src/net/sourceforge/plantuml/command/SingleLineCommand.java b/src/net/sourceforge/plantuml/command/SingleLineCommand.java
index 772f3fcaf..b26c2453a 100644
--- a/src/net/sourceforge/plantuml/command/SingleLineCommand.java
+++ b/src/net/sourceforge/plantuml/command/SingleLineCommand.java
@@ -69,7 +69,7 @@ public abstract class SingleLineCommand implements Command
if (isCommandForbidden()) {
return CommandControl.NOT_OK;
}
- final String line = StringUtils.trin(lines.getFirst499());
+ final String line = lines.getFirst499().getStringTrimmed();
final Matcher2 m = pattern.matcher(line);
final boolean result = m.find();
if (result) {
@@ -89,7 +89,7 @@ public abstract class SingleLineCommand implements Command
if (lines.size() != 1) {
throw new IllegalArgumentException();
}
- final String line = StringUtils.trin(lines.getFirst499());
+ final String line = lines.getFirst499().getStringTrimmed();
if (isForbidden(line)) {
return CommandExecutionResult.error("Syntax error: " + line);
}
diff --git a/src/net/sourceforge/plantuml/command/SingleLineCommand2.java b/src/net/sourceforge/plantuml/command/SingleLineCommand2.java
index 1ba9e4980..8959e003d 100644
--- a/src/net/sourceforge/plantuml/command/SingleLineCommand2.java
+++ b/src/net/sourceforge/plantuml/command/SingleLineCommand2.java
@@ -35,8 +35,9 @@
*/
package net.sourceforge.plantuml.command;
+import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.PSystemError;
-import net.sourceforge.plantuml.StringUtils;
+import net.sourceforge.plantuml.StringLocated;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.core.Diagram;
@@ -70,11 +71,11 @@ public abstract class SingleLineCommand2 implements Command implements Command implements Command implements Command implements Command 0;
+ for (StringLocated s : lines) {
+ assert s.getString().length() > 0;
- if (s.toString().equals("}")) {
+ if (s.getString().equals("}")) {
this.pop();
continue;
}
- final Matcher2 m = p1.matcher(s);
+ final Matcher2 m = p1.matcher(s.getString());
if (m.find() == false) {
throw new IllegalStateException();
}
@@ -98,7 +98,7 @@ public class SkinLoader {
final String key = this.getFullParam() + m.group(1);
diagram.setParam(key, m.group(3));
} else {
- throw new IllegalStateException("." + s.toString() + ".");
+ throw new IllegalStateException("." + s.getString() + ".");
}
}
diff --git a/src/net/sourceforge/plantuml/command/UmlDiagramFactory.java b/src/net/sourceforge/plantuml/command/UmlDiagramFactory.java
index 484c6ab85..264b2338e 100644
--- a/src/net/sourceforge/plantuml/command/UmlDiagramFactory.java
+++ b/src/net/sourceforge/plantuml/command/UmlDiagramFactory.java
@@ -41,10 +41,10 @@ import java.util.Collections;
import java.util.List;
import net.sourceforge.plantuml.AbstractPSystem;
-import net.sourceforge.plantuml.CharSequence2;
import net.sourceforge.plantuml.ErrorUml;
import net.sourceforge.plantuml.ErrorUmlType;
import net.sourceforge.plantuml.PSystemError;
+import net.sourceforge.plantuml.StringLocated;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.classdiagram.command.CommandHideShowByGender;
import net.sourceforge.plantuml.classdiagram.command.CommandHideShowByVisibility;
@@ -69,8 +69,8 @@ public abstract class UmlDiagramFactory extends PSystemAbstractFactory {
final public Diagram createSystem(UmlSource source) {
final IteratorCounter2 it = source.iterator2();
- final CharSequence2 startLine = it.next();
- if (StartUtils.isArobaseStartDiagram(startLine) == false) {
+ final StringLocated startLine = it.next();
+ if (StartUtils.isArobaseStartDiagram(startLine.getString()) == false) {
throw new UnsupportedOperationException();
}
@@ -80,7 +80,7 @@ public abstract class UmlDiagramFactory extends PSystemAbstractFactory {
AbstractPSystem sys = createEmptyDiagram();
while (it.hasNext()) {
- if (StartUtils.isArobaseEndDiagram(it.peek())) {
+ if (StartUtils.isArobaseEndDiagram(it.peek().getString())) {
if (sys == null) {
return null;
}
@@ -118,7 +118,7 @@ public abstract class UmlDiagramFactory extends PSystemAbstractFactory {
final CommandExecutionResult result = sys.executeCommand(step.command, step.blocLines);
if (result.isOk() == false) {
final ErrorUml err = new ErrorUml(ErrorUmlType.EXECUTION_ERROR, result.getError(),
- ((CharSequence2) step.blocLines.getFirst499()).getLocation());
+ ((StringLocated) step.blocLines.getFirst499()).getLocation());
sys = new PSystemError(source, err, result.getDebugLines());
}
if (result.getNewDiagram() != null) {
@@ -140,7 +140,7 @@ public abstract class UmlDiagramFactory extends PSystemAbstractFactory {
}
private Step getCandidate(final IteratorCounter2 it) {
- final BlocLines single = BlocLines.single(it.peek());
+ final BlocLines single = BlocLines.single2(it.peek());
for (Command cmd : cmds) {
final CommandControl result = cmd.isValid(single);
if (result == CommandControl.OK) {
@@ -182,13 +182,13 @@ public abstract class UmlDiagramFactory extends PSystemAbstractFactory {
}
private BlocLines addOneSingleLineManageEmbedded2(IteratorCounter2 it, BlocLines lines) {
- final CharSequence linetoBeAdded = it.next();
+ final StringLocated linetoBeAdded = it.next();
lines = lines.add2(linetoBeAdded);
- if (StringUtils.trinNoTrace(linetoBeAdded).equals("{{")) {
+ if (StringUtils.trinNoTrace(linetoBeAdded.getString()).equals("{{")) {
while (it.hasNext()) {
- final CharSequence s = it.next();
+ final StringLocated s = it.next();
lines = lines.add2(s);
- if (StringUtils.trinNoTrace(s).equals("}}")) {
+ if (StringUtils.trinNoTrace(s.getString()).equals("}}")) {
return lines;
}
}
diff --git a/src/net/sourceforge/plantuml/command/note/FactoryNoteActivityCommand.java b/src/net/sourceforge/plantuml/command/note/FactoryNoteActivityCommand.java
index ead6a871a..324b3d326 100644
--- a/src/net/sourceforge/plantuml/command/note/FactoryNoteActivityCommand.java
+++ b/src/net/sourceforge/plantuml/command/note/FactoryNoteActivityCommand.java
@@ -35,6 +35,7 @@
*/
package net.sourceforge.plantuml.command.note;
+import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.UrlBuilder;
@@ -90,7 +91,7 @@ public final class FactoryNoteActivityCommand implements SingleMultiFactoryComma
public final CommandExecutionResult executeNow(final ActivityDiagram system, BlocLines lines) {
// StringUtils.trim(lines, true);
- final RegexResult arg = getStartingPattern().matcher(StringUtils.trin(lines.getFirst499()));
+ final RegexResult arg = getStartingPattern().matcher(lines.getFirst499().getStringTrimmed());
lines = lines.subExtract(1, 1);
lines = lines.removeEmptyColumns();
@@ -121,7 +122,7 @@ public final class FactoryNoteActivityCommand implements SingleMultiFactoryComma
return new SingleLineCommand2(getRegexConcatSingleLine()) {
@Override
- protected CommandExecutionResult executeArg(final ActivityDiagram system, RegexResult arg) {
+ protected CommandExecutionResult executeArg(final ActivityDiagram system, LineLocation location, RegexResult arg) {
final IEntity note = system.createNote(UniqueSequence.getCode("GN"),
Display.getWithNewlines(arg.get("NOTE", 0)));
return executeInternal(system, arg, note);
diff --git a/src/net/sourceforge/plantuml/command/note/FactoryNoteCommand.java b/src/net/sourceforge/plantuml/command/note/FactoryNoteCommand.java
index 43180178c..2f76f49b1 100644
--- a/src/net/sourceforge/plantuml/command/note/FactoryNoteCommand.java
+++ b/src/net/sourceforge/plantuml/command/note/FactoryNoteCommand.java
@@ -35,7 +35,7 @@
*/
package net.sourceforge.plantuml.command.note;
-import net.sourceforge.plantuml.StringUtils;
+import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram;
import net.sourceforge.plantuml.classdiagram.command.CommandCreateClassMultilines;
import net.sourceforge.plantuml.command.BlocLines;
@@ -84,7 +84,7 @@ public final class FactoryNoteCommand implements SingleMultiFactoryCommand(getRegexConcatSingleLine()) {
@Override
- protected CommandExecutionResult executeArg(final AbstractEntityDiagram system, RegexResult arg) {
+ protected CommandExecutionResult executeArg(final AbstractEntityDiagram system, LineLocation location, RegexResult arg) {
final String display = arg.get("DISPLAY", 0);
return executeInternal(system, arg, BlocLines.getWithNewlines(display));
}
@@ -103,7 +103,7 @@ public final class FactoryNoteCommand implements SingleMultiFactoryCommand(getRegexConcatSingleLine(partialPattern)) {
@Override
- protected CommandExecutionResult executeArg(final AbstractEntityDiagram system, RegexResult arg) {
+ protected CommandExecutionResult executeArg(final AbstractEntityDiagram system, LineLocation location, RegexResult arg) {
final String s = arg.get("NOTE", 0);
return executeInternal(arg, system, null, BlocLines.getWithNewlines(s));
}
@@ -139,7 +140,7 @@ public final class FactoryNoteOnEntityCommand implements SingleMultiFactoryComma
protected CommandExecutionResult executeNow(final AbstractEntityDiagram system, BlocLines lines) {
// StringUtils.trim(lines, false);
- final RegexResult line0 = getStartingPattern().matcher(StringUtils.trin(lines.getFirst499()));
+ final RegexResult line0 = getStartingPattern().matcher(lines.getFirst499().getStringTrimmed());
lines = lines.subExtract(1, 1);
lines = lines.removeEmptyColumns();
diff --git a/src/net/sourceforge/plantuml/command/note/FactoryNoteOnLinkCommand.java b/src/net/sourceforge/plantuml/command/note/FactoryNoteOnLinkCommand.java
index b55c61e1c..599445720 100644
--- a/src/net/sourceforge/plantuml/command/note/FactoryNoteOnLinkCommand.java
+++ b/src/net/sourceforge/plantuml/command/note/FactoryNoteOnLinkCommand.java
@@ -35,6 +35,7 @@
*/
package net.sourceforge.plantuml.command.note;
+import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.UrlBuilder;
@@ -88,7 +89,7 @@ public final class FactoryNoteOnLinkCommand implements SingleMultiFactoryCommand
}
protected CommandExecutionResult executeNow(final CucaDiagram system, BlocLines lines) {
- final String line0 = lines.getFirst499().toString();
+ final String line0 = lines.getFirst499().getString();
lines = lines.subExtract(1, 1);
lines = lines.removeEmptyColumns();
if (lines.size() > 0) {
@@ -105,7 +106,7 @@ public final class FactoryNoteOnLinkCommand implements SingleMultiFactoryCommand
return new SingleLineCommand2(getRegexConcatSingleLine()) {
@Override
- protected CommandExecutionResult executeArg(final CucaDiagram system, RegexResult arg) {
+ protected CommandExecutionResult executeArg(final CucaDiagram system, LineLocation location, RegexResult arg) {
final BlocLines note = BlocLines.getWithNewlines(arg.get("NOTE", 0));
return executeInternal(system, note, arg);
}
diff --git a/src/net/sourceforge/plantuml/command/note/FactoryTipOnEntityCommand.java b/src/net/sourceforge/plantuml/command/note/FactoryTipOnEntityCommand.java
index 65f2590b3..aa02d55c9 100644
--- a/src/net/sourceforge/plantuml/command/note/FactoryTipOnEntityCommand.java
+++ b/src/net/sourceforge/plantuml/command/note/FactoryTipOnEntityCommand.java
@@ -100,7 +100,7 @@ public final class FactoryTipOnEntityCommand implements SingleMultiFactoryComman
protected CommandExecutionResult executeNow(final AbstractEntityDiagram system, BlocLines lines) {
// StringUtils.trim(lines, false);
- final RegexResult line0 = getStartingPattern().matcher(StringUtils.trin(lines.getFirst499()));
+ final RegexResult line0 = getStartingPattern().matcher(lines.getFirst499().getStringTrimmed());
lines = lines.subExtract(1, 1);
lines = lines.removeEmptyColumns();
diff --git a/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteCommand.java b/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteCommand.java
index 0436e7deb..04c8b3c1f 100644
--- a/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteCommand.java
+++ b/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteCommand.java
@@ -37,6 +37,7 @@ package net.sourceforge.plantuml.command.note.sequence;
import net.sourceforge.plantuml.ColorParam;
import net.sourceforge.plantuml.FontParam;
+import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.UrlBuilder;
@@ -67,6 +68,7 @@ public final class FactorySequenceNoteCommand implements SingleMultiFactoryComma
private RegexConcat getRegexConcatMultiLine() {
return new RegexConcat(//
new RegexLeaf("^"), //
+ new RegexLeaf("PARALLEL", "(&[%s]*)?"), //
new RegexLeaf("VMERGE", "(/)?[%s]*"), //
new RegexLeaf("STYLE", "(note|hnote|rnote)"), //
new RegexLeaf("[%s]*"), //
@@ -82,6 +84,7 @@ public final class FactorySequenceNoteCommand implements SingleMultiFactoryComma
private RegexConcat getRegexConcatSingleLine() {
return new RegexConcat(//
new RegexLeaf("^"), //
+ new RegexLeaf("PARALLEL", "(&[%s]*)?"), //
new RegexLeaf("VMERGE", "(/)?[%s]*"), //
new RegexLeaf("STYLE", "(note|hnote|rnote)"), //
new RegexLeaf("[%s]*"), //
@@ -110,7 +113,7 @@ public final class FactorySequenceNoteCommand implements SingleMultiFactoryComma
}
protected CommandExecutionResult executeNow(final SequenceDiagram system, BlocLines lines) {
- final RegexResult line0 = getStartingPattern().matcher(StringUtils.trin(lines.getFirst499()));
+ final RegexResult line0 = getStartingPattern().matcher(lines.getFirst499().getStringTrimmed());
lines = lines.subExtract(1, 1);
lines = lines.removeEmptyColumns();
return executeInternal(system, line0, lines);
@@ -122,7 +125,7 @@ public final class FactorySequenceNoteCommand implements SingleMultiFactoryComma
return new SingleLineCommand2(getRegexConcatSingleLine()) {
@Override
- protected CommandExecutionResult executeArg(final SequenceDiagram system, RegexResult arg) {
+ protected CommandExecutionResult executeArg(final SequenceDiagram system, LineLocation location, RegexResult arg) {
return executeInternal(system, arg, BlocLines.getWithNewlines(arg.get("NOTE", 0)));
}
@@ -137,6 +140,7 @@ public final class FactorySequenceNoteCommand implements SingleMultiFactoryComma
if (strings.size() > 0) {
final boolean tryMerge = arg.get("VMERGE", 0) != null;
+ final boolean parallel = arg.get("PARALLEL", 0) != null;
final Display display = diagram.manageVariable(strings.toDisplay());
final Note note = new Note(p, position, display);
Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet());
@@ -153,6 +157,9 @@ public final class FactorySequenceNoteCommand implements SingleMultiFactoryComma
final Url urlLink = urlBuilder.getUrl(arg.get("URL", 0));
note.setUrl(urlLink);
}
+ if (parallel) {
+ note.goParallel();
+ }
diagram.addNote(note, tryMerge);
}
return CommandExecutionResult.ok();
diff --git a/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteOnArrowCommand.java b/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteOnArrowCommand.java
index 35b9a302f..879d8d979 100644
--- a/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteOnArrowCommand.java
+++ b/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteOnArrowCommand.java
@@ -37,6 +37,7 @@ package net.sourceforge.plantuml.command.note.sequence;
import net.sourceforge.plantuml.ColorParam;
import net.sourceforge.plantuml.FontParam;
+import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.UrlBuilder;
@@ -97,7 +98,7 @@ public final class FactorySequenceNoteOnArrowCommand implements SingleMultiFacto
return new SingleLineCommand2(getRegexConcatSingleLine()) {
@Override
- protected CommandExecutionResult executeArg(final SequenceDiagram system, RegexResult arg) {
+ protected CommandExecutionResult executeArg(final SequenceDiagram system, LineLocation location, RegexResult arg) {
return executeInternal(system, arg, BlocLines.getWithNewlines(arg.get("NOTE", 0)));
}
@@ -114,7 +115,7 @@ public final class FactorySequenceNoteOnArrowCommand implements SingleMultiFacto
}
protected CommandExecutionResult executeNow(final SequenceDiagram system, BlocLines lines) {
- final RegexResult line0 = getStartingPattern().matcher(StringUtils.trin(lines.getFirst499()));
+ final RegexResult line0 = getStartingPattern().matcher(lines.getFirst499().getStringTrimmed());
lines = lines.subExtract(1, 1);
lines = lines.removeEmptyColumns();
return executeInternal(system, line0, lines);
diff --git a/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteOverSeveralCommand.java b/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteOverSeveralCommand.java
index 669b57e30..97cc403d1 100644
--- a/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteOverSeveralCommand.java
+++ b/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteOverSeveralCommand.java
@@ -35,6 +35,7 @@
*/
package net.sourceforge.plantuml.command.note.sequence;
+import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.UrlBuilder;
@@ -96,7 +97,7 @@ public final class FactorySequenceNoteOverSeveralCommand implements SingleMultiF
return new SingleLineCommand2(getRegexConcatSingleLine()) {
@Override
- protected CommandExecutionResult executeArg(final SequenceDiagram system, RegexResult arg) {
+ protected CommandExecutionResult executeArg(final SequenceDiagram system, LineLocation location, RegexResult arg) {
final BlocLines strings = BlocLines.getWithNewlines(arg.get("NOTE", 0));
return executeInternal(system, arg, strings);
@@ -115,7 +116,7 @@ public final class FactorySequenceNoteOverSeveralCommand implements SingleMultiF
}
protected CommandExecutionResult executeNow(final SequenceDiagram system, BlocLines lines) {
- final RegexResult line0 = getStartingPattern().matcher(StringUtils.trin(lines.getFirst499()));
+ final RegexResult line0 = getStartingPattern().matcher(lines.getFirst499().getStringTrimmed());
lines = lines.subExtract(1, 1);
lines = lines.removeEmptyColumns();
return executeInternal(system, line0, lines);
diff --git a/src/net/sourceforge/plantuml/core/DiagramType.java b/src/net/sourceforge/plantuml/core/DiagramType.java
index 6e99cc493..db4317d06 100644
--- a/src/net/sourceforge/plantuml/core/DiagramType.java
+++ b/src/net/sourceforge/plantuml/core/DiagramType.java
@@ -38,7 +38,7 @@ package net.sourceforge.plantuml.core;
import net.sourceforge.plantuml.utils.StartUtils;
public enum DiagramType {
- UML, BPM, DITAA, DOT, PROJECT, JCCKIT, SALT, FLOW, CREOLE, JUNGLE, CUTE, MATH, LATEX, DEFINITION, GANTT, NW, MINDMAP, UNKNOWN;
+ UML, BPM, DITAA, DOT, PROJECT, JCCKIT, SALT, FLOW, CREOLE, JUNGLE, CUTE, MATH, LATEX, DEFINITION, GANTT, NW, MINDMAP, WBS, UNKNOWN;
static public DiagramType getTypeFromArobaseStart(String s) {
s = s.toLowerCase();
@@ -96,6 +96,9 @@ public enum DiagramType {
if (StartUtils.startsWithSymbolAnd("startmindmap", s)) {
return MINDMAP;
}
+ if (StartUtils.startsWithSymbolAnd("startwbs", s)) {
+ return WBS;
+ }
return UNKNOWN;
}
}
diff --git a/src/net/sourceforge/plantuml/core/UmlSource.java b/src/net/sourceforge/plantuml/core/UmlSource.java
index 5d8b3ee3f..e641f86f4 100644
--- a/src/net/sourceforge/plantuml/core/UmlSource.java
+++ b/src/net/sourceforge/plantuml/core/UmlSource.java
@@ -41,9 +41,8 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import net.sourceforge.plantuml.BackSlash;
-import net.sourceforge.plantuml.CharSequence2;
-import net.sourceforge.plantuml.CharSequence2Impl;
import net.sourceforge.plantuml.LineLocation;
+import net.sourceforge.plantuml.StringLocated;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.command.regex.Matcher2;
import net.sourceforge.plantuml.command.regex.MyPattern;
@@ -64,13 +63,13 @@ import net.sourceforge.plantuml.version.IteratorCounter2Impl;
*/
final public class UmlSource {
- final private List source;
+ final private List source;
public UmlSource removeInitialSkinparam() {
if (hasInitialSkinparam(source) == false) {
return this;
}
- final List copy = new ArrayList(source);
+ final List copy = new ArrayList(source);
while (hasInitialSkinparam(copy)) {
copy.remove(1);
}
@@ -78,19 +77,19 @@ final public class UmlSource {
}
public boolean containsIgnoreCase(String searched) {
- for (CharSequence2 s : source) {
- if (StringUtils.goLowerCase(s.toString()).contains(searched)) {
+ for (StringLocated s : source) {
+ if (StringUtils.goLowerCase(s.getString()).contains(searched)) {
return true;
}
}
return false;
}
- private static boolean hasInitialSkinparam(final List copy) {
- return copy.size() > 1 && (copy.get(1).startsWith("skinparam ") || copy.get(1).startsWith("skinparamlocked "));
+ private static boolean hasInitialSkinparam(final List copy) {
+ return copy.size() > 1 && (copy.get(1).getString().startsWith("skinparam ") || copy.get(1).getString().startsWith("skinparamlocked "));
}
- private UmlSource(List source) {
+ private UmlSource(List source) {
this.source = source;
}
@@ -102,18 +101,18 @@ final public class UmlSource {
* @param checkEndingBackslash
* true
if an ending backslash means that a line has to be collapsed with the following one.
*/
- public UmlSource(List data, boolean checkEndingBackslash) {
- this(new ArrayList());
+ public UmlSource(List data, boolean checkEndingBackslash) {
+ this(new ArrayList());
if (checkEndingBackslash) {
final StringBuilder pending = new StringBuilder();
- for (CharSequence2 cs : data) {
- final String s = cs.toString2();
+ for (StringLocated cs : data) {
+ final String s = cs.getString();
if (StringUtils.endsWithBackslash(s)) {
pending.append(s.substring(0, s.length() - 1));
} else {
pending.append(s);
- this.source.add(new CharSequence2Impl(pending.toString(), cs.getLocation()));
+ this.source.add(new StringLocated(pending.toString(), cs.getLocation()));
pending.setLength(0);
}
}
@@ -128,7 +127,7 @@ final public class UmlSource {
* @return the type of the diagram.
*/
public DiagramType getDiagramType() {
- return DiagramType.getTypeFromArobaseStart(source.get(0).toString2());
+ return DiagramType.getTypeFromArobaseStart(source.get(0).getString());
}
/**
@@ -147,8 +146,8 @@ final public class UmlSource {
*/
public String getPlainString() {
final StringBuilder sb = new StringBuilder();
- for (CharSequence2 s : source) {
- sb.append(s);
+ for (StringLocated s : source) {
+ sb.append(s.getString());
sb.append('\r');
sb.append(BackSlash.CHAR_NEWLINE);
}
@@ -167,9 +166,9 @@ final public class UmlSource {
}
public String getLine(LineLocation n) {
- for (CharSequence2 s : source) {
+ for (StringLocated s : source) {
if (s.getLocation().compareTo(n) == 0) {
- return s.toString();
+ return s.getString();
}
}
return null;
@@ -190,17 +189,17 @@ final public class UmlSource {
* @return true if the diagram does not contain information.
*/
public boolean isEmpty() {
- for (CharSequence2 s : source) {
- if (StartUtils.isArobaseStartDiagram(s)) {
+ for (StringLocated s : source) {
+ if (StartUtils.isArobaseStartDiagram(s.getString())) {
continue;
}
- if (StartUtils.isArobaseEndDiagram(s)) {
+ if (StartUtils.isArobaseEndDiagram(s.getString())) {
continue;
}
- if (s.toString().matches("\\s*'.*")) {
+ if (s.getString().matches("\\s*'.*")) {
continue;
}
- if (StringUtils.trin(s).length() != 0) {
+ if (StringUtils.trin(s.getString()).length() != 0) {
return false;
}
}
@@ -214,8 +213,8 @@ final public class UmlSource {
*/
public Display getTitle() {
final Pattern2 p = MyPattern.cmpile("(?i)^[%s]*title[%s]+(.+)$");
- for (CharSequence2 s : source) {
- final Matcher2 m = p.matcher(s);
+ for (StringLocated s : source) {
+ final Matcher2 m = p.matcher(s.getString());
final boolean ok = m.matches();
if (ok) {
return Display.create(m.group(1));
@@ -225,12 +224,12 @@ final public class UmlSource {
}
public boolean isStartDef() {
- return source.get(0).startsWith("@startdef");
+ return source.get(0).getString().startsWith("@startdef");
}
public String getId() {
final Pattern p = Pattern.compile("id=([\\w]+)\\b");
- final Matcher m = p.matcher(source.get(0));
+ final Matcher m = p.matcher(source.get(0).getString());
if (m.find()) {
return m.group(1);
}
diff --git a/src/net/sourceforge/plantuml/creole/AbstractAtom.java b/src/net/sourceforge/plantuml/creole/AbstractAtom.java
new file mode 100644
index 000000000..b0cf83113
--- /dev/null
+++ b/src/net/sourceforge/plantuml/creole/AbstractAtom.java
@@ -0,0 +1,48 @@
+/* ========================================================================
+ * PlantUML : a free UML diagram generator
+ * ========================================================================
+ *
+ * (C) Copyright 2009-2020, Arnaud Roques
+ *
+ * Project Info: http://plantuml.com
+ *
+ * If you like this project or if you find it useful, you can support us at:
+ *
+ * http://plantuml.com/patreon (only 1$ per month!)
+ * http://plantuml.com/paypal
+ *
+ * This file is part of PlantUML.
+ *
+ * PlantUML is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * PlantUML distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+ * USA.
+ *
+ *
+ * Original Author: Arnaud Roques
+ *
+ *
+ */
+package net.sourceforge.plantuml.creole;
+
+import java.util.List;
+
+import net.sourceforge.plantuml.graphic.StringBounder;
+
+public abstract class AbstractAtom implements Atom {
+
+ public List splitInTwo(StringBounder stringBounder, double width) {
+ throw new UnsupportedOperationException(getClass().toString());
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/creole/Atom.java b/src/net/sourceforge/plantuml/creole/Atom.java
index e963b40f2..5c7404176 100644
--- a/src/net/sourceforge/plantuml/creole/Atom.java
+++ b/src/net/sourceforge/plantuml/creole/Atom.java
@@ -36,6 +36,7 @@
package net.sourceforge.plantuml.creole;
import java.awt.geom.Dimension2D;
+import java.util.List;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.ugraphic.UGraphic;
@@ -48,5 +49,7 @@ public interface Atom extends UShape {
public double getStartingAltitude(StringBounder stringBounder);
public void drawU(UGraphic ug);
-
+
+ public List splitInTwo(StringBounder stringBounder, double width);
+
}
diff --git a/src/net/sourceforge/plantuml/creole/AtomHorizontalTexts.java b/src/net/sourceforge/plantuml/creole/AtomHorizontalTexts.java
index b5f757fb8..251112365 100644
--- a/src/net/sourceforge/plantuml/creole/AtomHorizontalTexts.java
+++ b/src/net/sourceforge/plantuml/creole/AtomHorizontalTexts.java
@@ -43,7 +43,7 @@ import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate;
-public class AtomHorizontalTexts implements Atom {
+public class AtomHorizontalTexts extends AbstractAtom implements Atom {
private final List