1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-12-22 10:59:01 +00:00

version 8042

This commit is contained in:
Arnaud Roques 2016-05-31 21:41:55 +02:00
parent c1f657b42e
commit fd538b5fe8
214 changed files with 956 additions and 753 deletions

View File

@ -30,12 +30,13 @@
Script Author: Julien Eluard
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>net.sourceforge.plantuml</groupId>
<artifactId>plantuml</artifactId>
<version>8041-SNAPSHOT</version>
<version>8042-SNAPSHOT</version>
<packaging>jar</packaging>
<name>PlantUML</name>

View File

@ -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;
@ -101,6 +100,11 @@ public abstract class AbstractPSystem implements Diagram {
return null;
}
public String checkFinalError() {
return null;
}
public void makeDiagramReady() {
}

View File

@ -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;

View File

@ -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<String> excluded;
private final Option option;
private final static Pattern predirPath = MyPattern.cmpile("^([^*?]*[/\\\\])?(.*)$");
private final static Pattern2 predirPath = MyPattern.cmpile("^([^*?]*[/\\\\])?(.*)$");
public FileGroup(String pattern, List<String> 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) {

View File

@ -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 {

View File

@ -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<Diagram> getDiagrams() {
return Collections.unmodifiableList(diagrams);
}

View File

@ -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));
}

View File

@ -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;

View File

@ -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;

View File

@ -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<String, String> params = new HashMap<String, String>();
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, "");

View File

@ -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<String> getSplit(Pattern pattern, String line) {
final Matcher m = pattern.matcher(line);
final static public List<String> 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<String> result = new ArrayList<String>();
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)));
}

View File

@ -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<String> getFailureText1(Throwable exception, String graphvizVersion) {

View File

@ -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();
}

View File

@ -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);
}

View File

@ -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<PSystemXearth> {
}
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<PSystemXearth> {
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;

View File

@ -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());

View File

@ -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;
}

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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;

View File

@ -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<ActivityDiagram3> {

View File

@ -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<ActivityDiagram3> {
@ -74,7 +74,7 @@ public class CommandRepeatWhile3 extends SingleLineCommand2<ActivityDiagram3> {
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<ActivityDiagram3> {
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);
}
}

View File

@ -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<ActivityDiagram3> {
@ -95,7 +95,7 @@ public class CommandRepeatWhile3Multilines extends CommandMultilines3<ActivityDi
Display yes = Display.NULL;// Display.getWithNewlines("arg.getLazzy(\"WHEN\", 0)");
final Display out = Display.NULL; // Display.getWithNewlines("arg.getLazzy(\"OUT\", 0)");
final HtmlColor linkColor = null; // diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR",
final Rainbow linkColor = Rainbow.none(); // diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR",
// 0));
final Display linkLabel = Display.NULL; // Display.getWithNewlines("arg.get(\"LABEL\", 0)");
final List<Display> splitted = testDisplay.splitMultiline(MyPattern.cmpile("\\)[%s]*(is|equals?)[%s]*\\(",

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -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<Connection> conns = new ArrayList<Connection>();
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;

View File

@ -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;

View File

@ -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;

View File

@ -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 {

View File

@ -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();

View File

@ -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 {

View File

@ -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;

View File

@ -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 {

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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 {

View File

@ -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();

View File

@ -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) {

View File

@ -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();
}
}

View File

@ -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();
}
}

View File

@ -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<AbstractClassOrOb
if (arg.get("LABEL_LINK", 0) != null) {
labelLink = arg.get("LABEL_LINK", 0);
if (firstLabel == null && secondLabel == null) {
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.trin(m1.group(2)), "\""));
secondLabel = m1.group(3);
} else {
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.trin(m2.group(2)), "\""));
secondLabel = null;
} else {
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(

View File

@ -33,14 +33,13 @@
*/
package net.sourceforge.plantuml.classdiagram.command;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
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;
@ -130,24 +129,24 @@ final public class CommandLinkLollipop extends SingleLineCommand2<AbstractClassO
if (arg.get("LABEL_LINK", 0) != null) {
labelLink = arg.get("LABEL_LINK", 0);
if (firstLabel == null && secondLabel == null) {
final Pattern p1 = MyPattern.cmpile("^\"([^\"]+)\"([^\"]+)\"([^\"]+)\"$");
final Matcher m1 = p1.matcher(labelLink);
final Pattern2 p1 = MyPattern.cmpile("^\"([^\"]+)\"([^\"]+)\"([^\"]+)\"$");
final Matcher2 m1 = p1.matcher(labelLink);
if (m1.matches()) {
firstLabel = m1.group(1);
labelLink = StringUtils.trin(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(StringUtils
.trin(m1.group(2))));
secondLabel = m1.group(3);
} else {
final Pattern p2 = MyPattern.cmpile("^\"([^\"]+)\"([^\"]+)$");
final Matcher m2 = p2.matcher(labelLink);
final Pattern2 p2 = MyPattern.cmpile("^\"([^\"]+)\"([^\"]+)$");
final Matcher2 m2 = p2.matcher(labelLink);
if (m2.matches()) {
firstLabel = m2.group(1);
labelLink = StringUtils.trin(StringUtils
.eventuallyRemoveStartingAndEndingDoubleQuote(StringUtils.trin(m2.group(2))));
secondLabel = null;
} else {
final Pattern p3 = MyPattern.cmpile("^([^\"]+)\"([^\"]+)\"$");
final Matcher m3 = p3.matcher(labelLink);
final Pattern2 p3 = MyPattern.cmpile("^([^\"]+)\"([^\"]+)\"$");
final Matcher2 m3 = p3.matcher(labelLink);
if (m3.matches()) {
firstLabel = null;
labelLink = StringUtils.trin(StringUtils

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 19109 $
* Revision $Revision: 19880 $
*
*/
package net.sourceforge.plantuml.classdiagram.command;
@ -40,19 +40,19 @@ import java.io.IOException;
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.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.LeafType;
class JavaFile {
private static final Pattern classDefinition = MyPattern
private static final Pattern2 classDefinition = MyPattern
.cmpile("^(?:public[%s]+|abstract[%s]+|final[%s]+)*(class|interface|enum|annotation)[%s]+(\\w+)(?:.*\\b(extends|implements)[%s]+([\\w%s,]+))?");
private static final Pattern packageDefinition = MyPattern.cmpile("^package[%s]+([\\w+.]+)[%s]*;");
private static final Pattern2 packageDefinition = MyPattern.cmpile("^package[%s]+([\\w+.]+)[%s]*;");
private final List<JavaClass> all = new ArrayList<JavaClass>();
@ -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);

View File

@ -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);
}

View File

@ -39,14 +39,16 @@ public class CommandDecoratorMultine<D extends Diagram> implements Command<D> {
private final SingleLineCommand2<D> cmd;
private final boolean removeEmptyColumn;
private final int nbMaxLines;
public CommandDecoratorMultine(SingleLineCommand2<D> cmd) {
this(cmd, false);
public CommandDecoratorMultine(SingleLineCommand2<D> cmd, int nbMaxLines) {
this(cmd, false, nbMaxLines);
}
public CommandDecoratorMultine(SingleLineCommand2<D> cmd, boolean removeEmptyColumn) {
public CommandDecoratorMultine(SingleLineCommand2<D> 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<D extends Diagram> implements Command<D> {
return cmd.getDescription();
}
public int getNbMaxLines() {
return nbMaxLines;
}
}

View File

@ -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;

View File

@ -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<S extends Diagram> implements Command<S> {
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<S extends Diagram> implements Command<S>
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<S extends Diagram> implements Command<S>
protected void actionIfCommandValid() {
}
protected final Pattern getStartingPattern() {
protected final Pattern2 getStartingPattern() {
return starting;
}

View File

@ -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<S extends Diagram> implements Command<S
return CommandControl.OK_PARTIAL;
}
final Matcher m1 = MyPattern.cmpile(getPatternEnd()).matcher(StringUtils.trinNoTrace(lines.getLast499()));
final Matcher2 m1 = MyPattern.cmpile(getPatternEnd()).matcher(StringUtils.trinNoTrace(lines.getLast499()));
if (m1.matches() == false) {
return CommandControl.OK_PARTIAL;
}

View File

@ -33,16 +33,15 @@
*/
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 CommandMultilinesBracket<S extends Diagram> implements Command<S> {
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<S extends Diagram> implements Com
protected void actionIfCommandValid() {
}
protected final Pattern getStartingPattern() {
protected final Pattern2 getStartingPattern() {
return starting;
}
@ -70,7 +69,7 @@ public abstract class CommandMultilinesBracket<S extends Diagram> 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;
}

View File

@ -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<UmlDiagram> {
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();
}

View File

@ -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<UmlDiagram> {
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();
}

View File

@ -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<UmlDiagram> {
@ -64,7 +64,7 @@ public class CommandSkinParamMultilines extends CommandMultilinesBracket<UmlDiag
}
}
private final static Pattern p1 = MyPattern
private final static Pattern2 p1 = MyPattern
.cmpile("^([\\w.]*(?:\\<\\<.*\\>\\>)?[\\w.]*)[%s]+(?:(\\{)|(.*))$|^\\}?$");
public CommandSkinParamMultilines() {
@ -87,7 +87,7 @@ public class CommandSkinParamMultilines extends CommandMultilinesBracket<UmlDiag
public CommandExecutionResult execute(UmlDiagram diagram, BlocLines lines) {
final Context context = new Context();
final Matcher mStart = getStartingPattern().matcher(StringUtils.trin(lines.getFirst499()));
final Matcher2 mStart = getStartingPattern().matcher(StringUtils.trin(lines.getFirst499()));
if (mStart.find() == false) {
throw new IllegalStateException();
}
@ -108,7 +108,7 @@ public class CommandSkinParamMultilines extends CommandMultilinesBracket<UmlDiag
context.pop();
continue;
}
final Matcher m = p1.matcher(s);
final Matcher2 m = p1.matcher(s);
if (m.find() == false) {
throw new IllegalStateException();
}

View File

@ -47,7 +47,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.ugraphic.sprite.SpriteImage;
import net.sourceforge.plantuml.version.PSystemVersion;
public class CommandSpriteFile extends SingleLineCommand2<UmlDiagram> {

View File

@ -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<S extends Diagram> implements Command<S> {
private final Pattern pattern;
private final Pattern2 pattern;
public SingleLineCommand(String pattern) {
if (pattern == null) {
@ -69,7 +69,7 @@ public abstract class SingleLineCommand<S extends Diagram> implements Command<S>
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();

View File

@ -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;
@ -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);

View File

@ -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<String, Long> durations = new HashMap<String, Long>();
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);
}
}
}

View File

@ -34,14 +34,13 @@
package net.sourceforge.plantuml.command.regex;
import java.util.Iterator;
import java.util.regex.Matcher;
public class MatcherIterator implements Iterator<String> {
private int cpt = 1;
private final Matcher matcher;
private final Matcher2 matcher;
MatcherIterator(Matcher matcher) {
MatcherIterator(Matcher2 matcher) {
this.matcher = matcher;
}

View File

@ -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) {

View File

@ -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();
}
}

View File

@ -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<IRegex> 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);
}

View File

@ -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;
}

View File

@ -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;

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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));

View File

@ -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 = "\\<font(?:[%s]+size[%s]*=[%s]*[%g]?(\\d+)[%g]?|[%s]+color[%s]*=[%s]*[%g]?(#[0-9a-fA-F]{6}|\\w+)[%g]?)+[%s]*\\>";
@ -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();
}

View File

@ -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 + "(.*?)\\</color\\>)");
@ -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();
}

View File

@ -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();
}

View File

@ -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 + "(.*?)\\</font\\>)");
@ -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();
}

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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 + "(.*?)\\</size\\>)");
@ -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();
}

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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;
}

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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;

View File

@ -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 {

View File

@ -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<CharSequence> {
return naturalHorizontalAlignment;
}
public List<Display> splitMultiline(Pattern separator) {
public List<Display> splitMultiline(Pattern2 separator) {
final List<Display> result = new ArrayList<Display>();
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);

View File

@ -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 {

View File

@ -33,7 +33,6 @@
*/
package net.sourceforge.plantuml.cucadiagram;
import net.sourceforge.plantuml.ugraphic.UChange;
import net.sourceforge.plantuml.ugraphic.UStroke;
public enum LinkStyle {

View File

@ -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) {

View File

@ -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;

View File

@ -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<String> result = new ArrayList<String>();
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()));

View File

@ -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 {

View File

@ -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;

View File

@ -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;

View File

@ -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;
@ -138,5 +144,4 @@ public class DescriptionDiagram extends AbstractEntityDiagram {
return namespaceSeparator;
}
}

View File

@ -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);
}
}

View File

@ -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<DescriptionDiagram> {
}
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<DescriptionDiagram> {
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<DescriptionDiagram> {
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

View File

@ -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;
}

View File

@ -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;

View File

@ -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;

Some files were not shown because too many files have changed in this diff Show More