diff --git a/pom.xml b/pom.xml index 600fb1f2c..f4cb76d2b 100644 --- a/pom.xml +++ b/pom.xml @@ -30,12 +30,13 @@ Script Author: Julien Eluard --> - + 4.0.0 net.sourceforge.plantuml plantuml - 8041-SNAPSHOT + 8042-SNAPSHOT jar PlantUML diff --git a/src/net/sourceforge/plantuml/AbstractPSystem.java b/src/net/sourceforge/plantuml/AbstractPSystem.java index 5cc4bbd0b..9a2dfdcd2 100644 --- a/src/net/sourceforge/plantuml/AbstractPSystem.java +++ b/src/net/sourceforge/plantuml/AbstractPSystem.java @@ -28,12 +28,11 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 19109 $ + * Revision $Revision: 19886 $ * */ package net.sourceforge.plantuml; -import java.util.List; import java.util.Properties; import net.sourceforge.plantuml.command.BlocLines; @@ -100,6 +99,11 @@ public abstract class AbstractPSystem implements Diagram { public String getWarningOrError() { return null; } + + public String checkFinalError() { + return null; + } + public void makeDiagramReady() { } diff --git a/src/net/sourceforge/plantuml/BlockUml.java b/src/net/sourceforge/plantuml/BlockUml.java index 3e977157b..2ef4b8d04 100644 --- a/src/net/sourceforge/plantuml/BlockUml.java +++ b/src/net/sourceforge/plantuml/BlockUml.java @@ -36,10 +36,10 @@ package net.sourceforge.plantuml; import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; +import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; +import net.sourceforge.plantuml.command.regex.Pattern2; import net.sourceforge.plantuml.core.Diagram; public class BlockUml { @@ -48,7 +48,7 @@ public class BlockUml { private final int startLine; private Diagram system; - private static final Pattern patternFilename = MyPattern.cmpile("^@start[^%s{}%g]+[%s{][%s%g]*([^%g]*?)[%s}%g]*$"); + private static final Pattern2 patternFilename = MyPattern.cmpile("^@start[^%s{}%g]+[%s{][%s%g]*([^%g]*?)[%s}%g]*$"); BlockUml(String... strings) { this(convert(strings), 0); @@ -91,7 +91,7 @@ public class BlockUml { if (OptionFlags.getInstance().isWord()) { return null; } - final Matcher m = patternFilename.matcher(StringUtils.trin(data.get(0).toString())); + final Matcher2 m = patternFilename.matcher(StringUtils.trin(data.get(0).toString())); final boolean ok = m.find(); if (ok == false) { return null; diff --git a/src/net/sourceforge/plantuml/FileGroup.java b/src/net/sourceforge/plantuml/FileGroup.java index d17604bdb..478a52bb7 100644 --- a/src/net/sourceforge/plantuml/FileGroup.java +++ b/src/net/sourceforge/plantuml/FileGroup.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 19109 $ + * Revision $Revision: 19880 $ * */ package net.sourceforge.plantuml; @@ -37,10 +37,10 @@ import java.io.File; import java.util.ArrayList; import java.util.Collections; import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; +import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; +import net.sourceforge.plantuml.command.regex.Pattern2; public class FileGroup { @@ -49,7 +49,7 @@ public class FileGroup { private final List excluded; private final Option option; - private final static Pattern predirPath = MyPattern.cmpile("^([^*?]*[/\\\\])?(.*)$"); + private final static Pattern2 predirPath = MyPattern.cmpile("^([^*?]*[/\\\\])?(.*)$"); public FileGroup(String pattern, List excluded, Option option) { this.pattern = pattern; @@ -67,7 +67,7 @@ public class FileGroup { } private void recurse() { - final Matcher m = predirPath.matcher(pattern); + final Matcher2 m = predirPath.matcher(pattern); final boolean ok = m.find(); if (ok == false) { throw new IllegalArgumentException(); @@ -123,11 +123,11 @@ public class FileGroup { return f.getPath().replace('\\', '/'); } - private final static Pattern noStarInDirectory = MyPattern.cmpile("^(?:([^*?]*)[/\\\\])?([^/\\\\]*)$"); + private final static Pattern2 noStarInDirectory = MyPattern.cmpile("^(?:([^*?]*)[/\\\\])?([^/\\\\]*)$"); private void initWithSimpleStar() { assert pattern.indexOf("**") == -1; - final Matcher m = noStarInDirectory.matcher(pattern); + final Matcher2 m = noStarInDirectory.matcher(pattern); if (m.find()) { File dir = new File("."); if (m.group(1) != null) { diff --git a/src/net/sourceforge/plantuml/LineConfigurable.java b/src/net/sourceforge/plantuml/LineConfigurable.java index 64772346b..f42b55526 100644 --- a/src/net/sourceforge/plantuml/LineConfigurable.java +++ b/src/net/sourceforge/plantuml/LineConfigurable.java @@ -36,7 +36,6 @@ package net.sourceforge.plantuml; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.Colors; -import net.sourceforge.plantuml.ugraphic.UStroke; public interface LineConfigurable { diff --git a/src/net/sourceforge/plantuml/NewpagedDiagram.java b/src/net/sourceforge/plantuml/NewpagedDiagram.java index e9b640dbd..671e3defc 100644 --- a/src/net/sourceforge/plantuml/NewpagedDiagram.java +++ b/src/net/sourceforge/plantuml/NewpagedDiagram.java @@ -142,6 +142,17 @@ public class NewpagedDiagram extends AbstractPSystem { } } + @Override + public String checkFinalError() { + for (Diagram p : getDiagrams()) { + final String check = ((AbstractPSystem) p).checkFinalError(); + if (check != null) { + return check; + } + } + return super.checkFinalError(); + } + public final List getDiagrams() { return Collections.unmodifiableList(diagrams); } diff --git a/src/net/sourceforge/plantuml/Option.java b/src/net/sourceforge/plantuml/Option.java index ac52b14bb..2268ee8aa 100644 --- a/src/net/sourceforge/plantuml/Option.java +++ b/src/net/sourceforge/plantuml/Option.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 19636 $ + * Revision $Revision: 19880 $ * */ package net.sourceforge.plantuml; @@ -43,10 +43,10 @@ import java.util.Collections; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -import java.util.regex.Matcher; -import java.util.regex.Pattern; +import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; +import net.sourceforge.plantuml.command.regex.Pattern2; import net.sourceforge.plantuml.cucadiagram.dot.GraphvizUtils; import net.sourceforge.plantuml.preproc.Defines; @@ -283,16 +283,16 @@ public class Option { } private void manageDefine(String s) { - final Pattern p = MyPattern.cmpile("^(\\w+)(?:=(.*))?$"); - final Matcher m = p.matcher(s); + final Pattern2 p = MyPattern.cmpile("^(\\w+)(?:=(.*))?$"); + final Matcher2 m = p.matcher(s); if (m.find()) { define(m.group(1), m.group(2)); } } private void manageSkinParam(String s) { - final Pattern p = MyPattern.cmpile("^(\\w+)(?:=(.*))?$"); - final Matcher m = p.matcher(s); + final Pattern2 p = MyPattern.cmpile("^(\\w+)(?:=(.*))?$"); + final Matcher2 m = p.matcher(s); if (m.find()) { skinParam(m.group(1), m.group(2)); } diff --git a/src/net/sourceforge/plantuml/OptionFlags.java b/src/net/sourceforge/plantuml/OptionFlags.java index 66d3908b0..1474d30a3 100644 --- a/src/net/sourceforge/plantuml/OptionFlags.java +++ b/src/net/sourceforge/plantuml/OptionFlags.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 19636 $ + * Revision $Revision: 19870 $ * */ package net.sourceforge.plantuml; @@ -68,6 +68,10 @@ public class OptionFlags { reset(false); } + public final void setDotExecutable(String dotExecutable) { + GraphvizUtils.setDotExecutable(dotExecutable); + } + private void reset(boolean exit) { // keepTmpFiles = false; verbose = false; diff --git a/src/net/sourceforge/plantuml/OptionPrint.java b/src/net/sourceforge/plantuml/OptionPrint.java index 54f444e04..66093ad4c 100644 --- a/src/net/sourceforge/plantuml/OptionPrint.java +++ b/src/net/sourceforge/plantuml/OptionPrint.java @@ -28,14 +28,13 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 19636 $ + * Revision $Revision: 19885 $ * */ package net.sourceforge.plantuml; import java.io.File; import java.nio.charset.Charset; -import java.util.Date; import java.util.Properties; import net.sourceforge.plantuml.cucadiagram.dot.GraphvizUtils; diff --git a/src/net/sourceforge/plantuml/SkinParam.java b/src/net/sourceforge/plantuml/SkinParam.java index f3b6b1fc8..755ebbd6d 100644 --- a/src/net/sourceforge/plantuml/SkinParam.java +++ b/src/net/sourceforge/plantuml/SkinParam.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 19706 $ + * Revision $Revision: 19880 $ * */ package net.sourceforge.plantuml; @@ -41,10 +41,10 @@ import java.util.HashMap; import java.util.Map; import java.util.Set; import java.util.TreeSet; -import java.util.regex.Matcher; -import java.util.regex.Pattern; +import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; +import net.sourceforge.plantuml.command.regex.Pattern2; import net.sourceforge.plantuml.creole.CommandCreoleMonospaced; import net.sourceforge.plantuml.cucadiagram.Rankdir; import net.sourceforge.plantuml.cucadiagram.Stereotype; @@ -69,7 +69,7 @@ import net.sourceforge.plantuml.ugraphic.sprite.SpriteImage; public class SkinParam implements ISkinParam { private static final String stereoPatternString = "\\<\\<(.*?)\\>\\>"; - private static final Pattern stereoPattern = MyPattern.cmpile(stereoPatternString); + private static final Pattern2 stereoPattern = MyPattern.cmpile(stereoPatternString); private final Map params = new HashMap(); private Rankdir rankdir = Rankdir.TOP_TO_BOTTOM; @@ -109,7 +109,7 @@ public class SkinParam implements ISkinParam { // // key = key.replaceAll("componentarrow", "genericarrow"); // // key = key.replaceAll("statearrow", "genericarrow"); // // key = key.replaceAll("usecasearrow", "genericarrow"); - final Matcher m = stereoPattern.matcher(key); + final Matcher2 m = stereoPattern.matcher(key); if (m.find()) { final String s = m.group(1); key = key.replaceAll(stereoPatternString, ""); diff --git a/src/net/sourceforge/plantuml/StringUtils.java b/src/net/sourceforge/plantuml/StringUtils.java index f9ef0c42b..aad38b7db 100644 --- a/src/net/sourceforge/plantuml/StringUtils.java +++ b/src/net/sourceforge/plantuml/StringUtils.java @@ -43,7 +43,9 @@ import java.util.Locale; import java.util.regex.Matcher; import java.util.regex.Pattern; +import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; +import net.sourceforge.plantuml.command.regex.Pattern2; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.HtmlColorTransparent; @@ -83,8 +85,8 @@ public class StringUtils { return Collections.unmodifiableList(result); } - final static public List getSplit(Pattern pattern, String line) { - final Matcher m = pattern.matcher(line); + final static public List getSplit(Pattern2 pattern, String line) { + final Matcher2 m = pattern.matcher(line); if (m.find() == false) { return null; } @@ -354,8 +356,8 @@ public class StringUtils { // throw new IllegalArgumentException(); // } final List result = new ArrayList(); - final Pattern p = MyPattern.cmpile("([\\p{L}0-9_.]+|[%g][^%g]+[%g])"); - final Matcher m = p.matcher(s); + final Pattern2 p = MyPattern.cmpile("([\\p{L}0-9_.]+|[%g][^%g]+[%g])"); + final Matcher2 m = p.matcher(s); while (m.find()) { result.add(eventuallyRemoveStartingAndEndingDoubleQuote(m.group(0))); } diff --git a/src/net/sourceforge/plantuml/UmlDiagram.java b/src/net/sourceforge/plantuml/UmlDiagram.java index 914df6de5..3b168088d 100644 --- a/src/net/sourceforge/plantuml/UmlDiagram.java +++ b/src/net/sourceforge/plantuml/UmlDiagram.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 19753 $ + * Revision $Revision: 19863 $ * */ package net.sourceforge.plantuml; @@ -277,10 +277,11 @@ public abstract class UmlDiagram extends AbstractPSystem implements Diagram, Ann } public String getFlashData() { - final StringBuilder result = new StringBuilder(); final UmlSource source = getSource(); - result.append(source.getPlainString()); - return result.toString(); + if (source == null) { + return ""; + } + return source.getPlainString(); } static private List getFailureText1(Throwable exception, String graphvizVersion) { diff --git a/src/net/sourceforge/plantuml/UrlBuilder.java b/src/net/sourceforge/plantuml/UrlBuilder.java index 8edfa8fbd..e132252be 100644 --- a/src/net/sourceforge/plantuml/UrlBuilder.java +++ b/src/net/sourceforge/plantuml/UrlBuilder.java @@ -33,10 +33,9 @@ */ package net.sourceforge.plantuml; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - +import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; +import net.sourceforge.plantuml.command.regex.Pattern2; public class UrlBuilder { @@ -70,8 +69,8 @@ public class UrlBuilder { } public static String multilineTooltip(String label) { - final Pattern p = MyPattern.cmpile("(?i)^(" + URL_PATTERN + ")?(.*)$"); - final Matcher m = p.matcher(label); + final Pattern2 p = MyPattern.cmpile("(?i)^(" + URL_PATTERN + ")?(.*)$"); + final Matcher2 m = p.matcher(label); if (m.matches() == false) { return label; } @@ -85,7 +84,7 @@ public class UrlBuilder { } public Url getUrl(String s) { - final Pattern p; + final Pattern2 p; if (mode == ModeUrl.STRICT) { p = MyPattern.cmpile("(?i)^" + URL_PATTERN + "$"); } else if (mode == ModeUrl.AT_START) { @@ -97,7 +96,7 @@ public class UrlBuilder { } else { throw new IllegalStateException(); } - final Matcher m = p.matcher(StringUtils.trinNoTrace(s)); + final Matcher2 m = p.matcher(StringUtils.trinNoTrace(s)); if (m.matches() == false) { return null; } @@ -143,8 +142,8 @@ public class UrlBuilder { } public static String purgeUrl(final String label) { - final Pattern p = MyPattern.cmpile("[%s]*" + URL_PATTERN + "[%s]*"); - final Matcher m = p.matcher(label); + final Pattern2 p = MyPattern.cmpile("[%s]*" + URL_PATTERN + "[%s]*"); + final Matcher2 m = p.matcher(label); if (m.find() == false) { throw new IllegalStateException(); } diff --git a/src/net/sourceforge/plantuml/acearth/PSystemXearth.java b/src/net/sourceforge/plantuml/acearth/PSystemXearth.java index e3800fc71..4b23d84dd 100644 --- a/src/net/sourceforge/plantuml/acearth/PSystemXearth.java +++ b/src/net/sourceforge/plantuml/acearth/PSystemXearth.java @@ -41,6 +41,7 @@ import java.util.Arrays; import java.util.Collection; import java.util.Date; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.TimeZone; @@ -108,9 +109,9 @@ public class PSystemXearth extends AbstractPSystem { private Date extractGmt(String s) { final SimpleDateFormat timeFormat; if (s.matches("\\d{4}/\\d{2}/\\d{2} \\d{2}:\\d{2}:\\d{2}")) { - timeFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); + timeFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss", Locale.US); } else if (s.matches("\\d{4}/\\d{2}/\\d{2} \\d{2}:\\d{2}")) { - timeFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm"); + timeFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm", Locale.US); } else { throw new UnsupportedOperationException(s); } diff --git a/src/net/sourceforge/plantuml/acearth/PSystemXearthFactory.java b/src/net/sourceforge/plantuml/acearth/PSystemXearthFactory.java index 61b07b731..8be764800 100644 --- a/src/net/sourceforge/plantuml/acearth/PSystemXearthFactory.java +++ b/src/net/sourceforge/plantuml/acearth/PSystemXearthFactory.java @@ -37,11 +37,11 @@ import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -import java.util.regex.Matcher; -import java.util.regex.Pattern; import net.sourceforge.plantuml.command.PSystemBasicFactory; +import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; +import net.sourceforge.plantuml.command.regex.Pattern2; import com.ctreber.acearth.plugins.markers.Marker; @@ -61,8 +61,8 @@ public class PSystemXearthFactory extends PSystemBasicFactory { } private void extractDimension(String startLine) { - final Pattern p = MyPattern.cmpile("\\((\\d+),(\\d+)\\)"); - final Matcher m = p.matcher(startLine); + final Pattern2 p = MyPattern.cmpile("\\((\\d+),(\\d+)\\)"); + final Matcher2 m = p.matcher(startLine); final boolean ok = m.find(); if (ok) { width = Integer.parseInt(m.group(1)); @@ -83,8 +83,8 @@ public class PSystemXearthFactory extends PSystemBasicFactory { if (line.startsWith("#") || line.startsWith("'")) { return system; } - final Pattern p = MyPattern.cmpile("(\\w+)[%s]*=[%s]*(.*)"); - final Matcher m = p.matcher(line); + final Pattern2 p = MyPattern.cmpile("(\\w+)[%s]*=[%s]*(.*)"); + final Matcher2 m = p.matcher(line); if (m.find()) { config.put(m.group(1), m.group(2)); return system; diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagram3.java b/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagram3.java index eaedec51d..dfd84fb44 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagram3.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagram3.java @@ -53,7 +53,6 @@ import net.sourceforge.plantuml.core.DiagramDescriptionImpl; import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorAndStyle; import net.sourceforge.plantuml.graphic.Rainbow; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockCompressed; @@ -62,7 +61,6 @@ import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.sequencediagram.NotePosition; import net.sourceforge.plantuml.sequencediagram.NoteType; -import net.sourceforge.plantuml.skin.rose.Rose; import net.sourceforge.plantuml.ugraphic.ImageBuilder; public class ActivityDiagram3 extends UmlDiagram { @@ -309,11 +307,11 @@ public class ActivityDiagram3 extends UmlDiagram { } public CommandExecutionResult repeatWhile(Display label, Display yes, Display out, Display linkLabel, - HtmlColor linkColor) { + Rainbow linkColor) { manageSwimlaneStrategy(); if (current() instanceof InstructionRepeat) { final InstructionRepeat instructionRepeat = (InstructionRepeat) current(); - final LinkRendering back = new LinkRendering(HtmlColorAndStyle.fromColor(linkColor)).withDisplay(linkLabel); + final LinkRendering back = new LinkRendering(linkColor).withDisplay(linkLabel); instructionRepeat.setTest(label, yes, out, nextLinkRenderer(), back); setCurrent(instructionRepeat.getParent()); this.setNextLinkRendererInternal(LinkRendering.none()); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagramFactory3.java b/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagramFactory3.java index 96d698e9e..4196bce94 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagramFactory3.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagramFactory3.java @@ -99,11 +99,11 @@ public class ActivityDiagramFactory3 extends UmlDiagramFactory { cmds.add(new CommandActivity3()); cmds.add(new CommandIf4()); cmds.add(new CommandIf2()); - cmds.add(new CommandDecoratorMultine(new CommandIf2())); + cmds.add(new CommandDecoratorMultine(new CommandIf2(), 50)); cmds.add(new CommandIfLegacy1()); cmds.add(new CommandElseIf2()); cmds.add(new CommandElse3()); - cmds.add(new CommandDecoratorMultine(new CommandElse3())); + cmds.add(new CommandDecoratorMultine(new CommandElse3(), 50)); cmds.add(new CommandElseLegacy1()); cmds.add(new CommandEndif3()); cmds.add(new CommandRepeat3()); @@ -132,7 +132,7 @@ public class ActivityDiagramFactory3 extends UmlDiagramFactory { cmds.add(new CommandLabel()); cmds.add(new CommandGoto()); - cmds.add(new CommandDecoratorMultine(new CommandElseIf2())); + cmds.add(new CommandDecoratorMultine(new CommandElseIf2(), 50)); return cmds; } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/InstructionEnd.java b/src/net/sourceforge/plantuml/activitydiagram3/InstructionEnd.java index 7918c9321..2e5904ef5 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/InstructionEnd.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/InstructionEnd.java @@ -36,8 +36,6 @@ package net.sourceforge.plantuml.activitydiagram3; import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; -import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.sequencediagram.NotePosition; public class InstructionEnd extends MonoSwimable implements Instruction { diff --git a/src/net/sourceforge/plantuml/activitydiagram3/InstructionGoto.java b/src/net/sourceforge/plantuml/activitydiagram3/InstructionGoto.java index 6c5862367..1f578ea24 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/InstructionGoto.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/InstructionGoto.java @@ -37,8 +37,6 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGoto; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; -import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.sequencediagram.NotePosition; public class InstructionGoto extends MonoSwimable implements Instruction { diff --git a/src/net/sourceforge/plantuml/activitydiagram3/InstructionLabel.java b/src/net/sourceforge/plantuml/activitydiagram3/InstructionLabel.java index e26fe2665..69da503a6 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/InstructionLabel.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/InstructionLabel.java @@ -37,8 +37,6 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileLabel; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; -import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.sequencediagram.NotePosition; public class InstructionLabel extends MonoSwimable implements Instruction { diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivity3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivity3.java index e11df6ec1..d16b7cddc 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivity3.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivity3.java @@ -44,7 +44,6 @@ 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.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.color.ColorParser; import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.Colors; diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandArrowLong3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandArrowLong3.java index c4fa4dc3b..41e5cf82b 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandArrowLong3.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandArrowLong3.java @@ -45,8 +45,6 @@ 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.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorAndStyle; import net.sourceforge.plantuml.graphic.Rainbow; public class CommandArrowLong3 extends CommandMultilines2 { diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandRepeatWhile3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandRepeatWhile3.java index 2558650fa..ff0a16087 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandRepeatWhile3.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandRepeatWhile3.java @@ -42,7 +42,7 @@ 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.HtmlColor; +import net.sourceforge.plantuml.graphic.Rainbow; public class CommandRepeatWhile3 extends SingleLineCommand2 { @@ -74,7 +74,7 @@ public class CommandRepeatWhile3 extends SingleLineCommand2 { new RegexOptional(new RegexConcat( // new RegexOr(// new RegexLeaf("->"), // - new RegexLeaf("COLOR", "-\\[(#\\w+)\\]->")), // + new RegexLeaf("COLOR", CommandArrow3.STYLE_COLORS)), // new RegexLeaf("[%s]*"), // new RegexOr(// new RegexLeaf("LABEL", "(.*)"), // @@ -88,9 +88,18 @@ public class CommandRepeatWhile3 extends SingleLineCommand2 { final Display test = Display.getWithNewlines(arg.getLazzy("TEST", 0)); final Display yes = Display.getWithNewlines(arg.getLazzy("WHEN", 0)); final Display out = Display.getWithNewlines(arg.getLazzy("OUT", 0)); - final HtmlColor linkColor = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)); + + final String colorString = arg.get("COLOR", 0); + final Rainbow rainbow; + if (colorString == null) { + rainbow = Rainbow.none(); + } else { + rainbow = Rainbow.build(diagram.getSkinParam(), colorString, diagram.getSkinParam() + .colorArrowSeparationSpace()); + } + final Display linkLabel = Display.getWithNewlines(arg.get("LABEL", 0)); - return diagram.repeatWhile(test, yes, out, linkLabel, linkColor); + return diagram.repeatWhile(test, yes, out, linkLabel, rainbow); } } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandRepeatWhile3Multilines.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandRepeatWhile3Multilines.java index 4f9ecd7b7..a899bdc29 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandRepeatWhile3Multilines.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandRepeatWhile3Multilines.java @@ -47,7 +47,7 @@ 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.graphic.HtmlColor; +import net.sourceforge.plantuml.graphic.Rainbow; public class CommandRepeatWhile3Multilines extends CommandMultilines3 { @@ -95,8 +95,8 @@ public class CommandRepeatWhile3Multilines extends CommandMultilines3 splitted = testDisplay.splitMultiline(MyPattern.cmpile("\\)[%s]*(is|equals?)[%s]*\\(", Pattern.CASE_INSENSITIVE)); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FloatingNote.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FloatingNote.java index 7c67b4b26..a1574ed4f 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FloatingNote.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FloatingNote.java @@ -53,7 +53,6 @@ import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.skin.rose.Rose; import net.sourceforge.plantuml.svek.image.Opale; -import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UStroke; diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorCreateFork.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorCreateFork.java index 145a8ad3a..763efaa66 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorCreateFork.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorCreateFork.java @@ -40,7 +40,6 @@ import java.util.List; import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.ISkinParam; -import net.sourceforge.plantuml.activitydiagram3.LinkRendering; import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractConnection; import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows; import net.sourceforge.plantuml.activitydiagram3.ftile.Connection; diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorCreateSplit.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorCreateSplit.java index ddc8d9577..016d551ec 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorCreateSplit.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorCreateSplit.java @@ -39,7 +39,6 @@ import java.util.HashSet; import java.util.List; import java.util.Set; -import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.OptionFlags; import net.sourceforge.plantuml.activitydiagram3.LinkRendering; diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileGroup.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileGroup.java index 5259b720b..feebcdbae 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileGroup.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileGroup.java @@ -33,7 +33,6 @@ */ package net.sourceforge.plantuml.activitydiagram3.ftile.vcompact; -import java.awt.Font; import java.awt.geom.Dimension2D; import java.util.Set; @@ -44,7 +43,6 @@ import net.sourceforge.plantuml.activitydiagram3.LinkRendering; import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile; import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry; -import net.sourceforge.plantuml.activitydiagram3.ftile.FtileMarged; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileUtils; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; import net.sourceforge.plantuml.cucadiagram.Display; diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfLongHorizontal.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfLongHorizontal.java index 31d877e49..aa80d355c 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfLongHorizontal.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfLongHorizontal.java @@ -169,9 +169,11 @@ class FtileIfLongHorizontal extends AbstractFtile { final Ftile ftile = tiles.get(i); final Ftile diam = diamonds.get(i); - final Rainbow color = FtileIfWithLinks.getInColor(thens.get(i), arrowColor); - conns.add(result.new ConnectionVerticalIn(diam, ftile, color == null ? arrowColor : color)); - conns.add(result.new ConnectionVerticalOut(ftile, arrowColor)); + final Rainbow rainbowIn = FtileIfWithLinks.getInColor(thens.get(i), arrowColor); + final Branch branch = thens.get(i); + final Rainbow rainbowOut = branch.getInlinkRenderingColorAndStyle(); + conns.add(result.new ConnectionVerticalIn(diam, ftile, rainbowIn.size() == 0 ? arrowColor : rainbowIn)); + conns.add(result.new ConnectionVerticalOut(ftile, rainbowOut.size() == 0 ? arrowColor : rainbowOut)); } final Rainbow topInColor = topInlinkRendering.getRainbow(arrowColor); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWhile.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWhile.java index ab305e63f..77d3eba60 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWhile.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWhile.java @@ -62,9 +62,9 @@ import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorAndStyle; import net.sourceforge.plantuml.graphic.Rainbow; import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.graphic.StringBounderUtils; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.svek.ConditionStyle; @@ -143,9 +143,14 @@ class FtileWhile extends AbstractFtile { afterEndwhileColor = afterEndwhile.getRainbow(); } + final Dimension2D dim = whileBlock.calculateDimension(StringBounderUtils.asStringBounder()); final List conns = new ArrayList(); - conns.add(result.new ConnectionIn(whileBlock.getInLinkRendering().getRainbow(arrowColor))); - conns.add(result.new ConnectionBack(endInlinkColor)); + if (dim.getWidth() == 0 || dim.getHeight() == 0) { + conns.add(result.new ConnectionBackEmpty(endInlinkColor)); + } else { + conns.add(result.new ConnectionIn(whileBlock.getInLinkRendering().getRainbow(arrowColor))); + conns.add(result.new ConnectionBack(endInlinkColor)); + } conns.add(result.new ConnectionOut(afterEndwhileColor)); return FtileUtils.addConnection(result, conns); } @@ -288,6 +293,59 @@ class FtileWhile extends AbstractFtile { } + class ConnectionBackEmpty extends AbstractConnection { + private final Rainbow endInlinkColor; + + public ConnectionBackEmpty(Rainbow endInlinkColor) { + super(diamond1, diamond1); + this.endInlinkColor = endInlinkColor; + } + + private Point2D getP1(final StringBounder stringBounder) { + return getTranslateDiamond1(stringBounder).getTranslated( + diamond1.calculateDimension(stringBounder).getPointOut()); + } + + private double getBottom(final StringBounder stringBounder) { + final FtileGeometry geo = whileBlock.calculateDimension(stringBounder); + return getTranslateForWhile(stringBounder).getDy() + geo.getHeight(); + } + + private Point2D getP2(final StringBounder stringBounder) { + return getTranslateDiamond1(stringBounder).getTranslated(new Point2D.Double(0, 0)); + } + + public void drawU(UGraphic ug) { + final StringBounder stringBounder = ug.getStringBounder(); + + final Snake snake = new Snake(endInlinkColor, Arrows.asToLeft()); + final Dimension2D dimTotal = calculateDimension(stringBounder); + final Point2D p1 = getP1(stringBounder); + final Point2D p2 = getP2(stringBounder); + final FtileGeometry dimDiamond1 = diamond1.calculateDimension(stringBounder); + + final double x1 = p1.getX(); + final double y1 = p1.getY(); + final double x2 = p2.getX() + dimDiamond1.getWidth(); + final double y2 = p2.getY() + dimDiamond1.getOutY() / 2; + + snake.addPoint(x1, y1); + final double y1bis = Math.max(y1, getBottom(stringBounder)) + Diamond.diamondHalfSize; + snake.addPoint(x1, y1bis); + final double xx = dimTotal.getWidth(); + snake.addPoint(xx, y1bis); + snake.addPoint(xx, y2); + snake.addPoint(x2, y2); + snake.emphasizeDirection(Direction.UP); + + ug.draw(snake); + + ug.apply(new UTranslate(x1, y1bis)).draw(new UEmpty(5, Diamond.diamondHalfSize)); + + } + + } + class ConnectionOut extends AbstractConnection { private final Rainbow afterEndwhileColor; 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 e5ca1de44..1a14a076a 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/ConditionalBuilder.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/ConditionalBuilder.java @@ -37,7 +37,6 @@ import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.activitydiagram3.Branch; -import net.sourceforge.plantuml.activitydiagram3.LinkRendering; import net.sourceforge.plantuml.activitydiagram3.ftile.Diamond; import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileEmpty; diff --git a/src/net/sourceforge/plantuml/asciiart/ComponentTextActiveLine.java b/src/net/sourceforge/plantuml/asciiart/ComponentTextActiveLine.java index 3086aa81b..4023f5b65 100644 --- a/src/net/sourceforge/plantuml/asciiart/ComponentTextActiveLine.java +++ b/src/net/sourceforge/plantuml/asciiart/ComponentTextActiveLine.java @@ -38,7 +38,6 @@ import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.FileFormat; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.skin.Area; -import net.sourceforge.plantuml.skin.Component; import net.sourceforge.plantuml.skin.Context2D; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.txt.UGraphicTxt; diff --git a/src/net/sourceforge/plantuml/asciiart/ComponentTextActor.java b/src/net/sourceforge/plantuml/asciiart/ComponentTextActor.java index ddc68f145..dd4d9b532 100644 --- a/src/net/sourceforge/plantuml/asciiart/ComponentTextActor.java +++ b/src/net/sourceforge/plantuml/asciiart/ComponentTextActor.java @@ -36,15 +36,14 @@ package net.sourceforge.plantuml.asciiart; import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.FileFormat; +import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.skin.Area; -import net.sourceforge.plantuml.skin.Component; import net.sourceforge.plantuml.skin.ComponentType; import net.sourceforge.plantuml.skin.Context2D; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.txt.UGraphicTxt; -import net.sourceforge.plantuml.StringUtils; public class ComponentTextActor extends AbstractComponentText { diff --git a/src/net/sourceforge/plantuml/asciiart/ComponentTextArrow.java b/src/net/sourceforge/plantuml/asciiart/ComponentTextArrow.java index e3a80d8ed..f3b798fcd 100644 --- a/src/net/sourceforge/plantuml/asciiart/ComponentTextArrow.java +++ b/src/net/sourceforge/plantuml/asciiart/ComponentTextArrow.java @@ -87,6 +87,9 @@ public class ComponentTextArrow extends AbstractComponentText { } public void drawU(UGraphic ug, Area area, Context2D context) { + if (config.isHidden()) { + return; + } final Dimension2D dimensionToUse = area.getDimensionToUse(); final UmlCharArea charArea = ((UGraphicTxt) ug).getCharArea(); final int width = (int) dimensionToUse.getWidth(); diff --git a/src/net/sourceforge/plantuml/asciiart/ComponentTextDivider.java b/src/net/sourceforge/plantuml/asciiart/ComponentTextDivider.java index c0b7e0d45..cf65b5509 100644 --- a/src/net/sourceforge/plantuml/asciiart/ComponentTextDivider.java +++ b/src/net/sourceforge/plantuml/asciiart/ComponentTextDivider.java @@ -36,15 +36,14 @@ package net.sourceforge.plantuml.asciiart; import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.FileFormat; +import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.skin.Area; -import net.sourceforge.plantuml.skin.Component; import net.sourceforge.plantuml.skin.ComponentType; import net.sourceforge.plantuml.skin.Context2D; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.txt.UGraphicTxt; -import net.sourceforge.plantuml.StringUtils; public class ComponentTextDivider extends AbstractComponentText { diff --git a/src/net/sourceforge/plantuml/asciiart/ComponentTextGroupingElse.java b/src/net/sourceforge/plantuml/asciiart/ComponentTextGroupingElse.java index d4b2704e4..111af9282 100644 --- a/src/net/sourceforge/plantuml/asciiart/ComponentTextGroupingElse.java +++ b/src/net/sourceforge/plantuml/asciiart/ComponentTextGroupingElse.java @@ -39,7 +39,6 @@ import net.sourceforge.plantuml.FileFormat; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.skin.Area; -import net.sourceforge.plantuml.skin.Component; import net.sourceforge.plantuml.skin.ComponentType; import net.sourceforge.plantuml.skin.Context2D; import net.sourceforge.plantuml.ugraphic.UGraphic; diff --git a/src/net/sourceforge/plantuml/asciiart/ComponentTextGroupingHeader.java b/src/net/sourceforge/plantuml/asciiart/ComponentTextGroupingHeader.java index fd2768605..8e06a5c03 100644 --- a/src/net/sourceforge/plantuml/asciiart/ComponentTextGroupingHeader.java +++ b/src/net/sourceforge/plantuml/asciiart/ComponentTextGroupingHeader.java @@ -36,15 +36,14 @@ package net.sourceforge.plantuml.asciiart; import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.FileFormat; +import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.skin.Area; -import net.sourceforge.plantuml.skin.Component; import net.sourceforge.plantuml.skin.ComponentType; import net.sourceforge.plantuml.skin.Context2D; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.txt.UGraphicTxt; -import net.sourceforge.plantuml.StringUtils; public class ComponentTextGroupingHeader extends AbstractComponentText { diff --git a/src/net/sourceforge/plantuml/asciiart/ComponentTextGroupingTail.java b/src/net/sourceforge/plantuml/asciiart/ComponentTextGroupingTail.java index ac9b77391..10a7ba9f1 100644 --- a/src/net/sourceforge/plantuml/asciiart/ComponentTextGroupingTail.java +++ b/src/net/sourceforge/plantuml/asciiart/ComponentTextGroupingTail.java @@ -39,7 +39,6 @@ import java.util.List; import net.sourceforge.plantuml.FileFormat; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.skin.Area; -import net.sourceforge.plantuml.skin.Component; import net.sourceforge.plantuml.skin.ComponentType; import net.sourceforge.plantuml.skin.Context2D; import net.sourceforge.plantuml.ugraphic.UGraphic; diff --git a/src/net/sourceforge/plantuml/asciiart/ComponentTextLine.java b/src/net/sourceforge/plantuml/asciiart/ComponentTextLine.java index a332eeb5b..548fba7c0 100644 --- a/src/net/sourceforge/plantuml/asciiart/ComponentTextLine.java +++ b/src/net/sourceforge/plantuml/asciiart/ComponentTextLine.java @@ -38,7 +38,6 @@ import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.FileFormat; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.skin.Area; -import net.sourceforge.plantuml.skin.Component; import net.sourceforge.plantuml.skin.Context2D; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.txt.UGraphicTxt; diff --git a/src/net/sourceforge/plantuml/asciiart/ComponentTextNewpage.java b/src/net/sourceforge/plantuml/asciiart/ComponentTextNewpage.java index 656bf3e35..554405b3f 100644 --- a/src/net/sourceforge/plantuml/asciiart/ComponentTextNewpage.java +++ b/src/net/sourceforge/plantuml/asciiart/ComponentTextNewpage.java @@ -38,7 +38,6 @@ import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.FileFormat; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.skin.Area; -import net.sourceforge.plantuml.skin.Component; import net.sourceforge.plantuml.skin.Context2D; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.txt.UGraphicTxt; diff --git a/src/net/sourceforge/plantuml/asciiart/ComponentTextParticipant.java b/src/net/sourceforge/plantuml/asciiart/ComponentTextParticipant.java index 97aff4257..d082c045c 100644 --- a/src/net/sourceforge/plantuml/asciiart/ComponentTextParticipant.java +++ b/src/net/sourceforge/plantuml/asciiart/ComponentTextParticipant.java @@ -36,15 +36,14 @@ package net.sourceforge.plantuml.asciiart; import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.FileFormat; +import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.skin.Area; -import net.sourceforge.plantuml.skin.Component; import net.sourceforge.plantuml.skin.ComponentType; import net.sourceforge.plantuml.skin.Context2D; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.txt.UGraphicTxt; -import net.sourceforge.plantuml.StringUtils; public class ComponentTextParticipant extends AbstractComponentText { diff --git a/src/net/sourceforge/plantuml/asciiart/ComponentTextSelfArrow.java b/src/net/sourceforge/plantuml/asciiart/ComponentTextSelfArrow.java index d21948417..f6da4b404 100644 --- a/src/net/sourceforge/plantuml/asciiart/ComponentTextSelfArrow.java +++ b/src/net/sourceforge/plantuml/asciiart/ComponentTextSelfArrow.java @@ -36,16 +36,15 @@ package net.sourceforge.plantuml.asciiart; import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.FileFormat; +import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.skin.Area; import net.sourceforge.plantuml.skin.ArrowConfiguration; -import net.sourceforge.plantuml.skin.Component; import net.sourceforge.plantuml.skin.ComponentType; import net.sourceforge.plantuml.skin.Context2D; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.txt.UGraphicTxt; -import net.sourceforge.plantuml.StringUtils; public class ComponentTextSelfArrow extends AbstractComponentText { @@ -63,6 +62,9 @@ public class ComponentTextSelfArrow extends AbstractComponentText { } public void drawU(UGraphic ug, Area area, Context2D context) { + if (config.isHidden()) { + return; + } final Dimension2D dimensionToUse = area.getDimensionToUse(); final UmlCharArea charArea = ((UGraphicTxt) ug).getCharArea(); final int width = (int) dimensionToUse.getWidth(); diff --git a/src/net/sourceforge/plantuml/asciiart/UmlCharAreaImpl.java b/src/net/sourceforge/plantuml/asciiart/UmlCharAreaImpl.java index 0aafa3b24..8a9d3f88f 100644 --- a/src/net/sourceforge/plantuml/asciiart/UmlCharAreaImpl.java +++ b/src/net/sourceforge/plantuml/asciiart/UmlCharAreaImpl.java @@ -28,15 +28,13 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 19109 $ + * Revision $Revision: 19885 $ * */ package net.sourceforge.plantuml.asciiart; import java.util.Collection; -import net.sourceforge.plantuml.ugraphic.ClipContainer; - public class UmlCharAreaImpl extends BasicCharAreaImpl implements UmlCharArea { public void drawBoxSimple(int x, int y, int width, int height) { diff --git a/src/net/sourceforge/plantuml/classdiagram/ClassDiagram.java b/src/net/sourceforge/plantuml/classdiagram/ClassDiagram.java index cd70afa4e..b49b92351 100644 --- a/src/net/sourceforge/plantuml/classdiagram/ClassDiagram.java +++ b/src/net/sourceforge/plantuml/classdiagram/ClassDiagram.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 19109 $ + * Revision $Revision: 19886 $ * */ package net.sourceforge.plantuml.classdiagram; @@ -47,6 +47,7 @@ import net.sourceforge.plantuml.cucadiagram.GroupType; import net.sourceforge.plantuml.cucadiagram.IGroup; import net.sourceforge.plantuml.cucadiagram.ILeaf; import net.sourceforge.plantuml.cucadiagram.LeafType; +import net.sourceforge.plantuml.cucadiagram.Link; import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.USymbol; @@ -232,4 +233,21 @@ public class ClassDiagram extends AbstractClassOrObjectDiagram { return new EntityImageClass(null, entity, getSkinParam(), this); } + + @Override + public String checkFinalError() { + for (Link link : this.getLinks()) { + final int len = link.getLength(); + if (len == 1) { + for (Link link2 : this.getLinks()) { + if (link2.sameConnections(link) && link2.getLength() != 1) { + link2.setLength(1); + } + } + } + } + this.applySingleStrategy(); + return super.checkFinalError(); + } + } diff --git a/src/net/sourceforge/plantuml/classdiagram/ClassDiagramFactory.java b/src/net/sourceforge/plantuml/classdiagram/ClassDiagramFactory.java index 310f55745..e453ae70d 100644 --- a/src/net/sourceforge/plantuml/classdiagram/ClassDiagramFactory.java +++ b/src/net/sourceforge/plantuml/classdiagram/ClassDiagramFactory.java @@ -36,8 +36,6 @@ package net.sourceforge.plantuml.classdiagram; import java.util.ArrayList; import java.util.List; -import net.sourceforge.plantuml.AbstractPSystem; -import net.sourceforge.plantuml.NewpagedDiagram; import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.classdiagram.command.CommandAddMethod; import net.sourceforge.plantuml.classdiagram.command.CommandAllowMixing; @@ -69,8 +67,6 @@ import net.sourceforge.plantuml.command.note.FactoryNoteOnEntityCommand; import net.sourceforge.plantuml.command.note.FactoryNoteOnLinkCommand; import net.sourceforge.plantuml.command.note.FactoryTipOnEntityCommand; import net.sourceforge.plantuml.command.regex.RegexLeaf; -import net.sourceforge.plantuml.core.Diagram; -import net.sourceforge.plantuml.cucadiagram.Link; import net.sourceforge.plantuml.descdiagram.command.CommandNewpage; import net.sourceforge.plantuml.objectdiagram.command.CommandCreateEntityObject; import net.sourceforge.plantuml.objectdiagram.command.CommandCreateEntityObjectMultilines; @@ -147,32 +143,4 @@ public class ClassDiagramFactory extends UmlDiagramFactory { return cmds; } - - @Override - public String checkFinalError(AbstractPSystem sys) { - if (sys instanceof NewpagedDiagram) { - for (Diagram p : ((NewpagedDiagram) sys).getDiagrams()) { - checkFinal((ClassDiagram) p); - } - } else { - final ClassDiagram system = (ClassDiagram) sys; - checkFinal(system); - } - return super.checkFinalError(sys); - } - - private void checkFinal(final ClassDiagram system) { - for (Link link : system.getLinks()) { - final int len = link.getLength(); - if (len == 1) { - for (Link link2 : system.getLinks()) { - if (link2.sameConnections(link) && link2.getLength() != 1) { - link2.setLength(1); - } - } - } - } - system.applySingleStrategy(); - } - } diff --git a/src/net/sourceforge/plantuml/classdiagram/command/CommandLinkClass.java b/src/net/sourceforge/plantuml/classdiagram/command/CommandLinkClass.java index 01b4d68ba..98049a288 100644 --- a/src/net/sourceforge/plantuml/classdiagram/command/CommandLinkClass.java +++ b/src/net/sourceforge/plantuml/classdiagram/command/CommandLinkClass.java @@ -34,15 +34,15 @@ package net.sourceforge.plantuml.classdiagram.command; import java.util.StringTokenizer; -import java.util.regex.Matcher; -import java.util.regex.Pattern; import net.sourceforge.plantuml.Direction; import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.SingleLineCommand2; +import net.sourceforge.plantuml.command.regex.Matcher2; 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.RegexOr; @@ -213,24 +213,24 @@ final public class CommandLinkClass extends SingleLineCommand2 all = new ArrayList(); @@ -73,11 +73,11 @@ class JavaFile { String s; while ((s = br.readLine()) != null) { s = StringUtils.trin(s); - final Matcher matchPackage = packageDefinition.matcher(s); + final Matcher2 matchPackage = packageDefinition.matcher(s); if (matchPackage.find()) { javaPackage = matchPackage.group(1); } else { - final Matcher matchClassDefinition = classDefinition.matcher(s); + final Matcher2 matchClassDefinition = classDefinition.matcher(s); if (matchClassDefinition.find()) { final String n = matchClassDefinition.group(2); final String p = matchClassDefinition.group(4); diff --git a/src/net/sourceforge/plantuml/code/ArobaseStringCompressor.java b/src/net/sourceforge/plantuml/code/ArobaseStringCompressor.java index 999d8d37f..e05c1f5c1 100644 --- a/src/net/sourceforge/plantuml/code/ArobaseStringCompressor.java +++ b/src/net/sourceforge/plantuml/code/ArobaseStringCompressor.java @@ -28,26 +28,26 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 19109 $ + * Revision $Revision: 19880 $ * */ package net.sourceforge.plantuml.code; import java.io.IOException; import java.io.StringReader; -import java.util.regex.Matcher; -import java.util.regex.Pattern; import net.sourceforge.plantuml.CharSequence2; import net.sourceforge.plantuml.StringUtils; +import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; +import net.sourceforge.plantuml.command.regex.Pattern2; import net.sourceforge.plantuml.preproc.ReadLine; import net.sourceforge.plantuml.preproc.ReadLineReader; import net.sourceforge.plantuml.preproc.UncommentReadLine; public class ArobaseStringCompressor implements StringCompressor { - private final static Pattern p = MyPattern.cmpile("(?s)(?i)^[%s]*(@startuml[^\\n\\r]*)?[%s]*(.*?)[%s]*(@enduml)?[%s]*$"); + private final static Pattern2 p = MyPattern.cmpile("(?s)(?i)^[%s]*(@startuml[^\\n\\r]*)?[%s]*(.*?)[%s]*(@enduml)?[%s]*$"); public String compress(final String data) throws IOException { final ReadLine r = new UncommentReadLine(new ReadLineReader(new StringReader(data), "COMPRESS")); @@ -79,7 +79,7 @@ public class ArobaseStringCompressor implements StringCompressor { } private String compressOld(String s) throws IOException { - final Matcher m = p.matcher(s); + final Matcher2 m = p.matcher(s); if (m.find()) { return clean(m.group(2)); } @@ -109,7 +109,7 @@ public class ArobaseStringCompressor implements StringCompressor { } private String clean1(String s) { - final Matcher m = p.matcher(s); + final Matcher2 m = p.matcher(s); if (m.matches()) { return m.group(2); } diff --git a/src/net/sourceforge/plantuml/command/CommandDecoratorMultine.java b/src/net/sourceforge/plantuml/command/CommandDecoratorMultine.java index 47c3b17b2..04a1cb867 100644 --- a/src/net/sourceforge/plantuml/command/CommandDecoratorMultine.java +++ b/src/net/sourceforge/plantuml/command/CommandDecoratorMultine.java @@ -39,14 +39,16 @@ public class CommandDecoratorMultine implements Command { private final SingleLineCommand2 cmd; private final boolean removeEmptyColumn; + private final int nbMaxLines; - public CommandDecoratorMultine(SingleLineCommand2 cmd) { - this(cmd, false); + public CommandDecoratorMultine(SingleLineCommand2 cmd, int nbMaxLines) { + this(cmd, false, nbMaxLines); } - public CommandDecoratorMultine(SingleLineCommand2 cmd, boolean removeEmptyColumn) { + public CommandDecoratorMultine(SingleLineCommand2 cmd, boolean removeEmptyColumn, int nbMaxLines) { this.cmd = cmd; this.removeEmptyColumn = removeEmptyColumn; + this.nbMaxLines = nbMaxLines; } public CommandExecutionResult execute(D diagram, BlocLines lines) { @@ -79,4 +81,8 @@ public class CommandDecoratorMultine implements Command { return cmd.getDescription(); } + public int getNbMaxLines() { + return nbMaxLines; + } + } diff --git a/src/net/sourceforge/plantuml/command/CommandFooter.java b/src/net/sourceforge/plantuml/command/CommandFooter.java index 85c7d0326..30773da98 100644 --- a/src/net/sourceforge/plantuml/command/CommandFooter.java +++ b/src/net/sourceforge/plantuml/command/CommandFooter.java @@ -28,14 +28,13 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 19109 $ + * Revision $Revision: 19885 $ * */ package net.sourceforge.plantuml.command; import java.util.List; -import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.UmlDiagram; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.DisplayPositionned; diff --git a/src/net/sourceforge/plantuml/command/CommandMultilines.java b/src/net/sourceforge/plantuml/command/CommandMultilines.java index d5897d632..70f6cbc11 100644 --- a/src/net/sourceforge/plantuml/command/CommandMultilines.java +++ b/src/net/sourceforge/plantuml/command/CommandMultilines.java @@ -28,21 +28,20 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 19109 $ + * Revision $Revision: 19880 $ * */ package net.sourceforge.plantuml.command; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - import net.sourceforge.plantuml.StringUtils; +import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; +import net.sourceforge.plantuml.command.regex.Pattern2; import net.sourceforge.plantuml.core.Diagram; public abstract class CommandMultilines implements Command { - private final Pattern starting; + private final Pattern2 starting; public CommandMultilines(String patternStart) { if (patternStart.startsWith("(?i)^") == false || patternStart.endsWith("$") == false) { @@ -61,7 +60,7 @@ public abstract class CommandMultilines implements Command if (isCommandForbidden()) { return CommandControl.NOT_OK; } - Matcher m1 = starting.matcher(StringUtils.trin(lines.getFirst499())); + Matcher2 m1 = starting.matcher(StringUtils.trin(lines.getFirst499())); if (m1.matches() == false) { return CommandControl.NOT_OK; } @@ -85,7 +84,7 @@ public abstract class CommandMultilines implements Command protected void actionIfCommandValid() { } - protected final Pattern getStartingPattern() { + protected final Pattern2 getStartingPattern() { return starting; } diff --git a/src/net/sourceforge/plantuml/command/CommandMultilines2.java b/src/net/sourceforge/plantuml/command/CommandMultilines2.java index 4346c8676..76d0a78bf 100644 --- a/src/net/sourceforge/plantuml/command/CommandMultilines2.java +++ b/src/net/sourceforge/plantuml/command/CommandMultilines2.java @@ -33,10 +33,8 @@ */ package net.sourceforge.plantuml.command; -import java.util.List; -import java.util.regex.Matcher; - import net.sourceforge.plantuml.StringUtils; +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; @@ -74,7 +72,7 @@ public abstract class CommandMultilines2 implements Command implements Command { - private final Pattern starting; + private final Pattern2 starting; public CommandMultilinesBracket(String patternStart) { if (patternStart.startsWith("(?i)^") == false || patternStart.endsWith("$") == false) { @@ -62,7 +61,7 @@ public abstract class CommandMultilinesBracket implements Com protected void actionIfCommandValid() { } - protected final Pattern getStartingPattern() { + protected final Pattern2 getStartingPattern() { return starting; } @@ -70,7 +69,7 @@ public abstract class CommandMultilinesBracket implements Com if (isCommandForbidden()) { return CommandControl.NOT_OK; } - final Matcher m1 = starting.matcher(StringUtils.trin(lines.getFirst499())); + final Matcher2 m1 = starting.matcher(StringUtils.trin(lines.getFirst499())); if (m1.matches() == false) { return CommandControl.NOT_OK; } diff --git a/src/net/sourceforge/plantuml/command/CommandMultilinesFooter.java b/src/net/sourceforge/plantuml/command/CommandMultilinesFooter.java index 9d35aa59a..e03538ca3 100644 --- a/src/net/sourceforge/plantuml/command/CommandMultilinesFooter.java +++ b/src/net/sourceforge/plantuml/command/CommandMultilinesFooter.java @@ -28,15 +28,14 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 19109 $ + * Revision $Revision: 19880 $ * */ package net.sourceforge.plantuml.command; -import java.util.regex.Matcher; - import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.UmlDiagram; +import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.DisplayPositionned; import net.sourceforge.plantuml.graphic.HorizontalAlignment; @@ -55,7 +54,7 @@ public class CommandMultilinesFooter extends CommandMultilines { public CommandExecutionResult execute(final UmlDiagram diagram, BlocLines lines) { lines = lines.trim(false); - final Matcher m = getStartingPattern().matcher(StringUtils.trin(lines.getFirst499())); + final Matcher2 m = getStartingPattern().matcher(StringUtils.trin(lines.getFirst499())); 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 8cc48cc0a..6eaae8971 100644 --- a/src/net/sourceforge/plantuml/command/CommandMultilinesHeader.java +++ b/src/net/sourceforge/plantuml/command/CommandMultilinesHeader.java @@ -28,15 +28,14 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 19109 $ + * Revision $Revision: 19880 $ * */ package net.sourceforge.plantuml.command; -import java.util.regex.Matcher; - import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.UmlDiagram; +import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.DisplayPositionned; import net.sourceforge.plantuml.graphic.HorizontalAlignment; @@ -55,7 +54,7 @@ public class CommandMultilinesHeader extends CommandMultilines { public CommandExecutionResult execute(final UmlDiagram diagram, BlocLines lines) { lines = lines.trim(false); - final Matcher m = getStartingPattern().matcher(StringUtils.trin(lines.getFirst499())); + final Matcher2 m = getStartingPattern().matcher(StringUtils.trin(lines.getFirst499())); if (m.find() == false) { throw new IllegalStateException(); } diff --git a/src/net/sourceforge/plantuml/command/CommandSkinParamMultilines.java b/src/net/sourceforge/plantuml/command/CommandSkinParamMultilines.java index da9984306..0ee89cb16 100644 --- a/src/net/sourceforge/plantuml/command/CommandSkinParamMultilines.java +++ b/src/net/sourceforge/plantuml/command/CommandSkinParamMultilines.java @@ -35,12 +35,12 @@ package net.sourceforge.plantuml.command; import java.util.ArrayList; import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.UmlDiagram; +import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; +import net.sourceforge.plantuml.command.regex.Pattern2; public class CommandSkinParamMultilines extends CommandMultilinesBracket { @@ -64,7 +64,7 @@ public class CommandSkinParamMultilines extends CommandMultilinesBracket\\>)?[\\w.]*)[%s]+(?:(\\{)|(.*))$|^\\}?$"); public CommandSkinParamMultilines() { @@ -87,7 +87,7 @@ public class CommandSkinParamMultilines extends CommandMultilinesBracket { diff --git a/src/net/sourceforge/plantuml/command/SingleLineCommand.java b/src/net/sourceforge/plantuml/command/SingleLineCommand.java index f4ca55588..ad6e50353 100644 --- a/src/net/sourceforge/plantuml/command/SingleLineCommand.java +++ b/src/net/sourceforge/plantuml/command/SingleLineCommand.java @@ -28,22 +28,22 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 19109 $ + * Revision $Revision: 19880 $ * */ package net.sourceforge.plantuml.command; import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; import net.sourceforge.plantuml.StringUtils; +import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; +import net.sourceforge.plantuml.command.regex.Pattern2; import net.sourceforge.plantuml.core.Diagram; public abstract class SingleLineCommand implements Command { - private final Pattern pattern; + private final Pattern2 pattern; public SingleLineCommand(String pattern) { if (pattern == null) { @@ -69,7 +69,7 @@ public abstract class SingleLineCommand implements Command return CommandControl.NOT_OK; } final String line = StringUtils.trin(lines.getFirst499()); - final Matcher m = pattern.matcher(line); + final Matcher2 m = pattern.matcher(line); final boolean result = m.find(); if (result) { actionIfCommandValid(); diff --git a/src/net/sourceforge/plantuml/command/UmlDiagramFactory.java b/src/net/sourceforge/plantuml/command/UmlDiagramFactory.java index 7b4db6b2f..18cedb756 100644 --- a/src/net/sourceforge/plantuml/command/UmlDiagramFactory.java +++ b/src/net/sourceforge/plantuml/command/UmlDiagramFactory.java @@ -84,16 +84,16 @@ public abstract class UmlDiagramFactory extends PSystemAbstractFactory { while (it.hasNext()) { if (StartUtils.isArobaseEndDiagram(it.peek())) { - final String err = checkFinalError(sys); + if (sys == null) { + return null; + } + final String err = sys.checkFinalError(); if (err != null) { return buildEmptyError(source, err, it.peek().getLocation()); } if (source.getTotalLineCount() == 2) { return buildEmptyError(source, it.peek().getLocation()); } - if (sys == null) { - return null; - } sys.makeDiagramReady(); if (sys.isOk() == false) { return null; @@ -186,7 +186,7 @@ public abstract class UmlDiagramFactory extends PSystemAbstractFactory { if (system instanceof NewpagedDiagram) { final NewpagedDiagram newpagedDiagram = (NewpagedDiagram) system; return cmd.execute(newpagedDiagram.getLastDiagram(), lines); - + } return cmd.execute(system, lines); } @@ -196,6 +196,7 @@ public abstract class UmlDiagramFactory extends PSystemAbstractFactory { private BlocLines isMultilineCommandOk(IteratorCounter2 it, Command cmd) { BlocLines lines = new BlocLines(); + int nb = 0; while (it.hasNext()) { lines = addOneSingleLineManageEmbedded2(it, lines); final CommandControl result = cmd.isValid(lines); @@ -205,6 +206,10 @@ public abstract class UmlDiagramFactory extends PSystemAbstractFactory { if (result == CommandControl.OK) { return lines; } + nb++; + if (cmd instanceof CommandDecoratorMultine && nb > ((CommandDecoratorMultine) cmd).getNbMaxLines()) { + return null; + } } return null; } @@ -226,10 +231,6 @@ public abstract class UmlDiagramFactory extends PSystemAbstractFactory { // ----------------------------------- - public String checkFinalError(AbstractPSystem system) { - return null; - } - final public CommandControl isValid(BlocLines lines) { for (Command cmd : cmds) { final CommandControl result = cmd.isValid(lines); diff --git a/src/net/sourceforge/plantuml/command/regex/Matcher2.java b/src/net/sourceforge/plantuml/command/regex/Matcher2.java new file mode 100644 index 000000000..18ef92218 --- /dev/null +++ b/src/net/sourceforge/plantuml/command/regex/Matcher2.java @@ -0,0 +1,149 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2017, Arnaud Roques + * + * Project Info: http://plantuml.com + * + * 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. + * + * [Java is a trademark or registered trademark of Sun Microsystems, Inc. + * in the United States and other countries.] + * + * Original Author: Arnaud Roques + * + * Revision $Revision: 4762 $ + * + */ +package net.sourceforge.plantuml.command.regex; + +import java.util.HashMap; +import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public class Matcher2 { + + private final static boolean INSTRUMENT = false; + private final Matcher matcher; + private final String id; + + private Matcher2(Matcher matcher, String id) { + this.matcher = matcher; + this.id = id; + } + + public static Matcher2 build(Pattern pattern, CharSequence input) { + final long now = System.currentTimeMillis(); + final String id = pattern.pattern(); + try { + return new Matcher2(pattern.matcher(input), id); + } finally { + if (INSTRUMENT) { + addTime(id, System.currentTimeMillis() - now); + } + } + } + + public boolean matches() { + final long now = System.currentTimeMillis(); + try { + return matcher.matches(); + } finally { + addTime(System.currentTimeMillis() - now); + } + } + + private void addTime(long duration) { + if (INSTRUMENT == false) { + return; + } + addTime(id, duration); + } + + private static final Map durations = new HashMap(); + + private static synchronized void addTime(String id, long duration) { + Long total = durations.get(id); + if (total == null) { + total = 0L; + } + total += duration; + durations.put(id, total); + if (total > 200) { + System.err.println("foo " + total + " " + id); + } + + } + + public String group(int n) { + final long now = System.currentTimeMillis(); + try { + return matcher.group(n); + } finally { + addTime(System.currentTimeMillis() - now); + } + } + + public String group() { + final long now = System.currentTimeMillis(); + try { + return matcher.group(); + } finally { + addTime(System.currentTimeMillis() - now); + } + } + + public int groupCount() { + final long now = System.currentTimeMillis(); + try { + return matcher.groupCount(); + } finally { + addTime(System.currentTimeMillis() - now); + } + } + + public boolean find() { + final long now = System.currentTimeMillis(); + try { + return matcher.find(); + } finally { + addTime(System.currentTimeMillis() - now); + } + } + + public int end() { + final long now = System.currentTimeMillis(); + try { + return matcher.end(); + } finally { + addTime(System.currentTimeMillis() - now); + } + } + + public int start() { + final long now = System.currentTimeMillis(); + try { + return matcher.start(); + } finally { + addTime(System.currentTimeMillis() - now); + } + } + +} diff --git a/src/net/sourceforge/plantuml/command/regex/MatcherIterator.java b/src/net/sourceforge/plantuml/command/regex/MatcherIterator.java index cfe4aff5d..dec35743b 100644 --- a/src/net/sourceforge/plantuml/command/regex/MatcherIterator.java +++ b/src/net/sourceforge/plantuml/command/regex/MatcherIterator.java @@ -34,14 +34,13 @@ package net.sourceforge.plantuml.command.regex; import java.util.Iterator; -import java.util.regex.Matcher; public class MatcherIterator implements Iterator { private int cpt = 1; - private final Matcher matcher; + private final Matcher2 matcher; - MatcherIterator(Matcher matcher) { + MatcherIterator(Matcher2 matcher) { this.matcher = matcher; } diff --git a/src/net/sourceforge/plantuml/command/regex/MyPattern.java b/src/net/sourceforge/plantuml/command/regex/MyPattern.java index cd685fb79..64a91641d 100644 --- a/src/net/sourceforge/plantuml/command/regex/MyPattern.java +++ b/src/net/sourceforge/plantuml/command/regex/MyPattern.java @@ -38,24 +38,24 @@ import java.util.regex.Pattern; // Splitter.java to be finished public abstract class MyPattern { - public static Pattern cmpile(String p) { + public static Pattern2 cmpile(String p) { p = transformAndCheck(p); - return Pattern.compile(p); + return new Pattern2(Pattern.compile(p)); } - public static Pattern cmpileNockeck(String p) { + public static Pattern2 cmpileNockeck(String p) { p = transform(p); - return Pattern.compile(p); + return new Pattern2(Pattern.compile(p)); } - public static Pattern cmpile(String p, int type) { + public static Pattern2 cmpile(String p, int type) { p = transformAndCheck(p); - return Pattern.compile(p, type); + return new Pattern2(Pattern.compile(p, type)); } - public static Pattern cmpileNockeck(String p, int type) { + public static Pattern2 cmpileNockeck(String p, int type) { p = transform(p); - return Pattern.compile(p, type); + return new Pattern2(Pattern.compile(p, type)); } private static String transformAndCheck(String p) { diff --git a/src/net/sourceforge/plantuml/command/regex/Pattern2.java b/src/net/sourceforge/plantuml/command/regex/Pattern2.java new file mode 100644 index 000000000..a40dddd60 --- /dev/null +++ b/src/net/sourceforge/plantuml/command/regex/Pattern2.java @@ -0,0 +1,54 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2017, Arnaud Roques + * + * Project Info: http://plantuml.com + * + * 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. + * + * [Java is a trademark or registered trademark of Sun Microsystems, Inc. + * in the United States and other countries.] + * + * Original Author: Arnaud Roques + * + * Revision $Revision: 4762 $ + * + */ +package net.sourceforge.plantuml.command.regex; + +import java.util.regex.Pattern; + +public class Pattern2 { + + private final Pattern pattern; + + public Pattern2(Pattern pattern) { + this.pattern = pattern; + } + + public Matcher2 matcher(CharSequence input) { + return Matcher2.build(pattern, input); + } + + public String pattern() { + return pattern.pattern(); + } + +} diff --git a/src/net/sourceforge/plantuml/command/regex/RegexComposed.java b/src/net/sourceforge/plantuml/command/regex/RegexComposed.java index 2d094c819..338d61120 100644 --- a/src/net/sourceforge/plantuml/command/regex/RegexComposed.java +++ b/src/net/sourceforge/plantuml/command/regex/RegexComposed.java @@ -38,14 +38,12 @@ import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; -import java.util.regex.Matcher; -import java.util.regex.Pattern; public abstract class RegexComposed implements IRegex { private final List partials; - abstract protected Pattern getFull(); + abstract protected Pattern2 getFull(); public RegexComposed(IRegex... partial) { this.partials = Arrays.asList(partial); @@ -72,7 +70,7 @@ public abstract class RegexComposed implements IRegex { } public RegexResult matcher(String s) { - final Matcher matcher = getFull().matcher(s); + final Matcher2 matcher = getFull().matcher(s); if (matcher.find() == false) { throw new IllegalArgumentException(getClass()+" "+s); } diff --git a/src/net/sourceforge/plantuml/command/regex/RegexConcat.java b/src/net/sourceforge/plantuml/command/regex/RegexConcat.java index b108212a9..5735c9b41 100644 --- a/src/net/sourceforge/plantuml/command/regex/RegexConcat.java +++ b/src/net/sourceforge/plantuml/command/regex/RegexConcat.java @@ -37,7 +37,7 @@ import java.util.regex.Pattern; public class RegexConcat extends RegexComposed implements IRegex { - private final Pattern full; + private final Pattern2 full; public RegexConcat(IRegex... partial) { super(partial); @@ -49,7 +49,7 @@ public class RegexConcat extends RegexComposed implements IRegex { } @Override - protected Pattern getFull() { + protected Pattern2 getFull() { return full; } diff --git a/src/net/sourceforge/plantuml/command/regex/RegexLeaf.java b/src/net/sourceforge/plantuml/command/regex/RegexLeaf.java index 30590c74c..7785f345d 100644 --- a/src/net/sourceforge/plantuml/command/regex/RegexLeaf.java +++ b/src/net/sourceforge/plantuml/command/regex/RegexLeaf.java @@ -40,7 +40,7 @@ import java.util.regex.Pattern; public class RegexLeaf implements IRegex { - private final Pattern pattern; + private final Pattern2 pattern; private final String name; private int count = -1; diff --git a/src/net/sourceforge/plantuml/command/regex/RegexOptional.java b/src/net/sourceforge/plantuml/command/regex/RegexOptional.java index 63c4332d1..9d7ad69eb 100644 --- a/src/net/sourceforge/plantuml/command/regex/RegexOptional.java +++ b/src/net/sourceforge/plantuml/command/regex/RegexOptional.java @@ -37,7 +37,7 @@ import java.util.regex.Pattern; public class RegexOptional extends RegexComposed implements IRegex { - private final Pattern full; + private final Pattern2 full; public RegexOptional(IRegex partial) { super(partial); @@ -48,7 +48,7 @@ public class RegexOptional extends RegexComposed implements IRegex { } @Override - protected Pattern getFull() { + protected Pattern2 getFull() { return full; } diff --git a/src/net/sourceforge/plantuml/command/regex/RegexOr.java b/src/net/sourceforge/plantuml/command/regex/RegexOr.java index e62acf959..4f108a5fc 100644 --- a/src/net/sourceforge/plantuml/command/regex/RegexOr.java +++ b/src/net/sourceforge/plantuml/command/regex/RegexOr.java @@ -36,11 +36,10 @@ package net.sourceforge.plantuml.command.regex; import java.util.HashMap; import java.util.Iterator; import java.util.Map; -import java.util.regex.Pattern; public class RegexOr extends RegexComposed implements IRegex { - private final Pattern full; + private final Pattern2 full; private final String name; public RegexOr(IRegex... partial) { @@ -64,7 +63,7 @@ public class RegexOr extends RegexComposed implements IRegex { } @Override - protected Pattern getFull() { + protected Pattern2 getFull() { return full; } diff --git a/src/net/sourceforge/plantuml/core/UmlSource.java b/src/net/sourceforge/plantuml/core/UmlSource.java index 029ede329..f638f5fcc 100644 --- a/src/net/sourceforge/plantuml/core/UmlSource.java +++ b/src/net/sourceforge/plantuml/core/UmlSource.java @@ -36,13 +36,13 @@ package net.sourceforge.plantuml.core; import java.util.ArrayList; import java.util.Collections; import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; import net.sourceforge.plantuml.CharSequence2; import net.sourceforge.plantuml.CharSequence2Impl; import net.sourceforge.plantuml.StringUtils; +import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; +import net.sourceforge.plantuml.command.regex.Pattern2; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.utils.StartUtils; import net.sourceforge.plantuml.version.IteratorCounter2; @@ -179,9 +179,9 @@ final public class UmlSource { * @return */ public Display getTitle() { - final Pattern p = MyPattern.cmpile("(?i)^[%s]*title[%s]+(.+)$"); + final Pattern2 p = MyPattern.cmpile("(?i)^[%s]*title[%s]+(.+)$"); for (String s : source) { - final Matcher m = p.matcher(s); + final Matcher2 m = p.matcher(s); final boolean ok = m.matches(); if (ok) { return Display.create(m.group(1)); diff --git a/src/net/sourceforge/plantuml/creole/CommandCreoleColorAndSizeChange.java b/src/net/sourceforge/plantuml/creole/CommandCreoleColorAndSizeChange.java index 249cbd829..c65eca8ec 100644 --- a/src/net/sourceforge/plantuml/creole/CommandCreoleColorAndSizeChange.java +++ b/src/net/sourceforge/plantuml/creole/CommandCreoleColorAndSizeChange.java @@ -33,17 +33,16 @@ */ package net.sourceforge.plantuml.creole; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - +import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; +import net.sourceforge.plantuml.command.regex.Pattern2; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.HtmlColorSet; public class CommandCreoleColorAndSizeChange implements Command { - private final Pattern pattern; + private final Pattern2 pattern; public static final String fontPattern = "\\"; @@ -61,7 +60,7 @@ public class CommandCreoleColorAndSizeChange implements Command { } public int matchingSize(String line) { - final Matcher m = pattern.matcher(line); + final Matcher2 m = pattern.matcher(line); if (m.find() == false) { return 0; } @@ -69,7 +68,7 @@ public class CommandCreoleColorAndSizeChange implements Command { } public String executeAndGetRemaining(String line, StripeSimple stripe) { - final Matcher m = pattern.matcher(line); + final Matcher2 m = pattern.matcher(line); if (m.find() == false) { throw new IllegalStateException(); } diff --git a/src/net/sourceforge/plantuml/creole/CommandCreoleColorChange.java b/src/net/sourceforge/plantuml/creole/CommandCreoleColorChange.java index 2a2970ac7..78756b63f 100644 --- a/src/net/sourceforge/plantuml/creole/CommandCreoleColorChange.java +++ b/src/net/sourceforge/plantuml/creole/CommandCreoleColorChange.java @@ -33,10 +33,9 @@ */ package net.sourceforge.plantuml.creole; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - +import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; +import net.sourceforge.plantuml.command.regex.Pattern2; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.HtmlColorSet; @@ -44,7 +43,7 @@ import net.sourceforge.plantuml.graphic.Splitter; public class CommandCreoleColorChange implements Command { - private final Pattern pattern; + private final Pattern2 pattern; public static Command create() { return new CommandCreoleColorChange("^(?i)(" + Splitter.fontColorPattern2 + "(.*?)\\)"); @@ -60,7 +59,7 @@ public class CommandCreoleColorChange implements Command { } public int matchingSize(String line) { - final Matcher m = pattern.matcher(line); + final Matcher2 m = pattern.matcher(line); if (m.find() == false) { return 0; } @@ -68,7 +67,7 @@ public class CommandCreoleColorChange implements Command { } public String executeAndGetRemaining(String line, StripeSimple stripe) { - final Matcher m = pattern.matcher(line); + final Matcher2 m = pattern.matcher(line); if (m.find() == false) { throw new IllegalStateException(); } diff --git a/src/net/sourceforge/plantuml/creole/CommandCreoleExposantChange.java b/src/net/sourceforge/plantuml/creole/CommandCreoleExposantChange.java index 34f323c45..e6eee8cc1 100644 --- a/src/net/sourceforge/plantuml/creole/CommandCreoleExposantChange.java +++ b/src/net/sourceforge/plantuml/creole/CommandCreoleExposantChange.java @@ -33,16 +33,15 @@ */ package net.sourceforge.plantuml.creole; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - +import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; +import net.sourceforge.plantuml.command.regex.Pattern2; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.FontPosition; public class CommandCreoleExposantChange implements Command { - private final Pattern pattern; + private final Pattern2 pattern; private final FontPosition position; private CommandCreoleExposantChange(String p, FontPosition position) { @@ -60,7 +59,7 @@ public class CommandCreoleExposantChange implements Command { // } public int matchingSize(String line) { - final Matcher m = pattern.matcher(line); + final Matcher2 m = pattern.matcher(line); if (m.find() == false) { return 0; } @@ -68,7 +67,7 @@ public class CommandCreoleExposantChange implements Command { } public String executeAndGetRemaining(String line, StripeSimple stripe) { - final Matcher m = pattern.matcher(line); + final Matcher2 m = pattern.matcher(line); if (m.find() == false) { throw new IllegalStateException(); } diff --git a/src/net/sourceforge/plantuml/creole/CommandCreoleFontFamilyChange.java b/src/net/sourceforge/plantuml/creole/CommandCreoleFontFamilyChange.java index 9f24cee10..8e4dc8959 100644 --- a/src/net/sourceforge/plantuml/creole/CommandCreoleFontFamilyChange.java +++ b/src/net/sourceforge/plantuml/creole/CommandCreoleFontFamilyChange.java @@ -33,16 +33,15 @@ */ package net.sourceforge.plantuml.creole; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - +import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; +import net.sourceforge.plantuml.command.regex.Pattern2; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.Splitter; public class CommandCreoleFontFamilyChange implements Command { - private final Pattern pattern; + private final Pattern2 pattern; public static Command create() { return new CommandCreoleFontFamilyChange("^(?i)(" + Splitter.fontFamilyPattern + "(.*?)\\)"); @@ -58,7 +57,7 @@ public class CommandCreoleFontFamilyChange implements Command { } public int matchingSize(String line) { - final Matcher m = pattern.matcher(line); + final Matcher2 m = pattern.matcher(line); if (m.find() == false) { return 0; } @@ -66,7 +65,7 @@ public class CommandCreoleFontFamilyChange implements Command { } public String executeAndGetRemaining(String line, StripeSimple stripe) { - final Matcher m = pattern.matcher(line); + final Matcher2 m = pattern.matcher(line); if (m.find() == false) { throw new IllegalStateException(); } diff --git a/src/net/sourceforge/plantuml/creole/CommandCreoleImg.java b/src/net/sourceforge/plantuml/creole/CommandCreoleImg.java index 6024819a0..86702e0d1 100644 --- a/src/net/sourceforge/plantuml/creole/CommandCreoleImg.java +++ b/src/net/sourceforge/plantuml/creole/CommandCreoleImg.java @@ -37,12 +37,14 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import net.sourceforge.plantuml.StringUtils; +import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; +import net.sourceforge.plantuml.command.regex.Pattern2; import net.sourceforge.plantuml.graphic.Splitter; public class CommandCreoleImg implements Command { - private final Pattern pattern; + private final Pattern2 pattern; private CommandCreoleImg(String p) { this.pattern = MyPattern.cmpile(p); @@ -53,7 +55,7 @@ public class CommandCreoleImg implements Command { } public int matchingSize(String line) { - final Matcher m = pattern.matcher(line); + final Matcher2 m = pattern.matcher(line); if (m.find() == false) { return 0; } @@ -61,7 +63,7 @@ public class CommandCreoleImg implements Command { } public String executeAndGetRemaining(String line, StripeSimple stripe) { - final Matcher m = pattern.matcher(line); + final Matcher2 m = pattern.matcher(line); if (m.find() == false) { throw new IllegalStateException(); } diff --git a/src/net/sourceforge/plantuml/creole/CommandCreoleMonospaced.java b/src/net/sourceforge/plantuml/creole/CommandCreoleMonospaced.java index 14c4fc59d..295c49199 100644 --- a/src/net/sourceforge/plantuml/creole/CommandCreoleMonospaced.java +++ b/src/net/sourceforge/plantuml/creole/CommandCreoleMonospaced.java @@ -33,17 +33,16 @@ */ package net.sourceforge.plantuml.creole; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - +import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; +import net.sourceforge.plantuml.command.regex.Pattern2; import net.sourceforge.plantuml.graphic.FontConfiguration; public class CommandCreoleMonospaced implements Command { public static final String MONOSPACED = "monospaced"; - private final Pattern pattern; + private final Pattern2 pattern; private final String monospacedFamily; public static Command create(String monospacedFamily) { @@ -56,7 +55,7 @@ public class CommandCreoleMonospaced implements Command { } public int matchingSize(String line) { - final Matcher m = pattern.matcher(line); + final Matcher2 m = pattern.matcher(line); if (m.find() == false) { return 0; } @@ -64,7 +63,7 @@ public class CommandCreoleMonospaced implements Command { } public String executeAndGetRemaining(String line, StripeSimple stripe) { - final Matcher m = pattern.matcher(line); + final Matcher2 m = pattern.matcher(line); if (m.find() == false) { throw new IllegalStateException(); } diff --git a/src/net/sourceforge/plantuml/creole/CommandCreoleOpenIcon.java b/src/net/sourceforge/plantuml/creole/CommandCreoleOpenIcon.java index a571d82cc..5a2283996 100644 --- a/src/net/sourceforge/plantuml/creole/CommandCreoleOpenIcon.java +++ b/src/net/sourceforge/plantuml/creole/CommandCreoleOpenIcon.java @@ -33,15 +33,14 @@ */ package net.sourceforge.plantuml.creole; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - +import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; +import net.sourceforge.plantuml.command.regex.Pattern2; import net.sourceforge.plantuml.graphic.Splitter; public class CommandCreoleOpenIcon implements Command { - private final Pattern pattern; + private final Pattern2 pattern; private CommandCreoleOpenIcon(String p) { this.pattern = MyPattern.cmpile(p); @@ -52,7 +51,7 @@ public class CommandCreoleOpenIcon implements Command { } public int matchingSize(String line) { - final Matcher m = pattern.matcher(line); + final Matcher2 m = pattern.matcher(line); if (m.find() == false) { return 0; } @@ -60,7 +59,7 @@ public class CommandCreoleOpenIcon implements Command { } public String executeAndGetRemaining(String line, StripeSimple stripe) { - final Matcher m = pattern.matcher(line); + final Matcher2 m = pattern.matcher(line); if (m.find() == false) { throw new IllegalStateException(); } diff --git a/src/net/sourceforge/plantuml/creole/CommandCreoleSizeChange.java b/src/net/sourceforge/plantuml/creole/CommandCreoleSizeChange.java index 6c83e3ed8..34795d6dc 100644 --- a/src/net/sourceforge/plantuml/creole/CommandCreoleSizeChange.java +++ b/src/net/sourceforge/plantuml/creole/CommandCreoleSizeChange.java @@ -33,16 +33,15 @@ */ package net.sourceforge.plantuml.creole; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - +import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; +import net.sourceforge.plantuml.command.regex.Pattern2; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.Splitter; public class CommandCreoleSizeChange implements Command { - private final Pattern pattern; + private final Pattern2 pattern; public static Command create() { return new CommandCreoleSizeChange("^(?i)(" + Splitter.fontSizePattern2 + "(.*?)\\)"); @@ -58,7 +57,7 @@ public class CommandCreoleSizeChange implements Command { } public int matchingSize(String line) { - final Matcher m = pattern.matcher(line); + final Matcher2 m = pattern.matcher(line); if (m.find() == false) { return 0; } @@ -66,7 +65,7 @@ public class CommandCreoleSizeChange implements Command { } public String executeAndGetRemaining(String line, StripeSimple stripe) { - final Matcher m = pattern.matcher(line); + final Matcher2 m = pattern.matcher(line); if (m.find() == false) { throw new IllegalStateException(); } diff --git a/src/net/sourceforge/plantuml/creole/CommandCreoleSpace.java b/src/net/sourceforge/plantuml/creole/CommandCreoleSpace.java index 2941d7fd0..aa0c28ecd 100644 --- a/src/net/sourceforge/plantuml/creole/CommandCreoleSpace.java +++ b/src/net/sourceforge/plantuml/creole/CommandCreoleSpace.java @@ -33,14 +33,13 @@ */ package net.sourceforge.plantuml.creole; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - +import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; +import net.sourceforge.plantuml.command.regex.Pattern2; public class CommandCreoleSpace implements Command { - private final Pattern pattern; + private final Pattern2 pattern; private CommandCreoleSpace(String p) { this.pattern = MyPattern.cmpile(p); @@ -51,7 +50,7 @@ public class CommandCreoleSpace implements Command { } public int matchingSize(String line) { - final Matcher m = pattern.matcher(line); + final Matcher2 m = pattern.matcher(line); if (m.find() == false) { return 0; } @@ -59,7 +58,7 @@ public class CommandCreoleSpace implements Command { } public String executeAndGetRemaining(String line, StripeSimple stripe) { - final Matcher m = pattern.matcher(line); + final Matcher2 m = pattern.matcher(line); if (m.find() == false) { throw new IllegalStateException(); } diff --git a/src/net/sourceforge/plantuml/creole/CommandCreoleSprite.java b/src/net/sourceforge/plantuml/creole/CommandCreoleSprite.java index 1b8f44e43..71104d91e 100644 --- a/src/net/sourceforge/plantuml/creole/CommandCreoleSprite.java +++ b/src/net/sourceforge/plantuml/creole/CommandCreoleSprite.java @@ -33,15 +33,14 @@ */ package net.sourceforge.plantuml.creole; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - +import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; +import net.sourceforge.plantuml.command.regex.Pattern2; import net.sourceforge.plantuml.graphic.Splitter; public class CommandCreoleSprite implements Command { - private final Pattern pattern; + private final Pattern2 pattern; private CommandCreoleSprite(String p) { this.pattern = MyPattern.cmpile(p); @@ -52,7 +51,7 @@ public class CommandCreoleSprite implements Command { } public int matchingSize(String line) { - final Matcher m = pattern.matcher(line); + final Matcher2 m = pattern.matcher(line); if (m.find() == false) { return 0; } @@ -60,7 +59,7 @@ public class CommandCreoleSprite implements Command { } public String executeAndGetRemaining(String line, StripeSimple stripe) { - final Matcher m = pattern.matcher(line); + final Matcher2 m = pattern.matcher(line); if (m.find() == false) { throw new IllegalStateException(); } diff --git a/src/net/sourceforge/plantuml/creole/CommandCreoleStyle.java b/src/net/sourceforge/plantuml/creole/CommandCreoleStyle.java index 4a2cea86a..b3df4dc6c 100644 --- a/src/net/sourceforge/plantuml/creole/CommandCreoleStyle.java +++ b/src/net/sourceforge/plantuml/creole/CommandCreoleStyle.java @@ -33,10 +33,9 @@ */ package net.sourceforge.plantuml.creole; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - +import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; +import net.sourceforge.plantuml.command.regex.Pattern2; import net.sourceforge.plantuml.graphic.AddStyle; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.FontStyle; @@ -44,7 +43,7 @@ import net.sourceforge.plantuml.graphic.HtmlColor; public class CommandCreoleStyle implements Command { - private final Pattern p; + private final Pattern2 p; private final FontStyle style; private final boolean tryExtendedColor; @@ -69,7 +68,7 @@ public class CommandCreoleStyle implements Command { this.tryExtendedColor = tryExtendedColor; } - private HtmlColor getExtendedColor(Matcher m) { + private HtmlColor getExtendedColor(Matcher2 m) { if (tryExtendedColor) { return style.getExtendedColor(m.group(2)); } @@ -77,7 +76,7 @@ public class CommandCreoleStyle implements Command { } public String executeAndGetRemaining(final String line, StripeSimple stripe) { - final Matcher m = p.matcher(line); + final Matcher2 m = p.matcher(line); if (m.find() == false) { throw new IllegalStateException(); } @@ -91,7 +90,7 @@ public class CommandCreoleStyle implements Command { } public int matchingSize(String line) { - final Matcher m = p.matcher(line); + final Matcher2 m = p.matcher(line); if (m.find() == false) { return 0; } diff --git a/src/net/sourceforge/plantuml/creole/CommandCreoleSvgAttributeChange.java b/src/net/sourceforge/plantuml/creole/CommandCreoleSvgAttributeChange.java index 3469652c4..ebb4ab98d 100644 --- a/src/net/sourceforge/plantuml/creole/CommandCreoleSvgAttributeChange.java +++ b/src/net/sourceforge/plantuml/creole/CommandCreoleSvgAttributeChange.java @@ -33,17 +33,16 @@ */ package net.sourceforge.plantuml.creole; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - +import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; +import net.sourceforge.plantuml.command.regex.Pattern2; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.Splitter; import net.sourceforge.plantuml.graphic.SvgAttributes; public class CommandCreoleSvgAttributeChange implements Command { - private final Pattern pattern; + private final Pattern2 pattern; public static final String fontPattern = Splitter.svgAttributePattern; @@ -60,7 +59,7 @@ public class CommandCreoleSvgAttributeChange implements Command { } public int matchingSize(String line) { - final Matcher m = pattern.matcher(line); + final Matcher2 m = pattern.matcher(line); if (m.find() == false) { return 0; } @@ -68,7 +67,7 @@ public class CommandCreoleSvgAttributeChange implements Command { } public String executeAndGetRemaining(String line, StripeSimple stripe) { - final Matcher m = pattern.matcher(line); + final Matcher2 m = pattern.matcher(line); if (m.find() == false) { throw new IllegalStateException(); } diff --git a/src/net/sourceforge/plantuml/creole/CommandCreoleUrl.java b/src/net/sourceforge/plantuml/creole/CommandCreoleUrl.java index 8b6fd78ef..1d3fe8126 100644 --- a/src/net/sourceforge/plantuml/creole/CommandCreoleUrl.java +++ b/src/net/sourceforge/plantuml/creole/CommandCreoleUrl.java @@ -33,18 +33,17 @@ */ package net.sourceforge.plantuml.creole; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.UrlBuilder; import net.sourceforge.plantuml.UrlBuilder.ModeUrl; +import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; +import net.sourceforge.plantuml.command.regex.Pattern2; public class CommandCreoleUrl implements Command { - private final Pattern pattern; + private final Pattern2 pattern; private final ISkinSimple skinParam; public static Command create(ISkinSimple skinParam) { @@ -58,7 +57,7 @@ public class CommandCreoleUrl implements Command { } public int matchingSize(String line) { - final Matcher m = pattern.matcher(line); + final Matcher2 m = pattern.matcher(line); if (m.find() == false) { return 0; } @@ -66,7 +65,7 @@ public class CommandCreoleUrl implements Command { } public String executeAndGetRemaining(String line, StripeSimple stripe) { - final Matcher m = pattern.matcher(line); + final Matcher2 m = pattern.matcher(line); if (m.find() == false) { throw new IllegalStateException(); } diff --git a/src/net/sourceforge/plantuml/creole/CreoleStripeSimpleParser.java b/src/net/sourceforge/plantuml/creole/CreoleStripeSimpleParser.java index 440af8b58..7244711fb 100644 --- a/src/net/sourceforge/plantuml/creole/CreoleStripeSimpleParser.java +++ b/src/net/sourceforge/plantuml/creole/CreoleStripeSimpleParser.java @@ -33,12 +33,11 @@ */ package net.sourceforge.plantuml.creole; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.StringUtils; +import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; +import net.sourceforge.plantuml.command.regex.Pattern2; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.utils.CharHidder; @@ -60,23 +59,23 @@ public class CreoleStripeSimpleParser { throw new IllegalArgumentException(); } - final Pattern p4 = MyPattern.cmpile("^--([^-]*)--$"); - final Matcher m4 = p4.matcher(line); + final Pattern2 p4 = MyPattern.cmpile("^--([^-]*)--$"); + final Matcher2 m4 = p4.matcher(line); if (m4.find()) { this.line = m4.group(1); this.style = new StripeStyle(StripeStyleType.HORIZONTAL_LINE, 0, '-'); return; } - final Pattern p5 = MyPattern.cmpile("^==([^=]*)==$"); - final Matcher m5 = p5.matcher(line); + final Pattern2 p5 = MyPattern.cmpile("^==([^=]*)==$"); + final Matcher2 m5 = p5.matcher(line); if (m5.find()) { this.line = m5.group(1); this.style = new StripeStyle(StripeStyleType.HORIZONTAL_LINE, 0, '='); return; } - final Pattern p5b = MyPattern.cmpile("^===*==$"); - final Matcher m5b = p5b.matcher(line); + final Pattern2 p5b = MyPattern.cmpile("^===*==$"); + final Matcher2 m5b = p5b.matcher(line); if (m5b.find()) { this.line = ""; this.style = new StripeStyle(StripeStyleType.HORIZONTAL_LINE, 0, '='); @@ -93,8 +92,8 @@ public class CreoleStripeSimpleParser { // } // } - final Pattern p7 = MyPattern.cmpile("^\\.\\.([^\\.]*)\\.\\.$"); - final Matcher m7 = p7.matcher(line); + final Pattern2 p7 = MyPattern.cmpile("^\\.\\.([^\\.]*)\\.\\.$"); + final Matcher2 m7 = p7.matcher(line); if (m7.find()) { this.line = m7.group(1); this.style = new StripeStyle(StripeStyleType.HORIZONTAL_LINE, 0, '.'); @@ -102,8 +101,8 @@ public class CreoleStripeSimpleParser { } if (modeSimpleLine == CreoleMode.FULL) { - final Pattern p1 = MyPattern.cmpile("^(\\*+)([^*]+(?:[^*]|\\*\\*[^*]+\\*\\*)*)$"); - final Matcher m1 = p1.matcher(line); + final Pattern2 p1 = MyPattern.cmpile("^(\\*+)([^*]+(?:[^*]|\\*\\*[^*]+\\*\\*)*)$"); + final Matcher2 m1 = p1.matcher(line); if (m1.find()) { this.line = StringUtils.trin(m1.group(2)); final int order = m1.group(1).length() - 1; @@ -113,8 +112,8 @@ public class CreoleStripeSimpleParser { } if (modeSimpleLine == CreoleMode.FULL) { - final Pattern p2 = MyPattern.cmpile("^(#+)(.+)$"); - final Matcher m2 = p2.matcher(CharHidder.hide(line)); + final Pattern2 p2 = MyPattern.cmpile("^(#+)(.+)$"); + final Matcher2 m2 = p2.matcher(CharHidder.hide(line)); if (m2.find()) { this.line = StringUtils.trin(CharHidder.unhide(m2.group(2))); final int order = CharHidder.unhide(m2.group(1)).length() - 1; @@ -123,8 +122,8 @@ public class CreoleStripeSimpleParser { } } - final Pattern p3 = MyPattern.cmpile("^(=+)(.+)$"); - final Matcher m3 = p3.matcher(line); + final Pattern2 p3 = MyPattern.cmpile("^(=+)(.+)$"); + final Matcher2 m3 = p3.matcher(line); if (m3.find()) { this.line = StringUtils.trin(m3.group(2)); final int order = m3.group(1).length() - 1; diff --git a/src/net/sourceforge/plantuml/cucadiagram/BodyEnhanced.java b/src/net/sourceforge/plantuml/cucadiagram/BodyEnhanced.java index 415dbbaab..6d3539620 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/BodyEnhanced.java +++ b/src/net/sourceforge/plantuml/cucadiagram/BodyEnhanced.java @@ -55,7 +55,6 @@ import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockLineBefore; import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.TextBlockVertical2; -import net.sourceforge.plantuml.skin.rose.Rose; import net.sourceforge.plantuml.ugraphic.UGraphic; public class BodyEnhanced extends AbstractTextBlock implements TextBlock { diff --git a/src/net/sourceforge/plantuml/cucadiagram/Display.java b/src/net/sourceforge/plantuml/cucadiagram/Display.java index 75278a9dd..420794f69 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/Display.java +++ b/src/net/sourceforge/plantuml/cucadiagram/Display.java @@ -39,8 +39,6 @@ import java.util.Collection; import java.util.Collections; import java.util.Iterator; import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; import net.sourceforge.plantuml.CharSequence2; import net.sourceforge.plantuml.CharSequence2Impl; @@ -52,6 +50,8 @@ import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.UrlBuilder; import net.sourceforge.plantuml.UrlBuilder.ModeUrl; +import net.sourceforge.plantuml.command.regex.Matcher2; +import net.sourceforge.plantuml.command.regex.Pattern2; import net.sourceforge.plantuml.creole.CreoleMode; import net.sourceforge.plantuml.creole.CreoleParser; import net.sourceforge.plantuml.creole.Sheet; @@ -323,12 +323,12 @@ public class Display implements Iterable { return naturalHorizontalAlignment; } - public List splitMultiline(Pattern separator) { + public List splitMultiline(Pattern2 separator) { final List result = new ArrayList(); Display pending = new Display(this.naturalHorizontalAlignment, this.isNull, this.defaultCreoleMode); result.add(pending); for (CharSequence line : display) { - final Matcher m = separator.matcher(line); + final Matcher2 m = separator.matcher(line); if (m.find()) { final CharSequence s1 = line.subSequence(0, m.start()); pending.display.add(s1); diff --git a/src/net/sourceforge/plantuml/cucadiagram/IEntity.java b/src/net/sourceforge/plantuml/cucadiagram/IEntity.java index d7b4d11ad..784391d24 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/IEntity.java +++ b/src/net/sourceforge/plantuml/cucadiagram/IEntity.java @@ -41,7 +41,6 @@ import net.sourceforge.plantuml.Removeable; import net.sourceforge.plantuml.SpecificBackcolorable; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.graphic.USymbol; -import net.sourceforge.plantuml.graphic.color.Colors; public interface IEntity extends SpecificBackcolorable, Hideable, Removeable, LineConfigurable { diff --git a/src/net/sourceforge/plantuml/cucadiagram/LinkStyle.java b/src/net/sourceforge/plantuml/cucadiagram/LinkStyle.java index dcd8fe210..2b3ec3b97 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/LinkStyle.java +++ b/src/net/sourceforge/plantuml/cucadiagram/LinkStyle.java @@ -33,7 +33,6 @@ */ package net.sourceforge.plantuml.cucadiagram; -import net.sourceforge.plantuml.ugraphic.UChange; import net.sourceforge.plantuml.ugraphic.UStroke; public enum LinkStyle { diff --git a/src/net/sourceforge/plantuml/cucadiagram/MemberImpl.java b/src/net/sourceforge/plantuml/cucadiagram/MemberImpl.java index 54acd7d3d..97b4c224b 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/MemberImpl.java +++ b/src/net/sourceforge/plantuml/cucadiagram/MemberImpl.java @@ -33,14 +33,13 @@ */ package net.sourceforge.plantuml.cucadiagram; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.UrlBuilder; import net.sourceforge.plantuml.UrlBuilder.ModeUrl; +import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; +import net.sourceforge.plantuml.command.regex.Pattern2; import net.sourceforge.plantuml.skin.VisibilityModifier; public class MemberImpl implements Member { @@ -57,8 +56,8 @@ public class MemberImpl implements Member { tmpDisplay = tmpDisplay.replaceAll("(?i)\\{(method|field)\\}\\s*", ""); if (manageModifier) { this.hasUrl = new UrlBuilder(null, ModeUrl.ANYWHERE).getUrl(tmpDisplay) != null; - final Pattern pstart = MyPattern.cmpile("^(" + UrlBuilder.getRegexp() + ")([^\\[\\]]+)$"); - final Matcher mstart = pstart.matcher(tmpDisplay); + final Pattern2 pstart = MyPattern.cmpile("^(" + UrlBuilder.getRegexp() + ")([^\\[\\]]+)$"); + final Matcher2 mstart = pstart.matcher(tmpDisplay); if (mstart.matches()) { if (mstart.groupCount() != 4) { @@ -69,9 +68,9 @@ public class MemberImpl implements Member { this.url.setMember(true); tmpDisplay = /* mstart.group(1).trim() + */StringUtils.trin(mstart.group(mstart.groupCount())); } else { - final Pattern pend = MyPattern.cmpile("^((?:[^\\[\\]]|\\[[^\\[\\]]*\\])+)(" + UrlBuilder.getRegexp() + final Pattern2 pend = MyPattern.cmpile("^((?:[^\\[\\]]|\\[[^\\[\\]]*\\])+)(" + UrlBuilder.getRegexp() + ")$"); - final Matcher mend = pend.matcher(tmpDisplay); + final Matcher2 mend = pend.matcher(tmpDisplay); if (mend.matches()) { if (mend.groupCount() != 4) { diff --git a/src/net/sourceforge/plantuml/cucadiagram/MethodsOrFieldsArea.java b/src/net/sourceforge/plantuml/cucadiagram/MethodsOrFieldsArea.java index b85e74a8a..84f833fb7 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/MethodsOrFieldsArea.java +++ b/src/net/sourceforge/plantuml/cucadiagram/MethodsOrFieldsArea.java @@ -47,7 +47,6 @@ import net.sourceforge.plantuml.graphic.AbstractTextBlock; 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.graphic.TextBlockLineBefore; diff --git a/src/net/sourceforge/plantuml/cucadiagram/Stereotype.java b/src/net/sourceforge/plantuml/cucadiagram/Stereotype.java index c820149a9..616185e50 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/Stereotype.java +++ b/src/net/sourceforge/plantuml/cucadiagram/Stereotype.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 19251 $ + * Revision $Revision: 19880 $ * */ package net.sourceforge.plantuml.cucadiagram; @@ -42,7 +42,9 @@ import java.util.regex.Pattern; import net.sourceforge.plantuml.Hideable; import net.sourceforge.plantuml.StringUtils; +import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; +import net.sourceforge.plantuml.command.regex.Pattern2; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.IHtmlColorSet; @@ -51,9 +53,9 @@ import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.sprite.SpriteUtils; public class Stereotype implements CharSequence, Hideable { - private final static Pattern circleChar = MyPattern + private final static Pattern2 circleChar = MyPattern .cmpile("\\<\\<[%s]*\\(?(\\S)[%s]*,[%s]*(#[0-9a-fA-F]{6}|\\w+)[%s]*(?:[),](.*?))?\\>\\>"); - private final static Pattern circleSprite = MyPattern.cmpile("\\<\\<[%s]*\\(?\\$(" + SpriteUtils.SPRITE_NAME + private final static Pattern2 circleSprite = MyPattern.cmpile("\\<\\<[%s]*\\(?\\$(" + SpriteUtils.SPRITE_NAME + ")[%s]*(?:,[%s]*(#[0-9a-fA-F]{6}|\\w+))?[%s]*(?:[),](.*?))?\\>\\>"); private final String label; @@ -79,8 +81,8 @@ public class Stereotype implements CharSequence, Hideable { this.automaticPackageStyle = automaticPackageStyle; this.radius = radius; this.circledFont = circledFont; - final Matcher mCircleChar = circleChar.matcher(label); - final Matcher mCircleSprite = circleSprite.matcher(label); + final Matcher2 mCircleChar = circleChar.matcher(label); + final Matcher2 mCircleSprite = circleSprite.matcher(label); if (mCircleSprite.find()) { if (StringUtils.isNotEmpty(mCircleSprite.group(3))) { this.label = "<<" + mCircleSprite.group(3) + ">>"; @@ -207,8 +209,8 @@ public class Stereotype implements CharSequence, Hideable { return null; } final List result = new ArrayList(); - final Pattern p = MyPattern.cmpile("\\<\\<.*?\\>\\>"); - final Matcher m = p.matcher(getLabel(false)); + final Pattern2 p = MyPattern.cmpile("\\<\\<.*?\\>\\>"); + final Matcher2 m = p.matcher(getLabel(false)); while (m.find()) { if (useGuillemet) { result.add(StringUtils.manageGuillemetStrict(m.group())); diff --git a/src/net/sourceforge/plantuml/cucadiagram/dot/CucaDiagramTxtMaker.java b/src/net/sourceforge/plantuml/cucadiagram/dot/CucaDiagramTxtMaker.java index 1d26270e6..bf6e1bb8a 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/dot/CucaDiagramTxtMaker.java +++ b/src/net/sourceforge/plantuml/cucadiagram/dot/CucaDiagramTxtMaker.java @@ -46,6 +46,7 @@ import java.util.List; import java.util.Map; import net.sourceforge.plantuml.FileFormat; +import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.cucadiagram.CucaDiagram; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.IEntity; @@ -57,7 +58,6 @@ import net.sourceforge.plantuml.posimo.GraphvizSolverB; import net.sourceforge.plantuml.posimo.Path; import net.sourceforge.plantuml.ugraphic.UTranslate; import net.sourceforge.plantuml.ugraphic.txt.UGraphicTxt; -import net.sourceforge.plantuml.StringUtils; public final class CucaDiagramTxtMaker { diff --git a/src/net/sourceforge/plantuml/cucadiagram/dot/Neighborhood.java b/src/net/sourceforge/plantuml/cucadiagram/dot/Neighborhood.java index 9c9f1f86a..6f94f3766 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/dot/Neighborhood.java +++ b/src/net/sourceforge/plantuml/cucadiagram/dot/Neighborhood.java @@ -45,7 +45,6 @@ import net.sourceforge.plantuml.cucadiagram.ILeaf; import net.sourceforge.plantuml.cucadiagram.Link; import net.sourceforge.plantuml.svek.Bibliotekon; import net.sourceforge.plantuml.svek.Line; -import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UPolygon; diff --git a/src/net/sourceforge/plantuml/cute/Arc.java b/src/net/sourceforge/plantuml/cute/Arc.java index 90c89ff63..b21f7173e 100644 --- a/src/net/sourceforge/plantuml/cute/Arc.java +++ b/src/net/sourceforge/plantuml/cute/Arc.java @@ -35,8 +35,6 @@ package net.sourceforge.plantuml.cute; import java.awt.geom.Point2D; -import net.sourceforge.plantuml.ugraphic.UPath; - public class Arc { private final Segment segment; diff --git a/src/net/sourceforge/plantuml/descdiagram/DescriptionDiagram.java b/src/net/sourceforge/plantuml/descdiagram/DescriptionDiagram.java index c429de2c8..32e781004 100644 --- a/src/net/sourceforge/plantuml/descdiagram/DescriptionDiagram.java +++ b/src/net/sourceforge/plantuml/descdiagram/DescriptionDiagram.java @@ -33,13 +33,13 @@ */ package net.sourceforge.plantuml.descdiagram; +import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram; import net.sourceforge.plantuml.cucadiagram.Code; import net.sourceforge.plantuml.cucadiagram.ILeaf; import net.sourceforge.plantuml.cucadiagram.LeafType; import net.sourceforge.plantuml.graphic.USymbol; -import net.sourceforge.plantuml.StringUtils; public class DescriptionDiagram extends AbstractEntityDiagram { @@ -125,6 +125,12 @@ public class DescriptionDiagram extends AbstractEntityDiagram { } } + @Override + public String checkFinalError() { + this.applySingleStrategy(); + return super.checkFinalError(); + } + @Override public UmlDiagramType getUmlDiagramType() { return UmlDiagramType.DESCRIPTION; @@ -133,10 +139,9 @@ public class DescriptionDiagram extends AbstractEntityDiagram { public void setNamespaceSeparator(String namespaceSeparator) { this.namespaceSeparator = namespaceSeparator; } - + public String getNamespaceSeparator() { return namespaceSeparator; } - } diff --git a/src/net/sourceforge/plantuml/descdiagram/DescriptionDiagramFactory.java b/src/net/sourceforge/plantuml/descdiagram/DescriptionDiagramFactory.java index 365010e93..5fdd53ae4 100644 --- a/src/net/sourceforge/plantuml/descdiagram/DescriptionDiagramFactory.java +++ b/src/net/sourceforge/plantuml/descdiagram/DescriptionDiagramFactory.java @@ -36,7 +36,6 @@ package net.sourceforge.plantuml.descdiagram; import java.util.ArrayList; import java.util.List; -import net.sourceforge.plantuml.AbstractPSystem; import net.sourceforge.plantuml.classdiagram.command.CommandHideShowSpecificClass; import net.sourceforge.plantuml.classdiagram.command.CommandUrl; import net.sourceforge.plantuml.command.Command; @@ -113,12 +112,4 @@ public class DescriptionDiagramFactory extends UmlDiagramFactory { return cmds; } - @Override - public String checkFinalError(AbstractPSystem system) { - if (system instanceof DescriptionDiagram) { - ((DescriptionDiagram) system).applySingleStrategy(); - } - return super.checkFinalError(system); - } - } diff --git a/src/net/sourceforge/plantuml/descdiagram/command/CommandLinkElement.java b/src/net/sourceforge/plantuml/descdiagram/command/CommandLinkElement.java index 39c5dd5f5..bc888f7dd 100644 --- a/src/net/sourceforge/plantuml/descdiagram/command/CommandLinkElement.java +++ b/src/net/sourceforge/plantuml/descdiagram/command/CommandLinkElement.java @@ -31,16 +31,15 @@ */ package net.sourceforge.plantuml.descdiagram.command; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.Direction; import net.sourceforge.plantuml.StringUtils; 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.Matcher2; 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.RegexResult; @@ -221,8 +220,8 @@ public class CommandLinkElement extends SingleLineCommand2 { } private void init() { - final Pattern p1 = MyPattern.cmpile("^[%g]([^%g]+)[%g]([^%g]+)[%g]([^%g]+)[%g]$"); - final Matcher m1 = p1.matcher(labelLink); + final Pattern2 p1 = MyPattern.cmpile("^[%g]([^%g]+)[%g]([^%g]+)[%g]([^%g]+)[%g]$"); + final Matcher2 m1 = p1.matcher(labelLink); if (m1.matches()) { firstLabel = m1.group(1); labelLink = StringUtils.trin(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(StringUtils @@ -230,8 +229,8 @@ public class CommandLinkElement extends SingleLineCommand2 { secondLabel = m1.group(3); return; } - final Pattern p2 = MyPattern.cmpile("^[%g]([^%g]+)[%g]([^%g]+)$"); - final Matcher m2 = p2.matcher(labelLink); + final Pattern2 p2 = MyPattern.cmpile("^[%g]([^%g]+)[%g]([^%g]+)$"); + final Matcher2 m2 = p2.matcher(labelLink); if (m2.matches()) { firstLabel = m2.group(1); labelLink = StringUtils.trin(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(StringUtils @@ -239,8 +238,8 @@ public class CommandLinkElement extends SingleLineCommand2 { secondLabel = null; return; } - final Pattern p3 = MyPattern.cmpile("^([^%g]+)[%g]([^%g]+)[%g]$"); - final Matcher m3 = p3.matcher(labelLink); + final Pattern2 p3 = MyPattern.cmpile("^([^%g]+)[%g]([^%g]+)[%g]$"); + final Matcher2 m3 = p3.matcher(labelLink); if (m3.matches()) { firstLabel = null; labelLink = StringUtils.trin(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(StringUtils diff --git a/src/net/sourceforge/plantuml/eggs/PSystemPathFactory.java b/src/net/sourceforge/plantuml/eggs/PSystemPathFactory.java index 62b3bace8..06bdcf261 100644 --- a/src/net/sourceforge/plantuml/eggs/PSystemPathFactory.java +++ b/src/net/sourceforge/plantuml/eggs/PSystemPathFactory.java @@ -33,20 +33,19 @@ */ package net.sourceforge.plantuml.eggs; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - import net.sourceforge.plantuml.AbstractPSystem; import net.sourceforge.plantuml.command.PSystemSingleLineFactory; +import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; +import net.sourceforge.plantuml.command.regex.Pattern2; public class PSystemPathFactory extends PSystemSingleLineFactory { - final private static Pattern p = MyPattern.cmpile("(?i)^path[%s]+([0-9A-Za-z]+)$"); + final private static Pattern2 p = MyPattern.cmpile("(?i)^path[%s]+([0-9A-Za-z]+)$"); @Override protected AbstractPSystem executeLine(String line) { - final Matcher m = p.matcher(line); + final Matcher2 m = p.matcher(line); if (m.find() == false) { return null; } diff --git a/src/net/sourceforge/plantuml/graph/AbstractEntityImage.java b/src/net/sourceforge/plantuml/graph/AbstractEntityImage.java index fcc2fafd8..69fb4f85d 100644 --- a/src/net/sourceforge/plantuml/graph/AbstractEntityImage.java +++ b/src/net/sourceforge/plantuml/graph/AbstractEntityImage.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 19109 $ + * Revision $Revision: 19885 $ * */ package net.sourceforge.plantuml.graph; @@ -39,7 +39,6 @@ import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.cucadiagram.IEntity; import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorSet; import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.ugraphic.ColorMapper; diff --git a/src/net/sourceforge/plantuml/graph/Elastane.java b/src/net/sourceforge/plantuml/graph/Elastane.java index 1aca4b0ef..127ff3bc4 100644 --- a/src/net/sourceforge/plantuml/graph/Elastane.java +++ b/src/net/sourceforge/plantuml/graph/Elastane.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 19267 $ + * Revision $Revision: 19885 $ * */ package net.sourceforge.plantuml.graph; @@ -60,10 +60,8 @@ import net.sourceforge.plantuml.geom.PolylineBreakeable; import net.sourceforge.plantuml.geom.XMoveable; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounderUtils; import net.sourceforge.plantuml.graphic.TextBlock; -import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.UFont; diff --git a/src/net/sourceforge/plantuml/graph/EntityImageActivity.java b/src/net/sourceforge/plantuml/graph/EntityImageActivity.java index 26b8d8574..46f016b5b 100644 --- a/src/net/sourceforge/plantuml/graph/EntityImageActivity.java +++ b/src/net/sourceforge/plantuml/graph/EntityImageActivity.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 19267 $ + * Revision $Revision: 19885 $ * */ package net.sourceforge.plantuml.graph; @@ -40,11 +40,9 @@ import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.SpriteContainerEmpty; -import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.IEntity; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.StringBounderUtils; import net.sourceforge.plantuml.graphic.TextBlock; diff --git a/src/net/sourceforge/plantuml/graph/EntityImageUsecase.java b/src/net/sourceforge/plantuml/graph/EntityImageUsecase.java index 1b312677e..6ae98f67a 100644 --- a/src/net/sourceforge/plantuml/graph/EntityImageUsecase.java +++ b/src/net/sourceforge/plantuml/graph/EntityImageUsecase.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 19267 $ + * Revision $Revision: 19885 $ * */ package net.sourceforge.plantuml.graph; @@ -41,11 +41,9 @@ import java.awt.geom.QuadCurve2D; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.SpriteContainerEmpty; -import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.IEntity; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.StringBounderUtils; import net.sourceforge.plantuml.graphic.TextBlock; diff --git a/src/net/sourceforge/plantuml/graph/Graph2.java b/src/net/sourceforge/plantuml/graph/Graph2.java index cfb944414..f76bc2b5e 100644 --- a/src/net/sourceforge/plantuml/graph/Graph2.java +++ b/src/net/sourceforge/plantuml/graph/Graph2.java @@ -28,19 +28,17 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 19267 $ + * Revision $Revision: 19885 $ * */ package net.sourceforge.plantuml.graph; -import java.awt.Color; import java.awt.Graphics2D; import java.awt.geom.Dimension2D; import java.util.ArrayList; import java.util.Collections; import java.util.List; -import net.sourceforge.plantuml.EmptyImageBuilder; import net.sourceforge.plantuml.cucadiagram.IEntity; import net.sourceforge.plantuml.graphic.StringBounderUtils; diff --git a/src/net/sourceforge/plantuml/graph/Graph3.java b/src/net/sourceforge/plantuml/graph/Graph3.java index 556ab734c..625b26b3c 100644 --- a/src/net/sourceforge/plantuml/graph/Graph3.java +++ b/src/net/sourceforge/plantuml/graph/Graph3.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 19267 $ + * Revision $Revision: 19885 $ * */ package net.sourceforge.plantuml.graph; @@ -47,7 +47,6 @@ import java.util.Map; import java.util.Set; import net.sourceforge.plantuml.Dimension2DDouble; -import net.sourceforge.plantuml.EmptyImageBuilder; import net.sourceforge.plantuml.Log; import net.sourceforge.plantuml.cucadiagram.IEntity; import net.sourceforge.plantuml.geom.InflationTransform; diff --git a/src/net/sourceforge/plantuml/graph/Graph4.java b/src/net/sourceforge/plantuml/graph/Graph4.java index 860b3c8c3..da4a49991 100644 --- a/src/net/sourceforge/plantuml/graph/Graph4.java +++ b/src/net/sourceforge/plantuml/graph/Graph4.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 19267 $ + * Revision $Revision: 19885 $ * */ package net.sourceforge.plantuml.graph; @@ -47,7 +47,6 @@ import java.util.List; import java.util.Map; import net.sourceforge.plantuml.Dimension2DDouble; -import net.sourceforge.plantuml.EmptyImageBuilder; import net.sourceforge.plantuml.Log; import net.sourceforge.plantuml.cucadiagram.IEntity; import net.sourceforge.plantuml.geom.InflationTransform; diff --git a/src/net/sourceforge/plantuml/graph/Graph5.java b/src/net/sourceforge/plantuml/graph/Graph5.java index 38dfb6e91..97115e8ca 100644 --- a/src/net/sourceforge/plantuml/graph/Graph5.java +++ b/src/net/sourceforge/plantuml/graph/Graph5.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 19267 $ + * Revision $Revision: 19885 $ * */ package net.sourceforge.plantuml.graph; @@ -46,7 +46,6 @@ import java.util.List; import java.util.Map; import net.sourceforge.plantuml.Dimension2DDouble; -import net.sourceforge.plantuml.EmptyImageBuilder; import net.sourceforge.plantuml.cucadiagram.IEntity; import net.sourceforge.plantuml.graph2.IInflationTransform; import net.sourceforge.plantuml.graph2.InflationTransform2; diff --git a/src/net/sourceforge/plantuml/graph/LinkString.java b/src/net/sourceforge/plantuml/graph/LinkString.java index 132b6a517..7afd60f21 100644 --- a/src/net/sourceforge/plantuml/graph/LinkString.java +++ b/src/net/sourceforge/plantuml/graph/LinkString.java @@ -28,25 +28,24 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 19109 $ + * Revision $Revision: 19880 $ * */ package net.sourceforge.plantuml.graph; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - +import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; +import net.sourceforge.plantuml.command.regex.Pattern2; public class LinkString { - final private static Pattern p = MyPattern.cmpile("(.*)->(.*)"); + final private static Pattern2 p = MyPattern.cmpile("(.*)->(.*)"); final private String node1; final private String node2; public LinkString(String desc) { - final Matcher m = p.matcher(desc); + final Matcher2 m = p.matcher(desc); if (m.find() == false) { throw new IllegalArgumentException(); } diff --git a/src/net/sourceforge/plantuml/graph/MethodsOrFieldsArea.java b/src/net/sourceforge/plantuml/graph/MethodsOrFieldsArea.java index 3677a86c8..ddfa1d934 100644 --- a/src/net/sourceforge/plantuml/graph/MethodsOrFieldsArea.java +++ b/src/net/sourceforge/plantuml/graph/MethodsOrFieldsArea.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 19109 $ + * Revision $Revision: 19885 $ * */ package net.sourceforge.plantuml.graph; @@ -43,10 +43,8 @@ import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.Member; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; -import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.skin.VisibilityModifier; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; diff --git a/src/net/sourceforge/plantuml/graphic/ColorAndSizeChange.java b/src/net/sourceforge/plantuml/graphic/ColorAndSizeChange.java index 789dbbe07..f46637f4d 100644 --- a/src/net/sourceforge/plantuml/graphic/ColorAndSizeChange.java +++ b/src/net/sourceforge/plantuml/graphic/ColorAndSizeChange.java @@ -28,33 +28,32 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 19109 $ + * Revision $Revision: 19880 $ * */ package net.sourceforge.plantuml.graphic; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - +import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; +import net.sourceforge.plantuml.command.regex.Pattern2; class ColorAndSizeChange implements FontChange { - static final Pattern colorPattern = MyPattern.cmpile("(?i)color\\s*=\\s*[%g]?(#[0-9a-fA-F]{6}|\\w+)[%g]?"); + static final Pattern2 colorPattern = MyPattern.cmpile("(?i)color\\s*=\\s*[%g]?(#[0-9a-fA-F]{6}|\\w+)[%g]?"); - static final Pattern sizePattern = MyPattern.cmpile("(?i)size\\s*=\\s*[%g]?(\\d+)[%g]?"); + static final Pattern2 sizePattern = MyPattern.cmpile("(?i)size\\s*=\\s*[%g]?(\\d+)[%g]?"); private final HtmlColor color; private final Integer size; ColorAndSizeChange(String s) { - final Matcher matcherColor = colorPattern.matcher(s); + final Matcher2 matcherColor = colorPattern.matcher(s); if (matcherColor.find()) { color = HtmlColorSet.getInstance().getColorIfValid(matcherColor.group(1)); } else { color = null; } - final Matcher matcherSize = sizePattern.matcher(s); + final Matcher2 matcherSize = sizePattern.matcher(s); if (matcherSize.find()) { size = new Integer(matcherSize.group(1)); } else { diff --git a/src/net/sourceforge/plantuml/graphic/ColorChange.java b/src/net/sourceforge/plantuml/graphic/ColorChange.java index 507e5afd7..cc1f720f5 100644 --- a/src/net/sourceforge/plantuml/graphic/ColorChange.java +++ b/src/net/sourceforge/plantuml/graphic/ColorChange.java @@ -33,19 +33,18 @@ */ package net.sourceforge.plantuml.graphic; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - +import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; +import net.sourceforge.plantuml.command.regex.Pattern2; class ColorChange implements FontChange { - static private final Pattern colorPattern = MyPattern.cmpile("(?i)" + Splitter.fontColorPattern2); + static private final Pattern2 colorPattern = MyPattern.cmpile("(?i)" + Splitter.fontColorPattern2); private final HtmlColor color; ColorChange(String s) { - final Matcher matcherColor = colorPattern.matcher(s); + final Matcher2 matcherColor = colorPattern.matcher(s); if (matcherColor.find() == false) { throw new IllegalArgumentException(); } diff --git a/src/net/sourceforge/plantuml/graphic/DateEventUtils.java b/src/net/sourceforge/plantuml/graphic/DateEventUtils.java index 9f7b5ec0e..bf715f518 100644 --- a/src/net/sourceforge/plantuml/graphic/DateEventUtils.java +++ b/src/net/sourceforge/plantuml/graphic/DateEventUtils.java @@ -38,10 +38,13 @@ import java.awt.geom.Dimension2D; import java.awt.image.BufferedImage; import java.text.SimpleDateFormat; import java.util.Arrays; +import java.util.Calendar; import java.util.Date; import java.util.List; +import java.util.Locale; import net.sourceforge.plantuml.Dimension2DDouble; +import net.sourceforge.plantuml.Log; import net.sourceforge.plantuml.SpriteContainerEmpty; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.ugraphic.LimitFinder; @@ -55,32 +58,38 @@ import net.sourceforge.plantuml.webp.Portraits; public class DateEventUtils { - public static TextBlock addEvent(TextBlock textBlock, HtmlColor color) { - final String today = new SimpleDateFormat("MM-dd").format(new Date()); - final String todayDayOfWeek = new SimpleDateFormat("MM-dd-u").format(new Date()); - - if ("11-05".equals(today)) { - final List asList = Arrays.asList("November 5th, 1955", - "Doc Brown's discovery of the Flux Capacitor, that makes time-travel possible."); - return TextBlockUtils.mergeTB(textBlock, getComment(asList, color), HorizontalAlignment.LEFT); - } else if ("08-29".equals(today)) { - final List asList = Arrays.asList("August 29th, 1997", - "Skynet becomes self-aware at 02:14 AM Eastern Time."); - return TextBlockUtils.mergeTB(textBlock, getComment(asList, color), HorizontalAlignment.LEFT); - } else if ("06-29".equals(today)) { - final List asList = Arrays.asList("June 29th, 1975", - "\"It was the first time in history that anyone had typed", - "a character on a keyboard and seen it show up on their", - "own computer's screen right in front of them.\"", "\t\t\t\t\t\t\t\t\t\tSteve Wozniak"); - return TextBlockUtils.mergeTB(textBlock, getComment(asList, color), HorizontalAlignment.LEFT); - } else if ("01-07".equals(today) || "01-08-1".equals(todayDayOfWeek)) { - return addCharlie(textBlock); - } else if ("11-13".equals(today) || "11-14-1".equals(todayDayOfWeek)) { - return addMemorial(textBlock, color); + public static TextBlock addEvent(final TextBlock textBlock, final HtmlColor color) { + try { + final String today = new SimpleDateFormat("MM-dd", Locale.US).format(new Date()); + if ("11-05".equals(today)) { + final List asList = Arrays.asList("November 5th, 1955", + "Doc Brown's discovery of the Flux Capacitor, that makes time-travel possible."); + return TextBlockUtils.mergeTB(textBlock, getComment(asList, color), HorizontalAlignment.LEFT); + } else if ("08-29".equals(today)) { + final List asList = Arrays.asList("August 29th, 1997", + "Skynet becomes self-aware at 02:14 AM Eastern Time."); + return TextBlockUtils.mergeTB(textBlock, getComment(asList, color), HorizontalAlignment.LEFT); + } else if ("06-29".equals(today)) { + final List asList = Arrays.asList("June 29th, 1975", + "\"It was the first time in history that anyone had typed", + "a character on a keyboard and seen it show up on their", + "own computer's screen right in front of them.\"", "\t\t\t\t\t\t\t\t\t\tSteve Wozniak"); + return TextBlockUtils.mergeTB(textBlock, getComment(asList, color), HorizontalAlignment.LEFT); + } else if ("01-07".equals(today) || ("01-08".equals(today) && getDayOfWeek() == Calendar.MONDAY)) { + return addCharlie(textBlock); + } else if ("11-13".equals(today) || ("11-14".equals(today) && getDayOfWeek() == Calendar.MONDAY)) { + return addMemorial(textBlock, color); + } + } catch (Throwable t) { + Log.debug("Error " + t); } return textBlock; } + private synchronized static int getDayOfWeek() { + return Calendar.getInstance().get(Calendar.DAY_OF_WEEK); + } + private static TextBlock addMemorial(TextBlock textBlock, HtmlColor color) { final Portrait portrait = Portraits.getOne(); if (portrait == null) { diff --git a/src/net/sourceforge/plantuml/graphic/FontFamilyChange.java b/src/net/sourceforge/plantuml/graphic/FontFamilyChange.java index 5f11c00bb..9ed80fff4 100644 --- a/src/net/sourceforge/plantuml/graphic/FontFamilyChange.java +++ b/src/net/sourceforge/plantuml/graphic/FontFamilyChange.java @@ -33,20 +33,19 @@ */ package net.sourceforge.plantuml.graphic; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - import net.sourceforge.plantuml.StringUtils; +import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; +import net.sourceforge.plantuml.command.regex.Pattern2; class FontFamilyChange implements FontChange { - static private final Pattern colorPattern = MyPattern.cmpile("(?i)" + Splitter.fontFamilyPattern); + static private final Pattern2 colorPattern = MyPattern.cmpile("(?i)" + Splitter.fontFamilyPattern); private final String family; FontFamilyChange(String s) { - final Matcher matcherColor = colorPattern.matcher(s); + final Matcher2 matcherColor = colorPattern.matcher(s); if (matcherColor.find() == false) { throw new IllegalArgumentException(); } diff --git a/src/net/sourceforge/plantuml/graphic/FontStyle.java b/src/net/sourceforge/plantuml/graphic/FontStyle.java index 23774e3f1..f2db7e306 100644 --- a/src/net/sourceforge/plantuml/graphic/FontStyle.java +++ b/src/net/sourceforge/plantuml/graphic/FontStyle.java @@ -28,15 +28,15 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 19109 $ + * Revision $Revision: 19880 $ * */ package net.sourceforge.plantuml.graphic; import java.awt.Font; import java.util.EnumSet; -import java.util.regex.Matcher; +import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; import net.sourceforge.plantuml.ugraphic.UFont; @@ -112,7 +112,7 @@ public enum FontStyle { } public HtmlColor getExtendedColor(String s) { - final Matcher m = MyPattern.cmpile(getActivationPattern()).matcher(s); + final Matcher2 m = MyPattern.cmpile(getActivationPattern()).matcher(s); if (m.find() == false || m.groupCount() != 1) { return null; } diff --git a/src/net/sourceforge/plantuml/graphic/HtmlColorAndStyle.java b/src/net/sourceforge/plantuml/graphic/HtmlColorAndStyle.java index 43250b2dd..8eaa53634 100644 --- a/src/net/sourceforge/plantuml/graphic/HtmlColorAndStyle.java +++ b/src/net/sourceforge/plantuml/graphic/HtmlColorAndStyle.java @@ -45,6 +45,11 @@ public class HtmlColorAndStyle { private final HtmlColor color; private final LinkStyle style; + @Override + public String toString() { + return color + " " + style; + } + public static Rainbow fromColor(HtmlColor color) { if (color == null) { return Rainbow.none(); diff --git a/src/net/sourceforge/plantuml/graphic/HtmlColorSetSimple.java b/src/net/sourceforge/plantuml/graphic/HtmlColorSetSimple.java index 7bc28c909..0b6a09f71 100644 --- a/src/net/sourceforge/plantuml/graphic/HtmlColorSetSimple.java +++ b/src/net/sourceforge/plantuml/graphic/HtmlColorSetSimple.java @@ -40,9 +40,9 @@ import java.util.HashMap; import java.util.Map; import java.util.Set; import java.util.TreeSet; -import java.util.regex.Matcher; import net.sourceforge.plantuml.StringUtils; +import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; public class HtmlColorSetSimple implements IHtmlColorSet { @@ -62,7 +62,7 @@ public class HtmlColorSetSimple implements IHtmlColorSet { if (s == null) { return null; } - final Matcher m = MyPattern.cmpile("[-\\\\|/]").matcher(s); + final Matcher2 m = MyPattern.cmpile("[-\\\\|/]").matcher(s); if (m.find()) { final char sep = m.group(0).charAt(0); final int idx = s.indexOf(sep); diff --git a/src/net/sourceforge/plantuml/graphic/HtmlCommandFactory.java b/src/net/sourceforge/plantuml/graphic/HtmlCommandFactory.java index 1b47f1630..cf1b0f7c1 100644 --- a/src/net/sourceforge/plantuml/graphic/HtmlCommandFactory.java +++ b/src/net/sourceforge/plantuml/graphic/HtmlCommandFactory.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 19109 $ + * Revision $Revision: 19878 $ * */ package net.sourceforge.plantuml.graphic; @@ -40,11 +40,12 @@ import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.UrlBuilder; import net.sourceforge.plantuml.UrlBuilder.ModeUrl; import net.sourceforge.plantuml.command.regex.MyPattern; +import net.sourceforge.plantuml.command.regex.Pattern2; class HtmlCommandFactory { - static final Pattern addStyle; - static final Pattern removeStyle; + static final Pattern2 addStyle; + static final Pattern2 removeStyle; static { final StringBuilder sbAddStyle = new StringBuilder(); @@ -66,7 +67,7 @@ class HtmlCommandFactory { removeStyle = MyPattern.cmpile(sbRemoveStyle.toString(), Pattern.CASE_INSENSITIVE); } - private Pattern htmlTag = MyPattern.cmpile(Splitter.htmlTag, Pattern.CASE_INSENSITIVE); + private Pattern2 htmlTag = MyPattern.cmpile(Splitter.htmlTag, Pattern.CASE_INSENSITIVE); HtmlCommand getHtmlCommand(String s) { if (htmlTag.matcher(s).matches() == false) { diff --git a/src/net/sourceforge/plantuml/graphic/Img.java b/src/net/sourceforge/plantuml/graphic/Img.java index 1285c837f..0c74c72b8 100644 --- a/src/net/sourceforge/plantuml/graphic/Img.java +++ b/src/net/sourceforge/plantuml/graphic/Img.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 19109 $ + * Revision $Revision: 19880 $ * */ package net.sourceforge.plantuml.graphic; @@ -41,21 +41,21 @@ import java.io.IOException; import java.io.InputStream; import java.net.URL; import java.net.URLConnection; -import java.util.regex.Matcher; -import java.util.regex.Pattern; import javax.imageio.ImageIO; import net.sourceforge.plantuml.FileSystem; import net.sourceforge.plantuml.StringUtils; +import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; +import net.sourceforge.plantuml.command.regex.Pattern2; public class Img implements HtmlCommand { - final static private Pattern srcPattern = MyPattern.cmpile("(?i)src[%s]*=[%s]*[\"%q]?([^%s\">]+)[\"%q]?"); - final static private Pattern vspacePattern = MyPattern.cmpile("(?i)vspace[%s]*=[%s]*[\"%q]?(\\d+)[\"%q]?"); - final static private Pattern valignPattern = MyPattern.cmpile("(?i)valign[%s]*=[%s]*[\"%q]?(top|bottom|middle)[\"%q]?"); - final static private Pattern noSrcColonPattern = MyPattern.cmpile("(?i)" + Splitter.imgPatternNoSrcColon); + final static private Pattern2 srcPattern = MyPattern.cmpile("(?i)src[%s]*=[%s]*[\"%q]?([^%s\">]+)[\"%q]?"); + final static private Pattern2 vspacePattern = MyPattern.cmpile("(?i)vspace[%s]*=[%s]*[\"%q]?(\\d+)[\"%q]?"); + final static private Pattern2 valignPattern = MyPattern.cmpile("(?i)valign[%s]*=[%s]*[\"%q]?(top|bottom|middle)[\"%q]?"); + final static private Pattern2 noSrcColonPattern = MyPattern.cmpile("(?i)" + Splitter.imgPatternNoSrcColon); private final TextBlock tileImage; @@ -64,7 +64,7 @@ public class Img implements HtmlCommand { } static int getVspace(String html) { - final Matcher m = vspacePattern.matcher(html); + final Matcher2 m = vspacePattern.matcher(html); if (m.find() == false) { return 0; } @@ -72,7 +72,7 @@ public class Img implements HtmlCommand { } static ImgValign getValign(String html) { - final Matcher m = valignPattern.matcher(html); + final Matcher2 m = valignPattern.matcher(html); if (m.find() == false) { return ImgValign.TOP; } @@ -81,16 +81,16 @@ public class Img implements HtmlCommand { static HtmlCommand getInstance(String html, boolean withSrc) { if (withSrc) { - final Matcher m = srcPattern.matcher(html); + final Matcher2 m = srcPattern.matcher(html); final int vspace = getVspace(html); final ImgValign valign = getValign(html); return build(m, valign, vspace); } - final Matcher m = noSrcColonPattern.matcher(html); + final Matcher2 m = noSrcColonPattern.matcher(html); return build(m, ImgValign.TOP, 0); } - private static HtmlCommand build(final Matcher m, final ImgValign valign, final int vspace) { + private static HtmlCommand build(final Matcher2 m, final ImgValign valign, final int vspace) { if (m.find() == false) { return new Text("(SYNTAX ERROR)"); } diff --git a/src/net/sourceforge/plantuml/graphic/Rainbow.java b/src/net/sourceforge/plantuml/graphic/Rainbow.java index 42fdc14f9..3900e2c42 100644 --- a/src/net/sourceforge/plantuml/graphic/Rainbow.java +++ b/src/net/sourceforge/plantuml/graphic/Rainbow.java @@ -47,6 +47,11 @@ public class Rainbow { private Rainbow(int colorArrowSeparationSpace) { this.colorArrowSeparationSpace = colorArrowSeparationSpace; } + + @Override + public String toString() { + return colors.toString(); + } public static Rainbow none() { return new Rainbow(0); @@ -67,7 +72,7 @@ public class Rainbow { result.colors.add(color); return result; } - + public static Rainbow build(ISkinParam skinParam, String colorString, int colorArrowSeparationSpace) { if (colorString == null) { return Rainbow.none(); diff --git a/src/net/sourceforge/plantuml/graphic/SizeChange.java b/src/net/sourceforge/plantuml/graphic/SizeChange.java index 51de33617..1c530b035 100644 --- a/src/net/sourceforge/plantuml/graphic/SizeChange.java +++ b/src/net/sourceforge/plantuml/graphic/SizeChange.java @@ -33,19 +33,18 @@ */ package net.sourceforge.plantuml.graphic; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - +import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; +import net.sourceforge.plantuml.command.regex.Pattern2; class SizeChange implements FontChange { - static private final Pattern sizePattern = MyPattern.cmpile("(?i)" + Splitter.fontSizePattern2); + static private final Pattern2 sizePattern = MyPattern.cmpile("(?i)" + Splitter.fontSizePattern2); private final Integer size; SizeChange(String s) { - final Matcher matcherSize = sizePattern.matcher(s); + final Matcher2 matcherSize = sizePattern.matcher(s); if (matcherSize.find() == false) { throw new IllegalArgumentException(); } diff --git a/src/net/sourceforge/plantuml/graphic/Splitter.java b/src/net/sourceforge/plantuml/graphic/Splitter.java index 0b4787916..51eb43546 100644 --- a/src/net/sourceforge/plantuml/graphic/Splitter.java +++ b/src/net/sourceforge/plantuml/graphic/Splitter.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 19271 $ + * Revision $Revision: 19880 $ * */ package net.sourceforge.plantuml.graphic; @@ -38,11 +38,12 @@ import java.util.Collection; import java.util.Collections; import java.util.EnumSet; import java.util.List; -import java.util.regex.Matcher; import java.util.regex.Pattern; import net.sourceforge.plantuml.StringUtils; +import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; +import net.sourceforge.plantuml.command.regex.Pattern2; import net.sourceforge.plantuml.ugraphic.sprite.SpriteUtils; public class Splitter { @@ -67,7 +68,7 @@ public class Splitter { static final String linkPattern = "\\[\\[([^\\[\\]]+)\\]\\]"; - private static final Pattern tagOrText; + private static final Pattern2 tagOrText; static { final StringBuilder sb = new StringBuilder("(?i)"); @@ -114,7 +115,7 @@ public class Splitter { private final List splitted = new ArrayList(); public Splitter(String s) { - final Matcher matcher = tagOrText.matcher(s); + final Matcher2 matcher = tagOrText.matcher(s); while (matcher.find()) { String part = matcher.group(0); part = StringUtils.showComparatorCharacters(part); diff --git a/src/net/sourceforge/plantuml/graphic/SvgAttributes.java b/src/net/sourceforge/plantuml/graphic/SvgAttributes.java index 59fc13d37..9bdedddb7 100644 --- a/src/net/sourceforge/plantuml/graphic/SvgAttributes.java +++ b/src/net/sourceforge/plantuml/graphic/SvgAttributes.java @@ -36,11 +36,11 @@ package net.sourceforge.plantuml.graphic; import java.util.Collections; import java.util.Map; import java.util.TreeMap; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import net.sourceforge.plantuml.command.regex.MyPattern; import net.sourceforge.plantuml.StringUtils; +import net.sourceforge.plantuml.command.regex.Matcher2; +import net.sourceforge.plantuml.command.regex.MyPattern; +import net.sourceforge.plantuml.command.regex.Pattern2; public class SvgAttributes { @@ -54,8 +54,8 @@ public class SvgAttributes { } public SvgAttributes(String args) { - final Pattern p = MyPattern.cmpile("(\\w+)\\s*=\\s*([%g][^%g]*[%g]|(?:\\w+))"); - final Matcher m = p.matcher(args); + final Pattern2 p = MyPattern.cmpile("(\\w+)\\s*=\\s*([%g][^%g]*[%g]|(?:\\w+))"); + final Matcher2 m = p.matcher(args); while (m.find()) { attributes.put(m.group(1), StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(m.group(2))); } diff --git a/src/net/sourceforge/plantuml/graphic/SvgAttributesChange.java b/src/net/sourceforge/plantuml/graphic/SvgAttributesChange.java index 7fcfb6ecf..3112f751b 100644 --- a/src/net/sourceforge/plantuml/graphic/SvgAttributesChange.java +++ b/src/net/sourceforge/plantuml/graphic/SvgAttributesChange.java @@ -33,18 +33,17 @@ */ package net.sourceforge.plantuml.graphic; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - +import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; +import net.sourceforge.plantuml.command.regex.Pattern2; class SvgAttributesChange implements FontChange { - static final Pattern pattern = MyPattern.cmpile(Splitter.svgAttributePattern); + static final Pattern2 pattern = MyPattern.cmpile(Splitter.svgAttributePattern); private final SvgAttributes attributes; SvgAttributesChange(String s) { - final Matcher m = pattern.matcher(s); + final Matcher2 m = pattern.matcher(s); if (m.find() == false) { throw new IllegalStateException(); } diff --git a/src/net/sourceforge/plantuml/graphic/UGraphicDelegator.java b/src/net/sourceforge/plantuml/graphic/UGraphicDelegator.java index 22089a8e6..9a06a914f 100644 --- a/src/net/sourceforge/plantuml/graphic/UGraphicDelegator.java +++ b/src/net/sourceforge/plantuml/graphic/UGraphicDelegator.java @@ -33,9 +33,6 @@ */ package net.sourceforge.plantuml.graphic; -import java.io.IOException; -import java.io.OutputStream; - import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UGraphic; diff --git a/src/net/sourceforge/plantuml/graphic/USymbolArtifact.java b/src/net/sourceforge/plantuml/graphic/USymbolArtifact.java index a96a26d83..57e3db764 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolArtifact.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolArtifact.java @@ -36,7 +36,6 @@ package net.sourceforge.plantuml.graphic; import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.Dimension2DDouble; -import net.sourceforge.plantuml.creole.Stencil; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphicStencil; import net.sourceforge.plantuml.ugraphic.ULine; diff --git a/src/net/sourceforge/plantuml/graphic/USymbolComponent2.java b/src/net/sourceforge/plantuml/graphic/USymbolComponent2.java index 4c4b10fbd..e02c755c0 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolComponent2.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolComponent2.java @@ -36,7 +36,6 @@ package net.sourceforge.plantuml.graphic; import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.Dimension2DDouble; -import net.sourceforge.plantuml.graphic.USymbol.Margin; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UShape; diff --git a/src/net/sourceforge/plantuml/hector/CucaDiagramFileMakerHector.java b/src/net/sourceforge/plantuml/hector/CucaDiagramFileMakerHector.java index e0b70a38f..b66ead2e2 100644 --- a/src/net/sourceforge/plantuml/hector/CucaDiagramFileMakerHector.java +++ b/src/net/sourceforge/plantuml/hector/CucaDiagramFileMakerHector.java @@ -42,7 +42,6 @@ import java.util.Map; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.FileFormatOption; -import net.sourceforge.plantuml.api.ImageDataSimple; import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.cucadiagram.CucaDiagram; import net.sourceforge.plantuml.cucadiagram.ILeaf; diff --git a/src/net/sourceforge/plantuml/hector/CucaDiagramFileMakerHector2.java b/src/net/sourceforge/plantuml/hector/CucaDiagramFileMakerHector2.java index 1e23f4c5e..d64b041c5 100644 --- a/src/net/sourceforge/plantuml/hector/CucaDiagramFileMakerHector2.java +++ b/src/net/sourceforge/plantuml/hector/CucaDiagramFileMakerHector2.java @@ -43,7 +43,6 @@ import java.util.Map; import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.FileFormatOption; -import net.sourceforge.plantuml.api.ImageDataSimple; import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.cucadiagram.CucaDiagram; import net.sourceforge.plantuml.cucadiagram.ILeaf; diff --git a/src/net/sourceforge/plantuml/hector/CucaDiagramFileMakerHector3.java b/src/net/sourceforge/plantuml/hector/CucaDiagramFileMakerHector3.java index efbc097a7..5acffd898 100644 --- a/src/net/sourceforge/plantuml/hector/CucaDiagramFileMakerHector3.java +++ b/src/net/sourceforge/plantuml/hector/CucaDiagramFileMakerHector3.java @@ -43,7 +43,6 @@ import java.util.Map; import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.FileFormatOption; -import net.sourceforge.plantuml.api.ImageDataSimple; import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.cucadiagram.CucaDiagram; import net.sourceforge.plantuml.cucadiagram.ILeaf; diff --git a/src/net/sourceforge/plantuml/hector/CucaDiagramFileMakerHector4.java b/src/net/sourceforge/plantuml/hector/CucaDiagramFileMakerHector4.java index 9d092b031..2bb5c29e8 100644 --- a/src/net/sourceforge/plantuml/hector/CucaDiagramFileMakerHector4.java +++ b/src/net/sourceforge/plantuml/hector/CucaDiagramFileMakerHector4.java @@ -44,7 +44,6 @@ import java.util.Map; import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.FileFormatOption; -import net.sourceforge.plantuml.api.ImageDataSimple; import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.cucadiagram.CucaDiagram; import net.sourceforge.plantuml.cucadiagram.ILeaf; diff --git a/src/net/sourceforge/plantuml/hector/CucaDiagramFileMakerHectorB1.java b/src/net/sourceforge/plantuml/hector/CucaDiagramFileMakerHectorB1.java index 0f6ad8659..815bfe2c4 100644 --- a/src/net/sourceforge/plantuml/hector/CucaDiagramFileMakerHectorB1.java +++ b/src/net/sourceforge/plantuml/hector/CucaDiagramFileMakerHectorB1.java @@ -44,7 +44,6 @@ import java.util.Map; import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.FileFormatOption; -import net.sourceforge.plantuml.api.ImageDataSimple; import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.cucadiagram.CucaDiagram; import net.sourceforge.plantuml.cucadiagram.ILeaf; diff --git a/src/net/sourceforge/plantuml/hector/CucaDiagramFileMakerHectorB2.java b/src/net/sourceforge/plantuml/hector/CucaDiagramFileMakerHectorB2.java index 9b43ea097..8e8dea343 100644 --- a/src/net/sourceforge/plantuml/hector/CucaDiagramFileMakerHectorB2.java +++ b/src/net/sourceforge/plantuml/hector/CucaDiagramFileMakerHectorB2.java @@ -44,7 +44,6 @@ import java.util.Map; import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.FileFormatOption; -import net.sourceforge.plantuml.api.ImageDataSimple; import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.cucadiagram.CucaDiagram; import net.sourceforge.plantuml.cucadiagram.ILeaf; diff --git a/src/net/sourceforge/plantuml/hector2/CucaDiagramFileMakerHectorC1.java b/src/net/sourceforge/plantuml/hector2/CucaDiagramFileMakerHectorC1.java index f46902a66..a73dbbde0 100644 --- a/src/net/sourceforge/plantuml/hector2/CucaDiagramFileMakerHectorC1.java +++ b/src/net/sourceforge/plantuml/hector2/CucaDiagramFileMakerHectorC1.java @@ -39,7 +39,6 @@ import java.io.OutputStream; import java.util.List; import net.sourceforge.plantuml.FileFormatOption; -import net.sourceforge.plantuml.api.ImageDataSimple; import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.cucadiagram.CucaDiagram; import net.sourceforge.plantuml.cucadiagram.Link; diff --git a/src/net/sourceforge/plantuml/html/CucaDiagramHtmlMaker.java b/src/net/sourceforge/plantuml/html/CucaDiagramHtmlMaker.java index d8f3aa193..c664da6e9 100644 --- a/src/net/sourceforge/plantuml/html/CucaDiagramHtmlMaker.java +++ b/src/net/sourceforge/plantuml/html/CucaDiagramHtmlMaker.java @@ -41,17 +41,14 @@ import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.List; -import java.util.Map; -import java.util.TreeMap; -import net.sourceforge.plantuml.cucadiagram.Code; +import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.cucadiagram.CucaDiagram; import net.sourceforge.plantuml.cucadiagram.IEntity; import net.sourceforge.plantuml.cucadiagram.LeafType; import net.sourceforge.plantuml.cucadiagram.Link; import net.sourceforge.plantuml.cucadiagram.Member; import net.sourceforge.plantuml.cucadiagram.Stereotype; -import net.sourceforge.plantuml.StringUtils; public final class CucaDiagramHtmlMaker { diff --git a/src/net/sourceforge/plantuml/html/LinkHtmlPrinter.java b/src/net/sourceforge/plantuml/html/LinkHtmlPrinter.java index 48e443e69..914bbc2a6 100644 --- a/src/net/sourceforge/plantuml/html/LinkHtmlPrinter.java +++ b/src/net/sourceforge/plantuml/html/LinkHtmlPrinter.java @@ -35,11 +35,11 @@ package net.sourceforge.plantuml.html; import java.io.PrintWriter; +import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.cucadiagram.IEntity; import net.sourceforge.plantuml.cucadiagram.LeafType; import net.sourceforge.plantuml.cucadiagram.Link; import net.sourceforge.plantuml.cucadiagram.LinkDecor; -import net.sourceforge.plantuml.StringUtils; public final class LinkHtmlPrinter { diff --git a/src/net/sourceforge/plantuml/jcckit/PSystemJcckitFactory.java b/src/net/sourceforge/plantuml/jcckit/PSystemJcckitFactory.java index 3974cc80d..ced91c52b 100644 --- a/src/net/sourceforge/plantuml/jcckit/PSystemJcckitFactory.java +++ b/src/net/sourceforge/plantuml/jcckit/PSystemJcckitFactory.java @@ -36,13 +36,13 @@ package net.sourceforge.plantuml.jcckit; import java.io.IOException; import java.io.StringReader; import java.util.Properties; -import java.util.regex.Matcher; -import java.util.regex.Pattern; import net.sourceforge.plantuml.Log; import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.command.PSystemBasicFactory; +import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; +import net.sourceforge.plantuml.command.regex.Pattern2; import net.sourceforge.plantuml.core.DiagramType; public class PSystemJcckitFactory extends PSystemBasicFactory { @@ -72,8 +72,8 @@ public class PSystemJcckitFactory extends PSystemBasicFactory { } private void extractDimension(String startLine) { - final Pattern p = MyPattern.cmpile("\\((\\d+),(\\d+)\\)"); - final Matcher m = p.matcher(startLine); + final Pattern2 p = MyPattern.cmpile("\\((\\d+),(\\d+)\\)"); + final Matcher2 m = p.matcher(startLine); final boolean ok = m.find(); if (ok) { width = Integer.parseInt(m.group(1)); diff --git a/src/net/sourceforge/plantuml/logo/TurtleGraphicsPane.java b/src/net/sourceforge/plantuml/logo/TurtleGraphicsPane.java index 485e6ca9e..fd71bbe71 100644 --- a/src/net/sourceforge/plantuml/logo/TurtleGraphicsPane.java +++ b/src/net/sourceforge/plantuml/logo/TurtleGraphicsPane.java @@ -48,7 +48,6 @@ import net.sourceforge.plantuml.graphic.HtmlColorSetSimple; import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.IHtmlColorSet; import net.sourceforge.plantuml.graphic.TextBlock; -import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UFont; diff --git a/src/net/sourceforge/plantuml/objectdiagram/command/CommandCreateEntityObject.java b/src/net/sourceforge/plantuml/objectdiagram/command/CommandCreateEntityObject.java index 0ce6a8c09..0f5b715c7 100644 --- a/src/net/sourceforge/plantuml/objectdiagram/command/CommandCreateEntityObject.java +++ b/src/net/sourceforge/plantuml/objectdiagram/command/CommandCreateEntityObject.java @@ -50,7 +50,6 @@ import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.graphic.color.ColorParser; import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.objectdiagram.AbstractClassOrObjectDiagram; -import net.sourceforge.plantuml.objectdiagram.ObjectDiagram; public class CommandCreateEntityObject extends SingleLineCommand2 { diff --git a/src/net/sourceforge/plantuml/objectdiagram/command/CommandCreateEntityObjectMultilines.java b/src/net/sourceforge/plantuml/objectdiagram/command/CommandCreateEntityObjectMultilines.java index ce2e7029f..7296d8d51 100644 --- a/src/net/sourceforge/plantuml/objectdiagram/command/CommandCreateEntityObjectMultilines.java +++ b/src/net/sourceforge/plantuml/objectdiagram/command/CommandCreateEntityObjectMultilines.java @@ -51,7 +51,6 @@ import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.graphic.color.ColorParser; import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.objectdiagram.AbstractClassOrObjectDiagram; -import net.sourceforge.plantuml.objectdiagram.ObjectDiagram; import net.sourceforge.plantuml.skin.VisibilityModifier; public class CommandCreateEntityObjectMultilines extends CommandMultilines2 { diff --git a/src/net/sourceforge/plantuml/openiconic/SvgCommandLetter.java b/src/net/sourceforge/plantuml/openiconic/SvgCommandLetter.java index 9c91d432e..e059c0187 100644 --- a/src/net/sourceforge/plantuml/openiconic/SvgCommandLetter.java +++ b/src/net/sourceforge/plantuml/openiconic/SvgCommandLetter.java @@ -33,13 +33,7 @@ */ package net.sourceforge.plantuml.openiconic; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - import net.sourceforge.plantuml.StringUtils; -import net.sourceforge.plantuml.ugraphic.UGraphic; -import net.sourceforge.plantuml.ugraphic.UTranslate; public class SvgCommandLetter implements SvgCommand { diff --git a/src/net/sourceforge/plantuml/oregon/PSystemOregon.java b/src/net/sourceforge/plantuml/oregon/PSystemOregon.java index e2df8da88..ca0b569a5 100644 --- a/src/net/sourceforge/plantuml/oregon/PSystemOregon.java +++ b/src/net/sourceforge/plantuml/oregon/PSystemOregon.java @@ -41,6 +41,7 @@ import java.util.List; import net.sourceforge.plantuml.AbstractPSystem; import net.sourceforge.plantuml.FileFormatOption; +import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.DiagramDescriptionImpl; import net.sourceforge.plantuml.core.ImageData; @@ -50,7 +51,6 @@ import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.ImageBuilder; import net.sourceforge.plantuml.ugraphic.UAntiAliasing; import net.sourceforge.plantuml.ugraphic.UFont; -import net.sourceforge.plantuml.StringUtils; public class PSystemOregon extends AbstractPSystem { diff --git a/src/net/sourceforge/plantuml/posimo/DotPath.java b/src/net/sourceforge/plantuml/posimo/DotPath.java index 9f960ac6e..676273272 100644 --- a/src/net/sourceforge/plantuml/posimo/DotPath.java +++ b/src/net/sourceforge/plantuml/posimo/DotPath.java @@ -48,7 +48,6 @@ import java.util.Map; import java.util.StringTokenizer; import net.sourceforge.plantuml.EnsureVisible; -import net.sourceforge.plantuml.OptionFlags; import net.sourceforge.plantuml.asciiart.BasicCharArea; import net.sourceforge.plantuml.eps.EpsGraphics; import net.sourceforge.plantuml.geom.LineSegmentDouble; diff --git a/src/net/sourceforge/plantuml/posimo/Frame.java b/src/net/sourceforge/plantuml/posimo/Frame.java index f67cc6de3..945b618ae 100644 --- a/src/net/sourceforge/plantuml/posimo/Frame.java +++ b/src/net/sourceforge/plantuml/posimo/Frame.java @@ -40,14 +40,9 @@ import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ISkinParam; -import net.sourceforge.plantuml.SpriteContainerEmpty; -import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.FontConfiguration; -import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; -import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.skin.Area; import net.sourceforge.plantuml.skin.Component; import net.sourceforge.plantuml.skin.Context2D; diff --git a/src/net/sourceforge/plantuml/preproc/IfManager.java b/src/net/sourceforge/plantuml/preproc/IfManager.java index 60870a4e0..735dde36d 100644 --- a/src/net/sourceforge/plantuml/preproc/IfManager.java +++ b/src/net/sourceforge/plantuml/preproc/IfManager.java @@ -28,23 +28,23 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 19109 $ + * Revision $Revision: 19880 $ * */ package net.sourceforge.plantuml.preproc; import java.io.IOException; -import java.util.regex.Matcher; -import java.util.regex.Pattern; import net.sourceforge.plantuml.CharSequence2; +import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; +import net.sourceforge.plantuml.command.regex.Pattern2; class IfManager implements ReadLine { - protected static final Pattern ifdefPattern = MyPattern.cmpile("^[%s]*!if(n)?def[%s]+([A-Za-z_][A-Za-z_0-9]*)$"); - protected static final Pattern elsePattern = MyPattern.cmpile("^[%s]*!else$"); - protected static final Pattern endifPattern = MyPattern.cmpile("^[%s]*!endif$"); + protected static final Pattern2 ifdefPattern = MyPattern.cmpile("^[%s]*!if(n)?def[%s]+([A-Za-z_][A-Za-z_0-9]*)$"); + protected static final Pattern2 elsePattern = MyPattern.cmpile("^[%s]*!else$"); + protected static final Pattern2 endifPattern = MyPattern.cmpile("^[%s]*!endif$"); private final Defines defines; private final ReadLine source; @@ -74,7 +74,7 @@ class IfManager implements ReadLine { return null; } - final Matcher m = ifdefPattern.matcher(s); + final Matcher2 m = ifdefPattern.matcher(s); if (m.find()) { boolean ok = defines.isDefine(m.group(2)); if (m.group(1) != null) { diff --git a/src/net/sourceforge/plantuml/preproc/IfManagerNegatif.java b/src/net/sourceforge/plantuml/preproc/IfManagerNegatif.java index 033434b3c..6ada5ef82 100644 --- a/src/net/sourceforge/plantuml/preproc/IfManagerNegatif.java +++ b/src/net/sourceforge/plantuml/preproc/IfManagerNegatif.java @@ -28,15 +28,15 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 19109 $ + * Revision $Revision: 19880 $ * */ package net.sourceforge.plantuml.preproc; import java.io.IOException; -import java.util.regex.Matcher; import net.sourceforge.plantuml.CharSequence2; +import net.sourceforge.plantuml.command.regex.Matcher2; class IfManagerNegatif extends IfManager { @@ -55,7 +55,7 @@ class IfManagerNegatif extends IfManager { if (s == null) { return null; } - Matcher m = endifPattern.matcher(s); + Matcher2 m = endifPattern.matcher(s); if (m.find()) { return null; } @@ -70,7 +70,7 @@ class IfManagerNegatif extends IfManager { if (s == null) { return null; } - final Matcher m = endifPattern.matcher(s); + final Matcher2 m = endifPattern.matcher(s); if (m.find()) { return null; } diff --git a/src/net/sourceforge/plantuml/preproc/IfManagerPositif.java b/src/net/sourceforge/plantuml/preproc/IfManagerPositif.java index b12960f04..4925b0c9e 100644 --- a/src/net/sourceforge/plantuml/preproc/IfManagerPositif.java +++ b/src/net/sourceforge/plantuml/preproc/IfManagerPositif.java @@ -28,15 +28,15 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 19109 $ + * Revision $Revision: 19880 $ * */ package net.sourceforge.plantuml.preproc; import java.io.IOException; -import java.util.regex.Matcher; import net.sourceforge.plantuml.CharSequence2; +import net.sourceforge.plantuml.command.regex.Matcher2; class IfManagerPositif extends IfManager { @@ -50,7 +50,7 @@ class IfManagerPositif extends IfManager { if (s == null) { return null; } - Matcher m = endifPattern.matcher(s); + Matcher2 m = endifPattern.matcher(s); if (m.find()) { return null; } diff --git a/src/net/sourceforge/plantuml/preproc/Preprocessor.java b/src/net/sourceforge/plantuml/preproc/Preprocessor.java index 08892c558..d511ddce6 100644 --- a/src/net/sourceforge/plantuml/preproc/Preprocessor.java +++ b/src/net/sourceforge/plantuml/preproc/Preprocessor.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 19109 $ + * Revision $Revision: 19880 $ * */ package net.sourceforge.plantuml.preproc; @@ -39,24 +39,24 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Set; -import java.util.regex.Matcher; -import java.util.regex.Pattern; import net.sourceforge.plantuml.CharSequence2; import net.sourceforge.plantuml.CharSequence2Impl; import net.sourceforge.plantuml.StringUtils; +import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; +import net.sourceforge.plantuml.command.regex.Pattern2; import net.sourceforge.plantuml.utils.StartUtils; public class Preprocessor implements ReadLine { private static final String ID = "[A-Za-z_][A-Za-z_0-9]*"; private static final String ARG = "(?:\\(" + ID + "(?:," + ID + ")*?\\))?"; - private static final Pattern definePattern = MyPattern.cmpile("^[%s]*!define[%s]+(" + ID + ARG + ")" + private static final Pattern2 definePattern = MyPattern.cmpile("^[%s]*!define[%s]+(" + ID + ARG + ")" + "(?:[%s]+(.*))?$"); - private static final Pattern undefPattern = MyPattern.cmpile("^[%s]*!undef[%s]+(" + ID + ")$"); - private static final Pattern definelongPattern = MyPattern.cmpile("^[%s]*!definelong[%s]+(" + ID + ARG + ")"); - private static final Pattern enddefinelongPattern = MyPattern.cmpile("^[%s]*!enddefinelong[%s]*$"); + private static final Pattern2 undefPattern = MyPattern.cmpile("^[%s]*!undef[%s]+(" + ID + ")$"); + private static final Pattern2 definelongPattern = MyPattern.cmpile("^[%s]*!definelong[%s]+(" + ID + ARG + ")"); + private static final Pattern2 enddefinelongPattern = MyPattern.cmpile("^[%s]*!enddefinelong[%s]*$"); private final Defines defines; private final PreprocessorInclude rawSource; @@ -78,7 +78,7 @@ public class Preprocessor implements ReadLine { this.defines.restoreState(); } - Matcher m = definePattern.matcher(s); + Matcher2 m = definePattern.matcher(s); if (m.find()) { return manageDefine(m); } @@ -108,12 +108,12 @@ public class Preprocessor implements ReadLine { private int ignoreDefineDuringSeveralLines = 0; - private CharSequence2 manageUndef(Matcher m) throws IOException { + private CharSequence2 manageUndef(Matcher2 m) throws IOException { defines.undefine(m.group(1)); return this.readLine(); } - private CharSequence2 manageDefineLong(Matcher m) throws IOException { + private CharSequence2 manageDefineLong(Matcher2 m) throws IOException { final String group1 = m.group(1); final List def = new ArrayList(); while (true) { @@ -129,7 +129,7 @@ public class Preprocessor implements ReadLine { } } - private CharSequence2 manageDefine(Matcher m) throws IOException { + private CharSequence2 manageDefine(Matcher2 m) throws IOException { final String group1 = m.group(1); final String group2 = m.group(2); if (group2 == null) { diff --git a/src/net/sourceforge/plantuml/preproc/PreprocessorInclude.java b/src/net/sourceforge/plantuml/preproc/PreprocessorInclude.java index c25bc5691..88b478d4a 100644 --- a/src/net/sourceforge/plantuml/preproc/PreprocessorInclude.java +++ b/src/net/sourceforge/plantuml/preproc/PreprocessorInclude.java @@ -29,7 +29,7 @@ * Original Author: Arnaud Roques * Modified by: Nicolas Jouanin * - * Revision $Revision: 19729 $ + * Revision $Revision: 19880 $ * */ package net.sourceforge.plantuml.preproc; @@ -55,14 +55,16 @@ import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.Log; import net.sourceforge.plantuml.OptionFlags; import net.sourceforge.plantuml.StringUtils; +import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; +import net.sourceforge.plantuml.command.regex.Pattern2; import net.sourceforge.plantuml.utils.StartUtils; class PreprocessorInclude implements ReadLine { - private static final Pattern includePattern = MyPattern.cmpile("^[%s]*!include[%s]+[%g]?([^%g]+)[%g]?$"); - private static final Pattern includeManyPattern = MyPattern.cmpile("^[%s]*!include_many[%s]+[%g]?([^%g]+)[%g]?$"); - private static final Pattern includeURLPattern = MyPattern.cmpile("^[%s]*!includeurl[%s]+[%g]?([^%g]+)[%g]?$"); + private static final Pattern2 includePattern = MyPattern.cmpile("^[%s]*!include[%s]+[%g]?([^%g]+)[%g]?$"); + private static final Pattern2 includeManyPattern = MyPattern.cmpile("^[%s]*!include_many[%s]+[%g]?([^%g]+)[%g]?$"); + private static final Pattern2 includeURLPattern = MyPattern.cmpile("^[%s]*!includeurl[%s]+[%g]?([^%g]+)[%g]?$"); private final ReadLine reader2; private final String charset; @@ -131,23 +133,23 @@ class PreprocessorInclude implements ReadLine { } if (OptionFlags.ALLOW_INCLUDE) { assert included == null; - final Matcher m1 = includePattern.matcher(s); + final Matcher2 m1 = includePattern.matcher(s); if (m1.find()) { return manageFileInclude(m1, s.getLocation(), false); } - final Matcher m2 = includeManyPattern.matcher(s); + final Matcher2 m2 = includeManyPattern.matcher(s); if (m2.find()) { return manageFileInclude(m2, s.getLocation(), true); } } - final Matcher mUrl = includeURLPattern.matcher(s); + final Matcher2 mUrl = includeURLPattern.matcher(s); if (mUrl.find()) { return manageUrlInclude(mUrl, s.getLocation()); } return s; } - private CharSequence2 manageUrlInclude(Matcher m, LineLocation lineLocation) throws IOException { + private CharSequence2 manageUrlInclude(Matcher2 m, LineLocation lineLocation) throws IOException { String urlString = m.group(1); urlString = defines.applyDefines(urlString).get(0); // @@ -167,7 +169,7 @@ class PreprocessorInclude implements ReadLine { return this.readLine(); } - private CharSequence2 manageFileInclude(Matcher matcher, LineLocation lineLocation, boolean allowMany) throws IOException { + private CharSequence2 manageFileInclude(Matcher2 matcher, LineLocation lineLocation, boolean allowMany) throws IOException { String fileName = matcher.group(1); fileName = defines.applyDefines(fileName).get(0); final int idx = fileName.lastIndexOf('!'); diff --git a/src/net/sourceforge/plantuml/preproc/ReadLineReader.java b/src/net/sourceforge/plantuml/preproc/ReadLineReader.java index c59caf3d9..dcfa85b60 100644 --- a/src/net/sourceforge/plantuml/preproc/ReadLineReader.java +++ b/src/net/sourceforge/plantuml/preproc/ReadLineReader.java @@ -41,9 +41,11 @@ import net.sourceforge.plantuml.CharSequence2; import net.sourceforge.plantuml.CharSequence2Impl; import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.LineLocationImpl; +import net.sourceforge.plantuml.Log; public class ReadLineReader implements ReadLine { + private static final int LIMIT = 700; private final BufferedReader br; private LineLocationImpl location; @@ -62,6 +64,10 @@ public class ReadLineReader implements ReadLine { if (s == null) { return null; } + if (s.length() > LIMIT) { + Log.debug("Line truncated from " + s.length() + " to " + LIMIT); + s = s.substring(0, LIMIT); + } if (s.startsWith("\uFEFF")) { s = s.substring(1); } diff --git a/src/net/sourceforge/plantuml/preproc/UncommentReadLine.java b/src/net/sourceforge/plantuml/preproc/UncommentReadLine.java index a2169d543..c7ea60597 100644 --- a/src/net/sourceforge/plantuml/preproc/UncommentReadLine.java +++ b/src/net/sourceforge/plantuml/preproc/UncommentReadLine.java @@ -34,19 +34,19 @@ package net.sourceforge.plantuml.preproc; import java.io.IOException; -import java.util.regex.Matcher; -import java.util.regex.Pattern; import net.sourceforge.plantuml.CharSequence2; import net.sourceforge.plantuml.CharSequence2Impl; +import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; +import net.sourceforge.plantuml.command.regex.Pattern2; import net.sourceforge.plantuml.utils.StartUtils; public class UncommentReadLine implements ReadLine { private final ReadLine raw; - private final Pattern start; - private final Pattern unpause; + private final Pattern2 start; + private final Pattern2 unpause; private String headerToRemove; private boolean paused; @@ -63,12 +63,16 @@ public class UncommentReadLine implements ReadLine { return null; } - final Matcher m = start.matcher(result); - if (m.find()) { - headerToRemove = m.group(1); + // final Matcher m = start.matcher(result); + // if (m.find()) { + // headerToRemove = m.group(1); + // } + final String tmp = StartUtils.beforeStartUml(result); + if (tmp != null) { + headerToRemove = tmp; } if (paused) { - final Matcher m2 = unpause.matcher(result); + final Matcher2 m2 = unpause.matcher(result); if (m2.find()) { headerToRemove = m2.group(1); } diff --git a/src/net/sourceforge/plantuml/printskin/PrintSkin.java b/src/net/sourceforge/plantuml/printskin/PrintSkin.java index 2a7ac9c64..1ebe91474 100644 --- a/src/net/sourceforge/plantuml/printskin/PrintSkin.java +++ b/src/net/sourceforge/plantuml/printskin/PrintSkin.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 19109 $ + * Revision $Revision: 19885 $ * */ package net.sourceforge.plantuml.printskin; @@ -56,7 +56,6 @@ import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.TextBlock; -import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.png.PngIO; import net.sourceforge.plantuml.skin.Area; import net.sourceforge.plantuml.skin.ArrowConfiguration; diff --git a/src/net/sourceforge/plantuml/printskin/PrintSkinFactory.java b/src/net/sourceforge/plantuml/printskin/PrintSkinFactory.java index 33ca3d18e..fcfc5f029 100644 --- a/src/net/sourceforge/plantuml/printskin/PrintSkinFactory.java +++ b/src/net/sourceforge/plantuml/printskin/PrintSkinFactory.java @@ -34,20 +34,20 @@ package net.sourceforge.plantuml.printskin; import java.util.Arrays; -import java.util.regex.Matcher; -import java.util.regex.Pattern; import net.sourceforge.plantuml.AbstractPSystem; import net.sourceforge.plantuml.command.PSystemSingleLineFactory; +import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; +import net.sourceforge.plantuml.command.regex.Pattern2; public class PrintSkinFactory extends PSystemSingleLineFactory { - static final Pattern p = MyPattern.cmpile("(?i)^testskin[%s]+([\\w.]+)[%s]*(.*)$"); + static final Pattern2 p = MyPattern.cmpile("(?i)^testskin[%s]+([\\w.]+)[%s]*(.*)$"); @Override protected AbstractPSystem executeLine(String line) { - final Matcher m = p.matcher(line); + final Matcher2 m = p.matcher(line); if (m.find() == false) { return null; } diff --git a/src/net/sourceforge/plantuml/project/PSystemProject.java b/src/net/sourceforge/plantuml/project/PSystemProject.java index ebc1d8511..895ea87ac 100644 --- a/src/net/sourceforge/plantuml/project/PSystemProject.java +++ b/src/net/sourceforge/plantuml/project/PSystemProject.java @@ -43,6 +43,7 @@ import net.sourceforge.plantuml.AbstractPSystem; import net.sourceforge.plantuml.EmptyImageBuilder; import net.sourceforge.plantuml.FileFormat; import net.sourceforge.plantuml.FileFormatOption; +import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.api.ImageDataSimple; import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.DiagramDescriptionImpl; @@ -55,7 +56,6 @@ import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.eps.UGraphicEps; import net.sourceforge.plantuml.ugraphic.g2d.UGraphicG2d; import net.sourceforge.plantuml.ugraphic.svg.UGraphicSvg; -import net.sourceforge.plantuml.StringUtils; public class PSystemProject extends AbstractPSystem { diff --git a/src/net/sourceforge/plantuml/project2/PSystemProject2.java b/src/net/sourceforge/plantuml/project2/PSystemProject2.java index 1c1debd71..74466be4e 100644 --- a/src/net/sourceforge/plantuml/project2/PSystemProject2.java +++ b/src/net/sourceforge/plantuml/project2/PSystemProject2.java @@ -43,6 +43,7 @@ import net.sourceforge.plantuml.AbstractPSystem; import net.sourceforge.plantuml.EmptyImageBuilder; import net.sourceforge.plantuml.FileFormat; import net.sourceforge.plantuml.FileFormatOption; +import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.api.ImageDataSimple; import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.DiagramDescriptionImpl; @@ -54,7 +55,6 @@ import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.eps.UGraphicEps; import net.sourceforge.plantuml.ugraphic.g2d.UGraphicG2d; import net.sourceforge.plantuml.ugraphic.svg.UGraphicSvg; -import net.sourceforge.plantuml.StringUtils; public class PSystemProject2 extends AbstractPSystem { diff --git a/src/net/sourceforge/plantuml/salt/DataSourceImpl.java b/src/net/sourceforge/plantuml/salt/DataSourceImpl.java index a57c8204b..9ef6c439b 100644 --- a/src/net/sourceforge/plantuml/salt/DataSourceImpl.java +++ b/src/net/sourceforge/plantuml/salt/DataSourceImpl.java @@ -36,11 +36,11 @@ package net.sourceforge.plantuml.salt; import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer; -import java.util.regex.Matcher; -import java.util.regex.Pattern; import net.sourceforge.plantuml.StringUtils; +import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; +import net.sourceforge.plantuml.command.regex.Pattern2; public class DataSourceImpl implements DataSource { @@ -48,7 +48,7 @@ public class DataSourceImpl implements DataSource { private final List> data = new ArrayList>(); public DataSourceImpl(List data) { - final Pattern p = MyPattern.cmpile("\\{[-+#!*/]?"); + final Pattern2 p = MyPattern.cmpile("\\{[-+#!*/]?"); for (String s : data) { final StringTokenizer st = new StringTokenizer(s, "|}", true); while (st.hasMoreTokens()) { @@ -57,7 +57,7 @@ public class DataSourceImpl implements DataSource { continue; } final Terminator terminator = st.hasMoreTokens() ? Terminator.NEWCOL : Terminator.NEWLINE; - final Matcher m = p.matcher(token); + final Matcher2 m = p.matcher(token); final boolean found = m.find(); if (found == false) { addInternal(token, terminator); diff --git a/src/net/sourceforge/plantuml/salt/element/ElementDroplist.java b/src/net/sourceforge/plantuml/salt/element/ElementDroplist.java index e22d40067..897d9ca98 100644 --- a/src/net/sourceforge/plantuml/salt/element/ElementDroplist.java +++ b/src/net/sourceforge/plantuml/salt/element/ElementDroplist.java @@ -45,7 +45,6 @@ import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HtmlColorSet; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; -import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; diff --git a/src/net/sourceforge/plantuml/sequencediagram/Englober.java b/src/net/sourceforge/plantuml/sequencediagram/Englober.java index d87bc28c8..965b304c9 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/Englober.java +++ b/src/net/sourceforge/plantuml/sequencediagram/Englober.java @@ -43,7 +43,6 @@ import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.real.Real; import net.sourceforge.plantuml.real.RealUtils; -import net.sourceforge.plantuml.sequencediagram.teoz.Bordered; import net.sourceforge.plantuml.sequencediagram.teoz.LivingSpace; import net.sourceforge.plantuml.sequencediagram.teoz.TileArguments; import net.sourceforge.plantuml.skin.Area; diff --git a/src/net/sourceforge/plantuml/sequencediagram/SequenceDiagram.java b/src/net/sourceforge/plantuml/sequencediagram/SequenceDiagram.java index 5454d9899..fb03f39f8 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/SequenceDiagram.java +++ b/src/net/sourceforge/plantuml/sequencediagram/SequenceDiagram.java @@ -502,5 +502,15 @@ public class SequenceDiagram extends UmlDiagram { } return dpiFactor; } + + + @Override + public String checkFinalError() { + if (this.isHideUnlinkedData()) { + this.removeHiddenParticipants(); + } + return super.checkFinalError(); + } + } diff --git a/src/net/sourceforge/plantuml/sequencediagram/SequenceDiagramFactory.java b/src/net/sourceforge/plantuml/sequencediagram/SequenceDiagramFactory.java index 1acdebc2e..e027ca507 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/SequenceDiagramFactory.java +++ b/src/net/sourceforge/plantuml/sequencediagram/SequenceDiagramFactory.java @@ -36,7 +36,6 @@ package net.sourceforge.plantuml.sequencediagram; import java.util.ArrayList; import java.util.List; -import net.sourceforge.plantuml.AbstractPSystem; import net.sourceforge.plantuml.command.Command; import net.sourceforge.plantuml.command.UmlDiagramFactory; import net.sourceforge.plantuml.command.note.sequence.FactorySequenceNoteCommand; @@ -137,13 +136,4 @@ public class SequenceDiagramFactory extends UmlDiagramFactory { return cmds; } - @Override - public String checkFinalError(AbstractPSystem sys) { - final SequenceDiagram system = (SequenceDiagram) sys; - if (system.isHideUnlinkedData()) { - system.removeHiddenParticipants(); - } - return super.checkFinalError(system); - } - } diff --git a/src/net/sourceforge/plantuml/sequencediagram/command/CommandArrow.java b/src/net/sourceforge/plantuml/sequencediagram/command/CommandArrow.java index fb70bfe9e..e9558e1dc 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/command/CommandArrow.java +++ b/src/net/sourceforge/plantuml/sequencediagram/command/CommandArrow.java @@ -51,6 +51,7 @@ import net.sourceforge.plantuml.sequencediagram.LifeEventType; import net.sourceforge.plantuml.sequencediagram.Message; import net.sourceforge.plantuml.sequencediagram.Participant; import net.sourceforge.plantuml.sequencediagram.SequenceDiagram; +import net.sourceforge.plantuml.skin.ArrowBody; import net.sourceforge.plantuml.skin.ArrowConfiguration; import net.sourceforge.plantuml.skin.ArrowDecoration; import net.sourceforge.plantuml.skin.ArrowHead; @@ -175,7 +176,7 @@ public class CommandArrow extends SingleLineCommand2 { ArrowConfiguration config = hasDressing1 && hasDressing2 ? ArrowConfiguration.withDirectionBoth() : ArrowConfiguration.withDirectionNormal(); if (dotted) { - config = config.withDotted(); + config = config.withBody(ArrowBody.DOTTED); } if (sync) { config = config.withHead(ArrowHead.ASYNC); @@ -268,12 +269,15 @@ public class CommandArrow extends SingleLineCommand2 { while (st.hasMoreTokens()) { final String s = st.nextToken(); if (s.equalsIgnoreCase("dashed")) { + config = config.withBody(ArrowBody.DOTTED); // link.goDashed(); } else if (s.equalsIgnoreCase("bold")) { // link.goBold(); } else if (s.equalsIgnoreCase("dotted")) { + config = config.withBody(ArrowBody.DOTTED); // link.goDotted(); } else if (s.equalsIgnoreCase("hidden")) { + config = config.withBody(ArrowBody.HIDDEN); // link.goHidden(); } else { config = config.withColor(HtmlColorSet.getInstance().getColorIfValid(s)); diff --git a/src/net/sourceforge/plantuml/sequencediagram/command/CommandExoArrowAny.java b/src/net/sourceforge/plantuml/sequencediagram/command/CommandExoArrowAny.java index 1aa2eb3b4..45d82c51e 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/command/CommandExoArrowAny.java +++ b/src/net/sourceforge/plantuml/sequencediagram/command/CommandExoArrowAny.java @@ -45,6 +45,7 @@ import net.sourceforge.plantuml.sequencediagram.MessageExo; import net.sourceforge.plantuml.sequencediagram.MessageExoType; import net.sourceforge.plantuml.sequencediagram.Participant; import net.sourceforge.plantuml.sequencediagram.SequenceDiagram; +import net.sourceforge.plantuml.skin.ArrowBody; import net.sourceforge.plantuml.skin.ArrowConfiguration; import net.sourceforge.plantuml.skin.ArrowDecoration; import net.sourceforge.plantuml.skin.ArrowHead; @@ -78,7 +79,7 @@ abstract class CommandExoArrowAny extends SingleLineCommand2 { ArrowConfiguration config = bothDirection ? ArrowConfiguration.withDirectionBoth() : ArrowConfiguration .withDirectionNormal(); if (dotted) { - config = config.withDotted(); + config = config.withBody(ArrowBody.DOTTED); } if (sync) { config = config.withHead(ArrowHead.ASYNC); diff --git a/src/net/sourceforge/plantuml/sequencediagram/command/CommandGrouping.java b/src/net/sourceforge/plantuml/sequencediagram/command/CommandGrouping.java index e095880aa..7807a6377 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/command/CommandGrouping.java +++ b/src/net/sourceforge/plantuml/sequencediagram/command/CommandGrouping.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 19109 $ + * Revision $Revision: 19885 $ * */ package net.sourceforge.plantuml.sequencediagram.command; @@ -36,6 +36,7 @@ package net.sourceforge.plantuml.sequencediagram.command; import java.util.regex.Matcher; import java.util.regex.Pattern; +import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.regex.RegexConcat; @@ -44,7 +45,6 @@ import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.sequencediagram.GroupingType; import net.sourceforge.plantuml.sequencediagram.SequenceDiagram; -import net.sourceforge.plantuml.StringUtils; public class CommandGrouping extends SingleLineCommand2 { diff --git a/src/net/sourceforge/plantuml/sequencediagram/command/CommandHSpace.java b/src/net/sourceforge/plantuml/sequencediagram/command/CommandHSpace.java index 474c36b01..7517b2a2c 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/command/CommandHSpace.java +++ b/src/net/sourceforge/plantuml/sequencediagram/command/CommandHSpace.java @@ -35,10 +35,10 @@ package net.sourceforge.plantuml.sequencediagram.command; import java.util.List; +import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.SingleLineCommand; import net.sourceforge.plantuml.sequencediagram.SequenceDiagram; -import net.sourceforge.plantuml.StringUtils; public class CommandHSpace extends SingleLineCommand { diff --git a/src/net/sourceforge/plantuml/sequencediagram/command/CommandReferenceOverSeveral.java b/src/net/sourceforge/plantuml/sequencediagram/command/CommandReferenceOverSeveral.java index 0ce3d05e4..d686ecb60 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/command/CommandReferenceOverSeveral.java +++ b/src/net/sourceforge/plantuml/sequencediagram/command/CommandReferenceOverSeveral.java @@ -36,6 +36,7 @@ package net.sourceforge.plantuml.sequencediagram.command; import java.util.ArrayList; import java.util.List; +import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.SingleLineCommand2; @@ -47,7 +48,6 @@ import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.sequencediagram.Participant; import net.sourceforge.plantuml.sequencediagram.Reference; import net.sourceforge.plantuml.sequencediagram.SequenceDiagram; -import net.sourceforge.plantuml.StringUtils; public class CommandReferenceOverSeveral extends SingleLineCommand2 { diff --git a/src/net/sourceforge/plantuml/sequencediagram/command/CommandReturn.java b/src/net/sourceforge/plantuml/sequencediagram/command/CommandReturn.java index 312c469de..bd5db929c 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/command/CommandReturn.java +++ b/src/net/sourceforge/plantuml/sequencediagram/command/CommandReturn.java @@ -38,11 +38,11 @@ import java.util.List; import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.SingleLineCommand; import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.sequencediagram.AbstractMessage; import net.sourceforge.plantuml.sequencediagram.EventWithDeactivate; import net.sourceforge.plantuml.sequencediagram.LifeEventType; import net.sourceforge.plantuml.sequencediagram.Message; import net.sourceforge.plantuml.sequencediagram.SequenceDiagram; +import net.sourceforge.plantuml.skin.ArrowBody; import net.sourceforge.plantuml.skin.ArrowConfiguration; public class CommandReturn extends SingleLineCommand { @@ -65,7 +65,7 @@ public class CommandReturn extends SingleLineCommand { doDeactivation = false; } - final ArrowConfiguration arrow = message.getArrowConfiguration().withDotted(); + final ArrowConfiguration arrow = message.getArrowConfiguration().withBody(ArrowBody.DOTTED); sequenceDiagram.addMessage( new Message(message.getParticipant2(), message.getParticipant1(), Display.getWithNewlines(arg diff --git a/src/net/sourceforge/plantuml/sequencediagram/graphic/DrawableSet.java b/src/net/sourceforge/plantuml/sequencediagram/graphic/DrawableSet.java index 143b4dcc6..f061a91cc 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/graphic/DrawableSet.java +++ b/src/net/sourceforge/plantuml/sequencediagram/graphic/DrawableSet.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 19109 $ + * Revision $Revision: 19885 $ * */ package net.sourceforge.plantuml.sequencediagram.graphic; @@ -48,11 +48,11 @@ import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.SkinParamBackcolored; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.sequencediagram.Englober; import net.sourceforge.plantuml.sequencediagram.Event; import net.sourceforge.plantuml.sequencediagram.Newpage; import net.sourceforge.plantuml.sequencediagram.Participant; import net.sourceforge.plantuml.sequencediagram.ParticipantEnglober; -import net.sourceforge.plantuml.sequencediagram.Englober; import net.sourceforge.plantuml.skin.Area; import net.sourceforge.plantuml.skin.Component; import net.sourceforge.plantuml.skin.ComponentType; diff --git a/src/net/sourceforge/plantuml/sequencediagram/graphic/DrawableSetInitializer.java b/src/net/sourceforge/plantuml/sequencediagram/graphic/DrawableSetInitializer.java index ddcdf8f0b..8810516c6 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/graphic/DrawableSetInitializer.java +++ b/src/net/sourceforge/plantuml/sequencediagram/graphic/DrawableSetInitializer.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 19528 $ + * Revision $Revision: 19885 $ * */ package net.sourceforge.plantuml.sequencediagram.graphic; @@ -43,10 +43,10 @@ import net.sourceforge.plantuml.SkinParamBackcolored; import net.sourceforge.plantuml.SkinParamBackcoloredReference; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.StringBounder; -import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.sequencediagram.AbstractMessage; import net.sourceforge.plantuml.sequencediagram.Delay; import net.sourceforge.plantuml.sequencediagram.Divider; +import net.sourceforge.plantuml.sequencediagram.Englober; import net.sourceforge.plantuml.sequencediagram.Event; import net.sourceforge.plantuml.sequencediagram.GroupingLeaf; import net.sourceforge.plantuml.sequencediagram.GroupingStart; @@ -59,11 +59,9 @@ import net.sourceforge.plantuml.sequencediagram.Message; import net.sourceforge.plantuml.sequencediagram.MessageExo; import net.sourceforge.plantuml.sequencediagram.Newpage; import net.sourceforge.plantuml.sequencediagram.Note; -import net.sourceforge.plantuml.sequencediagram.NoteStyle; import net.sourceforge.plantuml.sequencediagram.Notes; import net.sourceforge.plantuml.sequencediagram.Participant; import net.sourceforge.plantuml.sequencediagram.ParticipantEnglober; -import net.sourceforge.plantuml.sequencediagram.Englober; import net.sourceforge.plantuml.sequencediagram.ParticipantType; import net.sourceforge.plantuml.sequencediagram.Reference; import net.sourceforge.plantuml.skin.Component; diff --git a/src/net/sourceforge/plantuml/sequencediagram/graphic/SequenceDiagramTxtMaker.java b/src/net/sourceforge/plantuml/sequencediagram/graphic/SequenceDiagramTxtMaker.java index f2f8316bd..aa1e7460e 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/graphic/SequenceDiagramTxtMaker.java +++ b/src/net/sourceforge/plantuml/sequencediagram/graphic/SequenceDiagramTxtMaker.java @@ -45,9 +45,6 @@ import net.sourceforge.plantuml.asciiart.TextStringBounder; import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.sequencediagram.Event; -import net.sourceforge.plantuml.sequencediagram.LifeEvent; -import net.sourceforge.plantuml.sequencediagram.LifeEventType; -import net.sourceforge.plantuml.sequencediagram.Message; import net.sourceforge.plantuml.sequencediagram.Participant; import net.sourceforge.plantuml.sequencediagram.SequenceDiagram; import net.sourceforge.plantuml.skin.Skin; diff --git a/src/net/sourceforge/plantuml/sequencediagram/graphic/Step1Abstract.java b/src/net/sourceforge/plantuml/sequencediagram/graphic/Step1Abstract.java index 3681b0df9..060a31210 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/graphic/Step1Abstract.java +++ b/src/net/sourceforge/plantuml/sequencediagram/graphic/Step1Abstract.java @@ -33,16 +33,10 @@ */ package net.sourceforge.plantuml.sequencediagram.graphic; -import net.sourceforge.plantuml.OptionFlags; import net.sourceforge.plantuml.Url; -import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.sequencediagram.AbstractMessage; -import net.sourceforge.plantuml.sequencediagram.LifeEvent; -import net.sourceforge.plantuml.sequencediagram.LifeEventType; -import net.sourceforge.plantuml.sequencediagram.MessageNumber; import net.sourceforge.plantuml.sequencediagram.NotePosition; -import net.sourceforge.plantuml.sequencediagram.Participant; import net.sourceforge.plantuml.skin.ArrowConfiguration; import net.sourceforge.plantuml.skin.Component; diff --git a/src/net/sourceforge/plantuml/sequencediagram/graphic/Step1Message.java b/src/net/sourceforge/plantuml/sequencediagram/graphic/Step1Message.java index 43cd46620..d46bd39d0 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/graphic/Step1Message.java +++ b/src/net/sourceforge/plantuml/sequencediagram/graphic/Step1Message.java @@ -28,19 +28,19 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 19528 $ + * Revision $Revision: 19885 $ * */ package net.sourceforge.plantuml.sequencediagram.graphic; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.OptionFlags; -import net.sourceforge.plantuml.SkinParamBackcolored; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.sequencediagram.InGroupable; import net.sourceforge.plantuml.sequencediagram.Message; import net.sourceforge.plantuml.sequencediagram.NotePosition; +import net.sourceforge.plantuml.skin.ArrowBody; import net.sourceforge.plantuml.skin.ArrowConfiguration; import net.sourceforge.plantuml.skin.ArrowHead; import net.sourceforge.plantuml.skin.Component; @@ -223,7 +223,10 @@ class Step1Message extends Step1Abstract { // return m.getArrowConfiguration().self(); ArrowConfiguration result = ArrowConfiguration.withDirectionSelf(); if (m.getArrowConfiguration().isDotted()) { - result = result.withDotted(); + result = result.withBody(ArrowBody.DOTTED); + } + if (m.getArrowConfiguration().isHidden()) { + result = result.withBody(ArrowBody.HIDDEN); } if (m.getArrowConfiguration().isAsync()) { result = result.withHead(ArrowHead.ASYNC); diff --git a/src/net/sourceforge/plantuml/sequencediagram/graphic/Step1MessageExo.java b/src/net/sourceforge/plantuml/sequencediagram/graphic/Step1MessageExo.java index 4c4af0c26..6a036557c 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/graphic/Step1MessageExo.java +++ b/src/net/sourceforge/plantuml/sequencediagram/graphic/Step1MessageExo.java @@ -34,13 +34,10 @@ package net.sourceforge.plantuml.sequencediagram.graphic; import net.sourceforge.plantuml.ISkinParam; -import net.sourceforge.plantuml.SkinParamBackcolored; -import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.sequencediagram.InGroupable; import net.sourceforge.plantuml.sequencediagram.MessageExo; import net.sourceforge.plantuml.sequencediagram.MessageExoType; -import net.sourceforge.plantuml.sequencediagram.MessageNumber; import net.sourceforge.plantuml.skin.ArrowConfiguration; import net.sourceforge.plantuml.skin.ComponentType; diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileSelf.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileSelf.java index 431a00ea9..c579dc541 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileSelf.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileSelf.java @@ -48,7 +48,6 @@ import net.sourceforge.plantuml.skin.ArrowConfiguration; import net.sourceforge.plantuml.skin.Component; import net.sourceforge.plantuml.skin.ComponentType; import net.sourceforge.plantuml.skin.Context2D; -import net.sourceforge.plantuml.skin.SimpleContext2D; import net.sourceforge.plantuml.skin.Skin; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileSelfNoteRight.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileSelfNoteRight.java index db7920aea..d1df73e86 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileSelfNoteRight.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileSelfNoteRight.java @@ -45,7 +45,6 @@ import net.sourceforge.plantuml.skin.Area; import net.sourceforge.plantuml.skin.Component; import net.sourceforge.plantuml.skin.ComponentType; import net.sourceforge.plantuml.skin.Context2D; -import net.sourceforge.plantuml.skin.SimpleContext2D; import net.sourceforge.plantuml.skin.Skin; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; diff --git a/src/net/sourceforge/plantuml/skin/AbstractTextualComponent.java b/src/net/sourceforge/plantuml/skin/AbstractTextualComponent.java index 951989337..b6c702f9c 100644 --- a/src/net/sourceforge/plantuml/skin/AbstractTextualComponent.java +++ b/src/net/sourceforge/plantuml/skin/AbstractTextualComponent.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 19109 $ + * Revision $Revision: 19885 $ * */ package net.sourceforge.plantuml.skin; @@ -46,7 +46,6 @@ import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockEmpty; -import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.ugraphic.UFont; public abstract class AbstractTextualComponent extends AbstractComponent { diff --git a/src/net/sourceforge/plantuml/skin/ArrowBody.java b/src/net/sourceforge/plantuml/skin/ArrowBody.java index c35d40e05..3944ea79a 100644 --- a/src/net/sourceforge/plantuml/skin/ArrowBody.java +++ b/src/net/sourceforge/plantuml/skin/ArrowBody.java @@ -34,5 +34,5 @@ package net.sourceforge.plantuml.skin; public enum ArrowBody { - NORMAL, DOTTED; + NORMAL, DOTTED, DASHED, HIDDEN, BOLD; } diff --git a/src/net/sourceforge/plantuml/skin/ArrowConfiguration.java b/src/net/sourceforge/plantuml/skin/ArrowConfiguration.java index 1b9f1ada8..e3c06fe05 100644 --- a/src/net/sourceforge/plantuml/skin/ArrowConfiguration.java +++ b/src/net/sourceforge/plantuml/skin/ArrowConfiguration.java @@ -102,8 +102,8 @@ public class ArrowConfiguration { return new ArrowConfiguration(body, dressing1, dressing2, decoration1, decoration2, color, true); } - public ArrowConfiguration withDotted() { - return new ArrowConfiguration(ArrowBody.DOTTED, dressing1, dressing2, decoration1, decoration2, color, isSelf); + public ArrowConfiguration withBody(ArrowBody type) { + return new ArrowConfiguration(type, dressing1, dressing2, decoration1, decoration2, color, isSelf); } public ArrowConfiguration withHead(ArrowHead head) { @@ -179,6 +179,10 @@ public class ArrowConfiguration { return body == ArrowBody.DOTTED; } + public boolean isHidden() { + return body == ArrowBody.HIDDEN; + } + public ArrowHead getHead() { if (dressing2 != null && dressing2.getHead() != ArrowHead.NONE) { return dressing2.getHead(); diff --git a/src/net/sourceforge/plantuml/skin/GrayComponent.java b/src/net/sourceforge/plantuml/skin/GrayComponent.java index 94ba26cac..589761b18 100644 --- a/src/net/sourceforge/plantuml/skin/GrayComponent.java +++ b/src/net/sourceforge/plantuml/skin/GrayComponent.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 19109 $ + * Revision $Revision: 19885 $ * */ package net.sourceforge.plantuml.skin; @@ -44,7 +44,6 @@ import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; -import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UFont; diff --git a/src/net/sourceforge/plantuml/skin/bluemodern/ComponentBlueModernArrow.java b/src/net/sourceforge/plantuml/skin/bluemodern/ComponentBlueModernArrow.java index 9efac2204..b56b8600a 100644 --- a/src/net/sourceforge/plantuml/skin/bluemodern/ComponentBlueModernArrow.java +++ b/src/net/sourceforge/plantuml/skin/bluemodern/ComponentBlueModernArrow.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 19109 $ + * Revision $Revision: 19873 $ * */ package net.sourceforge.plantuml.skin.bluemodern; @@ -63,6 +63,9 @@ public class ComponentBlueModernArrow extends AbstractComponentBlueModernArrow { @Override protected void drawInternalU(UGraphic ug, Area area) { + if (getArrowConfiguration().isHidden()) { + return; + } final Dimension2D dimensionToUse = area.getDimensionToUse(); final StringBounder stringBounder = ug.getStringBounder(); final int textHeight = (int) getTextHeight(stringBounder); diff --git a/src/net/sourceforge/plantuml/skin/bluemodern/ComponentBlueModernGroupingHeader.java b/src/net/sourceforge/plantuml/skin/bluemodern/ComponentBlueModernGroupingHeader.java index c083051fd..b35b3df35 100644 --- a/src/net/sourceforge/plantuml/skin/bluemodern/ComponentBlueModernGroupingHeader.java +++ b/src/net/sourceforge/plantuml/skin/bluemodern/ComponentBlueModernGroupingHeader.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 19109 $ + * Revision $Revision: 19885 $ * */ package net.sourceforge.plantuml.skin.bluemodern; @@ -42,7 +42,6 @@ import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; -import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.skin.AbstractTextualComponent; import net.sourceforge.plantuml.skin.Area; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; diff --git a/src/net/sourceforge/plantuml/skin/bluemodern/ComponentBlueModernSelfArrow.java b/src/net/sourceforge/plantuml/skin/bluemodern/ComponentBlueModernSelfArrow.java index e654fea8c..0bc290e21 100644 --- a/src/net/sourceforge/plantuml/skin/bluemodern/ComponentBlueModernSelfArrow.java +++ b/src/net/sourceforge/plantuml/skin/bluemodern/ComponentBlueModernSelfArrow.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 19109 $ + * Revision $Revision: 19873 $ * */ package net.sourceforge.plantuml.skin.bluemodern; @@ -62,6 +62,9 @@ public class ComponentBlueModernSelfArrow extends AbstractComponentBlueModernArr @Override protected void drawInternalU(UGraphic ug, Area area) { + if (getArrowConfiguration().isHidden()) { + return; + } final StringBounder stringBounder = ug.getStringBounder(); final int textHeight = (int) getTextHeight(stringBounder); diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseArrow.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseArrow.java index a3aab537b..a97cd7631 100644 --- a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseArrow.java +++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseArrow.java @@ -76,6 +76,9 @@ public class ComponentRoseArrow extends AbstractComponentRoseArrow { @Override public void drawInternalU(UGraphic ug, Area area) { + if (getArrowConfiguration().isHidden()) { + return; + } final Dimension2D dimensionToUse = area.getDimensionToUse(); final StringBounder stringBounder = ug.getStringBounder(); final int textHeight = (int) getTextHeight(stringBounder); diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseReference.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseReference.java index 89fb2d796..ff90a6ca7 100644 --- a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseReference.java +++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseReference.java @@ -43,7 +43,6 @@ import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.graphic.TextBlock; -import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.skin.AbstractTextualComponent; import net.sourceforge.plantuml.skin.Area; import net.sourceforge.plantuml.ugraphic.UGraphic; diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseSelfArrow.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseSelfArrow.java index bb2d60b1a..c14968a35 100644 --- a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseSelfArrow.java +++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseSelfArrow.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 19109 $ + * Revision $Revision: 19873 $ * */ package net.sourceforge.plantuml.skin.rose; @@ -71,6 +71,9 @@ public class ComponentRoseSelfArrow extends AbstractComponentRoseArrow { @Override protected void drawInternalU(UGraphic ug, Area area) { + if (getArrowConfiguration().isHidden()) { + return; + } final StringBounder stringBounder = ug.getStringBounder(); final double textHeight = getTextHeight(stringBounder); diff --git a/src/net/sourceforge/plantuml/statediagram/StateDiagram.java b/src/net/sourceforge/plantuml/statediagram/StateDiagram.java index 8a53758a9..5e54af309 100644 --- a/src/net/sourceforge/plantuml/statediagram/StateDiagram.java +++ b/src/net/sourceforge/plantuml/statediagram/StateDiagram.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 19361 $ + * Revision $Revision: 19886 $ * */ package net.sourceforge.plantuml.statediagram; @@ -42,6 +42,7 @@ import net.sourceforge.plantuml.cucadiagram.GroupType; import net.sourceforge.plantuml.cucadiagram.IEntity; import net.sourceforge.plantuml.cucadiagram.IGroup; import net.sourceforge.plantuml.cucadiagram.LeafType; +import net.sourceforge.plantuml.cucadiagram.Link; import net.sourceforge.plantuml.graphic.USymbol; import net.sourceforge.plantuml.utils.UniqueSequence; @@ -164,6 +165,45 @@ public class StateDiagram extends AbstractEntityDiagram { public final boolean isHideEmptyDescriptionForState() { return hideEmptyDescription; } + + @Override + public String checkFinalError() { + for (Link link : this.getLinks()) { + final IGroup parent1 = getGroupParentIfItIsConcurrentState(link.getEntity1()); + final IGroup parent2 = getGroupParentIfItIsConcurrentState(link.getEntity2()); + if (isCompatible(parent1, parent2) == false) { + return "State within concurrent state cannot be linked out of this concurrent state (between " + + link.getEntity1().getCode().getFullName() + " and " + + link.getEntity2().getCode().getFullName() + ")"; + } + } + return super.checkFinalError(); + } + + private static boolean isCompatible(IGroup parent1, IGroup parent2) { + if (parent1 == null && parent2 == null) { + return true; + } + if (parent1 != null ^ parent2 != null) { + return false; + } + assert parent1 != null && parent2 != null; + return parent1 == parent2; + } + + private static IGroup getGroupParentIfItIsConcurrentState(IEntity ent) { + IGroup parent = ent.getParentContainer(); + while (parent != null) { + if (parent.getGroupType() == GroupType.CONCURRENT_STATE) { + return parent; + } + parent = parent.getParentContainer(); + } + return null; + + } + + } diff --git a/src/net/sourceforge/plantuml/statediagram/StateDiagramFactory.java b/src/net/sourceforge/plantuml/statediagram/StateDiagramFactory.java index c2a882e78..69723b618 100644 --- a/src/net/sourceforge/plantuml/statediagram/StateDiagramFactory.java +++ b/src/net/sourceforge/plantuml/statediagram/StateDiagramFactory.java @@ -36,7 +36,6 @@ package net.sourceforge.plantuml.statediagram; import java.util.ArrayList; import java.util.List; -import net.sourceforge.plantuml.AbstractPSystem; import net.sourceforge.plantuml.classdiagram.command.CommandUrl; import net.sourceforge.plantuml.command.Command; import net.sourceforge.plantuml.command.CommandFootboxIgnored; @@ -47,10 +46,6 @@ import net.sourceforge.plantuml.command.note.FactoryNoteOnEntityCommand; import net.sourceforge.plantuml.command.note.FactoryNoteOnLinkCommand; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexOr; -import net.sourceforge.plantuml.cucadiagram.GroupType; -import net.sourceforge.plantuml.cucadiagram.IEntity; -import net.sourceforge.plantuml.cucadiagram.IGroup; -import net.sourceforge.plantuml.cucadiagram.Link; import net.sourceforge.plantuml.statediagram.command.CommandAddField; import net.sourceforge.plantuml.statediagram.command.CommandConcurrentState; import net.sourceforge.plantuml.statediagram.command.CommandCreatePackageState; @@ -103,43 +98,4 @@ public class StateDiagramFactory extends UmlDiagramFactory { return cmds; } - @Override - public String checkFinalError(AbstractPSystem sys) { - final StateDiagram system = (StateDiagram) sys; - - for (Link link : system.getLinks()) { - final IGroup parent1 = getGroupParentIfItIsConcurrentState(link.getEntity1()); - final IGroup parent2 = getGroupParentIfItIsConcurrentState(link.getEntity2()); - if (isCompatible(parent1, parent2) == false) { - return "State within concurrent state cannot be linked out of this concurrent state (between " - + link.getEntity1().getCode().getFullName() + " and " - + link.getEntity2().getCode().getFullName() + ")"; - } - } - return super.checkFinalError(system); - } - - private boolean isCompatible(IGroup parent1, IGroup parent2) { - if (parent1 == null && parent2 == null) { - return true; - } - if (parent1 != null ^ parent2 != null) { - return false; - } - assert parent1 != null && parent2 != null; - return parent1 == parent2; - } - - private IGroup getGroupParentIfItIsConcurrentState(IEntity ent) { - IGroup parent = ent.getParentContainer(); - while (parent != null) { - if (parent.getGroupType() == GroupType.CONCURRENT_STATE) { - return parent; - } - parent = parent.getParentContainer(); - } - return null; - - } - } diff --git a/src/net/sourceforge/plantuml/sudoku/PSystemSudokuFactory.java b/src/net/sourceforge/plantuml/sudoku/PSystemSudokuFactory.java index 018e7cf5a..dc5eb1a27 100644 --- a/src/net/sourceforge/plantuml/sudoku/PSystemSudokuFactory.java +++ b/src/net/sourceforge/plantuml/sudoku/PSystemSudokuFactory.java @@ -33,21 +33,20 @@ */ package net.sourceforge.plantuml.sudoku; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - import net.sourceforge.plantuml.AbstractPSystem; import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.command.PSystemSingleLineFactory; +import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; +import net.sourceforge.plantuml.command.regex.Pattern2; public class PSystemSudokuFactory extends PSystemSingleLineFactory { - final private static Pattern p = MyPattern.cmpile("(?i)^sudoku(?:[%s]+([0-9a-zA-Z]+))?[%s]*$"); + final private static Pattern2 p = MyPattern.cmpile("(?i)^sudoku(?:[%s]+([0-9a-zA-Z]+))?[%s]*$"); @Override protected AbstractPSystem executeLine(String line) { - final Matcher m = p.matcher(line); + final Matcher2 m = p.matcher(line); if (m.find() == false) { return null; } diff --git a/src/net/sourceforge/plantuml/svek/Control.java b/src/net/sourceforge/plantuml/svek/Control.java index 34232de42..7f6e496d4 100644 --- a/src/net/sourceforge/plantuml/svek/Control.java +++ b/src/net/sourceforge/plantuml/svek/Control.java @@ -37,12 +37,10 @@ import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.graphic.AbstractTextBlock; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; -import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UPolygon; diff --git a/src/net/sourceforge/plantuml/svek/CucaDiagramFileMakerSvek2InternalImage.java b/src/net/sourceforge/plantuml/svek/CucaDiagramFileMakerSvek2InternalImage.java index 22fbfdb13..d7a3f1210 100644 --- a/src/net/sourceforge/plantuml/svek/CucaDiagramFileMakerSvek2InternalImage.java +++ b/src/net/sourceforge/plantuml/svek/CucaDiagramFileMakerSvek2InternalImage.java @@ -44,7 +44,6 @@ import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.cucadiagram.ILeaf; import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.skin.rose.Rose; import net.sourceforge.plantuml.ugraphic.UChangeColor; diff --git a/src/net/sourceforge/plantuml/svek/extremity/ExtremityParenthesis2.java b/src/net/sourceforge/plantuml/svek/extremity/ExtremityParenthesis2.java index d57941f93..45297497f 100644 --- a/src/net/sourceforge/plantuml/svek/extremity/ExtremityParenthesis2.java +++ b/src/net/sourceforge/plantuml/svek/extremity/ExtremityParenthesis2.java @@ -35,12 +35,9 @@ package net.sourceforge.plantuml.svek.extremity; import java.awt.geom.Point2D; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.svek.image.EntityImageLollipopInterfaceEye2; -import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UGraphic; -import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UTranslate; class ExtremityParenthesis2 extends Extremity { diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageArcCircle.java b/src/net/sourceforge/plantuml/svek/image/EntityImageArcCircle.java index 35706552e..fe4d6d863 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageArcCircle.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageArcCircle.java @@ -38,7 +38,6 @@ import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ISkinParam; -import net.sourceforge.plantuml.SkinParamUtils; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.ILeaf; import net.sourceforge.plantuml.cucadiagram.Stereotype; @@ -46,7 +45,6 @@ import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; -import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.svek.AbstractEntityImage; import net.sourceforge.plantuml.svek.ShapeType; import net.sourceforge.plantuml.ugraphic.UGraphic; diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageClassHeader2.java b/src/net/sourceforge/plantuml/svek/image/EntityImageClassHeader2.java index 65fa8b8e5..bf8310219 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageClassHeader2.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageClassHeader2.java @@ -39,7 +39,6 @@ import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.SkinParamUtils; -import net.sourceforge.plantuml.creole.CreoleMode; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.EntityPortion; import net.sourceforge.plantuml.cucadiagram.ILeaf; diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageState.java b/src/net/sourceforge/plantuml/svek/image/EntityImageState.java index 716bdbbcb..6273f2356 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageState.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageState.java @@ -51,7 +51,6 @@ import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; -import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.svek.AbstractEntityImage; import net.sourceforge.plantuml.svek.ShapeType; diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageStateBorder.java b/src/net/sourceforge/plantuml/svek/image/EntityImageStateBorder.java index 909ee8d4b..9e7ad6a3c 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageStateBorder.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageStateBorder.java @@ -37,7 +37,6 @@ import java.awt.geom.Dimension2D; import java.awt.geom.Point2D; import net.sourceforge.plantuml.ColorParam; -import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.SkinParamUtils; diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageTips.java b/src/net/sourceforge/plantuml/svek/image/EntityImageTips.java index c55caca69..6cae16d58 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageTips.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageTips.java @@ -129,6 +129,9 @@ public class EntityImageTips extends AbstractEntityImage { for (Map.Entry ent : getEntity().getTips().entrySet()) { final Display display = ent.getValue(); final Rectangle2D memberPosition = shapeOther.getImage().getInnerPosition(ent.getKey(), stringBounder); + if (memberPosition == null) { + return; + } final Opale opale = getOpale(display); final Dimension2D dim = opale.calculateDimension(stringBounder); final Point2D pp1 = new Point2D.Double(0, dim.getHeight() / 2); @@ -138,9 +141,6 @@ public class EntityImageTips extends AbstractEntityImage { } else { x += 4; } - if (memberPosition == null) { - return; - } final double y = positionOther.getY() - positionMe.getY() - height + memberPosition.getCenterY(); final Point2D pp2 = new Point2D.Double(x, y); opale.setOpale(position.reverseDirection(), pp1, pp2); diff --git a/src/net/sourceforge/plantuml/svek/image/Footprint.java b/src/net/sourceforge/plantuml/svek/image/Footprint.java index 545b45b01..3d4878262 100644 --- a/src/net/sourceforge/plantuml/svek/image/Footprint.java +++ b/src/net/sourceforge/plantuml/svek/image/Footprint.java @@ -35,8 +35,6 @@ package net.sourceforge.plantuml.svek.image; import java.awt.geom.Dimension2D; import java.awt.geom.Point2D; -import java.io.IOException; -import java.io.OutputStream; import java.util.ArrayList; import java.util.List; diff --git a/src/net/sourceforge/plantuml/ugraphic/TextLimitFinder.java b/src/net/sourceforge/plantuml/ugraphic/TextLimitFinder.java index 551b18d3d..56a3129ef 100644 --- a/src/net/sourceforge/plantuml/ugraphic/TextLimitFinder.java +++ b/src/net/sourceforge/plantuml/ugraphic/TextLimitFinder.java @@ -34,8 +34,6 @@ package net.sourceforge.plantuml.ugraphic; import java.awt.geom.Dimension2D; -import java.io.IOException; -import java.io.OutputStream; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.graphic.StringBounder; diff --git a/src/net/sourceforge/plantuml/ugraphic/UGraphicUtils.java b/src/net/sourceforge/plantuml/ugraphic/UGraphicUtils.java index d22cbc948..60667b094 100644 --- a/src/net/sourceforge/plantuml/ugraphic/UGraphicUtils.java +++ b/src/net/sourceforge/plantuml/ugraphic/UGraphicUtils.java @@ -42,6 +42,7 @@ import java.io.OutputStream; import net.sourceforge.plantuml.EmptyImageBuilder; import net.sourceforge.plantuml.FileFormat; import net.sourceforge.plantuml.FileFormatOption; +import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.eps.EpsStrategy; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.TextBlock; @@ -50,7 +51,6 @@ import net.sourceforge.plantuml.png.PngIO; import net.sourceforge.plantuml.ugraphic.eps.UGraphicEps; import net.sourceforge.plantuml.ugraphic.g2d.UGraphicG2d; import net.sourceforge.plantuml.ugraphic.svg.UGraphicSvg; -import net.sourceforge.plantuml.StringUtils; public abstract class UGraphicUtils { diff --git a/src/net/sourceforge/plantuml/ugraphic/USegmentType.java b/src/net/sourceforge/plantuml/ugraphic/USegmentType.java index af048a723..2b7818201 100644 --- a/src/net/sourceforge/plantuml/ugraphic/USegmentType.java +++ b/src/net/sourceforge/plantuml/ugraphic/USegmentType.java @@ -35,6 +35,7 @@ package net.sourceforge.plantuml.ugraphic; import java.awt.geom.PathIterator; import java.util.EnumSet; + import net.sourceforge.plantuml.ugraphic.arc.ExtendedPathIterator; public enum USegmentType { diff --git a/src/net/sourceforge/plantuml/ugraphic/crossing/UGraphicCrossing.java b/src/net/sourceforge/plantuml/ugraphic/crossing/UGraphicCrossing.java index 0eaa6d842..3977b6341 100644 --- a/src/net/sourceforge/plantuml/ugraphic/crossing/UGraphicCrossing.java +++ b/src/net/sourceforge/plantuml/ugraphic/crossing/UGraphicCrossing.java @@ -47,7 +47,6 @@ import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UChange; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; -import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UShape; diff --git a/src/net/sourceforge/plantuml/ugraphic/eps/DriverTextEps.java b/src/net/sourceforge/plantuml/ugraphic/eps/DriverTextEps.java index 9999dbf44..38eeadd05 100644 --- a/src/net/sourceforge/plantuml/ugraphic/eps/DriverTextEps.java +++ b/src/net/sourceforge/plantuml/ugraphic/eps/DriverTextEps.java @@ -32,10 +32,8 @@ package net.sourceforge.plantuml.ugraphic.eps; import java.awt.Color; -import java.awt.FontMetrics; import java.awt.font.FontRenderContext; import java.awt.font.TextLayout; -import java.awt.geom.Dimension2D; import java.awt.geom.PathIterator; import net.sourceforge.plantuml.eps.EpsGraphics; @@ -55,7 +53,6 @@ import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UShape; import net.sourceforge.plantuml.ugraphic.UText; -import net.sourceforge.plantuml.ugraphic.g2d.DriverTextAsPathG2d; public class DriverTextEps implements UDriver { diff --git a/src/net/sourceforge/plantuml/ugraphic/eps/UGraphicEps.java b/src/net/sourceforge/plantuml/ugraphic/eps/UGraphicEps.java index 4d69753e4..1fdab5bd4 100644 --- a/src/net/sourceforge/plantuml/ugraphic/eps/UGraphicEps.java +++ b/src/net/sourceforge/plantuml/ugraphic/eps/UGraphicEps.java @@ -31,10 +31,8 @@ */ package net.sourceforge.plantuml.ugraphic.eps; -import java.io.File; import java.io.IOException; import java.io.OutputStream; -import java.io.PrintWriter; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.eps.EpsGraphics; diff --git a/src/net/sourceforge/plantuml/ugraphic/g2d/DriverPathG2dLegacy.java b/src/net/sourceforge/plantuml/ugraphic/g2d/DriverPathG2dLegacy.java index 7d803e054..fb49c0ad3 100644 --- a/src/net/sourceforge/plantuml/ugraphic/g2d/DriverPathG2dLegacy.java +++ b/src/net/sourceforge/plantuml/ugraphic/g2d/DriverPathG2dLegacy.java @@ -36,7 +36,6 @@ package net.sourceforge.plantuml.ugraphic.g2d; import java.awt.GradientPaint; import java.awt.Graphics2D; import java.awt.Shape; -import java.awt.geom.GeneralPath; import java.awt.geom.Line2D; import java.awt.geom.Path2D; diff --git a/src/net/sourceforge/plantuml/ugraphic/html5/DriverLineHtml5.java b/src/net/sourceforge/plantuml/ugraphic/html5/DriverLineHtml5.java index 3bc7cf212..5a98268a1 100644 --- a/src/net/sourceforge/plantuml/ugraphic/html5/DriverLineHtml5.java +++ b/src/net/sourceforge/plantuml/ugraphic/html5/DriverLineHtml5.java @@ -33,6 +33,7 @@ package net.sourceforge.plantuml.ugraphic.html5; import java.awt.geom.Line2D; +import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.ugraphic.ClipContainer; import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UClip; @@ -40,7 +41,6 @@ import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UShape; -import net.sourceforge.plantuml.StringUtils; public class DriverLineHtml5 implements UDriver { diff --git a/src/net/sourceforge/plantuml/ugraphic/html5/DriverRectangleHtml5.java b/src/net/sourceforge/plantuml/ugraphic/html5/DriverRectangleHtml5.java index 2065f6aff..4cb61f6a8 100644 --- a/src/net/sourceforge/plantuml/ugraphic/html5/DriverRectangleHtml5.java +++ b/src/net/sourceforge/plantuml/ugraphic/html5/DriverRectangleHtml5.java @@ -33,6 +33,7 @@ package net.sourceforge.plantuml.ugraphic.html5; import java.awt.geom.Rectangle2D; +import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.HtmlColorGradient; import net.sourceforge.plantuml.ugraphic.ClipContainer; @@ -42,7 +43,6 @@ import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UShape; -import net.sourceforge.plantuml.StringUtils; public class DriverRectangleHtml5 implements UDriver { diff --git a/src/net/sourceforge/plantuml/ugraphic/sprite/PSystemListInternalSprites.java b/src/net/sourceforge/plantuml/ugraphic/sprite/PSystemListInternalSprites.java index e6f9bd738..f7eb1a54b 100644 --- a/src/net/sourceforge/plantuml/ugraphic/sprite/PSystemListInternalSprites.java +++ b/src/net/sourceforge/plantuml/ugraphic/sprite/PSystemListInternalSprites.java @@ -38,7 +38,6 @@ import java.io.IOException; import java.io.OutputStream; import java.util.ArrayList; import java.util.List; -import java.util.Set; import net.sourceforge.plantuml.AbstractPSystem; import net.sourceforge.plantuml.FileFormatOption; diff --git a/src/net/sourceforge/plantuml/ugraphic/svg/DriverCenteredCharacterSvg.java b/src/net/sourceforge/plantuml/ugraphic/svg/DriverCenteredCharacterSvg.java index 4781b7825..2011deecd 100644 --- a/src/net/sourceforge/plantuml/ugraphic/svg/DriverCenteredCharacterSvg.java +++ b/src/net/sourceforge/plantuml/ugraphic/svg/DriverCenteredCharacterSvg.java @@ -33,6 +33,7 @@ package net.sourceforge.plantuml.ugraphic.svg; import java.awt.font.TextLayout; +import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.UnusedSpace; import net.sourceforge.plantuml.svg.SvgGraphics; @@ -42,7 +43,6 @@ import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UShape; -import net.sourceforge.plantuml.StringUtils; public class DriverCenteredCharacterSvg implements UDriver { diff --git a/src/net/sourceforge/plantuml/ugraphic/svg/DriverDotPathSvg.java b/src/net/sourceforge/plantuml/ugraphic/svg/DriverDotPathSvg.java index 14089704c..56f5f8bc2 100644 --- a/src/net/sourceforge/plantuml/ugraphic/svg/DriverDotPathSvg.java +++ b/src/net/sourceforge/plantuml/ugraphic/svg/DriverDotPathSvg.java @@ -33,13 +33,13 @@ */ package net.sourceforge.plantuml.ugraphic.svg; +import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.posimo.DotPath; import net.sourceforge.plantuml.svg.SvgGraphics; import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UShape; -import net.sourceforge.plantuml.StringUtils; public class DriverDotPathSvg implements UDriver { diff --git a/src/net/sourceforge/plantuml/ugraphic/svg/DriverLineSvg.java b/src/net/sourceforge/plantuml/ugraphic/svg/DriverLineSvg.java index 0db19bb64..f115f972c 100644 --- a/src/net/sourceforge/plantuml/ugraphic/svg/DriverLineSvg.java +++ b/src/net/sourceforge/plantuml/ugraphic/svg/DriverLineSvg.java @@ -33,6 +33,7 @@ package net.sourceforge.plantuml.ugraphic.svg; import java.awt.geom.Line2D; +import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.svg.SvgGraphics; import net.sourceforge.plantuml.ugraphic.ClipContainer; import net.sourceforge.plantuml.ugraphic.ColorMapper; @@ -41,7 +42,6 @@ import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UShape; -import net.sourceforge.plantuml.StringUtils; public class DriverLineSvg implements UDriver { diff --git a/src/net/sourceforge/plantuml/ugraphic/svg/DriverPathSvg.java b/src/net/sourceforge/plantuml/ugraphic/svg/DriverPathSvg.java index e7a95089a..d8058433c 100644 --- a/src/net/sourceforge/plantuml/ugraphic/svg/DriverPathSvg.java +++ b/src/net/sourceforge/plantuml/ugraphic/svg/DriverPathSvg.java @@ -31,6 +31,7 @@ */ package net.sourceforge.plantuml.ugraphic.svg; +import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.HtmlColorGradient; import net.sourceforge.plantuml.svg.SvgGraphics; @@ -41,7 +42,6 @@ import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UPath; import net.sourceforge.plantuml.ugraphic.UShape; import net.sourceforge.plantuml.ugraphic.g2d.DriverShadowedG2d; -import net.sourceforge.plantuml.StringUtils; public class DriverPathSvg extends DriverShadowedG2d implements UDriver { diff --git a/src/net/sourceforge/plantuml/ugraphic/svg/DriverPolygonSvg.java b/src/net/sourceforge/plantuml/ugraphic/svg/DriverPolygonSvg.java index fa372a590..6f860d1a0 100644 --- a/src/net/sourceforge/plantuml/ugraphic/svg/DriverPolygonSvg.java +++ b/src/net/sourceforge/plantuml/ugraphic/svg/DriverPolygonSvg.java @@ -31,8 +31,7 @@ */ package net.sourceforge.plantuml.ugraphic.svg; -import java.awt.geom.Point2D; - +import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.HtmlColorGradient; import net.sourceforge.plantuml.svg.SvgGraphics; @@ -43,7 +42,6 @@ import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UPolygon; import net.sourceforge.plantuml.ugraphic.UShape; -import net.sourceforge.plantuml.StringUtils; public class DriverPolygonSvg implements UDriver { diff --git a/src/net/sourceforge/plantuml/ugraphic/svg/DriverRectangleSvg.java b/src/net/sourceforge/plantuml/ugraphic/svg/DriverRectangleSvg.java index 220bbaf89..ef4044ebb 100644 --- a/src/net/sourceforge/plantuml/ugraphic/svg/DriverRectangleSvg.java +++ b/src/net/sourceforge/plantuml/ugraphic/svg/DriverRectangleSvg.java @@ -33,6 +33,7 @@ package net.sourceforge.plantuml.ugraphic.svg; import java.awt.geom.Rectangle2D; +import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.HtmlColorGradient; import net.sourceforge.plantuml.svg.SvgGraphics; @@ -43,7 +44,6 @@ import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UShape; -import net.sourceforge.plantuml.StringUtils; public class DriverRectangleSvg implements UDriver { diff --git a/src/net/sourceforge/plantuml/ugraphic/svg/DriverTextSvg.java b/src/net/sourceforge/plantuml/ugraphic/svg/DriverTextSvg.java index 2c0c59cce..7aac1df9b 100644 --- a/src/net/sourceforge/plantuml/ugraphic/svg/DriverTextSvg.java +++ b/src/net/sourceforge/plantuml/ugraphic/svg/DriverTextSvg.java @@ -31,10 +31,9 @@ */ package net.sourceforge.plantuml.ugraphic.svg; -import java.awt.Color; import java.awt.geom.Dimension2D; -import java.awt.geom.Rectangle2D; +import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.FontStyle; import net.sourceforge.plantuml.graphic.StringBounder; @@ -48,7 +47,6 @@ import net.sourceforge.plantuml.ugraphic.UFontContext; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UShape; import net.sourceforge.plantuml.ugraphic.UText; -import net.sourceforge.plantuml.StringUtils; public class DriverTextSvg implements UDriver { diff --git a/src/net/sourceforge/plantuml/ugraphic/txt/UGraphicTxt.java b/src/net/sourceforge/plantuml/ugraphic/txt/UGraphicTxt.java index 45442e99e..423625102 100644 --- a/src/net/sourceforge/plantuml/ugraphic/txt/UGraphicTxt.java +++ b/src/net/sourceforge/plantuml/ugraphic/txt/UGraphicTxt.java @@ -32,8 +32,6 @@ package net.sourceforge.plantuml.ugraphic.txt; import java.awt.geom.Dimension2D; -import java.io.IOException; -import java.io.OutputStream; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.Url; diff --git a/src/net/sourceforge/plantuml/utils/StartUtils.java b/src/net/sourceforge/plantuml/utils/StartUtils.java index ed777a2cf..b9afdeaf0 100644 --- a/src/net/sourceforge/plantuml/utils/StartUtils.java +++ b/src/net/sourceforge/plantuml/utils/StartUtils.java @@ -33,23 +33,48 @@ */ package net.sourceforge.plantuml.utils; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - import net.sourceforge.plantuml.CharSequence2; import net.sourceforge.plantuml.StringUtils; +import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; +import net.sourceforge.plantuml.command.regex.Pattern2; public class StartUtils { public static final String PAUSE_PATTERN = "(?i)((?:\\W|\\<[^<>]*\\>)*)@unpause"; public static final String START_PATTERN = "(?i)((?:[^\\w~]|\\<[^<>]*\\>)*)@start"; - public static boolean isArobaseStartDiagram(CharSequence s) { return StringUtils.trinNoTrace(s).startsWith("@start"); } + public static String beforeStartUml(final CharSequence2 result) { + boolean inside = false; + for (int i = 0; i < result.length(); i++) { + final String single = result.subSequence(i, i + 1).toString(); + if (inside) { + if (single.equals(">")) { + inside = false; + } + continue; + } + if (result.subSequence(i, result.length()).startsWith("@start")) { + return result.subSequence(0, i).toString(); + } + if (single.equals("<")) { + inside = true; + } else if (single.matches("[\\w~]")) { + return null; + } + } + return null; + // final Matcher m = MyPattern.cmpile(START_PATTERN).matcher(result); + // if (m.find()) { + // return m.group(1); + // } + // return null; + } + public static boolean isArobaseEndDiagram(CharSequence s) { return StringUtils.trinNoTrace(s).startsWith("@end"); } @@ -62,13 +87,13 @@ public class StartUtils { return StringUtils.trinNoTrace(s).startsWith("@unpause"); } - private static final Pattern append = MyPattern.cmpile("^\\W*@append"); + private static final Pattern2 append = MyPattern.cmpile("^\\W*@append"); public static CharSequence2 getPossibleAppend(CharSequence2 s) { - final Matcher m = append.matcher(s); + final Matcher2 m = append.matcher(s); if (m.find()) { return s.subSequence(m.group(0).length(), s.length()).trin(); - //return StringUtils.trin(s.toString().substring(m.group(0).length())); + // return StringUtils.trin(s.toString().substring(m.group(0).length())); } return null; } diff --git a/src/net/sourceforge/plantuml/version/Version.java b/src/net/sourceforge/plantuml/version/Version.java index a1ce44259..69b199b12 100644 --- a/src/net/sourceforge/plantuml/version/Version.java +++ b/src/net/sourceforge/plantuml/version/Version.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 19848 $ + * Revision $Revision: 19888 $ * */ package net.sourceforge.plantuml.version; @@ -39,7 +39,7 @@ import java.util.Date; public class Version { public static int version() { - return 8041; + return 8042; } public static String versionString() { @@ -63,7 +63,7 @@ public class Version { } public static long compileTime() { - return 1463677540151L; + return 1464713301187L; } public static String compileTimeString() {