1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-12-22 02:49:06 +00:00
This commit is contained in:
Arnaud Roques 2022-12-16 17:20:14 +01:00
parent 800ead7a8f
commit 8ff88645d4
148 changed files with 646 additions and 607 deletions

View File

@ -175,10 +175,9 @@ public class BlockUml {
if (system == null) {
if (preprocessorError)
system = new PSystemErrorPreprocessor(data, debug);
else {
else
system = new PSystemBuilder().createPSystem(data, rawSource,
skinParam == null ? Collections.<String, String>emptyMap() : skinParam.values());
}
}
return system;
}

View File

@ -212,8 +212,7 @@ public class PSystemBuilder {
if (License.getCurrent() == License.GPL || License.getCurrent() == License.GPLV2) {
factories.add(new PSystemXearthFactory());
}
factories.add(new GanttDiagramFactory(DiagramType.GANTT));
GanttDiagramFactory.clearCache();
factories.add(new GanttDiagramFactory());
factories.add(new FlowDiagramFactory());
// factories.add(new PSystemTreeFactory(DiagramType.JUNGLE));
// factories.add(new PSystemCuteFactory(DiagramType.CUTE));

View File

@ -143,7 +143,7 @@ final public class StringLocated {
public long getFoxSignature() {
if (fox == -1)
fox = FoxSignature.getFoxSignature(getString());
fox = FoxSignature.getFoxSignatureFromRealString(getString());
return fox;
}

View File

@ -35,7 +35,6 @@
*/
package net.sourceforge.plantuml.activitydiagram;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@ -64,8 +63,7 @@ public class ActivityDiagramFactory extends PSystemCommandFactory {
}
@Override
protected List<Command> createCommands() {
final List<Command> cmds = new ArrayList<>();
protected void initCommandsList(List<Command> cmds) {
cmds.add(new CommandFootboxIgnored());
CommonCommands.addCommonCommands1(cmds);
cmds.add(new CommandRankDir());
@ -90,8 +88,6 @@ public class ActivityDiagramFactory extends PSystemCommandFactory {
cmds.add(new CommandHideShow2());
// addCommand(new CommandInnerConcurrent(system));
return cmds;
}
}

View File

@ -35,7 +35,6 @@
*/
package net.sourceforge.plantuml.activitydiagram3;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@ -93,9 +92,8 @@ import net.sourceforge.plantuml.core.UmlSource;
public class ActivityDiagramFactory3 extends PSystemCommandFactory {
@Override
protected List<Command> createCommands() {
protected void initCommandsList(List<Command> cmds) {
final List<Command> cmds = new ArrayList<>();
cmds.add(new CommandFootboxIgnored());
CommonCommands.addCommonCommands1(cmds);
@ -155,8 +153,6 @@ public class ActivityDiagramFactory3 extends PSystemCommandFactory {
cmds.add(new CommandLabel());
cmds.add(new CommandGoto());
cmds.add(CommandDecoratorMultine.create(new CommandElseIf2(), 50));
return cmds;
}
@Override

View File

@ -89,7 +89,7 @@ public class CommandActivity3 extends SingleLineCommand2<ActivityDiagram3> {
new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), //
color().getRegex(), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREO", "(\\<{2}.*\\>{2})?"), //
new RegexLeaf("STEREO", "(\\<\\<.*\\>\\>)?"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf(":"), //
new RegexLeaf("LABEL", "(.*)"), //

View File

@ -78,7 +78,7 @@ public class CommandPartition3 extends SingleLineCommand2<ActivityDiagram3> {
RegexLeaf.spaceOneOrMore(), //
color("BACK2").getRegex())), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREO", "(\\<{2}.*\\>{2})?"), //
new RegexLeaf("STEREO", "(\\<\\<.*\\>\\>)?"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("\\{?"), //
RegexLeaf.end());

View File

@ -62,7 +62,7 @@ public class CommandRepeat3 extends SingleLineCommand2<ActivityDiagram3> {
static IRegex getRegexConcat() {
return RegexConcat.build(CommandRepeat3.class.getName(), RegexLeaf.start(), //
new RegexLeaf("STEREO", "(\\<{2}.*\\>{2})?"), //
new RegexLeaf("STEREO", "(\\<\\<.*\\>\\>)?"), //
ColorParser.exp4(), //
new RegexLeaf("repeat"), //
RegexLeaf.spaceZeroOrMore(), //

View File

@ -46,7 +46,6 @@ import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.activitydiagram3.Branch;
import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractConnection;
import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows;
import net.sourceforge.plantuml.activitydiagram3.ftile.Connection;
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
@ -60,7 +59,6 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamondInsi
import net.sourceforge.plantuml.awt.geom.XDimension2D;
import net.sourceforge.plantuml.awt.geom.XPoint2D;
import net.sourceforge.plantuml.creole.CreoleMode;
import net.sourceforge.plantuml.creole.Parser;
import net.sourceforge.plantuml.creole.Sheet;
import net.sourceforge.plantuml.creole.SheetBlock1;
import net.sourceforge.plantuml.creole.SheetBlock2;

View File

@ -103,9 +103,7 @@ class FtileIfLongHorizontal extends AbstractFtile {
}
private static List<Ftile> alignDiamonds(List<Ftile> diamonds, StringBounder stringBounder) {
double maxOutY = 0;
for (Ftile diamond : diamonds)
maxOutY = Math.max(maxOutY, diamond.calculateDimension(stringBounder).getOutY());
final double maxOutY = getMaxOutY(diamonds, stringBounder);
final List<Ftile> result = new ArrayList<>();
for (int i = 0; i < diamonds.size(); i++) {
@ -118,6 +116,13 @@ class FtileIfLongHorizontal extends AbstractFtile {
return result;
}
private static double getMaxOutY(List<Ftile> diamonds, StringBounder stringBounder) {
double maxOutY = 0;
for (Ftile diamond : diamonds)
maxOutY = Math.max(maxOutY, diamond.calculateDimension(stringBounder).getOutY());
return maxOutY;
}
public Set<Swimlane> getSwimlanes() {
final Set<Swimlane> result = new HashSet<>();
if (getSwimlaneIn() != null)
@ -508,9 +513,9 @@ class FtileIfLongHorizontal extends AbstractFtile {
if (leftOut == null)
return new double[] { Double.NaN, Double.NaN };
if (current == -1)
if (current == -1)
throw new IllegalStateException();
final int first = getFirstSwimlane(stringBounder, allTiles, allSwimlanes);
final int last = getLastSwimlane(stringBounder, allTiles, allSwimlanes);
if (current < first || current > last)
@ -660,14 +665,17 @@ class FtileIfLongHorizontal extends AbstractFtile {
}
private FtileGeometry calculateDimensionInternal(StringBounder stringBounder) {
final double maxOutY = getMaxOutY(diamonds, stringBounder);
XDimension2D result = new XDimension2D(0, 0);
for (Ftile couple : couples)
for (Ftile couple : couples)
result = result.mergeLR(couple.calculateDimension(stringBounder));
XDimension2D dimTile2 = tile2.calculateDimension(stringBounder);
dimTile2 = dimTile2.delta(0, getDiamondsHeight(stringBounder) / 2);
result = result.mergeLR(dimTile2);
result = result.delta(xSeparation * couples.size(), 100);
result = result.delta(xSeparation * couples.size(), Math.max(100, maxOutY));
return new FtileGeometry(result, result.getWidth() / 2, 0);
}

View File

@ -35,7 +35,6 @@
*/
package net.sourceforge.plantuml.board;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@ -52,9 +51,7 @@ public class BoardDiagramFactory extends PSystemCommandFactory {
}
@Override
protected List<Command> createCommands() {
final List<Command> cmds = new ArrayList<>();
protected void initCommandsList(List<Command> cmds) {
CommonCommands.addCommonCommands1(cmds);
cmds.add(new CommandBoardPlus());
// cmds.add(new CommandMindMapTabulation());
@ -63,8 +60,6 @@ public class BoardDiagramFactory extends PSystemCommandFactory {
// cmds.add(new CommandMindMapRoot());
// cmds.add(new CommandMindMapPlus());
// cmds.add(new CommandMindMapDirection());
return cmds;
}
@Override

View File

@ -35,7 +35,6 @@
*/
package net.sourceforge.plantuml.bpm;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@ -52,8 +51,7 @@ public class BpmDiagramFactory extends PSystemCommandFactory {
}
@Override
protected List<Command> createCommands() {
final List<Command> result = new ArrayList<>();
protected void initCommandsList(List<Command> result) {
result.add(new CommandDockedEvent());
result.add(new CommandMerge());
result.add(new CommandResume());
@ -61,7 +59,6 @@ public class BpmDiagramFactory extends PSystemCommandFactory {
result.add(new CommandNewBranch());
result.add(new CommandElseBranch());
result.add(new CommandEndBranch());
return result;
}
@Override

View File

@ -35,7 +35,6 @@
*/
package net.sourceforge.plantuml.classdiagram;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@ -91,8 +90,7 @@ public class ClassDiagramFactory extends PSystemCommandFactory {
}
@Override
protected List<Command> createCommands() {
final List<Command> cmds = new ArrayList<>();
protected void initCommandsList(List<Command> cmds) {
cmds.add(new CommandFootboxIgnored());
cmds.add(new CommandRankDir());
@ -161,7 +159,5 @@ public class ClassDiagramFactory extends PSystemCommandFactory {
cmds.add(new CommandCreateElementMultilines(1));
CommonCommands.addTitleCommands(cmds);
CommonCommands.addCommonCommands2(cmds);
return cmds;
}
}

View File

@ -105,7 +105,7 @@ public class CommandCreateClass extends SingleLineCommand2<ClassDiagram> {
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("TAGS1", Stereotag.pattern() + "?"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREO", "(\\<{2}.*\\>{2})?"), //
new RegexLeaf("STEREO", "(\\<\\<.*\\>\\>)?"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("TAGS2", Stereotag.pattern() + "?"), //
RegexLeaf.spaceZeroOrMore(), //

View File

@ -59,7 +59,9 @@ import net.sourceforge.plantuml.sequencediagram.SequenceDiagram;
public class CommandHideShowByGender extends SingleLineCommand2<UmlDiagram> {
public CommandHideShowByGender() {
public static final CommandHideShowByGender ME = new CommandHideShowByGender();
private CommandHideShowByGender() {
super(getRegexConcat());
}

View File

@ -54,7 +54,9 @@ import net.sourceforge.plantuml.skin.VisibilityModifier;
public class CommandHideShowByVisibility extends SingleLineCommand2<UmlDiagram> {
public CommandHideShowByVisibility() {
public static final CommandHideShowByVisibility ME = new CommandHideShowByVisibility();
private CommandHideShowByVisibility() {
super(getRegexConcat());
}

View File

@ -46,7 +46,9 @@ import net.sourceforge.plantuml.command.regex.RegexResult;
public class CommandAffineTransform extends SingleLineCommand2<UmlDiagram> {
public CommandAffineTransform() {
public static final CommandAffineTransform ME = new CommandAffineTransform();
private CommandAffineTransform() {
super(getRegexConcat());
}

View File

@ -39,7 +39,9 @@ import net.sourceforge.plantuml.TitledDiagram;
public class CommandAffineTransformMultiline extends CommandMultilines<TitledDiagram> {
public CommandAffineTransformMultiline() {
public static final CommandAffineTransformMultiline ME = new CommandAffineTransformMultiline();
private CommandAffineTransformMultiline() {
super("^!transformation[%s]+\\{[%s]*$");
}

View File

@ -44,7 +44,9 @@ import net.sourceforge.plantuml.command.regex.RegexResult;
public class CommandAssumeTransparent extends SingleLineCommand2<TitledDiagram> {
public CommandAssumeTransparent() {
public static final CommandAssumeTransparent ME = new CommandAssumeTransparent();
private CommandAssumeTransparent() {
super(getRegexConcat());
}

View File

@ -49,7 +49,9 @@ import net.sourceforge.plantuml.graphic.VerticalAlignment;
public class CommandCaption extends SingleLineCommand2<TitledDiagram> {
public CommandCaption() {
public static final CommandCaption ME = new CommandCaption();
private CommandCaption() {
super(getRegexConcat());
}

View File

@ -49,7 +49,9 @@ import net.sourceforge.plantuml.graphic.HorizontalAlignment;
public class CommandFooter extends SingleLineCommand2<TitledDiagram> {
public CommandFooter() {
public static final CommandFooter ME = new CommandFooter();
private CommandFooter() {
super(getRegexConcat());
}

View File

@ -49,7 +49,9 @@ import net.sourceforge.plantuml.graphic.HorizontalAlignment;
public class CommandHeader extends SingleLineCommand2<TitledDiagram> {
public CommandHeader() {
public static final CommandHeader ME = new CommandHeader();
private CommandHeader() {
super(getRegexConcat());
}

View File

@ -49,7 +49,9 @@ import net.sourceforge.plantuml.graphic.VerticalAlignment;
public class CommandLegend extends SingleLineCommand2<TitledDiagram> {
public CommandLegend() {
public static final CommandLegend ME = new CommandLegend();
private CommandLegend() {
super(getRegexConcat());
}

View File

@ -46,7 +46,9 @@ import net.sourceforge.plantuml.cucadiagram.Display;
public class CommandMainframe extends SingleLineCommand2<TitledDiagram> {
public CommandMainframe() {
public static final CommandMainframe ME = new CommandMainframe();
private CommandMainframe() {
super(getRegexConcat());
}

View File

@ -44,7 +44,9 @@ import net.sourceforge.plantuml.command.regex.RegexResult;
public class CommandMinwidth extends SingleLineCommand2<UmlDiagram> {
public CommandMinwidth() {
public static final CommandMinwidth ME = new CommandMinwidth();
private CommandMinwidth() {
super(getRegexConcat());
}

View File

@ -44,7 +44,9 @@ import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class CommandMultilinesCaption extends CommandMultilines<TitledDiagram> {
public CommandMultilinesCaption() {
public static final CommandMultilinesCaption ME = new CommandMultilinesCaption();
private CommandMultilinesCaption() {
super("^caption$");
}
@ -58,7 +60,8 @@ public class CommandMultilinesCaption extends CommandMultilines<TitledDiagram> {
lines = lines.removeEmptyColumns();
final Display strings = lines.toDisplay();
if (strings.size() > 0) {
diagram.setCaption(DisplayPositioned.single(strings.replaceBackslashT(), HorizontalAlignment.CENTER, VerticalAlignment.BOTTOM));
diagram.setCaption(DisplayPositioned.single(strings.replaceBackslashT(), HorizontalAlignment.CENTER,
VerticalAlignment.BOTTOM));
return CommandExecutionResult.ok();
}
return CommandExecutionResult.error("No caption defined");

View File

@ -45,7 +45,9 @@ import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class CommandMultilinesFooter extends CommandMultilines<TitledDiagram> {
public CommandMultilinesFooter() {
public static final CommandMultilinesFooter ME = new CommandMultilinesFooter();
private CommandMultilinesFooter() {
super("^(?:(left|right|center)?[%s]*)footer$");
}

View File

@ -45,7 +45,9 @@ import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class CommandMultilinesHeader extends CommandMultilines<TitledDiagram> {
public CommandMultilinesHeader() {
public static final CommandMultilinesHeader ME = new CommandMultilinesHeader();
private CommandMultilinesHeader() {
super("^(?:(left|right|center)?[%s]*)header$");
}

View File

@ -49,7 +49,9 @@ import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class CommandMultilinesLegend extends CommandMultilines2<TitledDiagram> {
public CommandMultilinesLegend() {
public static final CommandMultilinesLegend ME = new CommandMultilinesLegend();
private CommandMultilinesLegend() {
super(getRegexConcat(), MultilinesStrategy.REMOVE_STARTING_QUOTE, Trim.BOTH);
}

View File

@ -44,7 +44,9 @@ import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class CommandMultilinesTitle extends CommandMultilines<TitledDiagram> {
public CommandMultilinesTitle() {
public static final CommandMultilinesTitle ME = new CommandMultilinesTitle();
private CommandMultilinesTitle() {
super("^title$");
}
@ -58,7 +60,8 @@ public class CommandMultilinesTitle extends CommandMultilines<TitledDiagram> {
lines = lines.removeEmptyColumns();
final Display strings = lines.toDisplay();
if (strings.size() > 0) {
diagram.setTitle(DisplayPositioned.single(strings.replaceBackslashT(), HorizontalAlignment.CENTER, VerticalAlignment.TOP));
diagram.setTitle(DisplayPositioned.single(strings.replaceBackslashT(), HorizontalAlignment.CENTER,
VerticalAlignment.TOP));
return CommandExecutionResult.ok();
}
return CommandExecutionResult.error("No title defined");

View File

@ -60,6 +60,8 @@ import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class CommandNamespace extends SingleLineCommand2<ClassDiagram> {
public static final String NAMESPACE_REGEX = "([%pLN_][-%pLN_.:\\\\/]*)";
public CommandNamespace() {
super(getRegexConcat());
}
@ -68,7 +70,7 @@ public class CommandNamespace extends SingleLineCommand2<ClassDiagram> {
return RegexConcat.build(CommandNamespace.class.getName(), RegexLeaf.start(), //
new RegexLeaf("namespace"), //
RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("NAME", "([%pLN_][-%pLN_.:\\\\]*)"), //
new RegexLeaf("NAME", NAMESPACE_REGEX), //
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", "([%pLN_][-%pLN_.:\\\\]*)"), //
new RegexLeaf("NAME", CommandNamespace.NAMESPACE_REGEX), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREOTYPE", "(\\<\\<.*\\>\\>)?"), //
RegexLeaf.spaceZeroOrMore(), //
@ -110,8 +110,7 @@ public class CommandNamespace2 extends SingleLineCommand2<ClassDiagram> {
final String color = arg.get("COLOR", 0);
if (color != null) {
p.setSpecificColorTOBEREMOVED(ColorType.BACK,
diagram.getSkinParam().getIHtmlColorSet().getColor(color));
p.setSpecificColorTOBEREMOVED(ColorType.BACK, diagram.getSkinParam().getIHtmlColorSet().getColor(color));
}
return CommandExecutionResult.ok();
}

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", "([%pLN_][-%pLN_.:\\\\]*)"), //
new RegexLeaf("NAME", CommandNamespace.NAMESPACE_REGEX), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREOTYPE", "(\\<\\<.*\\>\\>)?"), //
RegexLeaf.spaceZeroOrMore(), //
@ -104,8 +104,7 @@ public class CommandNamespaceEmpty extends SingleLineCommand2<ClassDiagram> {
final String color = arg.get("COLOR", 0);
if (color != null) {
p.setSpecificColorTOBEREMOVED(ColorType.BACK,
diagram.getSkinParam().getIHtmlColorSet().getColor(color));
p.setSpecificColorTOBEREMOVED(ColorType.BACK, diagram.getSkinParam().getIHtmlColorSet().getColor(color));
}
diagram.endGroup();
return CommandExecutionResult.ok();

View File

@ -44,7 +44,9 @@ import net.sourceforge.plantuml.core.Diagram;
public class CommandNope extends SingleLineCommand2<Diagram> {
public CommandNope() {
public static final CommandNope ME = new CommandNope();
private CommandNope() {
super(getRegexConcat());
}

View File

@ -44,7 +44,9 @@ import net.sourceforge.plantuml.command.regex.RegexResult;
public class CommandPage extends SingleLineCommand2<AbstractPSystem> {
public CommandPage() {
public static final CommandPage ME = new CommandPage();
private CommandPage() {
super(getRegexConcat());
}
@ -60,14 +62,13 @@ public class CommandPage extends SingleLineCommand2<AbstractPSystem> {
}
@Override
protected CommandExecutionResult executeArg(AbstractPSystem system, LineLocation location,
RegexResult arg) {
protected CommandExecutionResult executeArg(AbstractPSystem system, LineLocation location, RegexResult arg) {
final int horizontal = Integer.parseInt(arg.get("NB1", 0));
final int vertical = Integer.parseInt(arg.get("NB2", 0));
if (horizontal <= 0 || vertical <= 0) {
if (horizontal <= 0 || vertical <= 0)
return CommandExecutionResult.error("Argument must be positive");
}
system.setSplitPagesHorizontal(horizontal);
system.setSplitPagesVertical(vertical);
return CommandExecutionResult.ok();

View File

@ -49,7 +49,9 @@ import net.sourceforge.plantuml.cucadiagram.dot.GraphvizUtils;
public class CommandPragma extends SingleLineCommand2<TitledDiagram> {
public CommandPragma() {
public static final CommandPragma ME = new CommandPragma();
private CommandPragma() {
super(getRegexConcat());
}

View File

@ -44,7 +44,9 @@ import net.sourceforge.plantuml.command.regex.RegexResult;
public class CommandRotate extends SingleLineCommand2<UmlDiagram> {
public CommandRotate() {
public static final CommandRotate ME = new CommandRotate();
private CommandRotate() {
super(getRegexConcat());
}

View File

@ -46,7 +46,9 @@ import net.sourceforge.plantuml.command.regex.RegexResult;
public class CommandScale extends SingleLineCommand2<AbstractPSystem> {
public CommandScale() {
public static final CommandScale ME = new CommandScale();
private CommandScale() {
super(getRegexConcat());
}

View File

@ -45,7 +45,9 @@ import net.sourceforge.plantuml.command.regex.RegexResult;
public class CommandScaleMaxHeight extends SingleLineCommand2<AbstractPSystem> {
public CommandScaleMaxHeight() {
public static final CommandScaleMaxHeight ME = new CommandScaleMaxHeight();
private CommandScaleMaxHeight() {
super(getRegexConcat());
}

View File

@ -45,7 +45,9 @@ import net.sourceforge.plantuml.command.regex.RegexResult;
public class CommandScaleMaxWidth extends SingleLineCommand2<AbstractPSystem> {
public CommandScaleMaxWidth() {
public static final CommandScaleMaxWidth ME = new CommandScaleMaxWidth();
private CommandScaleMaxWidth() {
super(getRegexConcat());
}

View File

@ -45,7 +45,9 @@ import net.sourceforge.plantuml.command.regex.RegexResult;
public class CommandScaleMaxWidthAndHeight extends SingleLineCommand2<AbstractPSystem> {
public CommandScaleMaxWidthAndHeight() {
public static final CommandScaleMaxWidthAndHeight ME = new CommandScaleMaxWidthAndHeight();
private CommandScaleMaxWidthAndHeight() {
super(getRegexConcat());
}

View File

@ -45,7 +45,9 @@ import net.sourceforge.plantuml.command.regex.RegexResult;
public class CommandScaleWidthAndHeight extends SingleLineCommand2<AbstractPSystem> {
public CommandScaleWidthAndHeight() {
public static final CommandScaleWidthAndHeight ME = new CommandScaleWidthAndHeight();
private CommandScaleWidthAndHeight() {
super(getRegexConcat());
}

View File

@ -46,7 +46,9 @@ import net.sourceforge.plantuml.command.regex.RegexResult;
public class CommandScaleWidthOrHeight extends SingleLineCommand2<AbstractPSystem> {
public CommandScaleWidthOrHeight() {
public static final CommandScaleWidthOrHeight ME = new CommandScaleWidthOrHeight();
private CommandScaleWidthOrHeight() {
super(getRegexConcat());
}

View File

@ -45,7 +45,9 @@ import net.sourceforge.plantuml.style.NoStyleAvailableException;
public class CommandSkinParam extends SingleLineCommand2<TitledDiagram> {
public CommandSkinParam() {
public static final CommandSkinParam ME = new CommandSkinParam();
private CommandSkinParam() {
super(getRegexConcat());
}

View File

@ -42,16 +42,18 @@ import net.sourceforge.plantuml.command.regex.MyPattern;
public class CommandSkinParamMultilines extends CommandMultilinesBracket<TitledDiagram> {
public CommandSkinParamMultilines() {
public static final CommandSkinParamMultilines ME = new CommandSkinParamMultilines();
private CommandSkinParamMultilines() {
super("^skinparam[%s]*(?:[%s]+([\\w.]*(?:\\<\\<.*\\>\\>)?[\\w.]*))?[%s]*\\{$");
}
@Override
protected boolean isLineConsistent(String line, int level) {
line = StringUtils.trin(line);
if (hasStartingQuote(line)) {
if (hasStartingQuote(line))
return true;
}
return SkinLoader.p1.matcher(line).matches();
}
@ -64,9 +66,9 @@ public class CommandSkinParamMultilines extends CommandMultilinesBracket<TitledD
final SkinLoader skinLoader = new SkinLoader(diagram);
final Matcher2 mStart = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString());
if (mStart.find() == false) {
if (mStart.find() == false)
throw new IllegalStateException();
}
final String group1 = mStart.group(1);
return skinLoader.execute(lines, group1);

View File

@ -58,7 +58,9 @@ import net.sourceforge.plantuml.sprite.SpriteSvg;
public class CommandSpriteFile extends SingleLineCommand2<TitledDiagram> {
public CommandSpriteFile() {
public static final CommandSpriteFile ME = new CommandSpriteFile();
private CommandSpriteFile() {
super(getRegexConcat());
}

View File

@ -45,7 +45,9 @@ import net.sourceforge.plantuml.emoji.SvgNanoParser;
public class CommandSpriteSvg extends SingleLineCommand2<TitledDiagram> {
public CommandSpriteSvg() {
public static final CommandSpriteSvg ME = new CommandSpriteSvg();
private CommandSpriteSvg() {
super(getRegexConcat());
}

View File

@ -46,7 +46,9 @@ import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class CommandSpriteSvgMultiline extends CommandMultilines2<TitledDiagram> {
public CommandSpriteSvgMultiline() {
public static final CommandSpriteSvgMultiline ME = new CommandSpriteSvgMultiline();
private CommandSpriteSvgMultiline() {
super(getRegexConcat(), MultilinesStrategy.KEEP_STARTING_QUOTE, Trim.BOTH);
}

View File

@ -49,7 +49,9 @@ import net.sourceforge.plantuml.graphic.VerticalAlignment;
public class CommandTitle extends SingleLineCommand2<TitledDiagram> {
public CommandTitle() {
public static final CommandTitle ME = new CommandTitle();
private CommandTitle() {
super(getRegexConcat());
}

View File

@ -56,56 +56,56 @@ public final class CommonCommands {
}
static public void addCommonCommands2(List<Command> cmds) {
cmds.add(new CommandNope());
cmds.add(new CommandPragma());
cmds.add(new CommandAssumeTransparent());
cmds.add(CommandNope.ME);
cmds.add(CommandPragma.ME);
cmds.add(CommandAssumeTransparent.ME);
cmds.add(new CommandSkinParam());
cmds.add(new CommandSkinParamMultilines());
cmds.add(new CommandSkin());
cmds.add(new CommandMinwidth());
cmds.add(new CommandPage());
cmds.add(new CommandRotate());
cmds.add(new CommandScale());
cmds.add(new CommandScaleWidthAndHeight());
cmds.add(new CommandScaleWidthOrHeight());
cmds.add(new CommandScaleMaxWidth());
cmds.add(new CommandScaleMaxHeight());
cmds.add(new CommandScaleMaxWidthAndHeight());
cmds.add(new CommandAffineTransform());
cmds.add(new CommandAffineTransformMultiline());
cmds.add(CommandSkinParam.ME);
cmds.add(CommandSkinParamMultilines.ME);
cmds.add(CommandSkin.ME);
cmds.add(CommandMinwidth.ME);
cmds.add(CommandPage.ME);
cmds.add(CommandRotate.ME);
cmds.add(CommandScale.ME);
cmds.add(CommandScaleWidthAndHeight.ME);
cmds.add(CommandScaleWidthOrHeight.ME);
cmds.add(CommandScaleMaxWidth.ME);
cmds.add(CommandScaleMaxHeight.ME);
cmds.add(CommandScaleMaxWidthAndHeight.ME);
cmds.add(CommandAffineTransform.ME);
cmds.add(CommandAffineTransformMultiline.ME);
final CommandFactorySprite factorySpriteCommand = new CommandFactorySprite();
cmds.add(factorySpriteCommand.createMultiLine(false));
cmds.add(factorySpriteCommand.createSingleLine());
cmds.add(new CommandSpriteSvg());
cmds.add(new CommandSpriteFile());
cmds.add(new CommandSpriteSvgMultiline());
cmds.add(CommandSpriteSvg.ME);
cmds.add(CommandSpriteFile.ME);
cmds.add(CommandSpriteSvgMultiline.ME);
cmds.add(new CommandStyleMultilinesCSS());
cmds.add(new CommandStyleImport());
cmds.add(CommandStyleMultilinesCSS.ME);
cmds.add(CommandStyleImport.ME);
}
static public void addCommonHides(List<Command> cmds) {
cmds.add(new CommandHideEmptyDescription());
cmds.add(new CommandHideShowByVisibility());
cmds.add(new CommandHideShowByGender());
cmds.add(CommandHideEmptyDescription.ME);
cmds.add(CommandHideShowByVisibility.ME);
cmds.add(CommandHideShowByGender.ME);
}
static public void addTitleCommands(List<Command> cmds) {
cmds.add(new CommandTitle());
cmds.add(new CommandMainframe());
cmds.add(new CommandCaption());
cmds.add(new CommandMultilinesCaption());
cmds.add(new CommandMultilinesTitle());
cmds.add(new CommandMultilinesLegend());
cmds.add(new CommandLegend());
cmds.add(CommandTitle.ME);
cmds.add(CommandMainframe.ME);
cmds.add(CommandCaption.ME);
cmds.add(CommandMultilinesCaption.ME);
cmds.add(CommandMultilinesTitle.ME);
cmds.add(CommandMultilinesLegend.ME);
cmds.add(CommandLegend.ME);
cmds.add(new CommandFooter());
cmds.add(new CommandMultilinesFooter());
cmds.add(CommandFooter.ME);
cmds.add(CommandMultilinesFooter.ME);
cmds.add(new CommandHeader());
cmds.add(new CommandMultilinesHeader());
cmds.add(CommandHeader.ME);
cmds.add(CommandMultilinesHeader.ME);
}
}

View File

@ -35,6 +35,7 @@
*/
package net.sourceforge.plantuml.command;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@ -55,9 +56,9 @@ import net.sourceforge.plantuml.version.IteratorCounter2;
public abstract class PSystemCommandFactory extends PSystemAbstractFactory {
private List<Command> cmds;
private final List<Command> cmds = new ArrayList<>();
protected abstract List<Command> createCommands();
protected abstract void initCommandsList(List<Command> cmds);
public abstract AbstractPSystem createEmptyDiagram(UmlSource source, Map<String, String> skinParam);
@ -149,8 +150,10 @@ public abstract class PSystemCommandFactory extends PSystemAbstractFactory {
private Step getCandidate(final IteratorCounter2 it) {
final BlocLines single = BlocLines.single(it.peek());
if (cmds == null)
cmds = createCommands();
synchronized (cmds) {
if (cmds.size() == 0)
initCommandsList(cmds);
}
for (Command cmd : cmds) {
final CommandControl result = cmd.isValid(single);

View File

@ -35,7 +35,6 @@
*/
package net.sourceforge.plantuml.command.note;
import net.sourceforge.plantuml.ColorParam;
import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.baraye.IEntity;
import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram;
@ -72,7 +71,7 @@ public final class CommandFactoryNote implements SingleMultiFactoryCommand<Abstr
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("TAGS", Stereotag.pattern() + "?"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREO", "(\\<{2}.*\\>{2})?"), //
new RegexLeaf("STEREO", "(\\<\\<.*\\>\\>)?"), //
RegexLeaf.spaceZeroOrMore(), //
ColorParser.exp1(), //
RegexLeaf.end() //
@ -93,7 +92,7 @@ public final class CommandFactoryNote implements SingleMultiFactoryCommand<Abstr
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("TAGS", Stereotag.pattern() + "?"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREO", "(\\<{2}.*\\>{2})?"), //
new RegexLeaf("STEREO", "(\\<\\<.*\\>\\>)?"), //
RegexLeaf.spaceZeroOrMore(), //
ColorParser.exp1(), //
RegexLeaf.end() //

View File

@ -94,7 +94,7 @@ public final class CommandFactoryNoteOnEntity implements SingleMultiFactoryComma
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("TAGS1", Stereotag.pattern() + "?"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREO", "(\\<{2}.*\\>{2})?"), //
new RegexLeaf("STEREO", "(\\<\\<.*\\>\\>)?"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("TAGS2", Stereotag.pattern() + "?"), //
RegexLeaf.spaceZeroOrMore(), //
@ -129,7 +129,7 @@ public final class CommandFactoryNoteOnEntity implements SingleMultiFactoryComma
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("TAGS1", Stereotag.pattern() + "?"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREO", "(\\<{2}.*\\>{2})?"), //
new RegexLeaf("STEREO", "(\\<\\<.*\\>\\>)?"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("TAGS2", Stereotag.pattern() + "?"), //
RegexLeaf.spaceZeroOrMore(), //
@ -155,7 +155,7 @@ public final class CommandFactoryNoteOnEntity implements SingleMultiFactoryComma
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("TAGS1", Stereotag.pattern() + "?"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREO", "(\\<{2}.*\\>{2})?"), //
new RegexLeaf("STEREO", "(\\<\\<.*\\>\\>)?"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("TAGS2", Stereotag.pattern() + "?"), //
RegexLeaf.spaceZeroOrMore(), //

View File

@ -68,7 +68,7 @@ public final class CommandFactoryNoteOnLink implements SingleMultiFactoryCommand
RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("POSITION", "(right|left|top|bottom)?"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("o[nf]"), //
new RegexLeaf("(on|of)"), //
RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("link"), //
RegexLeaf.spaceZeroOrMore(), //
@ -85,7 +85,7 @@ public final class CommandFactoryNoteOnLink implements SingleMultiFactoryCommand
RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("POSITION", "(right|left|top|bottom)?"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("o[nf]"), //
new RegexLeaf("(on|of)"), //
RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("link"), //
RegexLeaf.spaceZeroOrMore(), //

View File

@ -90,7 +90,7 @@ public final class CommandFactoryTipOnEntity implements SingleMultiFactoryComman
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("TAGS1", Stereotag.pattern() + "?"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREO", "(\\<{2}.*\\>{2})?"), //
new RegexLeaf("STEREO", "(\\<\\<.*\\>\\>)?"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("TAGS2", Stereotag.pattern() + "?"), //
RegexLeaf.spaceZeroOrMore(), //
@ -113,7 +113,7 @@ public final class CommandFactoryTipOnEntity implements SingleMultiFactoryComman
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("TAGS1", Stereotag.pattern() + "?"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREO", "(\\<{2}.*\\>{2})?"), //
new RegexLeaf("STEREO", "(\\<\\<.*\\>\\>)?"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("TAGS2", Stereotag.pattern() + "?"), //
RegexLeaf.spaceZeroOrMore(), //

View File

@ -71,7 +71,7 @@ public final class FactorySequenceNoteAcrossCommand implements SingleMultiFactor
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STYLE", "(note|hnote|rnote)"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREO", "(\\<{2}.*\\>{2})?"), //
new RegexLeaf("STEREO", "(\\<\\<.*\\>\\>)?"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("ACROSS", "(accross|across)"), //
RegexLeaf.spaceZeroOrMore(), //
@ -87,7 +87,7 @@ public final class FactorySequenceNoteAcrossCommand implements SingleMultiFactor
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STYLE", "(note|hnote|rnote)"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREO", "(\\<{2}.*\\>{2})?"), //
new RegexLeaf("STEREO", "(\\<\\<.*\\>\\>)?"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("ACROSS", "(accross|across)"), //
RegexLeaf.spaceZeroOrMore(), //

View File

@ -74,7 +74,7 @@ public final class FactorySequenceNoteCommand implements SingleMultiFactoryComma
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STYLE", "(note|hnote|rnote)"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREO", "(\\<{2}.*\\>{2})?"), //
new RegexLeaf("STEREO", "(\\<\\<.*\\>\\>)?"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("POSITION", "(right|left|over)"), //
RegexLeaf.spaceOneOrMore(), //
@ -92,7 +92,7 @@ public final class FactorySequenceNoteCommand implements SingleMultiFactoryComma
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STYLE", "(note|hnote|rnote)"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREO", "(\\<{2}.*\\>{2})?"), //
new RegexLeaf("STEREO", "(\\<\\<.*\\>\\>)?"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("POSITION", "(right|left|over)"), //
RegexLeaf.spaceOneOrMore(), //

View File

@ -75,7 +75,7 @@ public final class FactorySequenceNoteOnArrowCommand implements SingleMultiFacto
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STYLE", "(note|hnote|rnote)"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREO", "(\\<{2}.*\\>{2})?"), //
new RegexLeaf("STEREO", "(\\<\\<.*\\>\\>)?"), //
RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("POSITION", "(right|left|bottom|top)"), //
RegexLeaf.spaceZeroOrMore(), //
@ -89,7 +89,7 @@ public final class FactorySequenceNoteOnArrowCommand implements SingleMultiFacto
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STYLE", "(note|hnote|rnote)"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREO", "(\\<{2}.*\\>{2})?"), //
new RegexLeaf("STEREO", "(\\<\\<.*\\>\\>)?"), //
RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("POSITION", "(right|left|bottom|top)"), //
RegexLeaf.spaceZeroOrMore(), //

View File

@ -73,7 +73,7 @@ public final class FactorySequenceNoteOverSeveralCommand implements SingleMultiF
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STYLE", "(note|hnote|rnote)"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREO1", "(\\<{2}.*\\>{2})?"), //
new RegexLeaf("STEREO1", "(\\<\\<.*\\>\\>)?"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("over"), //
RegexLeaf.spaceOneOrMore(), //
@ -83,7 +83,7 @@ public final class FactorySequenceNoteOverSeveralCommand implements SingleMultiF
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("P2", "([%pLN_.@]+|[%g][^%g]+[%g])"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREO2", "(\\<{2}.*\\>{2})?"), //
new RegexLeaf("STEREO2", "(\\<\\<.*\\>\\>)?"), //
RegexLeaf.spaceZeroOrMore(), //
color().getRegex(), //
RegexLeaf.spaceZeroOrMore(), //
@ -98,7 +98,7 @@ public final class FactorySequenceNoteOverSeveralCommand implements SingleMultiF
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STYLE", "(note|hnote|rnote)"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREO1", "(\\<{2}.*\\>{2})?"), //
new RegexLeaf("STEREO1", "(\\<\\<.*\\>\\>)?"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("over"), //
RegexLeaf.spaceOneOrMore(), //
@ -108,7 +108,7 @@ public final class FactorySequenceNoteOverSeveralCommand implements SingleMultiF
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("P2", "([%pLN_.@]+|[%g][^%g]+[%g])"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREO2", "(\\<{2}.*\\>{2})?"), //
new RegexLeaf("STEREO2", "(\\<\\<.*\\>\\>)?"), //
RegexLeaf.spaceZeroOrMore(), //
color().getRegex(), //
RegexLeaf.spaceZeroOrMore(), //

View File

@ -38,53 +38,101 @@ package net.sourceforge.plantuml.command.regex;
public class FoxSignature {
private static final long masks[] = new long[127];
private static final long MASK_SPACES;
private static final long MASK_SPECIAL1;
static {
final String full = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0!\"#$%&\'()*+,-./:;<=>?@[\\]^_{|}~";
long m = 1L;
MASK_SPACES = m;
m = m << 1;
MASK_SPECIAL1 = m;
m = m << 1;
for (int i = 0; i < full.length(); i++) {
char ch = full.charAt(i);
masks[ch] = m;
if (ch >= 'A' && ch <= 'Z') {
ch = (char) (ch + ('a' - 'A'));
masks[ch] = m;
}
} else if (ch == '.' || ch == '=' || ch == '-' || ch == '~')
masks[ch] |= MASK_SPECIAL1;
m = m << 1;
}
masks[' '] = MASK_SPACES;
masks['\t'] = MASK_SPACES;
masks['\r'] = MASK_SPACES;
masks['\n'] = MASK_SPACES;
masks['\f'] = MASK_SPACES;
}
public static long getSpecialSpaces() {
return MASK_SPACES;
}
public static long getSpecial1() {
return MASK_SPECIAL1;
}
public static void printMe() {
for (int i = 0; i < masks.length; i++) {
for (int i = 0; i < masks.length; i++)
if (masks[i] > 0) {
final char ch = (char) i;
System.err.println("ch=" + ch + " " + masks[i]);
}
}
}
private static long getMask(char ch) {
if (ch < masks.length) {
if (ch < masks.length)
return masks[ch];
}
else if (ch == '\u00A0')
return MASK_SPACES;
return 0L;
}
public static long getFoxSignature(String s) {
public static long getFoxSignatureFromRealString(String s) {
long result = 0;
for (int i = 0; i < s.length(); i++)
result = result | getMask(s.charAt(i));
return result;
}
public static long getFoxSignatureFromRegex(String s) {
long result = 0;
for (int i = 0; i < s.length(); i++) {
result = result | getMask(s.charAt(i));
if (s.charAt(i) == '.') {
if (s.charAt(i + 1) == '+' || s.charAt(i + 1) == '*')
i++;
else
throw new IllegalArgumentException(s);
} else if (s.charAt(i) == '\\') {
if (s.charAt(i + 1) == 'b')
i++;
else if (Character.isLetterOrDigit(s.charAt(i + 1)))
throw new IllegalArgumentException(s);
} else {
if (i + 1 < s.length() && (s.charAt(i + 1) == '?' || s.charAt(i + 1) == '*')) {
i++;
continue;
}
result = result | getMask(s.charAt(i));
if (i + 1 < s.length() && s.charAt(i + 1) == '+') {
i++;
}
}
}
return result;
}
public static String backToString(long check) {
final StringBuilder sb = new StringBuilder();
for (int i = 0; i < masks.length; i++) {
for (int i = 0; i < masks.length; i++)
if (masks[i] != 0L && (check & masks[i]) != 0L) {
final char ch = (char) i;
sb.append(ch);
}
}
return sb.toString();
}

View File

@ -41,14 +41,16 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
import net.sourceforge.plantuml.StringLocated;
public abstract class RegexComposed implements IRegex {
protected static final AtomicInteger nbCreateMatches = new AtomicInteger();
// protected static final AtomicInteger nbCreateMatches = new AtomicInteger();
// protected static final AtomicInteger vtot = new AtomicInteger();
// protected static final AtomicInteger vescaped = new AtomicInteger();
private final List<IRegex> partials;
protected final List<IRegex> partials() {
@ -78,7 +80,7 @@ public abstract class RegexComposed implements IRegex {
}
public Map<String, RegexPartialMatch> createPartialMatch(Iterator<String> it) {
nbCreateMatches.incrementAndGet();
// nbCreateMatches.incrementAndGet();
final Map<String, RegexPartialMatch> result = new HashMap<String, RegexPartialMatch>();
for (IRegex r : partials)
result.putAll(r.createPartialMatch(it));

View File

@ -35,34 +35,38 @@
*/
package net.sourceforge.plantuml.command.regex;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.atomic.AtomicLong;
import net.sourceforge.plantuml.Log;
import net.sourceforge.plantuml.StringLocated;
public final class RegexConcat extends RegexComposed implements IRegex {
private static final ConcurrentMap<Object, RegexConcat> cache = new ConcurrentHashMap<Object, RegexConcat>();
private final AtomicLong foxRegex = new AtomicLong(-1L);
private int limitSize;
// private static final Set<String> PRINTED2 = new HashSet<>();
public static void printCacheInfo() {
int nbCompiled = 0;
int nbInvoked = 0;
for (RegexConcat reg : cache.values()) {
if (reg.isCompiled())
nbCompiled++;
if (reg.invoked())
nbInvoked++;
}
Log.info("Regex total/invoked/compiled " + cache.size() + "/" + nbInvoked + "/" + nbCompiled);
Log.info("Matches created " + nbCreateMatches.get());
// if (OptionFlags.getInstance().isVerbose())
// synchronized (cache) {
//
// final NumberFormat nf = NumberFormat.getInstance(Locale.US);
//
// int nbCompiled = 0;
// int nbInvoked = 0;
// for (RegexConcat reg : cache.values()) {
// if (reg.isCompiled())
// nbCompiled++;
//
// if (reg.invoked())
// nbInvoked++;
//
// }
// Log.info("Regex total/invoked/compiled " + nf.format(cache.size()) + "/" + nf.format(nbInvoked) + "/"
// + nf.format(nbCompiled));
// Log.info("Matches escaped " + nf.format(vescaped.get()) + "/" + nf.format(vtot.get()));
// Log.info("Matches created " + nf.format(nbCreateMatches.get()));
// }
}
public RegexConcat(IRegex... partials) {
@ -70,7 +74,8 @@ public final class RegexConcat extends RegexComposed implements IRegex {
}
private long foxRegex() {
if (foxRegex.get() == -1L) {
final long result = foxRegex.get();
if (result == -1L) {
long tmp = 0L;
for (int i = 1; i < partials().size() - 1; i++) {
final IRegex part = partials().get(i);
@ -80,26 +85,27 @@ public final class RegexConcat extends RegexComposed implements IRegex {
}
}
foxRegex.set(tmp);
return tmp;
}
return foxRegex.get();
return result;
}
public static RegexConcat build(String key, IRegex... partials) {
// return buildInternal(partials);
RegexConcat result = cache.get(key);
if (result == null) {
cache.putIfAbsent(key, buildInternal(partials));
result = cache.get(key);
// System.err.println("cache size=" + cache.size());
// } else {
// synchronized (PRINTED2) {
// if (PRINTED2.contains(key) == false) {
// System.err.println("if (key.equals(\"" + key + "\")) return
// buildInternal(partials);");
// }
// PRINTED2.add(key);
}
return result;
return buildInternal(partials);
// RegexConcat result = cache.get(key);
// if (result == null) {
// cache.putIfAbsent(key, buildInternal(partials));
// result = cache.get(key);
// // System.err.println("cache size=" + cache.size());
// // } else {
// // synchronized (PRINTED2) {
// // if (PRINTED2.contains(key) == false) {
// // System.err.println("if (key.equals(\"" + key + "\")) return
// // buildInternal(partials);");
// // }
// // PRINTED2.add(key);
// }
// return result;
}
private static RegexConcat buildInternal(IRegex... partials) {
@ -113,20 +119,35 @@ public final class RegexConcat extends RegexComposed implements IRegex {
return foxRegex.get() != -1L;
}
// static private final Set<String> PRINTED = new HashSet<>();
// static private final Set<String> ZERO = new HashSet<>();
@Override
public boolean match(StringLocated s) {
if (limitSize != 0 && s.getString().length() > limitSize)
return false;
// vtot.incrementAndGet();
final long foxRegex = foxRegex();
// synchronized (PRINTED) {
// final String full = getFullSlow();
// final boolean added = PRINTED.add(full);
// if (added && foxRegex == 0L) {
// ZERO.add(full);
// System.err.println("PR " + ZERO.size() + "/" + PRINTED.size() + " "
// + FoxSignature.backToString(foxRegex) + " " + full);
// }
// }
if (foxRegex != 0L) {
final long foxLine = s.getFoxSignature();
final long check = foxRegex & foxLine;
// System.err.println("r=" + getFullSlow() + " s=" + s + " line=" + foxLine + "
// regex" + foxRegex + " "
// + check + " <" + FoxSignature.backToString(check) + ">");
if (check != foxRegex)
if (check != foxRegex) {
// vescaped.incrementAndGet();
return false;
}
}
return super.match(s);

View File

@ -41,6 +41,7 @@ import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import net.sourceforge.plantuml.StringLocated;
@ -95,9 +96,9 @@ public class RegexLeaf implements IRegex {
}
public int count() {
if (count == -1) {
if (count == -1)
count = MyPattern.cmpile(pattern).matcher("").groupCount();
}
return count;
}
@ -107,9 +108,9 @@ public class RegexLeaf implements IRegex {
final String group = it.next();
m.add(group);
}
if (name == null) {
if (name == null)
return Collections.emptyMap();
}
return Collections.singletonMap(name, m);
}
@ -121,63 +122,52 @@ public class RegexLeaf implements IRegex {
throw new UnsupportedOperationException();
}
static private final Set<String> UNKNOWN = new HashSet<>();
// static private final Set<String> UNKNOWN = new HashSet<>();
static private final Pattern p1 = Pattern.compile("^[-0A-Za-z_!:@;/=,\"]+$");
static private final Pattern p2 = Pattern.compile("^[-0A-Za-z_!:@;/=,\"]+\\?$");
static private final Pattern p3 = Pattern
.compile("^\\(?[-0A-Za-z_!:@;/=\" ]+\\??(\\|[-0A-Za-z_!:@;/=,\" ]+\\??)+\\)?$");
static private final Pattern p1 = Pattern.compile(
"^\\(?((?:[-0A-Za-z_!:@;/=,\" ][?+*]?|\\\\[b$(){}<>|*.+^\\[\\]][?+*]?|\\.\\*|\\.\\+)+)(?:\\)\\+|\\))?$");
private static long getSignatureP3(String s) {
static private final Pattern p2 = Pattern.compile("^\\([-?a-z ]+(\\|[-?a-z ]+)+\\)$");
static private final Pattern p3 = Pattern.compile("^\\(?\\[[-=.~]+\\]\\+\\)?$");
private static long getSignatureP2(String s) {
long result = -1L;
for (StringTokenizer st = new StringTokenizer(s, "()|"); st.hasMoreTokens();) {
final String val = st.nextToken();
final long sig = FoxSignature.getFoxSignature(val.endsWith("?") ? val.substring(0, val.length() - 2) : val);
result = result & sig;
result = result & FoxSignature.getFoxSignatureFromRegex(val);
}
return result;
}
public long getFoxSignatureNone() {
return 0;
}
public long getFoxSignature() {
if (p1.matcher(pattern).matches())
return FoxSignature.getFoxSignature(pattern);
if (p2.matcher(pattern).matches())
return FoxSignature.getFoxSignature(pattern.substring(0, pattern.length() - 2));
if (p3.matcher(pattern).matches())
return getSignatureP3(pattern);
if (pattern.length() == 2 && pattern.startsWith("\\") && Character.isLetterOrDigit(pattern.charAt(1)) == false)
return FoxSignature.getFoxSignature(pattern.substring(1));
if (pattern.equals("\\<\\>") || pattern.equals("(\\<\\<.*\\>\\>)"))
return FoxSignature.getFoxSignature("<>");
if (pattern.equals("\\<-\\>"))
return FoxSignature.getFoxSignature("<->");
if (pattern.equals("(-+)"))
return FoxSignature.getFoxSignature("-");
if (pattern.equals("\\|+") || pattern.equals("\\|\\|"))
return FoxSignature.getFoxSignature("|");
if (pattern.equals("([*]+)"))
return FoxSignature.getFoxSignature("*");
if (pattern.equals("[%s]+") || pattern.equals("[%s]*"))
if (pattern.equals("[%s]+"))
return FoxSignature.getSpecialSpaces();
if (pattern.equals("[%s]*"))
return 0;
final String pattern2 = pattern.replaceAll("\\[%s\\][+*?]?|\\(\\[([^\\\\\\[\\]])+\\]\\)[+*?]?", "");
final Matcher m1 = p1.matcher(pattern2);
if (m1.matches())
return FoxSignature.getFoxSignatureFromRegex(m1.group(1));
final Matcher m2 = p2.matcher(pattern2);
if (m2.matches())
return getSignatureP2(pattern2);
final Matcher m3 = p3.matcher(pattern2);
if (m3.matches())
return FoxSignature.getSpecial1();
// synchronized (UNKNOWN) {
// final boolean changed = UNKNOWN.add(pattern);
// if (changed)
// System.err.println("unknow=" + pattern);
//
// final boolean changed = UNKNOWN.add(pattern2);
// if (changed) {
// if (pattern.equals(pattern2))
// System.err.println("unknow=" + UNKNOWN.size() + " " + pattern);
// else
// System.err.println("unknow=" + UNKNOWN.size() + " " + pattern2 + " " + pattern);
// // Thread.dumpStack();
// }
// }
return 0;
}

View File

@ -35,7 +35,6 @@
*/
package net.sourceforge.plantuml.compositediagram;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@ -58,15 +57,12 @@ public class CompositeDiagramFactory extends PSystemCommandFactory {
}
@Override
protected List<Command> createCommands() {
final List<Command> cmds = new ArrayList<>();
protected void initCommandsList(List<Command> cmds) {
cmds.add(new CommandCreateBlock());
cmds.add(new CommandLinkBlock());
cmds.add(new CommandCreatePackageBlock());
cmds.add(new CommandEndPackageBlock());
CommonCommands.addCommonCommands1(cmds);
return cmds;
}
@Override

View File

@ -61,22 +61,22 @@ public class CommandCreoleImg implements Command {
public int matchingSize(String line) {
final Matcher2 m = pattern.matcher(line);
if (m.find() == false) {
if (m.find() == false)
return 0;
}
return m.group(1).length();
}
public String executeAndGetRemaining(String line, StripeSimple stripe) {
final Matcher2 m = pattern.matcher(line);
if (m.find() == false) {
if (m.find() == false)
throw new IllegalStateException();
}
String src = m.group(2);
final double scale = Parser.getScale(m.group(3), 1);
if (src.toLowerCase().startsWith("src=")) {
if (src.toLowerCase().startsWith("src="))
src = src.substring(4);
}
src = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(src, "\"");
stripe.addImage(src, scale);
return line.substring(m.group(1).length());

View File

@ -57,7 +57,6 @@ 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.CreoleMode;
import net.sourceforge.plantuml.creole.Parser;
import net.sourceforge.plantuml.creole.Sheet;
import net.sourceforge.plantuml.creole.SheetBlock1;
import net.sourceforge.plantuml.creole.SheetBlock2;

View File

@ -518,16 +518,6 @@ public class Link extends WithLinkType implements Hideable, Removeable {
}
private UmlDiagramType umlType;
public void setUmlDiagramType(UmlDiagramType type) {
this.umlType = type;
}
public UmlDiagramType getUmlDiagramType() {
return umlType;
}
private LinkConstraint linkConstraint;
public void setLinkConstraint(LinkConstraint linkConstraint) {

View File

@ -44,7 +44,6 @@ import java.util.List;
import net.sourceforge.plantuml.EmbeddedDiagram;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.awt.geom.XDimension2D;

View File

@ -35,7 +35,6 @@
*/
package net.sourceforge.plantuml.descdiagram;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@ -74,9 +73,7 @@ public class DescriptionDiagramFactory extends PSystemCommandFactory {
}
@Override
protected List<Command> createCommands() {
final List<Command> cmds = new ArrayList<>();
protected void initCommandsList(List<Command> cmds) {
cmds.add(new CommandFootboxIgnored());
cmds.add(new CommandNamespaceSeparator());
cmds.add(new CommandRankDir());
@ -126,8 +123,6 @@ public class DescriptionDiagramFactory extends PSystemCommandFactory {
cmds.add(new CommandArchimate());
cmds.add(new CommandArchimateMultilines());
cmds.add(new CommandCreateDomain());
return cmds;
}
}

View File

@ -42,7 +42,6 @@ import net.sourceforge.plantuml.awt.geom.XDimension2D;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate;
import net.sourceforge.plantuml.ugraphic.color.HColor;
public class ETileAlternation extends ETile {

View File

@ -35,7 +35,6 @@
*/
package net.sourceforge.plantuml.ebnf;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@ -52,9 +51,7 @@ public class PSystemEbnfFactory extends PSystemCommandFactory {
}
@Override
protected List<Command> createCommands() {
final List<Command> cmds = new ArrayList<>();
protected void initCommandsList(List<Command> cmds) {
CommonCommands.addCommonCommands1(cmds);
cmds.add(new CommandComment());
cmds.add(new CommandCommentMultilines2());
@ -62,8 +59,6 @@ public class PSystemEbnfFactory extends PSystemCommandFactory {
cmds.add(new CommandEBnfSingleLine());
cmds.add(new CommandEbnfMultilines());
// cmds.add(new CommandNoteMultilines());
return cmds;
}
@Override

View File

@ -35,7 +35,6 @@
*/
package net.sourceforge.plantuml.flowdiagram;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@ -56,11 +55,9 @@ public class FlowDiagramFactory extends PSystemCommandFactory {
}
@Override
protected List<Command> createCommands() {
final List<Command> cmds = new ArrayList<>();
protected void initCommandsList(List<Command> cmds) {
cmds.add(new CommandLineSimple());
cmds.add(new CommandLink());
return cmds;
}
}

View File

@ -35,7 +35,6 @@
*/
package net.sourceforge.plantuml.help;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@ -51,10 +50,7 @@ public class HelpFactory extends PSystemCommandFactory {
}
@Override
protected List<Command> createCommands() {
final List<Command> cmds = new ArrayList<>();
protected void initCommandsList(List<Command> cmds) {
cmds.add(new CommandHelp());
cmds.add(new CommandHelpColor());
cmds.add(new CommandHelpFont());
@ -62,8 +58,6 @@ public class HelpFactory extends PSystemCommandFactory {
cmds.add(new CommandHelpSkinparam());
cmds.add(new CommandHelpType());
cmds.add(new CommandHelpTheme());
return cmds;
}
}

View File

@ -99,6 +99,7 @@ public class LatexBuilder implements ScientificEquation {
this.icon = icon;
}
@Override
public BufferedImage getImage() {
if (cache == null) {
cache = new BufferedImage((int) (icon.getIconWidth() * scale), (int) (icon.getIconHeight() * scale),
@ -133,6 +134,11 @@ public class LatexBuilder implements ScientificEquation {
return this;
}
@Override
public double getScale() {
return scale;
}
}
public String getSource() {

View File

@ -55,7 +55,7 @@ public class CommandMindMapOrgmode extends SingleLineCommand2<MindMapDiagram> {
static IRegex getRegexConcat() {
return RegexConcat.build(CommandMindMapOrgmode.class.getName(), RegexLeaf.start(), //
new RegexLeaf("TYPE", "([ \t]*[*]+)"), //
new RegexLeaf("TYPE", "([ \t]*\\*+)"), //
new RegexOptional(new RegexLeaf("BACKCOLOR", "\\[(#\\w+)\\]")), //
new RegexLeaf("SHAPE", "(_)?"), //
RegexLeaf.spaceOneOrMore(), //

View File

@ -60,7 +60,7 @@ public class CommandMindMapOrgmodeMultiline extends CommandMultilines2<MindMapDi
static IRegex getRegexConcat() {
return RegexConcat.build(CommandMindMapOrgmodeMultiline.class.getName(), RegexLeaf.start(), //
new RegexLeaf("TYPE", "([*]+)"), //
new RegexLeaf("TYPE", "(\\*+)"), //
new RegexOptional(new RegexLeaf("BACKCOLOR", "\\[(#\\w+)\\]")), //
new RegexLeaf("SHAPE", "(_)?"), //
new RegexLeaf(":"), //

View File

@ -35,7 +35,6 @@
*/
package net.sourceforge.plantuml.mindmap;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@ -53,9 +52,7 @@ public class MindMapDiagramFactory extends PSystemCommandFactory {
}
@Override
protected List<Command> createCommands() {
final List<Command> cmds = new ArrayList<>();
protected void initCommandsList(List<Command> cmds) {
CommonCommands.addCommonCommands1(cmds);
// cmds.add(new CommandMindMapTabulation());
cmds.add(new CommandRankDir());
@ -64,8 +61,6 @@ public class MindMapDiagramFactory extends PSystemCommandFactory {
cmds.add(new CommandMindMapRoot());
cmds.add(new CommandMindMapPlus());
cmds.add(new CommandMindMapDirection());
return cmds;
}
@Override

View File

@ -35,7 +35,6 @@
*/
package net.sourceforge.plantuml.nwdiag;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@ -58,9 +57,7 @@ public class NwDiagramFactory extends PSystemCommandFactory {
}
@Override
protected List<Command> createCommands() {
final List<Command> cmds = new ArrayList<>();
protected void initCommandsList(List<Command> cmds) {
CommonCommands.addCommonCommands1(cmds);
cmds.add(new CommandNwDiagInit());
cmds.add(new CommandComment());
@ -71,7 +68,6 @@ public class NwDiagramFactory extends PSystemCommandFactory {
cmds.add(new CommandProperty());
cmds.add(new CommandEndSomething());
cmds.add(new CommandFootboxIgnored());
return cmds;
}
}

View File

@ -35,9 +35,7 @@
*/
package net.sourceforge.plantuml.project;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Map;
@ -81,27 +79,25 @@ import net.sourceforge.plantuml.style.CommandStyleMultilinesCSS;
public class GanttDiagramFactory extends PSystemCommandFactory {
static private final List<Subject> subjects() {
return Arrays.<Subject>asList(new SubjectTask(), new SubjectProject(), new SubjectDayOfWeek(),
new SubjectDayAsDate(), new SubjectDaysAsDates(), new SubjectResource(), new SubjectToday(),
new SubjectSeparator());
return Arrays.<Subject>asList(SubjectTask.ME, SubjectProject.ME, SubjectDayOfWeek.ME, SubjectDayAsDate.ME,
SubjectDaysAsDates.ME, SubjectResource.ME, SubjectToday.ME, SubjectSeparator.ME);
}
public GanttDiagramFactory(DiagramType type) {
super(type);
public GanttDiagramFactory() {
super(DiagramType.GANTT);
}
@Override
protected List<Command> createCommands() {
final List<Command> cmds = new ArrayList<>();
protected void initCommandsList(List<Command> cmds) {
CommonCommands.addTitleCommands(cmds);
CommonCommands.addCommonCommands2(cmds);
cmds.add(new CommandStyleMultilinesCSS());
cmds.add(new CommandStyleImport());
cmds.add(CommandStyleMultilinesCSS.ME);
cmds.add(CommandStyleImport.ME);
cmds.add(new CommandNope());
cmds.add(CommandNope.ME);
cmds.addAll(getLanguageCommands());
addLanguageCommands(cmds);
cmds.add(new CommandGanttArrow());
cmds.add(new CommandGanttArrow2());
@ -119,48 +115,32 @@ public class GanttDiagramFactory extends PSystemCommandFactory {
cmds.add(new CommandLabelOnColumn());
cmds.add(new CommandHideResourceName());
cmds.add(new CommandHideResourceFootbox());
return cmds;
}
static private final Collection<Command> cache = new ArrayList<>();
private void addLanguageCommands(List<Command> cmd) {
for (Subject subject : subjects())
for (SentenceSimple sentenceA : subject.getSentences()) {
cmd.add(NaturalCommand.create(sentenceA));
for (SentenceSimple sentenceB : subject.getSentences()) {
final String signatureA = sentenceA.getSignature();
final String signatureB = sentenceB.getSignature();
if (signatureA.equals(signatureB) == false)
cmd.add(NaturalCommand.create(new SentenceAnd(sentenceA, sentenceB)));
public static void clearCache() {
cache.clear();
}
private static Collection<Command> getLanguageCommands() {
// Useless synchronized now
synchronized (cache) {
if (cache.size() == 0) {
for (Subject subject : subjects())
for (SentenceSimple sentenceA : subject.getSentences()) {
cache.add(NaturalCommand.create(sentenceA));
for (SentenceSimple sentenceB : subject.getSentences()) {
final String signatureA = sentenceA.getSignature();
final String signatureB = sentenceB.getSignature();
if (signatureA.equals(signatureB) == false)
cache.add(NaturalCommand.create(new SentenceAnd(sentenceA, sentenceB)));
}
}
for (Subject subject : subjects())
for (SentenceSimple sentenceA : subject.getSentences())
for (SentenceSimple sentenceB : subject.getSentences())
for (SentenceSimple sentenceC : subject.getSentences()) {
final String signatureA = sentenceA.getSignature();
final String signatureB = sentenceB.getSignature();
final String signatureC = sentenceC.getSignature();
if (signatureA.equals(signatureB) == false && signatureA.equals(signatureC) == false
&& signatureC.equals(signatureB) == false)
cache.add(
NaturalCommand.create(new SentenceAndAnd(sentenceA, sentenceB, sentenceC)));
}
}
}
}
return cache;
for (Subject subject : subjects())
for (SentenceSimple sentenceA : subject.getSentences())
for (SentenceSimple sentenceB : subject.getSentences())
for (SentenceSimple sentenceC : subject.getSentences()) {
final String signatureA = sentenceA.getSignature();
final String signatureB = sentenceB.getSignature();
final String signatureC = sentenceC.getSignature();
if (signatureA.equals(signatureB) == false && signatureA.equals(signatureC) == false
&& signatureC.equals(signatureB) == false)
cmd.add(NaturalCommand.create(new SentenceAndAnd(sentenceA, sentenceB, sentenceC)));
}
}
@Override

View File

@ -42,7 +42,7 @@ import net.sourceforge.plantuml.project.core.Task;
public class SentenceDisplayOnSameRowAs extends SentenceSimple {
public SentenceDisplayOnSameRowAs() {
super(new SubjectTask(), Verbs.displayOnSameRowAs(), new ComplementNamed());
super(SubjectTask.ME, Verbs.displayOnSameRowAs, new ComplementNamed());
}
@Override

View File

@ -45,7 +45,7 @@ import net.sourceforge.plantuml.project.core.TaskInstant;
public class SentenceEnds extends SentenceSimple {
public SentenceEnds() {
super(new SubjectTask(), Verbs.ends(), new ComplementBeforeOrAfterOrAtTaskStartOrEnd());
super(SubjectTask.ME, Verbs.ends, new ComplementBeforeOrAfterOrAtTaskStartOrEnd());
}
@Override

View File

@ -44,7 +44,7 @@ import net.sourceforge.plantuml.project.core.TaskInstant;
public class SentenceHappens extends SentenceSimple {
public SentenceHappens() {
super(new SubjectTask(), Verbs.happens(), new ComplementBeforeOrAfterOrAtTaskStartOrEnd());
super(SubjectTask.ME, Verbs.happens, new ComplementBeforeOrAfterOrAtTaskStartOrEnd());
}
@Override

View File

@ -44,7 +44,7 @@ import net.sourceforge.plantuml.project.time.Day;
public class SentenceHappensDate extends SentenceSimple {
public SentenceHappensDate() {
super(new SubjectTask(), Verbs.happens(), new ComplementDate());
super(SubjectTask.ME, Verbs.happens, new ComplementDate());
}
@Override

View File

@ -42,7 +42,7 @@ import net.sourceforge.plantuml.project.core.Task;
public class SentenceIsColored extends SentenceSimple {
public SentenceIsColored() {
super(new SubjectTask(), Verbs.isColored(), new ComplementInColors());
super(SubjectTask.ME, Verbs.isColored, new ComplementInColors());
}
@Override

View File

@ -42,7 +42,7 @@ import net.sourceforge.plantuml.project.core.Task;
public class SentenceIsColoredForCompletion extends SentenceSimple {
public SentenceIsColoredForCompletion() {
super(new SubjectTask(), Verbs.isColoredForCompletion(), new ComplementInColorsFromTo());
super(SubjectTask.ME, Verbs.isColoredForCompletion, new ComplementInColorsFromTo());
}
@Override

View File

@ -42,7 +42,7 @@ import net.sourceforge.plantuml.project.core.Task;
public class SentenceIsDeleted extends SentenceSimple {
public SentenceIsDeleted() {
super(new SubjectTask(), Verbs.isDeleted(), new ComplementEmpty());
super(SubjectTask.ME, Verbs.isDeleted, new ComplementEmpty());
}
@Override

View File

@ -43,7 +43,7 @@ import net.sourceforge.plantuml.project.core.Task;
public class SentenceIsForTask extends SentenceSimple {
public SentenceIsForTask() {
super(new SubjectTask(), Verbs.is(), new ComplementCompleted());
super(SubjectTask.ME, Verbs.is, new ComplementCompleted());
}
@Override

View File

@ -43,7 +43,7 @@ import net.sourceforge.plantuml.project.core.Task;
public class SentenceLasts extends SentenceSimple {
public SentenceLasts() {
super(new SubjectTask(), Verbs.lasts(), new ComplementSeveralDays());
super(SubjectTask.ME, Verbs.lasts, new ComplementSeveralDays());
}
@Override

View File

@ -43,7 +43,7 @@ import net.sourceforge.plantuml.project.core.Task;
public class SentenceLinksTo extends SentenceSimple {
public SentenceLinksTo() {
super(new SubjectTask(), Verbs.linksTo(), new ComplementUrl());
super(SubjectTask.ME, Verbs.linksTo, new ComplementUrl());
}
@Override

View File

@ -45,7 +45,7 @@ import net.sourceforge.plantuml.project.core.TaskInstant;
public class SentenceOccurs extends SentenceSimple {
public SentenceOccurs() {
super(new SubjectTask(), Verbs.occurs(), new ComplementFromTo());
super(SubjectTask.ME, Verbs.occurs, new ComplementFromTo());
}
@Override

View File

@ -43,7 +43,7 @@ import net.sourceforge.plantuml.project.time.Day;
public class SentencePausesDate extends SentenceSimple {
public SentencePausesDate() {
super(new SubjectTask(), Verbs.pauses(), new ComplementDate());
super(SubjectTask.ME, Verbs.pauses, new ComplementDate());
}
@Override

View File

@ -44,7 +44,7 @@ import net.sourceforge.plantuml.project.time.Day;
public class SentencePausesDates extends SentenceSimple {
public SentencePausesDates() {
super(new SubjectTask(), Verbs.pauses(), new ComplementDates());
super(SubjectTask.ME, Verbs.pauses, new ComplementDates());
}
@Override

View File

@ -43,7 +43,7 @@ import net.sourceforge.plantuml.project.time.DayOfWeek;
public class SentencePausesDayOfWeek extends SentenceSimple {
public SentencePausesDayOfWeek() {
super(new SubjectTask(), Verbs.pauses(), new ComplementDayOfWeek());
super(SubjectTask.ME, Verbs.pauses, new ComplementDayOfWeek());
}
@Override

View File

@ -43,7 +43,7 @@ import net.sourceforge.plantuml.project.time.Day;
public class SentenceTaskEndsAbsolute extends SentenceSimple {
public SentenceTaskEndsAbsolute() {
super(new SubjectTask(), Verbs.ends2(), new ComplementDate());
super(SubjectTask.ME, Verbs.ends2, new ComplementDate());
}
@Override

View File

@ -46,7 +46,7 @@ import net.sourceforge.plantuml.ugraphic.color.HColor;
public class SentenceTaskStarts extends SentenceSimple {
public SentenceTaskStarts() {
super(new SubjectTask(), Verbs.starts2(), new ComplementBeforeOrAfterOrAtTaskStartOrEnd());
super(SubjectTask.ME, Verbs.starts2, new ComplementBeforeOrAfterOrAtTaskStartOrEnd());
}
@Override

View File

@ -43,7 +43,7 @@ import net.sourceforge.plantuml.project.time.Day;
public class SentenceTaskStartsAbsolute extends SentenceSimple {
public SentenceTaskStartsAbsolute() {
super(new SubjectTask(), Verbs.starts3(), new ComplementDate());
super(SubjectTask.ME, Verbs.starts3, new ComplementDate());
}
@Override

View File

@ -46,7 +46,7 @@ import net.sourceforge.plantuml.ugraphic.color.HColor;
public class SentenceTaskStartsWithColor extends SentenceSimple {
public SentenceTaskStartsWithColor() {
super(new SubjectTask(), Verbs.starts2(),
super(SubjectTask.ME, Verbs.starts2,
new PairOfSomething(new ComplementBeforeOrAfterOrAtTaskStartOrEnd(), new ComplementWithColorLink()));
}

View File

@ -51,13 +51,18 @@ import net.sourceforge.plantuml.ugraphic.color.HColor;
public class SubjectDayAsDate implements Subject {
public static final Subject ME = new SubjectDayAsDate();
private SubjectDayAsDate() {
}
public Failable<Day> getMe(GanttDiagram project, RegexResult arg) {
if (arg.get("BDAY", 0) != null) {
if (arg.get("BDAY", 0) != null)
return Failable.ok(resultB(arg));
}
if (arg.get("ECOUNT", 0) != null) {
if (arg.get("ECOUNT", 0) != null)
return Failable.ok(resultE(project, arg));
}
throw new IllegalStateException();
}
@ -81,7 +86,7 @@ public class SubjectDayAsDate implements Subject {
class Close extends SentenceSimple {
public Close() {
super(SubjectDayAsDate.this, Verbs.isOrAre(), new ComplementClose());
super(SubjectDayAsDate.this, Verbs.isOrAre, new ComplementClose());
}
@Override
@ -93,7 +98,7 @@ public class SubjectDayAsDate implements Subject {
class Open extends SentenceSimple {
public Open() {
super(SubjectDayAsDate.this, Verbs.isOrAre(), new ComplementOpen());
super(SubjectDayAsDate.this, Verbs.isOrAre, new ComplementOpen());
}
@Override
@ -106,7 +111,7 @@ public class SubjectDayAsDate implements Subject {
class InColor extends SentenceSimple {
public InColor() {
super(SubjectDayAsDate.this, Verbs.isOrAre(), new ComplementInColors2());
super(SubjectDayAsDate.this, Verbs.isOrAre, new ComplementInColors2());
}
@Override

View File

@ -49,6 +49,11 @@ import net.sourceforge.plantuml.ugraphic.color.HColor;
public class SubjectDayOfWeek implements Subject {
public static final Subject ME = new SubjectDayOfWeek();
private SubjectDayOfWeek() {
}
public IRegex toRegex() {
return new RegexLeaf("SUBJECT", "(" + DayOfWeek.getRegexString() + ")");
}
@ -64,7 +69,7 @@ public class SubjectDayOfWeek implements Subject {
class AreOpen extends SentenceSimple {
public AreOpen() {
super(SubjectDayOfWeek.this, Verbs.are(), new ComplementOpen());
super(SubjectDayOfWeek.this, Verbs.are, new ComplementOpen());
}
@Override
@ -78,7 +83,7 @@ public class SubjectDayOfWeek implements Subject {
class AreClose extends SentenceSimple {
public AreClose() {
super(SubjectDayOfWeek.this, Verbs.are(), new ComplementClose());
super(SubjectDayOfWeek.this, Verbs.are, new ComplementClose());
}
@Override
@ -93,7 +98,7 @@ public class SubjectDayOfWeek implements Subject {
class InColor extends SentenceSimple {
public InColor() {
super(SubjectDayOfWeek.this, Verbs.isOrAre(), new ComplementInColors2());
super(SubjectDayOfWeek.this, Verbs.isOrAre, new ComplementInColors2());
}
@Override

View File

@ -52,6 +52,11 @@ import net.sourceforge.plantuml.ugraphic.color.HColor;
public class SubjectDaysAsDates implements Subject {
public static final Subject ME = new SubjectDaysAsDates();
private SubjectDaysAsDates() {
}
public IRegex toRegex() {
return new RegexOr(toRegexB(), toRegexE(), andRegex(), thenRegex());
}
@ -153,7 +158,7 @@ public class SubjectDaysAsDates implements Subject {
class Close extends SentenceSimple {
public Close() {
super(SubjectDaysAsDates.this, Verbs.isOrAre(), new ComplementClose());
super(SubjectDaysAsDates.this, Verbs.isOrAre, new ComplementClose());
}
@Override
@ -169,7 +174,7 @@ public class SubjectDaysAsDates implements Subject {
class Open extends SentenceSimple {
public Open() {
super(SubjectDaysAsDates.this, Verbs.isOrAre(), new ComplementOpen());
super(SubjectDaysAsDates.this, Verbs.isOrAre, new ComplementOpen());
}
@Override
@ -186,7 +191,7 @@ public class SubjectDaysAsDates implements Subject {
class InColor extends SentenceSimple {
public InColor() {
super(SubjectDaysAsDates.this, Verbs.isOrAre(), new ComplementInColors2());
super(SubjectDaysAsDates.this, Verbs.isOrAre, new ComplementInColors2());
}
@Override
@ -204,7 +209,7 @@ public class SubjectDaysAsDates implements Subject {
class Named extends SentenceSimple {
public Named() {
super(SubjectDaysAsDates.this, Verbs.isOrAreNamed(), new ComplementNamed());
super(SubjectDaysAsDates.this, Verbs.isOrAreNamed, new ComplementNamed());
}
@Override

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