1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-12-22 02:49:06 +00:00

Import version 1.2021.7

This commit is contained in:
Arnaud Roques 2021-05-23 17:35:13 +02:00
parent d8e1d6e69a
commit 39c585ee09
312 changed files with 1510 additions and 1035 deletions

View File

@ -35,7 +35,7 @@
<groupId>net.sourceforge.plantuml</groupId>
<artifactId>plantuml</artifactId>
<version>1.2021.6-SNAPSHOT</version>
<version>1.2021.8-SNAPSHOT</version>
<packaging>jar</packaging>
<name>PlantUML</name>

View File

@ -1,63 +0,0 @@
/* This file is taken from
https://github.com/andreas1327250/argon2-java
Original Author: Andreas Gadermaier <up.gadermaier@gmail.com>
*/
package ext.plantuml.com.at.gadermaier.argon2;
import static ext.plantuml.com.at.gadermaier.argon2.Constants.Constraints.MAX_AD_LENGTH;
import static ext.plantuml.com.at.gadermaier.argon2.Constants.Constraints.MAX_ITERATIONS;
import static ext.plantuml.com.at.gadermaier.argon2.Constants.Constraints.MAX_PARALLELISM;
import static ext.plantuml.com.at.gadermaier.argon2.Constants.Constraints.MAX_PWD_LENGTH;
import static ext.plantuml.com.at.gadermaier.argon2.Constants.Constraints.MAX_SALT_LENGTH;
import static ext.plantuml.com.at.gadermaier.argon2.Constants.Constraints.MAX_SECRET_LENGTH;
import static ext.plantuml.com.at.gadermaier.argon2.Constants.Constraints.MIN_ITERATIONS;
import static ext.plantuml.com.at.gadermaier.argon2.Constants.Constraints.MIN_PARALLELISM;
import static ext.plantuml.com.at.gadermaier.argon2.Constants.Constraints.MIN_PWD_LENGTH;
import static ext.plantuml.com.at.gadermaier.argon2.Constants.Constraints.MIN_SALT_LENGTH;
import static ext.plantuml.com.at.gadermaier.argon2.Constants.Messages.ADDITIONAL_MAX_MSG;
import static ext.plantuml.com.at.gadermaier.argon2.Constants.Messages.M_MIN_MSG;
import static ext.plantuml.com.at.gadermaier.argon2.Constants.Messages.PWD_MAX_MSG;
import static ext.plantuml.com.at.gadermaier.argon2.Constants.Messages.PWD_MIN_MSG;
import static ext.plantuml.com.at.gadermaier.argon2.Constants.Messages.P_MAX_MSG;
import static ext.plantuml.com.at.gadermaier.argon2.Constants.Messages.P_MIN_MSG;
import static ext.plantuml.com.at.gadermaier.argon2.Constants.Messages.SALT_MAX_MSG;
import static ext.plantuml.com.at.gadermaier.argon2.Constants.Messages.SALT_MIN_MSG;
import static ext.plantuml.com.at.gadermaier.argon2.Constants.Messages.SECRET_MAX_MSG;
import static ext.plantuml.com.at.gadermaier.argon2.Constants.Messages.T_MAX_MSG;
import static ext.plantuml.com.at.gadermaier.argon2.Constants.Messages.T_MIN_MSG;
import ext.plantuml.com.at.gadermaier.argon2.exception.Argon2InvalidParameterException;
class Validation {
static void validateInput(Argon2 argon2){
String message = null;
if (argon2.getLanes() < MIN_PARALLELISM)
message = P_MIN_MSG;
else if (argon2.getLanes() > MAX_PARALLELISM)
message = P_MAX_MSG;
else if(argon2.getMemory() < 2 * argon2.getLanes())
message = M_MIN_MSG;
else if(argon2.getIterations() < MIN_ITERATIONS)
message = T_MIN_MSG;
else if(argon2.getIterations() > MAX_ITERATIONS)
message = T_MAX_MSG;
else if(argon2.getPasswordLength() < MIN_PWD_LENGTH)
message = PWD_MIN_MSG;
else if(argon2.getPasswordLength() > MAX_PWD_LENGTH)
message = PWD_MAX_MSG;
else if(argon2.getSaltLength() < MIN_SALT_LENGTH)
message = SALT_MIN_MSG;
else if(argon2.getSaltLength() > MAX_SALT_LENGTH)
message = SALT_MAX_MSG;
else if(argon2.getSecretLength() > MAX_SECRET_LENGTH)
message = SECRET_MAX_MSG;
else if(argon2.getAdditionalLength() > MAX_AD_LENGTH)
message = ADDITIONAL_MAX_MSG;
if(message != null)
throw new Argon2InvalidParameterException(message);
}
}

View File

@ -39,6 +39,7 @@ import static net.sourceforge.plantuml.ugraphic.ImageBuilder.imageBuilder;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Objects;
import net.sourceforge.plantuml.command.BlocLines;
import net.sourceforge.plantuml.command.Command;
@ -53,7 +54,6 @@ import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.VerticalAlignment;
import net.sourceforge.plantuml.stats.StatsUtilsIncrement;
import net.sourceforge.plantuml.style.ClockwiseTopRightBottomLeft;
import net.sourceforge.plantuml.style.StyleBuilder;
import net.sourceforge.plantuml.ugraphic.ImageBuilder;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
import net.sourceforge.plantuml.version.License;
@ -61,9 +61,13 @@ import net.sourceforge.plantuml.version.Version;
public abstract class AbstractPSystem implements Diagram {
private UmlSource source;
private final UmlSource source;
private Scale scale;
public AbstractPSystem(UmlSource source) {
this.source = Objects.requireNonNull(source);
}
private String getVersion() {
final StringBuilder toAppend = new StringBuilder();
toAppend.append("PlantUML version ");
@ -100,10 +104,6 @@ public abstract class AbstractPSystem implements Diagram {
return getSource().seed();
}
final public void setSource(UmlSource source) {
this.source = source;
}
public int getNbImages() {
return 1;
}

View File

@ -47,13 +47,15 @@ import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.core.Diagram;
import net.sourceforge.plantuml.core.DiagramDescription;
import net.sourceforge.plantuml.core.ImageData;
import net.sourceforge.plantuml.core.UmlSource;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class NewpagedDiagram extends AbstractPSystem {
private final List<Diagram> diagrams = new ArrayList<>();
public NewpagedDiagram(AbstractPSystem diag1, AbstractPSystem diag2) {
public NewpagedDiagram(UmlSource source, AbstractPSystem diag1, AbstractPSystem diag2) {
super(source);
if (diag1 instanceof NewpagedDiagram) {
throw new IllegalArgumentException();
}

View File

@ -72,7 +72,7 @@ public class Option {
private OptionPreprocOutputMode preprocessorOutput = null;
private boolean failfast = false;
private boolean failfast2 = false;
private boolean pattern = false;
private boolean duration = false;
private boolean debugsvek = false;
private boolean splash = false;
@ -263,8 +263,6 @@ public class Option {
pipeMap = true;
} else if (s.equalsIgnoreCase("-pipenostderr")) {
pipeNoStdErr = true;
} else if (s.equalsIgnoreCase("-pattern")) {
pattern = true;
} else if (s.equalsIgnoreCase("-syntax")) {
syntax = true;
OptionFlags.getInstance().setQuiet(true);
@ -571,10 +569,6 @@ public class Option {
return syntax;
}
public final boolean isPattern() {
return pattern;
}
public FileFormatOption getFileFormatOption() {
if (debugsvek) {
fileFormatOption.setDebugSvek(true);

View File

@ -133,7 +133,6 @@ public class OptionPrint {
System.out.println(" -checkonly\t\tTo check the syntax of files without generating images");
System.out.println(" -failfast\t\tTo stop processing as soon as a syntax error in diagram occurs");
System.out.println(" -failfast2\t\tTo do a first syntax check before processing files, to fail even faster");
System.out.println(" -pattern\t\tTo print the list of Regular Expression used by PlantUML");
System.out.println(" -duration\t\tTo print the duration of complete diagrams processing");
System.out.println(" -nbthread N\t\tTo use (N) threads for processing");
System.out.println(" -nbthread auto\tTo use " + Option.defaultNbThreads() + " threads for processing");

View File

@ -126,12 +126,11 @@ public class PSystemBuilder {
final DiagramType diagramType = umlSource.getDiagramType();
final List<PSystemError> errors = new ArrayList<>();
final List<PSystemFactory> factories = getAllFactories(skinParam);
for (PSystemFactory systemFactory : factories) {
if (diagramType != systemFactory.getDiagramType()) {
continue;
}
final Diagram sys = systemFactory.createSystem(umlSource);
final Diagram sys = systemFactory.createSystem(umlSource, skinParam);
if (isOk(sys)) {
result = sys;
return sys;
@ -151,16 +150,17 @@ public class PSystemBuilder {
}
}
private static List<PSystemFactory> getAllFactories(ISkinSimple skinParam) {
final List<PSystemFactory> factories = new ArrayList<>();
private static final List<PSystemFactory> factories = new ArrayList<>();
static {
factories.add(new PSystemWelcomeFactory());
factories.add(new PSystemColorsFactory());
factories.add(new SequenceDiagramFactory(skinParam));
factories.add(new ClassDiagramFactory(skinParam));
factories.add(new ActivityDiagramFactory(skinParam));
factories.add(new DescriptionDiagramFactory(skinParam));
factories.add(new StateDiagramFactory(skinParam));
factories.add(new ActivityDiagramFactory3(skinParam));
factories.add(new SequenceDiagramFactory());
factories.add(new ClassDiagramFactory());
factories.add(new ActivityDiagramFactory());
factories.add(new DescriptionDiagramFactory());
factories.add(new StateDiagramFactory());
factories.add(new ActivityDiagramFactory3());
// factories.add(new CompositeDiagramFactory(skinParam));
factories.add(new BpmDiagramFactory(DiagramType.BPM));
// factories.add(new PostIdDiagramFactory());
@ -176,7 +176,8 @@ public class PSystemBuilder {
factories.add(new PSystemSaltFactory2(DiagramType.UML));
factories.add(new PSystemDotFactory(DiagramType.DOT));
factories.add(new PSystemDotFactory(DiagramType.UML));
factories.add(new NwDiagramFactory());
factories.add(new NwDiagramFactory(DiagramType.NW));
factories.add(new NwDiagramFactory(DiagramType.UML));
factories.add(new MindMapDiagramFactory());
factories.add(new WBSDiagramFactory());
factories.add(new PSystemDitaaFactory(DiagramType.DITAA));
@ -188,8 +189,8 @@ public class PSystemBuilder {
factories.add(new PSystemSudokuFactory());
}
factories.add(new PSystemDefinitionFactory());
factories.add(new ListSpriteDiagramFactory(skinParam));
factories.add(new StdlibDiagramFactory(skinParam));
factories.add(new ListSpriteDiagramFactory());
factories.add(new StdlibDiagramFactory());
factories.add(new PSystemMathFactory(DiagramType.MATH));
factories.add(new PSystemLatexFactory(DiagramType.LATEX));
// factories.add(new PSystemStatsFactory());
@ -208,6 +209,7 @@ public class PSystemBuilder {
}
factories.add(new GanttDiagramFactory(DiagramType.GANTT));
factories.add(new GanttDiagramFactory(DiagramType.UML));
GanttDiagramFactory.clearCache();
factories.add(new FlowDiagramFactory());
// factories.add(new PSystemTreeFactory(DiagramType.JUNGLE));
// factories.add(new PSystemCuteFactory(DiagramType.CUTE));
@ -219,7 +221,6 @@ public class PSystemBuilder {
factories.add(new GitDiagramFactory());
factories.add(new BoardDiagramFactory());
factories.add(new YamlDiagramFactory());
return factories;
}
private boolean isOk(Diagram ps) {

View File

@ -34,15 +34,20 @@
*/
package net.sourceforge.plantuml;
import net.sourceforge.plantuml.core.ImageData;
import net.sourceforge.plantuml.graphic.UDrawable;
import net.sourceforge.plantuml.ugraphic.ImageBuilder;
import java.io.IOException;
import java.io.OutputStream;
import net.sourceforge.plantuml.core.ImageData;
import net.sourceforge.plantuml.core.UmlSource;
import net.sourceforge.plantuml.graphic.UDrawable;
import net.sourceforge.plantuml.ugraphic.ImageBuilder;
// This class doesnt feel like a wonderful idea, just a stepping stone towards something
public abstract class PlainDiagram extends AbstractPSystem {
public PlainDiagram(UmlSource source) {
super(source);
}
@Override
public ImageBuilder createImageBuilder(FileFormatOption fileFormatOption) throws IOException {

View File

@ -34,14 +34,15 @@
*/
package net.sourceforge.plantuml;
import net.sourceforge.plantuml.graphic.GraphicPosition;
import net.sourceforge.plantuml.graphic.UDrawable;
import static net.sourceforge.plantuml.graphic.GraphicStrings.createBlackOnWhite;
import java.awt.image.BufferedImage;
import java.util.ArrayList;
import java.util.List;
import static net.sourceforge.plantuml.graphic.GraphicStrings.createBlackOnWhite;
import net.sourceforge.plantuml.core.UmlSource;
import net.sourceforge.plantuml.graphic.GraphicPosition;
import net.sourceforge.plantuml.graphic.UDrawable;
public abstract class PlainStringsDiagram extends PlainDiagram {
@ -50,6 +51,10 @@ public abstract class PlainStringsDiagram extends PlainDiagram {
protected final List<String> strings = new ArrayList<>();
public PlainStringsDiagram(UmlSource source) {
super(source);
}
@Override
public UDrawable getRootDrawable(FileFormatOption fileFormatOption) {
return createBlackOnWhite(strings, image, imagePosition);

View File

@ -54,13 +54,9 @@ import java.util.concurrent.TimeUnit;
import javax.swing.UIManager;
import net.sourceforge.plantuml.activitydiagram.ActivityDiagramFactory;
import net.sourceforge.plantuml.classdiagram.ClassDiagramFactory;
import net.sourceforge.plantuml.code.NoPlantumlCompressionException;
import net.sourceforge.plantuml.code.Transcoder;
import net.sourceforge.plantuml.code.TranscoderUtil;
import net.sourceforge.plantuml.command.PSystemCommandFactory;
import net.sourceforge.plantuml.descdiagram.DescriptionDiagramFactory;
import net.sourceforge.plantuml.ftp.FtpServer;
import net.sourceforge.plantuml.picoweb.PicoWebServer;
import net.sourceforge.plantuml.png.MetadataTag;
@ -68,10 +64,8 @@ import net.sourceforge.plantuml.preproc.Stdlib;
import net.sourceforge.plantuml.security.ImageIO;
import net.sourceforge.plantuml.security.SFile;
import net.sourceforge.plantuml.security.SecurityUtils;
import net.sourceforge.plantuml.sequencediagram.SequenceDiagramFactory;
import net.sourceforge.plantuml.sprite.SpriteGrayLevel;
import net.sourceforge.plantuml.sprite.SpriteUtils;
import net.sourceforge.plantuml.statediagram.StateDiagramFactory;
import net.sourceforge.plantuml.stats.StatsUtils;
import net.sourceforge.plantuml.swing.MainWindow2;
import net.sourceforge.plantuml.syntax.LanguageDescriptor;
@ -156,9 +150,7 @@ public class Run {
}
final ErrorStatus error = ErrorStatus.init();
boolean forceQuit = false;
if (option.isPattern()) {
managePattern();
} else if (OptionFlags.getInstance().isGui()) {
if (OptionFlags.getInstance().isGui()) {
try {
UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
} catch (Exception e) {
@ -359,25 +351,6 @@ public class Run {
}
}
private static void managePattern() {
printPattern(new SequenceDiagramFactory(null));
printPattern(new ClassDiagramFactory(null));
printPattern(new ActivityDiagramFactory(null));
printPattern(new DescriptionDiagramFactory(null));
// printPattern(new ComponentDiagramFactory());
printPattern(new StateDiagramFactory(null));
// printPattern(new ObjectDiagramFactory(null));
}
private static void printPattern(PSystemCommandFactory factory) {
System.out.println();
System.out.println(factory.getClass().getSimpleName().replaceAll("Factory", ""));
final List<String> descriptions = factory.getDescription();
for (String s : descriptions) {
System.out.println(s);
}
}
private static void managePipe(Option option, ErrorStatus error) throws IOException {
final String charset = option.getCharset();
new Pipe(option, System.out, System.in, charset).managePipe(error);

View File

@ -35,6 +35,8 @@
*/
package net.sourceforge.plantuml;
import static net.sourceforge.plantuml.ugraphic.ImageBuilder.plainImageBuilder;
import java.io.IOException;
import java.io.OutputStream;
import java.io.StringReader;
@ -50,8 +52,6 @@ import net.sourceforge.plantuml.preproc.Defines;
import net.sourceforge.plantuml.security.SFile;
import net.sourceforge.plantuml.svek.TextBlockBackcolored;
import static net.sourceforge.plantuml.ugraphic.ImageBuilder.plainImageBuilder;
public class SourceStringReader {
final private List<BlockUml> blocks;

View File

@ -420,13 +420,8 @@ public class StringUtils {
public static List<String> splitComma(String s) {
s = trin(s);
// if
// (s.matches("([\\p{L}0-9_.]+|[%g][^%g]+[%g])(\\s*,\\s*([\\p{L}0-9_.]+|[%g][^%g]+[%g]))*")
// == false) {
// throw new IllegalArgumentException();
// }
final List<String> result = new ArrayList<>();
final Pattern2 p = MyPattern.cmpile("([\\p{L}0-9_.]+|[%g][^%g]+[%g])");
final Pattern2 p = MyPattern.cmpile("([%pLN_.]+|[%g][^%g]+[%g])");
final Matcher2 m = p.matcher(s);
while (m.find()) {
result.add(eventuallyRemoveStartingAndEndingDoubleQuote(m.group(0)));

View File

@ -41,6 +41,7 @@ import net.sourceforge.plantuml.anim.Animation;
import net.sourceforge.plantuml.anim.AnimationDecoder;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.core.Diagram;
import net.sourceforge.plantuml.core.UmlSource;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.DisplayPositionned;
import net.sourceforge.plantuml.cucadiagram.DisplaySection;
@ -81,7 +82,8 @@ public abstract class TitledDiagram extends AbstractPSystem implements Diagram,
return pragma;
}
public TitledDiagram(UmlDiagramType type) {
public TitledDiagram(UmlSource source, UmlDiagramType type) {
super(source);
this.type = type;
this.skinParam = SkinParam.create(type);
}
@ -90,8 +92,8 @@ public abstract class TitledDiagram extends AbstractPSystem implements Diagram,
return skinParam.getCurrentStyleBuilder();
}
public TitledDiagram(UmlDiagramType type, ISkinSimple orig) {
this(type);
public TitledDiagram(UmlSource source, UmlDiagramType type, ISkinSimple orig) {
this(source, type);
if (orig != null) {
this.skinParam.copyAllFrom(orig);
}

View File

@ -35,6 +35,8 @@
*/
package net.sourceforge.plantuml;
import static net.sourceforge.plantuml.ugraphic.ImageBuilder.plainImageBuilder;
import java.awt.Color;
import java.awt.geom.AffineTransform;
import java.awt.geom.Dimension2D;
@ -79,8 +81,6 @@ import net.sourceforge.plantuml.ugraphic.UImage;
import net.sourceforge.plantuml.ugraphic.UTranslate;
import net.sourceforge.plantuml.version.Version;
import static net.sourceforge.plantuml.ugraphic.ImageBuilder.plainImageBuilder;
public abstract class UmlDiagram extends TitledDiagram implements Diagram, Annotated, WithSprite {
private boolean rotation;
@ -88,12 +88,12 @@ public abstract class UmlDiagram extends TitledDiagram implements Diagram, Annot
private int minwidth = Integer.MAX_VALUE;
public UmlDiagram(UmlDiagramType type) {
super(type);
public UmlDiagram(UmlSource source, UmlDiagramType type) {
super(source, type);
}
public UmlDiagram(UmlDiagramType type, ISkinSimple orig) {
super(type, orig);
public UmlDiagram(UmlSource source, UmlDiagramType type, ISkinSimple orig) {
super(source, type, orig);
}
final public int getMinwidth() {

View File

@ -62,12 +62,12 @@ public class UrlBuilder {
+ "[%s]*\\]\\]";
private static final String S_LINK_TOOLTIP_NOLABEL = "\\[\\[[%s]*" + //
"([^\\s%g{}]+?)" + // Link
"([^\\s%g{}\\[\\]]+?)" + // Link
"[%s]*\\{(.+)\\}" + // Tooltip
"[%s]*\\]\\]";
private static final String S_LINK_WITH_OPTIONAL_TOOLTIP_WITH_OPTIONAL_LABEL = "\\[\\[[%s]*" + //
"([^%s%g]+?)" + // Link
"([^%s%g\\[\\]]+?)" + // Link
"(?:[%s]*\\{([^{}]*)\\})?" + // Optional tooltip
"(?:[%s]([^%s\\{\\}\\[\\]][^\\[\\]]*))?" + // Optional label
"[%s]*\\]\\]";

View File

@ -55,6 +55,7 @@ import net.sourceforge.plantuml.FileFormatOption;
import net.sourceforge.plantuml.api.ImageDataSimple;
import net.sourceforge.plantuml.core.DiagramDescription;
import net.sourceforge.plantuml.core.ImageData;
import net.sourceforge.plantuml.core.UmlSource;
public class PSystemXearth extends AbstractPSystem {
@ -70,7 +71,8 @@ public class PSystemXearth extends AbstractPSystem {
"terminatorDiscontinuity", "gridDivision", "gridPixelDivision", "bigStars");
final private Collection<String> booleans = Arrays.asList("shadeP", "gridP", "starsP");
public PSystemXearth(int width, int height, Map<String, String> config, List<Marker> markers) {
public PSystemXearth(UmlSource source, int width, int height, Map<String, String> config, List<Marker> markers) {
super(source);
this.width = width;
this.height = height;
this.config = config;

View File

@ -45,6 +45,7 @@ import net.sourceforge.plantuml.command.PSystemBasicFactory;
import net.sourceforge.plantuml.command.regex.Matcher2;
import net.sourceforge.plantuml.command.regex.MyPattern;
import net.sourceforge.plantuml.command.regex.Pattern2;
import net.sourceforge.plantuml.core.UmlSource;
public class PSystemXearthFactory extends PSystemBasicFactory<PSystemXearth> {
@ -53,7 +54,8 @@ public class PSystemXearthFactory extends PSystemBasicFactory<PSystemXearth> {
private int width;
private int height;
public PSystemXearth init(String startLine) {
@Override
public PSystemXearth initDiagram(UmlSource source, String startLine) {
this.width = 512;
this.height = 512;
this.config.clear();
@ -72,10 +74,10 @@ public class PSystemXearthFactory extends PSystemBasicFactory<PSystemXearth> {
}
@Override
public PSystemXearth executeLine(PSystemXearth system, String line) {
public PSystemXearth executeLine(UmlSource source, PSystemXearth system, String line) {
if (system == null && line.startsWith("xearth")) {
extractDimension(line);
system = new PSystemXearth(width, height, config, markers);
system = new PSystemXearth(source, width, height, config, markers);
return system;
}
if (system == null) {

View File

@ -43,6 +43,7 @@ import net.sourceforge.plantuml.Direction;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.core.DiagramDescription;
import net.sourceforge.plantuml.core.UmlSource;
import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.CucaDiagram;
import net.sourceforge.plantuml.cucadiagram.Display;
@ -61,8 +62,8 @@ public class ActivityDiagram extends CucaDiagram {
private IEntity lastEntityBrancheConsulted;
private ConditionalContext currentContext;
public ActivityDiagram(ISkinSimple skinParam) {
super(UmlDiagramType.ACTIVITY, skinParam);
public ActivityDiagram(UmlSource source, ISkinSimple skinParam) {
super(source, UmlDiagramType.ACTIVITY, skinParam);
setNamespaceSeparator(null);
}

View File

@ -53,19 +53,13 @@ import net.sourceforge.plantuml.command.CommandRankDir;
import net.sourceforge.plantuml.command.PSystemCommandFactory;
import net.sourceforge.plantuml.command.note.CommandFactoryNoteActivity;
import net.sourceforge.plantuml.command.note.CommandFactoryNoteOnLink;
import net.sourceforge.plantuml.core.UmlSource;
public class ActivityDiagramFactory extends PSystemCommandFactory {
private final ISkinSimple skinParam;
public ActivityDiagramFactory(ISkinSimple skinParam) {
this.skinParam = skinParam;
}
@Override
public ActivityDiagram createEmptyDiagram() {
return new ActivityDiagram(skinParam);
public ActivityDiagram createEmptyDiagram(UmlSource source, ISkinSimple skinParam) {
return new ActivityDiagram(source, skinParam);
}
@Override

View File

@ -66,9 +66,9 @@ public class CommandIf extends SingleLineCommand2<ActivityDiagram> {
new RegexOptional(//
new RegexOr("FIRST", //
new RegexLeaf("STAR", "(\\(\\*(top)?\\))"), //
new RegexLeaf("CODE", "([\\p{L}0-9_.]+)"), //
new RegexLeaf("BAR", "(?:==+)[%s]*([\\p{L}0-9_.]+)[%s]*(?:==+)"), //
new RegexLeaf("QUOTED", "[%g]([^%g]+)[%g](?:[%s]+as[%s]+([\\p{L}0-9_.]+))?"))), //
new RegexLeaf("CODE", "([%pLN_.]+)"), //
new RegexLeaf("BAR", "(?:==+)[%s]*([%pLN_.]+)[%s]*(?:==+)"), //
new RegexLeaf("QUOTED", "[%g]([^%g]+)[%g](?:[%s]+as[%s]+([%pLN_.]+))?"))), //
RegexLeaf.spaceZeroOrMore(), //
//new RegexOptional(new RegexLeaf("ARROW", "([=-]+(?:(left|right|up|down|le?|ri?|up?|do?)(?=[-=.]))?[=-]*\\>)")), //
new RegexOptional(new RegexConcat( //
@ -83,7 +83,7 @@ public class CommandIf extends SingleLineCommand2<ActivityDiagram> {
new RegexOptional(new RegexLeaf("BRACKET", "\\[([^\\]*]+[^\\]]*)\\]")), //
RegexLeaf.spaceZeroOrMore(), //
new RegexOr(//
new RegexLeaf("IF1", "if[%s]*[%g]([^%g]*)[%g][%s]*(?:as[%s]+([\\p{L}0-9_.]+)[%s]+)?"), //
new RegexLeaf("IF1", "if[%s]*[%g]([^%g]*)[%g][%s]*(?:as[%s]+([%pLN_.]+)[%s]+)?"), //
new RegexLeaf("IF2", "if[%s]+(.+?)")), //
RegexLeaf.spaceZeroOrMore(), //
new RegexOptional(new RegexLeaf("then")), //

View File

@ -80,9 +80,9 @@ public class CommandLinkActivity extends SingleLineCommand2<ActivityDiagram> {
new RegexOptional(//
new RegexOr("FIRST", //
new RegexLeaf("STAR", "(\\(\\*(top)?\\))"), //
new RegexLeaf("CODE", "([\\p{L}0-9][\\p{L}0-9_.]*)"), //
new RegexLeaf("BAR", "(?:==+)[%s]*([\\p{L}0-9_.]+)[%s]*(?:==+)"), //
new RegexLeaf("QUOTED", "[%g]([^%g]+)[%g](?:[%s]+as[%s]+([\\p{L}0-9_.]+))?"))), //
new RegexLeaf("CODE", "([%pLN][%pLN_.]*)"), //
new RegexLeaf("BAR", "(?:==+)[%s]*([%pLN_.]+)[%s]*(?:==+)"), //
new RegexLeaf("QUOTED", "[%g]([^%g]+)[%g](?:[%s]+as[%s]+([%pLN_.]+))?"))), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREOTYPE", "(\\<\\<.*\\>\\>)?"), //
RegexLeaf.spaceZeroOrMore(), //
@ -103,9 +103,9 @@ public class CommandLinkActivity extends SingleLineCommand2<ActivityDiagram> {
new RegexOr("FIRST2", //
new RegexLeaf("STAR2", "(\\(\\*(top|\\d+)?\\))"), //
new RegexLeaf("OPENBRACKET2", "(\\{)"), //
new RegexLeaf("CODE2", "([\\p{L}0-9][\\p{L}0-9_.]*)"), //
new RegexLeaf("BAR2", "(?:==+)[%s]*([\\p{L}0-9_.]+)[%s]*(?:==+)"), //
new RegexLeaf("QUOTED2", "[%g]([^%g]+)[%g](?:[%s]+as[%s]+([\\p{L}0-9][\\p{L}0-9_.]*))?"), //
new RegexLeaf("CODE2", "([%pLN][%pLN_.]*)"), //
new RegexLeaf("BAR2", "(?:==+)[%s]*([%pLN_.]+)[%s]*(?:==+)"), //
new RegexLeaf("QUOTED2", "[%g]([^%g]+)[%g](?:[%s]+as[%s]+([%pLN][%pLN_.]*))?"), //
new RegexLeaf("QUOTED_INVISIBLE2", "(\\w.*?)")), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREOTYPE2", "(\\<\\<.*\\>\\>)?"), //

View File

@ -80,7 +80,7 @@ public class CommandLinkLongActivity extends CommandMultilines2<ActivityDiagram>
@Override
public String getPatternEnd() {
return "(?i)^[%s]*([^%g]*)[%g](?:[%s]+as[%s]+([\\p{L}0-9][\\p{L}0-9_.]*))?[%s]*(\\<\\<.*\\>\\>)?[%s]*(?:in[%s]+([%g][^%g]+[%g]|\\S+))?[%s]*(#\\w+)?$";
return "^[%s]*([^%g]*)[%g](?:[%s]+as[%s]+([%pLN][%pLN_.]*))?[%s]*(\\<\\<.*\\>\\>)?[%s]*(?:in[%s]+([%g][^%g]+[%g]|\\S+))?[%s]*(#\\w+)?$";
}
static IRegex getRegexConcat() {
@ -88,9 +88,9 @@ public class CommandLinkLongActivity extends CommandMultilines2<ActivityDiagram>
new RegexOptional(//
new RegexOr("FIRST", //
new RegexLeaf("STAR", "(\\(\\*(top)?\\))"), //
new RegexLeaf("CODE", "([\\p{L}0-9][\\p{L}0-9_.]*)"), //
new RegexLeaf("BAR", "(?:==+)[%s]*([\\p{L}0-9_.]+)[%s]*(?:==+)"), //
new RegexLeaf("QUOTED", "[%g]([^%g]+)[%g](?:[%s]+as[%s]+([\\p{L}0-9_.]+))?"))), //
new RegexLeaf("CODE", "([%pLN][%pLN_.]*)"), //
new RegexLeaf("BAR", "(?:==+)[%s]*([%pLN_.]+)[%s]*(?:==+)"), //
new RegexLeaf("QUOTED", "[%g]([^%g]+)[%g](?:[%s]+as[%s]+([%pLN_.]+))?"))), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREOTYPE", "(\\<\\<.*\\>\\>)?"), //
RegexLeaf.spaceZeroOrMore(), //

View File

@ -49,6 +49,7 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlanes;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.core.DiagramDescription;
import net.sourceforge.plantuml.core.ImageData;
import net.sourceforge.plantuml.core.UmlSource;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.graphic.Rainbow;
@ -73,8 +74,8 @@ public class ActivityDiagram3 extends UmlDiagram {
private final Swimlanes swinlanes = new Swimlanes(getSkinParam(), getPragma());
public ActivityDiagram3(ISkinSimple skinParam) {
super(UmlDiagramType.ACTIVITY, skinParam);
public ActivityDiagram3(UmlSource source, ISkinSimple skinParam) {
super(source, UmlDiagramType.ACTIVITY, skinParam);
}
private void manageSwimlaneStrategy() {

View File

@ -87,15 +87,10 @@ import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.CommandDecoratorMultine;
import net.sourceforge.plantuml.command.CommandFootboxIgnored;
import net.sourceforge.plantuml.command.PSystemCommandFactory;
import net.sourceforge.plantuml.core.UmlSource;
public class ActivityDiagramFactory3 extends PSystemCommandFactory {
private final ISkinSimple skinParam;
public ActivityDiagramFactory3(ISkinSimple skinParam) {
this.skinParam = skinParam;
}
@Override
protected List<Command> createCommands() {
@ -163,8 +158,8 @@ public class ActivityDiagramFactory3 extends PSystemCommandFactory {
}
@Override
public ActivityDiagram3 createEmptyDiagram() {
return new ActivityDiagram3(skinParam);
public ActivityDiagram3 createEmptyDiagram(UmlSource source, ISkinSimple skinParam) {
return new ActivityDiagram3(source, skinParam);
}
}

View File

@ -54,7 +54,7 @@ public class CommandGoto extends SingleLineCommand2<ActivityDiagram3> {
return RegexConcat.build(CommandGoto.class.getName(), RegexLeaf.start(), //
new RegexLeaf("goto"), //
RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("NAME", "([\\p{L}0-9_.]+)"), //
new RegexLeaf("NAME", "([%pLN_.]+)"), //
new RegexLeaf(";?"), //
RegexLeaf.end());
}

View File

@ -54,7 +54,7 @@ public class CommandLabel extends SingleLineCommand2<ActivityDiagram3> {
return RegexConcat.build(CommandLabel.class.getName(), RegexLeaf.start(), //
new RegexLeaf("label"), //
RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("NAME", "([\\p{L}0-9_.]+)"), //
new RegexLeaf("NAME", "([%pLN_.]+)"), //
new RegexLeaf(";?"), //
RegexLeaf.end());
}

View File

@ -64,7 +64,7 @@ public class CommandNoteLong3 extends CommandMultilines2<ActivityDiagram3> {
@Override
public String getPatternEnd() {
return "(?i)^end[%s]?note$";
return "^end[%s]?note$";
}
@Override

View File

@ -88,7 +88,9 @@ public class CommandRepeatWhile3Multilines extends CommandMultilines3<ActivityDi
// System.err.println("linesLast=" + lineLast);
//
// final HtmlColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(line0.get("COLOR", 0));
// final HtmlColor color =
// diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(line0.get("COLOR",
// 0));
final String test = line0.get("TEST1", 0);
Display testDisplay = Display.getWithNewlines(test);
@ -105,8 +107,8 @@ public class CommandRepeatWhile3Multilines extends CommandMultilines3<ActivityDi
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]*\\(",
Pattern.CASE_INSENSITIVE));
final List<Display> splitted = testDisplay
.splitMultiline(MyPattern.cmpile("\\)[%s]*(is|equals?)[%s]*\\("));
if (splitted.size() == 2) {
testDisplay = splitted.get(0);
yes = splitted.get(1);

View File

@ -44,6 +44,9 @@ public class FtileUtils {
}
public static Ftile addConnection(Ftile ftile, Collection<Connection> connections) {
if (connections.size() == 0) {
return ftile;
}
return new FtileWithConnection(ftile, connections);
}

View File

@ -51,7 +51,7 @@ class FtileWithConnection extends FtileDecorate {
FtileWithConnection(Ftile ftile, Collection<Connection> connections) {
super(ftile);
if (connections == null || connections.size() == 0) {
if (Objects.requireNonNull(connections).size() == 0) {
throw new IllegalArgumentException();
}
this.connections.addAll(connections);

View File

@ -108,7 +108,7 @@ public class FtileFactoryDelegatorSwitch extends FtileFactoryDelegator {
}
final FtileSwitchWithManyLinks result = new FtileSwitchWithManyLinks(ftiles, branches, swimlane, diamond1,
diamond2, getStringBounder(), arrowColor);
return result.addLinks();
return result.addLinks(getStringBounder());
}

View File

@ -208,7 +208,9 @@ public class ParallelBuilderFork extends AbstractParallelFtilesBuilder {
def = Rainbow.build(skinParam());
}
final Rainbow rainbow = tmp.getOutLinkRendering().getRainbow(def);
conns.add(new ConnectionOut(tmp, out, x, rainbow, getJustBeforeBar2(middle, getStringBounder())));
if (tmp.calculateDimension(getStringBounder()).hasPointOut()) {
conns.add(new ConnectionOut(tmp, out, x, rainbow, getJustBeforeBar2(middle, getStringBounder())));
}
x += dim.getWidth();
}
result = FtileUtils.addConnection(result, conns);

View File

@ -106,7 +106,7 @@ public class ParallelBuilderMerge extends AbstractParallelFtilesBuilder {
result = new FtileAssemblySimple(result, out);
final List<Connection> conns = new ArrayList<>();
final UTranslate diamondTranslate = result.getTranslateFor(out, getStringBounder());
int i = 0;
double x = 0;
for (Ftile tmp : list99) {
final Dimension2D dim = tmp.calculateDimension(getStringBounder());
@ -119,9 +119,11 @@ public class ParallelBuilderMerge extends AbstractParallelFtilesBuilder {
def = Rainbow.build(skinParam());
}
final Rainbow rainbow = tmp.getOutLinkRendering().getRainbow(def);
conns.add(new ConnectionHorizontalThenVertical(tmp, out, rainbow, translate0, diamondTranslate, i));
if (tmp.calculateDimension(getStringBounder()).hasPointOut()) {
conns.add(new ConnectionHorizontalThenVertical(tmp, out, rainbow, translate0, diamondTranslate));
}
x += dim.getWidth();
i++;
}
return FtileUtils.addConnection(result, conns);
}
@ -131,31 +133,32 @@ public class ParallelBuilderMerge extends AbstractParallelFtilesBuilder {
private final Rainbow arrowColor;
private final UTranslate diamondTranslate;
private final UTranslate translate0;
private final int counter;
public ConnectionHorizontalThenVertical(Ftile tile, Ftile diamond, Rainbow arrowColor, UTranslate translate0,
UTranslate diamondTranslate, int counter) {
UTranslate diamondTranslate) {
super(tile, diamond);
this.arrowColor = arrowColor;
this.diamondTranslate = diamondTranslate;
this.translate0 = translate0;
this.counter = counter;
}
public void drawU(UGraphic ug) {
final StringBounder stringBounder = ug.getStringBounder();
final Point2D p1 = getP1(stringBounder);
final Point2D p2 = getP2(stringBounder);
final Point2D p2 = getP2(stringBounder, p1.getX());
final double x1 = p1.getX();
final double y1 = p1.getY();
final double x2 = p2.getX();
final double y2 = p2.getY();
UPolygon endDecoration = null;
if (counter == 0) {
final UTranslate arrival = arrivalOnDiamond(stringBounder, p1.getX());
final UPolygon endDecoration;
if (arrival.getDx() < 0) {
endDecoration = Arrows.asToRight();
} else if (counter == 1) {
} else if (arrival.getDx() > 0) {
endDecoration = Arrows.asToLeft();
} else {
endDecoration = Arrows.asToDown();
}
final Snake snake = Snake.create(arrowColor, endDecoration);
snake.addPoint(x1, y1);
@ -169,17 +172,30 @@ public class ParallelBuilderMerge extends AbstractParallelFtilesBuilder {
return translate0.getTranslated(getFtile1().calculateDimension(stringBounder).getPointOut());
}
private Point2D getP2(final StringBounder stringBounder) {
final Point2D result = diamondTranslate
.getTranslated(getFtile2().calculateDimension(stringBounder).getPointOut());
private Point2D getP2(StringBounder stringBounder, double startX) {
final UTranslate arrival = arrivalOnDiamond(stringBounder, startX);
return arrival.getTranslated(getDiamondOut(stringBounder));
}
public Point2D getDiamondOut(StringBounder stringBounder) {
return diamondTranslate.getTranslated(getFtile2().calculateDimension(stringBounder).getPointOut());
}
public UTranslate arrivalOnDiamond(StringBounder stringBounder, double startX) {
final Point2D result = getDiamondOut(stringBounder);
final Dimension2D dim = getFtile2().calculateDimension(stringBounder);
UTranslate arrival = new UTranslate();
if (counter == 0) {
final double a = result.getX() - dim.getWidth() / 2;
final double b = result.getX() + dim.getWidth() / 2;
final UTranslate arrival;
if (startX < a) {
arrival = new UTranslate(-dim.getWidth() / 2, -dim.getHeight() / 2);
} else if (counter == 1) {
} else if (startX > b) {
arrival = new UTranslate(dim.getWidth() / 2, -dim.getHeight() / 2);
} else {
arrival = new UTranslate(0, -dim.getHeight());
}
return arrival.getTranslated(result);
return arrival;
}
}

View File

@ -195,7 +195,9 @@ public class ParallelBuilderSplit extends AbstractParallelFtilesBuilder {
rainbow = outLinkRendering.getRainbow(Rainbow.build(skinParam()));
}
conns.add(new ConnectionOut(translate0, tmp, out, x, rainbow, getHeightOfMiddle(inner)));
if (tmp.calculateDimension(getStringBounder()).hasPointOut()) {
conns.add(new ConnectionOut(translate0, tmp, out, x, rainbow, getHeightOfMiddle(inner)));
}
x += dim.getWidth();
}
if (last < geom.getLeft()) {

View File

@ -191,8 +191,8 @@ public class FtileSwitchWithManyLinks extends FtileSwitchWithDiamonds {
final double x2 = p2.getX();
final double y2 = p2.getY();
final Snake snake = Snake.create(null, arrowColor, Arrows.asToDown())
.withLabel(getLabelPositive(branch), VerticalAlignment.BOTTOM);
final Snake snake = Snake.create(null, arrowColor, Arrows.asToDown()).withLabel(getLabelPositive(branch),
VerticalAlignment.BOTTOM);
if (x2 < p1d.getX() - margin || x2 > p1b.getX() + margin) {
snake.addPoint(x2, p1d.getY());
snake.addPoint(x2, y2);
@ -274,15 +274,18 @@ public class FtileSwitchWithManyLinks extends FtileSwitchWithDiamonds {
return max + 10;
}
public Ftile addLinks() {
public Ftile addLinks(StringBounder stringBounder) {
final List<Connection> conns = new ArrayList<>();
conns.add(new ConnectionHorizontalThenVertical(tiles.get(0), branches.get(0)));
conns.add(new ConnectionHorizontalThenVertical(tiles.get(tiles.size() - 1), branches.get(tiles.size() - 1)));
conns.add(new ConnectionVerticalThenHorizontal(tiles.get(0)));
conns.add(new ConnectionVerticalThenHorizontal(tiles.get(tiles.size() - 1)));
for (int i = 1; i < tiles.size() - 1; i++) {
conns.add(new ConnectionVerticalTop(tiles.get(i), branches.get(i)));
conns.add(new ConnectionVerticalBottom(tiles.get(i)));
final Ftile tile = tiles.get(i);
conns.add(new ConnectionVerticalTop(tile, branches.get(i)));
if (tile.calculateDimension(stringBounder).hasPointOut()) {
conns.add(new ConnectionVerticalBottom(tile));
}
}
return FtileUtils.addConnection(this, conns);

View File

@ -35,13 +35,14 @@
*/
package net.sourceforge.plantuml.api;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.core.Diagram;
import net.sourceforge.plantuml.core.DiagramType;
import net.sourceforge.plantuml.core.UmlSource;
public interface PSystemFactory {
Diagram createSystem(UmlSource source);
Diagram createSystem(UmlSource source, ISkinSimple skinParam);
DiagramType getDiagramType();

View File

@ -3,25 +3,25 @@
Original Author: Andreas Gadermaier <up.gadermaier@gmail.com>
*/
package ext.plantuml.com.at.gadermaier.argon2;
package net.sourceforge.plantuml.argon2;
import static ext.plantuml.com.at.gadermaier.argon2.Constants.Defaults.LANES_DEF;
import static ext.plantuml.com.at.gadermaier.argon2.Constants.Defaults.LOG_M_COST_DEF;
import static ext.plantuml.com.at.gadermaier.argon2.Constants.Defaults.OUTLEN_DEF;
import static ext.plantuml.com.at.gadermaier.argon2.Constants.Defaults.TYPE_DEF;
import static ext.plantuml.com.at.gadermaier.argon2.Constants.Defaults.T_COST_DEF;
import static ext.plantuml.com.at.gadermaier.argon2.Constants.Defaults.VERSION_DEF;
import static net.sourceforge.plantuml.argon2.Constants.Defaults.LANES_DEF;
import static net.sourceforge.plantuml.argon2.Constants.Defaults.LOG_M_COST_DEF;
import static net.sourceforge.plantuml.argon2.Constants.Defaults.OUTLEN_DEF;
import static net.sourceforge.plantuml.argon2.Constants.Defaults.TYPE_DEF;
import static net.sourceforge.plantuml.argon2.Constants.Defaults.T_COST_DEF;
import static net.sourceforge.plantuml.argon2.Constants.Defaults.VERSION_DEF;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.Charset;
import java.util.Arrays;
import ext.plantuml.com.at.gadermaier.argon2.algorithm.FillMemory;
import ext.plantuml.com.at.gadermaier.argon2.algorithm.Finalize;
import ext.plantuml.com.at.gadermaier.argon2.algorithm.Initialize;
import ext.plantuml.com.at.gadermaier.argon2.model.Argon2Type;
import ext.plantuml.com.at.gadermaier.argon2.model.Instance;
import net.sourceforge.plantuml.argon2.algorithm.FillMemory;
import net.sourceforge.plantuml.argon2.algorithm.Finalize;
import net.sourceforge.plantuml.argon2.algorithm.Initialize;
import net.sourceforge.plantuml.argon2.model.Argon2Type;
import net.sourceforge.plantuml.argon2.model.Instance;
public class Argon2 {

View File

@ -3,7 +3,7 @@
Original Author: Andreas Gadermaier <up.gadermaier@gmail.com>
*/
package ext.plantuml.com.at.gadermaier.argon2;
package net.sourceforge.plantuml.argon2;
public class Argon2Factory {
public static Argon2 create(){

View File

@ -3,9 +3,9 @@
Original Author: Andreas Gadermaier <up.gadermaier@gmail.com>
*/
package ext.plantuml.com.at.gadermaier.argon2;
package net.sourceforge.plantuml.argon2;
import ext.plantuml.com.at.gadermaier.argon2.model.Argon2Type;
import net.sourceforge.plantuml.argon2.model.Argon2Type;
public class Constants {

View File

@ -3,7 +3,7 @@
Original Author: Andreas Gadermaier <up.gadermaier@gmail.com>
*/
package ext.plantuml.com.at.gadermaier.argon2;
package net.sourceforge.plantuml.argon2;
public class Util {

View File

@ -0,0 +1,63 @@
/* This file is taken from
https://github.com/andreas1327250/argon2-java
Original Author: Andreas Gadermaier <up.gadermaier@gmail.com>
*/
package net.sourceforge.plantuml.argon2;
import static net.sourceforge.plantuml.argon2.Constants.Constraints.MAX_AD_LENGTH;
import static net.sourceforge.plantuml.argon2.Constants.Constraints.MAX_ITERATIONS;
import static net.sourceforge.plantuml.argon2.Constants.Constraints.MAX_PARALLELISM;
import static net.sourceforge.plantuml.argon2.Constants.Constraints.MAX_PWD_LENGTH;
import static net.sourceforge.plantuml.argon2.Constants.Constraints.MAX_SALT_LENGTH;
import static net.sourceforge.plantuml.argon2.Constants.Constraints.MAX_SECRET_LENGTH;
import static net.sourceforge.plantuml.argon2.Constants.Constraints.MIN_ITERATIONS;
import static net.sourceforge.plantuml.argon2.Constants.Constraints.MIN_PARALLELISM;
import static net.sourceforge.plantuml.argon2.Constants.Constraints.MIN_PWD_LENGTH;
import static net.sourceforge.plantuml.argon2.Constants.Constraints.MIN_SALT_LENGTH;
import static net.sourceforge.plantuml.argon2.Constants.Messages.ADDITIONAL_MAX_MSG;
import static net.sourceforge.plantuml.argon2.Constants.Messages.M_MIN_MSG;
import static net.sourceforge.plantuml.argon2.Constants.Messages.PWD_MAX_MSG;
import static net.sourceforge.plantuml.argon2.Constants.Messages.PWD_MIN_MSG;
import static net.sourceforge.plantuml.argon2.Constants.Messages.P_MAX_MSG;
import static net.sourceforge.plantuml.argon2.Constants.Messages.P_MIN_MSG;
import static net.sourceforge.plantuml.argon2.Constants.Messages.SALT_MAX_MSG;
import static net.sourceforge.plantuml.argon2.Constants.Messages.SALT_MIN_MSG;
import static net.sourceforge.plantuml.argon2.Constants.Messages.SECRET_MAX_MSG;
import static net.sourceforge.plantuml.argon2.Constants.Messages.T_MAX_MSG;
import static net.sourceforge.plantuml.argon2.Constants.Messages.T_MIN_MSG;
import net.sourceforge.plantuml.argon2.exception.Argon2InvalidParameterException;
class Validation {
static void validateInput(Argon2 argon2){
String message = null;
if (argon2.getLanes() < MIN_PARALLELISM)
message = P_MIN_MSG;
else if (argon2.getLanes() > MAX_PARALLELISM)
message = P_MAX_MSG;
else if(argon2.getMemory() < 2 * argon2.getLanes())
message = M_MIN_MSG;
else if(argon2.getIterations() < MIN_ITERATIONS)
message = T_MIN_MSG;
else if(argon2.getIterations() > MAX_ITERATIONS)
message = T_MAX_MSG;
else if(argon2.getPasswordLength() < MIN_PWD_LENGTH)
message = PWD_MIN_MSG;
else if(argon2.getPasswordLength() > MAX_PWD_LENGTH)
message = PWD_MAX_MSG;
else if(argon2.getSaltLength() < MIN_SALT_LENGTH)
message = SALT_MIN_MSG;
else if(argon2.getSaltLength() > MAX_SALT_LENGTH)
message = SALT_MAX_MSG;
else if(argon2.getSecretLength() > MAX_SECRET_LENGTH)
message = SECRET_MAX_MSG;
else if(argon2.getAdditionalLength() > MAX_AD_LENGTH)
message = ADDITIONAL_MAX_MSG;
if(message != null)
throw new Argon2InvalidParameterException(message);
}
}

View File

@ -3,9 +3,9 @@
Original Author: Andreas Gadermaier <up.gadermaier@gmail.com>
*/
package ext.plantuml.com.at.gadermaier.argon2.algorithm;
package net.sourceforge.plantuml.argon2.algorithm;
import ext.plantuml.com.at.gadermaier.argon2.model.Block;
import net.sourceforge.plantuml.argon2.model.Block;
class FillBlock {

View File

@ -3,9 +3,9 @@
Original Author: Andreas Gadermaier <up.gadermaier@gmail.com>
*/
package ext.plantuml.com.at.gadermaier.argon2.algorithm;
package net.sourceforge.plantuml.argon2.algorithm;
import static ext.plantuml.com.at.gadermaier.argon2.Constants.ARGON2_SYNC_POINTS;
import static net.sourceforge.plantuml.argon2.Constants.ARGON2_SYNC_POINTS;
import java.util.ArrayList;
import java.util.List;
@ -14,8 +14,8 @@ import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import ext.plantuml.com.at.gadermaier.argon2.model.Instance;
import ext.plantuml.com.at.gadermaier.argon2.model.Position;
import net.sourceforge.plantuml.argon2.model.Instance;
import net.sourceforge.plantuml.argon2.model.Position;
public class FillMemory {

View File

@ -3,17 +3,17 @@
Original Author: Andreas Gadermaier <up.gadermaier@gmail.com>
*/
package ext.plantuml.com.at.gadermaier.argon2.algorithm;
package net.sourceforge.plantuml.argon2.algorithm;
import static ext.plantuml.com.at.gadermaier.argon2.Constants.ARGON2_ADDRESSES_IN_BLOCK;
import static ext.plantuml.com.at.gadermaier.argon2.Constants.ARGON2_VERSION_10;
import static net.sourceforge.plantuml.argon2.Constants.ARGON2_ADDRESSES_IN_BLOCK;
import static net.sourceforge.plantuml.argon2.Constants.ARGON2_VERSION_10;
import ext.plantuml.com.at.gadermaier.argon2.Constants;
import ext.plantuml.com.at.gadermaier.argon2.Util;
import ext.plantuml.com.at.gadermaier.argon2.model.Argon2Type;
import ext.plantuml.com.at.gadermaier.argon2.model.Block;
import ext.plantuml.com.at.gadermaier.argon2.model.Instance;
import ext.plantuml.com.at.gadermaier.argon2.model.Position;
import net.sourceforge.plantuml.argon2.Constants;
import net.sourceforge.plantuml.argon2.Util;
import net.sourceforge.plantuml.argon2.model.Argon2Type;
import net.sourceforge.plantuml.argon2.model.Block;
import net.sourceforge.plantuml.argon2.model.Instance;
import net.sourceforge.plantuml.argon2.model.Position;
class FillSegment {

View File

@ -3,11 +3,11 @@
Original Author: Andreas Gadermaier <up.gadermaier@gmail.com>
*/
package ext.plantuml.com.at.gadermaier.argon2.algorithm;
package net.sourceforge.plantuml.argon2.algorithm;
import ext.plantuml.com.at.gadermaier.argon2.Argon2;
import ext.plantuml.com.at.gadermaier.argon2.model.Block;
import ext.plantuml.com.at.gadermaier.argon2.model.Instance;
import net.sourceforge.plantuml.argon2.Argon2;
import net.sourceforge.plantuml.argon2.model.Block;
import net.sourceforge.plantuml.argon2.model.Instance;
public class Finalize {

View File

@ -3,15 +3,15 @@
Original Author: Andreas Gadermaier <up.gadermaier@gmail.com>
*/
package ext.plantuml.com.at.gadermaier.argon2.algorithm;
package net.sourceforge.plantuml.argon2.algorithm;
import static ext.plantuml.com.at.gadermaier.argon2.Constants.ARGON2_BLOCK_SIZE;
import static ext.plantuml.com.at.gadermaier.argon2.Constants.ARGON2_PREHASH_DIGEST_LENGTH;
import static ext.plantuml.com.at.gadermaier.argon2.Constants.ARGON2_PREHASH_SEED_LENGTH;
import static net.sourceforge.plantuml.argon2.Constants.ARGON2_BLOCK_SIZE;
import static net.sourceforge.plantuml.argon2.Constants.ARGON2_PREHASH_DIGEST_LENGTH;
import static net.sourceforge.plantuml.argon2.Constants.ARGON2_PREHASH_SEED_LENGTH;
import ext.plantuml.com.at.gadermaier.argon2.Util;
import ext.plantuml.com.at.gadermaier.argon2.blake2.Blake2b;
import ext.plantuml.com.at.gadermaier.argon2.model.Block;
import net.sourceforge.plantuml.argon2.Util;
import net.sourceforge.plantuml.argon2.blake2.Blake2b;
import net.sourceforge.plantuml.argon2.model.Block;
class Functions {

View File

@ -3,15 +3,15 @@
Original Author: Andreas Gadermaier <up.gadermaier@gmail.com>
*/
package ext.plantuml.com.at.gadermaier.argon2.algorithm;
package net.sourceforge.plantuml.argon2.algorithm;
import static ext.plantuml.com.at.gadermaier.argon2.Constants.ARGON2_BLOCK_SIZE;
import static ext.plantuml.com.at.gadermaier.argon2.Constants.ARGON2_PREHASH_DIGEST_LENGTH;
import static ext.plantuml.com.at.gadermaier.argon2.Constants.ARGON2_PREHASH_SEED_LENGTH;
import static net.sourceforge.plantuml.argon2.Constants.ARGON2_BLOCK_SIZE;
import static net.sourceforge.plantuml.argon2.Constants.ARGON2_PREHASH_DIGEST_LENGTH;
import static net.sourceforge.plantuml.argon2.Constants.ARGON2_PREHASH_SEED_LENGTH;
import ext.plantuml.com.at.gadermaier.argon2.Argon2;
import ext.plantuml.com.at.gadermaier.argon2.Util;
import ext.plantuml.com.at.gadermaier.argon2.model.Instance;
import net.sourceforge.plantuml.argon2.Argon2;
import net.sourceforge.plantuml.argon2.Util;
import net.sourceforge.plantuml.argon2.model.Instance;
public class Initialize {

View File

@ -23,12 +23,11 @@
You should have received a copy of the CC0 Public Domain Dedication along with
this software. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
*/
package ext.plantuml.com.at.gadermaier.argon2.blake2;
package net.sourceforge.plantuml.argon2.blake2;
import static ext.plantuml.com.at.gadermaier.argon2.blake2.Blake2b.Engine.Assert.*;
import static ext.plantuml.com.at.gadermaier.argon2.blake2.Blake2b.Engine.LittleEndian.*;
import static net.sourceforge.plantuml.argon2.blake2.Blake2b.Engine.Assert.*;
import static net.sourceforge.plantuml.argon2.blake2.Blake2b.Engine.LittleEndian.*;
import java.io.PrintStream;
import java.security.Key;

View File

@ -3,7 +3,7 @@
Original Author: Andreas Gadermaier <up.gadermaier@gmail.com>
*/
package ext.plantuml.com.at.gadermaier.argon2.exception;
package net.sourceforge.plantuml.argon2.exception;
/* dislike checked exceptions */
class Argon2Exception extends RuntimeException {

View File

@ -3,7 +3,7 @@
Original Author: Andreas Gadermaier <up.gadermaier@gmail.com>
*/
package ext.plantuml.com.at.gadermaier.argon2.exception;
package net.sourceforge.plantuml.argon2.exception;
public class Argon2InvalidParameterException extends Argon2Exception{
public Argon2InvalidParameterException(String message) {

View File

@ -3,7 +3,7 @@
Original Author: Andreas Gadermaier <up.gadermaier@gmail.com>
*/
package ext.plantuml.com.at.gadermaier.argon2.model;
package net.sourceforge.plantuml.argon2.model;
public enum Argon2Type {
Argon2d, Argon2i, Argon2id;

View File

@ -3,15 +3,15 @@
Original Author: Andreas Gadermaier <up.gadermaier@gmail.com>
*/
package ext.plantuml.com.at.gadermaier.argon2.model;
package net.sourceforge.plantuml.argon2.model;
import static ext.plantuml.com.at.gadermaier.argon2.Constants.ARGON2_BLOCK_SIZE;
import static ext.plantuml.com.at.gadermaier.argon2.Constants.ARGON2_QWORDS_IN_BLOCK;
import static net.sourceforge.plantuml.argon2.Constants.ARGON2_BLOCK_SIZE;
import static net.sourceforge.plantuml.argon2.Constants.ARGON2_QWORDS_IN_BLOCK;
import java.util.Arrays;
import ext.plantuml.com.at.gadermaier.argon2.Util;
import net.sourceforge.plantuml.argon2.Util;
public class Block {

View File

@ -3,11 +3,11 @@
Original Author: Andreas Gadermaier <up.gadermaier@gmail.com>
*/
package ext.plantuml.com.at.gadermaier.argon2.model;
package net.sourceforge.plantuml.argon2.model;
import static ext.plantuml.com.at.gadermaier.argon2.Constants.ARGON2_SYNC_POINTS;
import static net.sourceforge.plantuml.argon2.Constants.ARGON2_SYNC_POINTS;
import ext.plantuml.com.at.gadermaier.argon2.Argon2;
import net.sourceforge.plantuml.argon2.Argon2;
public class Instance {

View File

@ -3,7 +3,7 @@
Original Author: Andreas Gadermaier <up.gadermaier@gmail.com>
*/
package ext.plantuml.com.at.gadermaier.argon2.model;
package net.sourceforge.plantuml.argon2.model;
public class Position {

View File

@ -49,6 +49,7 @@ import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.core.DiagramDescription;
import net.sourceforge.plantuml.core.ImageData;
import net.sourceforge.plantuml.core.UmlSource;
import net.sourceforge.plantuml.graphic.InnerStrategy;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.svek.TextBlockBackcolored;
@ -68,8 +69,8 @@ public class BoardDiagram extends UmlDiagram {
return new DiagramDescription("Board");
}
public BoardDiagram() {
super(UmlDiagramType.BOARD);
public BoardDiagram(UmlSource source) {
super(source, UmlDiagramType.BOARD);
}
@Override

View File

@ -38,9 +38,11 @@ package net.sourceforge.plantuml.board;
import java.util.ArrayList;
import java.util.List;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.PSystemCommandFactory;
import net.sourceforge.plantuml.core.DiagramType;
import net.sourceforge.plantuml.core.UmlSource;
public class BoardDiagramFactory extends PSystemCommandFactory {
@ -65,8 +67,8 @@ public class BoardDiagramFactory extends PSystemCommandFactory {
}
@Override
public BoardDiagram createEmptyDiagram() {
return new BoardDiagram();
public BoardDiagram createEmptyDiagram(UmlSource source, ISkinSimple skinParam) {
return new BoardDiagram(source);
}
}

View File

@ -48,6 +48,7 @@ import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.core.DiagramDescription;
import net.sourceforge.plantuml.core.ImageData;
import net.sourceforge.plantuml.core.UmlSource;
import net.sourceforge.plantuml.graphic.UDrawable;
import net.sourceforge.plantuml.ugraphic.ImageBuilder;
@ -73,8 +74,8 @@ public class BpmDiagram extends UmlDiagram {
return new DiagramDescription("(Bpm Diagram)");
}
public BpmDiagram() {
super(UmlDiagramType.BPM);
public BpmDiagram(UmlSource source) {
super(source, UmlDiagramType.BPM);
}
@Override

View File

@ -39,9 +39,11 @@ import java.util.ArrayList;
import java.util.List;
import net.sourceforge.plantuml.AbstractPSystem;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.PSystemCommandFactory;
import net.sourceforge.plantuml.core.DiagramType;
import net.sourceforge.plantuml.core.UmlSource;
public class BpmDiagramFactory extends PSystemCommandFactory {
@ -63,8 +65,8 @@ public class BpmDiagramFactory extends PSystemCommandFactory {
}
@Override
public AbstractPSystem createEmptyDiagram() {
return new BpmDiagram();
public AbstractPSystem createEmptyDiagram(UmlSource source, ISkinSimple skinParam) {
return new BpmDiagram(source);
}
}

View File

@ -53,7 +53,7 @@ public class CommandGoto extends SingleLineCommand2<BpmDiagram> {
return RegexConcat.build(CommandGoto.class.getName(), RegexLeaf.start(), //
new RegexLeaf("goto"), //
RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("ID", "([\\p{L}0-9_.@]+)"), //
new RegexLeaf("ID", "([%pLN_.@]+)"), //
RegexLeaf.end());
}

View File

@ -51,7 +51,7 @@ public class CommandMerge extends SingleLineCommand2<BpmDiagram> {
static IRegex getRegexConcat() {
return RegexConcat.build(CommandMerge.class.getName(), RegexLeaf.start(), //
new RegexLeaf("ID", "([\\p{L}0-9_.@]+)"), //
new RegexLeaf("ID", "([%pLN_.@]+)"), //
new RegexLeaf(":?"), //
new RegexLeaf("\\<\\+\\>"), //
RegexLeaf.end());

View File

@ -53,7 +53,7 @@ public class CommandResume extends SingleLineCommand2<BpmDiagram> {
return RegexConcat.build(CommandResume.class.getName(), RegexLeaf.start(), //
new RegexLeaf("resume"), //
RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("ID", "([\\p{L}0-9_.@]+)"), //
new RegexLeaf("ID", "([%pLN_.@]+)"), //
RegexLeaf.end());
}

View File

@ -43,12 +43,13 @@ import java.util.List;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.core.DiagramDescription;
import net.sourceforge.plantuml.core.UmlSource;
import net.sourceforge.plantuml.cucadiagram.CucaDiagram;
public abstract class AbstractEntityDiagram extends CucaDiagram {
public AbstractEntityDiagram(UmlDiagramType type, ISkinSimple orig) {
super(type, orig);
public AbstractEntityDiagram(UmlSource source, UmlDiagramType type, ISkinSimple orig) {
super(source, type, orig);
}
final protected List<String> getDotStrings() {

View File

@ -43,6 +43,7 @@ import net.sourceforge.plantuml.FileFormatOption;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.core.ImageData;
import net.sourceforge.plantuml.core.UmlSource;
import net.sourceforge.plantuml.creole.CreoleMode;
import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.Display;
@ -60,8 +61,8 @@ import net.sourceforge.plantuml.svek.image.EntityImageClass;
public class ClassDiagram extends AbstractClassOrObjectDiagram {
public ClassDiagram(ISkinSimple skinParam) {
super(UmlDiagramType.CLASS, skinParam);
public ClassDiagram(UmlSource source, ISkinSimple skinParam) {
super(source, UmlDiagramType.CLASS, skinParam);
}
private Code getShortName1972(Code code) {

View File

@ -72,6 +72,7 @@ import net.sourceforge.plantuml.command.note.CommandFactoryNoteOnEntity;
import net.sourceforge.plantuml.command.note.CommandFactoryNoteOnLink;
import net.sourceforge.plantuml.command.note.CommandFactoryTipOnEntity;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.core.UmlSource;
import net.sourceforge.plantuml.descdiagram.command.CommandCreateElementMultilines;
import net.sourceforge.plantuml.descdiagram.command.CommandCreateElementParenthesis;
import net.sourceforge.plantuml.descdiagram.command.CommandNewpage;
@ -82,15 +83,9 @@ import net.sourceforge.plantuml.objectdiagram.command.CommandCreateMap;
public class ClassDiagramFactory extends PSystemCommandFactory {
private final ISkinSimple skinParam;
public ClassDiagramFactory(ISkinSimple skinParam) {
this.skinParam = skinParam;
}
@Override
public ClassDiagram createEmptyDiagram() {
return new ClassDiagram(skinParam);
public ClassDiagram createEmptyDiagram(UmlSource source, ISkinSimple skinParam) {
return new ClassDiagram(source, skinParam);
}
@Override

View File

@ -57,7 +57,7 @@ public class CommandAddMethod extends SingleLineCommand2<ClassDiagram> {
static IRegex getRegexConcat() {
return RegexConcat.build(CommandAddMethod.class.getName(), RegexLeaf.start(), //
new RegexLeaf("NAME", "([\\p{L}0-9_.]+|[%g][^%g]+[%g])"), //
new RegexLeaf("NAME", "([%pLN_.]+|[%g][^%g]+[%g])"), //
RegexLeaf.spaceOneOrMore(), //
new RegexLeaf(":"), //
RegexLeaf.spaceOneOrMore(), //

View File

@ -72,8 +72,8 @@ import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagram> {
private static final String CODE = CommandLinkClass.getSeparator() + "?[\\p{L}0-9_]+" + "(?:"
+ CommandLinkClass.getSeparator() + "[\\p{L}0-9_]+)*";
private static final String CODE = CommandLinkClass.getSeparator() + "?[%pLN_]+" + "(?:"
+ CommandLinkClass.getSeparator() + "[%pLN_]+)*";
public static final String CODES = CODE + "(?:\\s*,\\s*" + CODE + ")*";
enum Mode {
@ -86,7 +86,7 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
@Override
public String getPatternEnd() {
return "(?i)^[%s]*\\}[%s]*$";
return "^[%s]*\\}[%s]*$";
}
private static IRegex getRegexConcat() {

View File

@ -58,7 +58,7 @@ public class CommandDiamondAssociation extends SingleLineCommand2<ClassDiagram>
return RegexConcat.build(CommandDiamondAssociation.class.getName(), RegexLeaf.start(), //
new RegexLeaf("\\<\\>"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("CODE", "([\\p{L}0-9_.]+)"), //
new RegexLeaf("CODE", "([%pLN_.]+)"), //
RegexLeaf.end()); //
}

View File

@ -68,7 +68,7 @@ public class CommandHideShowByGender extends SingleLineCommand2<UmlDiagram> {
new RegexLeaf("COMMAND", "(hide|show)"), //
RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("GENDER",
"(?:(class|object|interface|enum|annotation|abstract|[\\p{L}0-9_.]+|[%g][^%g]+[%g]|\\<\\<.*\\>\\>)[%s]+)*?"), //
"(?:(class|object|interface|enum|annotation|abstract|[%pLN_.]+|[%g][^%g]+[%g]|\\<\\<.*\\>\\>)[%s]+)*?"), //
new RegexOptional( //
new RegexConcat( //
new RegexLeaf("EMPTY", "(empty)"), //

View File

@ -66,8 +66,8 @@ import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrObjectDiagram> {
private static final String SINGLE = "[.\\\\]{0,2}[\\p{L}0-9_]+(?:[.\\\\]{1,2}[\\p{L}0-9_]+)*";
private static final String SINGLE_GUILLEMENT = "[%g][.\\\\]{0,2}[\\p{L}0-9_]+(?:[.\\\\]{1,2}[\\p{L}0-9_]+)*[%g]";
private static final String SINGLE = "[.\\\\]{0,2}[%pLN_]+(?:[.\\\\]{1,2}[%pLN_]+)*";
private static final String SINGLE_GUILLEMENT = "[%g][.\\\\]{0,2}[%pLN_]+(?:[.\\\\]{1,2}[%pLN_]+)*[%g]";
private static final String SINGLE2 = "(?:" + SINGLE + "|" + SINGLE_GUILLEMENT + ")";
private static final String COUPLE = "\\([%s]*(" + SINGLE2 + ")[%s]*,[%s]*(" + SINGLE2 + ")[%s]*\\)";
@ -124,7 +124,7 @@ final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrOb
}
private static String getClassIdentifier() {
return "(" + getSeparator() + "?[\\p{L}0-9_$]+(?:" + getSeparator() + "[\\p{L}0-9_$]+)*|[%g][^%g]+[%g])";
return "(" + getSeparator() + "?[%pLN_$]+(?:" + getSeparator() + "[%pLN_$]+)*|[%g][^%g]+[%g])";
}
public static String getSeparator() {

View File

@ -73,7 +73,7 @@ final public class CommandLinkLollipop extends SingleLineCommand2<AbstractClassO
RegexLeaf.spaceOneOrMore() //
)), //
new RegexLeaf("ENT1", "(?:" + optionalKeywords(umlDiagramType) + "[%s]+)?"
+ "(\\.?[\\p{L}0-9_]+(?:\\.[\\p{L}0-9_]+)*|[%g][^%g]+[%g])[%s]*(\\<\\<.*\\>\\>)?"), //
+ "(\\.?[%pLN_]+(?:\\.[%pLN_]+)*|[%g][^%g]+[%g])[%s]*(\\<\\<.*\\>\\>)?"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexOptional(new RegexLeaf("FIRST_LABEL", "[%g]([^%g]+)[%g]")), //
RegexLeaf.spaceZeroOrMore(), //
@ -83,7 +83,7 @@ final public class CommandLinkLollipop extends SingleLineCommand2<AbstractClassO
new RegexOptional(new RegexLeaf("SECOND_LABEL", "[%g]([^%g]+)[%g]")), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("ENT2", "(?:" + optionalKeywords(umlDiagramType) + "[%s]+)?"
+ "(\\.?[\\p{L}0-9_]+(?:\\.[\\p{L}0-9_]+)*|[%g][^%g]+[%g])[%s]*(\\<\\<.*\\>\\>)?"), //
+ "(\\.?[%pLN_]+(?:\\.[%pLN_]+)*|[%g][^%g]+[%g])[%s]*(\\<\\<.*\\>\\>)?"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexOptional( //
new RegexConcat( //

View File

@ -59,7 +59,7 @@ public class CommandStereotype extends SingleLineCommand2<ClassDiagram> {
static IRegex getRegexConcat() {
return RegexConcat.build(CommandStereotype.class.getName(), //
RegexLeaf.start(), //
new RegexLeaf("NAME", "([\\p{L}0-9_.]+|[%g][^%g]+[%g])"), //
new RegexLeaf("NAME", "([%pLN_.]+|[%g][^%g]+[%g])"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREO", "(\\<\\<.*\\>\\>)"), RegexLeaf.end()); //
}

View File

@ -64,7 +64,7 @@ public class CommandUrl extends SingleLineCommand2<AbstractEntityDiagram> {
RegexLeaf.spaceZeroOrMore(), //
new RegexOptional(new RegexLeaf("of|for")), //
RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("CODE", "([\\p{L}0-9_.]+|[%g][^%g]+[%g])"), //
new RegexLeaf("CODE", "([%pLN_.]+|[%g][^%g]+[%g])"), //
RegexLeaf.spaceOneOrMore(), //
new RegexOptional(new RegexLeaf("is")), //
RegexLeaf.spaceZeroOrMore(), //

View File

@ -49,7 +49,7 @@ import net.sourceforge.plantuml.preproc.UncommentReadLine;
public class ArobaseStringCompressor implements StringCompressor {
private final static Pattern2 p = MyPattern.cmpile("(?s)(?i)^[%s]*(@startuml[^\\n\\r]*)?[%s]*(.*?)[%s]*(@enduml)?[%s]*$");
private final static Pattern2 p = MyPattern.cmpile("(?s)^[%s]*(@startuml[^\\n\\r]*)?[%s]*(.*?)[%s]*(@enduml)?[%s]*$");
public String compress(final String data) throws IOException {
final ReadLine r = new UncommentReadLine(ReadLineReader.create(new StringReader(data), "COMPRESS"));

View File

@ -40,12 +40,12 @@ import net.sourceforge.plantuml.TitledDiagram;
public class CommandAffineTransformMultiline extends CommandMultilines<TitledDiagram> {
public CommandAffineTransformMultiline() {
super("(?i)^!transformation[%s]+\\{[%s]*$");
super("^!transformation[%s]+\\{[%s]*$");
}
@Override
public String getPatternEnd() {
return "(?i)^[%s]*!\\}[%s]*$";
return "^[%s]*!\\}[%s]*$";
}
public CommandExecutionResult execute(final TitledDiagram diagram, BlocLines lines) {

View File

@ -60,7 +60,7 @@ public class CommandCaption extends SingleLineCommand2<TitledDiagram> {
new RegexLeaf("(?:[%s]*:[%s]*|[%s]+)"), //
new RegexOr(//
new RegexLeaf("DISPLAY1", "[%g](.*)[%g]"), //
new RegexLeaf("DISPLAY2", "(.*[\\p{L}0-9_.].*)")), //
new RegexLeaf("DISPLAY2", "(.*[%pLN_.].*)")), //
RegexLeaf.end()); //
}

View File

@ -58,7 +58,7 @@ public final class CommandFactorySprite implements SingleMultiFactoryCommand<Wit
new RegexLeaf("sprite"), //
RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("\\$?"), //
new RegexLeaf("NAME", "([-.\\p{L}0-9_]+)"), //
new RegexLeaf("NAME", "([-.%pLN_]+)"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexOptional(new RegexLeaf("DIM", "\\[(\\d+)x(\\d+)/(?:(\\d+)(z)?|(color))\\]")), //
RegexLeaf.spaceZeroOrMore(), //
@ -70,7 +70,7 @@ public final class CommandFactorySprite implements SingleMultiFactoryCommand<Wit
new RegexLeaf("sprite"), //
RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("\\$?"), //
new RegexLeaf("NAME", "([-.\\p{L}0-9_]+)"), //
new RegexLeaf("NAME", "([-.%pLN_]+)"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexOptional(new RegexLeaf("DIM", "\\[(\\d+)x(\\d+)/(?:(\\d+)(z)|(color))\\]")), //
RegexLeaf.spaceOneOrMore(), //
@ -94,7 +94,7 @@ public final class CommandFactorySprite implements SingleMultiFactoryCommand<Wit
@Override
public String getPatternEnd() {
return "(?i)^end[%s]?sprite|\\}$";
return "^end[%s]?sprite|\\}$";
}
protected CommandExecutionResult executeNow(final WithSprite system, BlocLines lines) {

View File

@ -65,7 +65,7 @@ public class CommandFooter extends SingleLineCommand2<TitledDiagram> {
RegexLeaf.spaceOneOrMore()), //
new RegexOr(//
new RegexLeaf("LABEL1", "[%g](.*)[%g]"), //
new RegexLeaf("LABEL2", "(.*[\\p{L}0-9_.].*)")), //
new RegexLeaf("LABEL2", "(.*[%pLN_.].*)")), //
RegexLeaf.end()); //
}

View File

@ -67,7 +67,7 @@ public class CommandHeader extends SingleLineCommand2<TitledDiagram> {
RegexLeaf.spaceOneOrMore()), //
new RegexOr(//
new RegexLeaf("LABEL1", "[%g](.*)[%g]"), //
new RegexLeaf("LABEL2", "(.*[\\p{L}0-9_.].*)")), //
new RegexLeaf("LABEL2", "(.*[%pLN_.].*)")), //
RegexLeaf.end()); //
}

View File

@ -60,7 +60,7 @@ public class CommandLegend extends SingleLineCommand2<TitledDiagram> {
new RegexLeaf("(?:[%s]*:[%s]*|[%s]+)"), //
new RegexOr(//
new RegexLeaf("LEGEND1", "[%g](.*)[%g]"), //
new RegexLeaf("LEGEND2", "(.*[\\p{L}0-9_.].*)")), //
new RegexLeaf("LEGEND2", "(.*[%pLN_.].*)")), //
RegexLeaf.end()); //
}

View File

@ -56,7 +56,7 @@ public class CommandMainframe extends SingleLineCommand2<TitledDiagram> {
new RegexOr( //
new RegexConcat(RegexLeaf.spaceZeroOrMore(), new RegexLeaf(":"), RegexLeaf.spaceZeroOrMore()), //
RegexLeaf.spaceOneOrMore()), //
new RegexLeaf("LABEL", "(.*[\\p{L}0-9_.].*)"), RegexLeaf.end()); //
new RegexLeaf("LABEL", "(.*[%pLN_.].*)"), RegexLeaf.end()); //
}
@Override

View File

@ -45,7 +45,7 @@ public abstract class CommandMultilines<S extends Diagram> implements Command<S>
private final Pattern2 starting;
public CommandMultilines(String patternStart) {
if (patternStart.startsWith("(?i)^") == false || patternStart.endsWith("$") == false) {
if (patternStart.startsWith("^") == false || patternStart.endsWith("$") == false) {
throw new IllegalArgumentException("Bad pattern " + patternStart);
}
this.starting = MyPattern.cmpile(patternStart);

View File

@ -46,7 +46,7 @@ public abstract class CommandMultilinesBracket<S extends Diagram> implements Com
private final Pattern2 starting;
public CommandMultilinesBracket(String patternStart) {
if (patternStart.startsWith("(?i)^") == false || patternStart.endsWith("$") == false) {
if (patternStart.startsWith("^") == false || patternStart.endsWith("$") == false) {
throw new IllegalArgumentException("Bad pattern " + patternStart);
}
this.starting = MyPattern.cmpile(patternStart);

View File

@ -45,12 +45,12 @@ import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class CommandMultilinesCaption extends CommandMultilines<TitledDiagram> {
public CommandMultilinesCaption() {
super("(?i)^caption$");
super("^caption$");
}
@Override
public String getPatternEnd() {
return "(?i)^end[%s]?caption$";
return "^end[%s]?caption$";
}
public CommandExecutionResult execute(final TitledDiagram diagram, BlocLines lines) throws NoSuchColorException {

View File

@ -39,9 +39,9 @@ import net.sourceforge.plantuml.core.Diagram;
public class CommandMultilinesComment extends CommandMultilines<Diagram> {
public static final String COMMENT_MULTILINE_START = "(?i)^[%s]*/[%q]([^%q]|[%q][^/])*$";
public static final String COMMENT_MULTILINE_END = "(?i)^([^%q]|[%q][^/])*[%q]/[%s]*$";
public static final String COMMENT_SINGLE_LINE = "(?i)^[%s]*([%q].*||/[%q].*[%q]/[%s]*)$";
public static final String COMMENT_MULTILINE_START = "^[%s]*/[%q]([^%q]|[%q][^/])*$";
public static final String COMMENT_MULTILINE_END = "^([^%q]|[%q][^/])*[%q]/[%s]*$";
public static final String COMMENT_SINGLE_LINE = "^[%s]*([%q].*||/[%q].*[%q]/[%s]*)$";
public static final String INNER_COMMENT = "/[%q].*?[%q]/";
private CommandMultilinesComment() {

View File

@ -47,12 +47,12 @@ import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class CommandMultilinesFooter extends CommandMultilines<TitledDiagram> {
public CommandMultilinesFooter() {
super("(?i)^(?:(left|right|center)?[%s]*)footer$");
super("^(?:(left|right|center)?[%s]*)footer$");
}
@Override
public String getPatternEnd() {
return "(?i)^end[%s]?footer$";
return "^end[%s]?footer$";
}
public CommandExecutionResult execute(final TitledDiagram diagram, BlocLines lines) throws NoSuchColorException {

View File

@ -47,12 +47,12 @@ import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class CommandMultilinesHeader extends CommandMultilines<TitledDiagram> {
public CommandMultilinesHeader() {
super("(?i)^(?:(left|right|center)?[%s]*)header$");
super("^(?:(left|right|center)?[%s]*)header$");
}
@Override
public String getPatternEnd() {
return "(?i)^end[%s]?header$";
return "^end[%s]?header$";
}
public CommandExecutionResult execute(final TitledDiagram diagram, BlocLines lines) throws NoSuchColorException {

View File

@ -70,7 +70,7 @@ public class CommandMultilinesLegend extends CommandMultilines2<TitledDiagram> {
@Override
public String getPatternEnd() {
return "(?i)^end[%s]?legend$";
return "^end[%s]?legend$";
}
@Override

View File

@ -45,12 +45,12 @@ import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class CommandMultilinesTitle extends CommandMultilines<TitledDiagram> {
public CommandMultilinesTitle() {
super("(?i)^title$");
super("^title$");
}
@Override
public String getPatternEnd() {
return "(?i)^end[%s]?title$";
return "^end[%s]?title$";
}
public CommandExecutionResult execute(final TitledDiagram diagram, BlocLines lines) throws NoSuchColorException {

View File

@ -66,7 +66,7 @@ public class CommandNamespace extends SingleLineCommand2<ClassDiagram> {
return RegexConcat.build(CommandNamespace.class.getName(), RegexLeaf.start(), //
new RegexLeaf("namespace"), //
RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("NAME", "([\\p{L}0-9_][-\\p{L}0-9_.:\\\\]*)"), //
new RegexLeaf("NAME", "([%pLN_][-%pLN_.:\\\\]*)"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREOTYPE", "(\\<\\<.*\\>\\>)?"), //
RegexLeaf.spaceZeroOrMore(), //

View File

@ -74,7 +74,7 @@ public class CommandNamespace2 extends SingleLineCommand2<ClassDiagram> {
new RegexLeaf("as"), //
RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("NAME", "([\\p{L}0-9_][-\\p{L}0-9_.:\\\\]*)"), //
new RegexLeaf("NAME", "([%pLN_][-%pLN_.:\\\\]*)"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREOTYPE", "(\\<\\<.*\\>\\>)?"), //
RegexLeaf.spaceZeroOrMore(), //

View File

@ -66,7 +66,7 @@ public class CommandNamespaceEmpty extends SingleLineCommand2<ClassDiagram> {
return RegexConcat.build(CommandNamespaceEmpty.class.getName(), RegexLeaf.start(), //
new RegexLeaf("namespace"), //
RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("NAME", "([\\p{L}0-9_][-\\p{L}0-9_.:\\\\]*)"), //
new RegexLeaf("NAME", "([%pLN_][-%pLN_.:\\\\]*)"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREOTYPE", "(\\<\\<.*\\>\\>)?"), //
RegexLeaf.spaceZeroOrMore(), //

View File

@ -79,7 +79,7 @@ public class CommandPackage extends SingleLineCommand2<AbstractEntityDiagram> {
RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("as"), //
RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("AS", "([\\p{L}0-9_.]+)") //
new RegexLeaf("AS", "([%pLN_.]+)") //
)), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREOTYPE", "(\\<\\<.*\\>\\>)?"), //

View File

@ -70,7 +70,7 @@ public class CommandPackageEmpty extends SingleLineCommand2<AbstractEntityDiagra
RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("as"), //
RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("CODE", "([\\p{L}0-9_.]+)") //
new RegexLeaf("CODE", "([%pLN_.]+)") //
)), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("COLOR", "(#[0-9a-fA-F]{6}|#?\\w+)?"), //

View File

@ -43,7 +43,7 @@ import net.sourceforge.plantuml.command.regex.MyPattern;
public class CommandSkinParamMultilines extends CommandMultilinesBracket<TitledDiagram> {
public CommandSkinParamMultilines() {
super("(?i)^skinparam[%s]*(?:[%s]+([\\w.]*(?:\\<\\<.*\\>\\>)?[\\w.]*))?[%s]*\\{$");
super("^skinparam[%s]*(?:[%s]+([\\w.]*(?:\\<\\<.*\\>\\>)?[\\w.]*))?[%s]*\\{$");
}
@Override

View File

@ -67,7 +67,7 @@ public class CommandSpriteFile extends SingleLineCommand2<TitledDiagram> {
new RegexLeaf("sprite"), //
RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("\\$?"), //
new RegexLeaf("NAME", "([-\\p{L}0-9_]+)"), //
new RegexLeaf("NAME", "([-%pLN_]+)"), //
RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("FILE", "(.*)"), RegexLeaf.end());
}

View File

@ -60,7 +60,7 @@ public class CommandTitle extends SingleLineCommand2<TitledDiagram> {
new RegexLeaf("(?:[%s]*:[%s]*|[%s]+)"), //
new RegexOr(//
new RegexLeaf("TITLE1", "[%g](.*)[%g]"), //
new RegexLeaf("TITLE2", "(.*[\\p{L}0-9_.].*)")), //
new RegexLeaf("TITLE2", "(.*[%pLN_.].*)")), //
RegexLeaf.end()); //
}

View File

@ -60,7 +60,6 @@ public abstract class PSystemAbstractFactory implements PSystemFactory {
List<StringLocated> trace) {
final ErrorUml err = new ErrorUml(ErrorUmlType.SYNTAX_ERROR, EMPTY_DESCRIPTION, 0, lineLocation);
final PSystemError result = PSystemErrorUtils.buildV2(source, err, null, trace);
result.setSource(source);
return result;
}
@ -68,7 +67,6 @@ public abstract class PSystemAbstractFactory implements PSystemFactory {
List<StringLocated> trace) {
final ErrorUml err = new ErrorUml(ErrorUmlType.EXECUTION_ERROR, stringError, 0, lineLocation);
final PSystemError result = PSystemErrorUtils.buildV2(source, err, null, trace);
result.setSource(source);
return result;
}

View File

@ -38,6 +38,7 @@ package net.sourceforge.plantuml.command;
import net.sourceforge.plantuml.AbstractPSystem;
import net.sourceforge.plantuml.ErrorUml;
import net.sourceforge.plantuml.ErrorUmlType;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.StringLocated;
import net.sourceforge.plantuml.core.Diagram;
import net.sourceforge.plantuml.core.DiagramType;
@ -56,21 +57,20 @@ public abstract class PSystemBasicFactory<P extends AbstractPSystem> extends PSy
this(DiagramType.UML);
}
public abstract P executeLine(P system, String line);
public abstract P executeLine(UmlSource source, P system, String line);
public P init(String startLine) {
return null;
}
public abstract P initDiagram(UmlSource source, String startLine);
private boolean isEmptyLine(StringLocated result) {
return result.getTrimmed().getString().length() == 0;
}
final public Diagram createSystem(UmlSource source) {
@Override
final public Diagram createSystem(UmlSource source, ISkinSimple skinParam) {
source = source.removeInitialSkinparam();
final IteratorCounter2 it = source.iterator2();
final StringLocated startLine = it.next();
P system = init(startLine.getString());
P system = initDiagram(source, startLine.getString());
boolean first = true;
while (it.hasNext()) {
final StringLocated s = it.next();
@ -82,21 +82,15 @@ public abstract class PSystemBasicFactory<P extends AbstractPSystem> extends PSy
if (source.getTotalLineCount() == 2 && source.isStartDef() == false) {
return buildEmptyError(source, s.getLocation(), it.getTrace());
}
if (system != null) {
system.setSource(source);
}
return system;
}
system = executeLine(system, s.getString());
system = executeLine(source, system, s.getString());
if (system == null) {
final ErrorUml err = new ErrorUml(ErrorUmlType.SYNTAX_ERROR, "Syntax Error?", 0, s.getLocation());
// return PSystemErrorUtils.buildV1(source, err, null);
return PSystemErrorUtils.buildV2(source, err, null, it.getTrace());
}
}
if (system != null) {
system.setSource(source);
}
return system;
}

View File

@ -43,6 +43,7 @@ import java.util.List;
import net.sourceforge.plantuml.AbstractPSystem;
import net.sourceforge.plantuml.ErrorUml;
import net.sourceforge.plantuml.ErrorUmlType;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.StringLocated;
import net.sourceforge.plantuml.classdiagram.command.CommandHideShowByGender;
@ -71,7 +72,8 @@ public abstract class PSystemCommandFactory extends PSystemAbstractFactory {
super(type);
}
final public Diagram createSystem(UmlSource source) {
@Override
final public Diagram createSystem(UmlSource source, ISkinSimple skinParam) {
final IteratorCounter2 it = source.iterator2();
final StringLocated startLine = it.next();
if (StartUtils.isArobaseStartDiagram(startLine.getString()) == false) {
@ -84,7 +86,7 @@ public abstract class PSystemCommandFactory extends PSystemAbstractFactory {
}
return buildEmptyError(source, startLine.getLocation(), it.getTrace());
}
AbstractPSystem sys = createEmptyDiagram();
AbstractPSystem sys = createEmptyDiagram(source, skinParam);
while (it.hasNext()) {
if (StartUtils.isArobaseEndDiagram(it.peek().getString())) {
@ -104,7 +106,6 @@ public abstract class PSystemCommandFactory extends PSystemAbstractFactory {
if (sys.isOk() == false) {
return null;
}
sys.setSource(source);
return sys;
}
sys = executeFewLines(sys, source, it);
@ -112,7 +113,6 @@ public abstract class PSystemCommandFactory extends PSystemAbstractFactory {
return sys;
}
}
sys.setSource(source);
return sys;
}
@ -214,7 +214,7 @@ public abstract class PSystemCommandFactory extends PSystemAbstractFactory {
protected abstract List<Command> createCommands();
public abstract AbstractPSystem createEmptyDiagram();
public abstract AbstractPSystem createEmptyDiagram(UmlSource source, ISkinSimple skinParam);
final protected void addCommonCommands1(List<Command> cmds) {
addTitleCommands(cmds);

View File

@ -38,6 +38,7 @@ package net.sourceforge.plantuml.command;
import net.sourceforge.plantuml.AbstractPSystem;
import net.sourceforge.plantuml.ErrorUml;
import net.sourceforge.plantuml.ErrorUmlType;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.StringLocated;
import net.sourceforge.plantuml.core.Diagram;
@ -49,13 +50,14 @@ import net.sourceforge.plantuml.version.IteratorCounter2;
public abstract class PSystemSingleLineFactory extends PSystemAbstractFactory {
protected abstract AbstractPSystem executeLine(String line);
protected abstract AbstractPSystem executeLine(UmlSource source, String line);
protected PSystemSingleLineFactory() {
super(DiagramType.UML);
}
final public Diagram createSystem(UmlSource source) {
@Override
final public Diagram createSystem(UmlSource source, ISkinSimple skinParam) {
if (source.getTotalLineCount() != 3) {
return null;
@ -78,13 +80,12 @@ public abstract class PSystemSingleLineFactory extends PSystemAbstractFactory {
if (StartUtils.isArobaseEndDiagram(s.getString())) {
return buildEmptyError(source, s.getLocation(), it.getTrace());
}
final AbstractPSystem sys = executeLine(s.getString());
final AbstractPSystem sys = executeLine(source, s.getString());
if (sys == null) {
final ErrorUml err = new ErrorUml(ErrorUmlType.SYNTAX_ERROR, "Syntax Error?", 0, s.getLocation());
// return PSystemErrorUtils.buildV1(source, err, null);
return PSystemErrorUtils.buildV2(source, err, null, it.getTrace());
}
sys.setSource(source);
return sys;
}

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