diff --git a/src/net/sourceforge/plantuml/cucadiagram/Code.java b/src/com/plantuml/wasm/RunInit.java
similarity index 76%
rename from src/net/sourceforge/plantuml/cucadiagram/Code.java
rename to src/com/plantuml/wasm/RunInit.java
index 8eccd8e7a..0d5dbe7d2 100644
--- a/src/net/sourceforge/plantuml/cucadiagram/Code.java
+++ b/src/com/plantuml/wasm/RunInit.java
@@ -30,14 +30,23 @@
*
*
* Original Author: Arnaud Roques
- *
+ *
*
*/
-package net.sourceforge.plantuml.cucadiagram;
+package com.plantuml.wasm;
-public interface Code {
+import java.io.IOException;
- public String getName();
+import net.sourceforge.plantuml.version.Version;
+
+public class RunInit {
+
+ public static String pathStdlib;
+
+ public static void main(String[] argsArray) throws IOException {
+ pathStdlib = argsArray[0];
+ System.err.println("RunInit: " + Version.versionString());
+ System.err.println("Internal path for stblib: " + pathStdlib);
+ }
- public Code eventuallyRemoveStartingAndEndingDoubleQuote(String format);
}
diff --git a/src/com/plantuml/wasm/Utils.java b/src/com/plantuml/wasm/Utils.java
new file mode 100644
index 000000000..5b0f186d5
--- /dev/null
+++ b/src/com/plantuml/wasm/Utils.java
@@ -0,0 +1,83 @@
+/* ========================================================================
+ * PlantUML : a free UML diagram generator
+ * ========================================================================
+ *
+ * (C) Copyright 2009-2023, Arnaud Roques
+ *
+ * Project Info: http://plantuml.com
+ *
+ * If you like this project or if you find it useful, you can support us at:
+ *
+ * http://plantuml.com/patreon (only 1$ per month!)
+ * http://plantuml.com/paypal
+ *
+ * This file is part of PlantUML.
+ *
+ * PlantUML is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * PlantUML distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+ * USA.
+ *
+ *
+ * Original Author: Arnaud Roques
+ *
+ *
+ */
+package com.plantuml.wasm;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+
+import net.sourceforge.plantuml.FileFormat;
+import net.sourceforge.plantuml.FileFormatOption;
+import net.sourceforge.plantuml.SourceStringReader;
+import net.sourceforge.plantuml.core.DiagramDescription;
+
+public class Utils {
+
+ public static int convertPng(String pathOut, String text) throws IOException {
+ final FileFormatOption format = new FileFormatOption(FileFormat.PNG);
+ text = cleanText(text);
+ return doTheJob(pathOut, text, format);
+ }
+
+ private static String cleanText(String text) {
+ if (text.endsWith("\n") == false)
+ text = text + "\n";
+ if (text.endsWith("@start") == false)
+ text = "@startuml\n" + text + "@enduml\n";
+
+ return text;
+ }
+
+ private static int doTheJob(String pathOut, String text, final FileFormatOption format)
+ throws FileNotFoundException, IOException {
+ final SourceStringReader sr = new SourceStringReader(text);
+ final FileOutputStream fos = new FileOutputStream(new File(pathOut));
+ DiagramDescription description = sr.outputImage(fos, format);
+ fos.close();
+ if (description.getDescription() != null && description.getDescription().contains("error"))
+ return 1;
+
+ return 0;
+ }
+
+ public static int convertSvg(String pathOut, String text) throws IOException {
+ final FileFormatOption format = new FileFormatOption(FileFormat.SVG);
+ text = cleanText(text);
+ return doTheJob(pathOut, text, format);
+ }
+
+}
diff --git a/src/ext/plantuml/com/ctreber/acearth/ACearth.java b/src/ext/plantuml/com/ctreber/acearth/ACearth.java
index 0b3c8e78c..cc0b2c738 100644
--- a/src/ext/plantuml/com/ctreber/acearth/ACearth.java
+++ b/src/ext/plantuml/com/ctreber/acearth/ACearth.java
@@ -97,6 +97,7 @@ import ext.plantuml.com.ctreber.aclib.sort.QuickSort;
* @author Christian Treber, ct@ctreber.com
*/
public class ACearth {
+ // :: remove folder when WASM
public static final String VERSION = "1.1";
public static final String BUILD = "22.11.2002 004";
@@ -115,7 +116,8 @@ public class ACearth {
/**
*
* Well, the main class.
- * @param markers
+ *
+ * @param markers
*/
public ACearth(List markers) {
// fsStartTime = System.currentTimeMillis();
@@ -171,15 +173,15 @@ public class ACearth {
// Process stars and lines (produces ScanDots-s).
List lScanDots = new ArrayList();
if (fConf.getBoolean("starsP")) {
- ScanDotGenerator lGenerator = new DotGeneratorStars(fConf.getInt("imageWidth"),
- fConf.getInt("imageHeight"), fConf.getDouble("starFrequency"), fConf.getInt("bigStars"), new Random(fCurrentTime));
+ ScanDotGenerator lGenerator = new DotGeneratorStars(fConf.getInt("imageWidth"), fConf.getInt("imageHeight"),
+ fConf.getDouble("starFrequency"), fConf.getInt("bigStars"), new Random(fCurrentTime));
lGenerator.generateScanDots();
lScanDots.addAll(lGenerator.getScanDots());
}
if (fConf.getBoolean("gridP")) {
- ScanDotGenerator lGenerator = new DotGeneratorLines(lProjection, fConf.getInt("gridDivision"), fConf
- .getInt("gridPixelDivision"));
+ ScanDotGenerator lGenerator = new DotGeneratorLines(lProjection, fConf.getInt("gridDivision"),
+ fConf.getInt("gridPixelDivision"));
lGenerator.generateScanDots();
lScanDots.addAll(lGenerator.getScanDots());
}
@@ -233,7 +235,8 @@ public class ACearth {
if (fConf.getInt("fixedTime") == 0) {
// No fixed time.
// final long lTimePassed = System.currentTimeMillis() - fsStartTime;
- // fCurrentTime = fsStartTime + (long) (fConf.getDouble("timeWarpFactor") * lTimePassed);
+ // fCurrentTime = fsStartTime + (long) (fConf.getDouble("timeWarpFactor") *
+ // lTimePassed);
fCurrentTime = System.currentTimeMillis();
} else {
// Fixed time.
@@ -259,8 +262,8 @@ public class ACearth {
// for ViewRotGalactic, compute appropriate viewing rotation
if (fConf.is("viewRotationType", "Galactic")) {
- fViewRotation = (Toolkit.degsToRads(fConf.getSunPos().getLat()
- * Math.sin((fViewPos.getLong() - fConf.getSunPos().getLong()))));
+ fViewRotation = (Toolkit.degsToRads(
+ fConf.getSunPos().getLat() * Math.sin((fViewPos.getLong() - fConf.getSunPos().getLong()))));
} else {
fViewRotation = fConf.getDouble("viewRotation");
}
@@ -290,8 +293,8 @@ public class ACearth {
z = 1;
/*
- * rotate in about y axis (from z towards x) according to the number of
- * orbits we've completed
+ * rotate in about y axis (from z towards x) according to the number of orbits
+ * we've completed
*/
a = (double) pTimeMillis / (fConf.getDouble("orbitPeriod") * 3600 * 1000) * 2 * Math.PI;
c = Math.cos(a);
@@ -302,8 +305,8 @@ public class ACearth {
x = t2;
/*
- * rotate about z axis (from x towards y) according to the inclination
- * of the orbit
+ * rotate about z axis (from x towards y) according to the inclination of the
+ * orbit
*/
a = Toolkit.degsToRads(fConf.getDouble("orbitInclination"));
c = Math.cos(a);
@@ -314,8 +317,8 @@ public class ACearth {
y = t2;
/*
- * rotate about y axis (from x towards z) according to the number of
- * rotations the earth has made
+ * rotate about y axis (from x towards z) according to the number of rotations
+ * the earth has made
*/
a = ((double) pTimeMillis / 86400000) * (2 * Math.PI);
c = Math.cos(a);
diff --git a/src/ext/plantuml/com/ctreber/aclib/gui/MOBoolean.java b/src/ext/plantuml/com/ctreber/aclib/gui/MOBoolean.java
index 814b9272f..d06e22066 100644
--- a/src/ext/plantuml/com/ctreber/aclib/gui/MOBoolean.java
+++ b/src/ext/plantuml/com/ctreber/aclib/gui/MOBoolean.java
@@ -9,6 +9,7 @@ package ext.plantuml.com.ctreber.aclib.gui;
*/
public class MOBoolean extends MonitoredObject
{
+ // :: remove folder when WASM
private boolean fBoolean;
public MOBoolean()
diff --git a/src/ext/plantuml/com/ctreber/aclib/sort/CTSort.java b/src/ext/plantuml/com/ctreber/aclib/sort/CTSort.java
index 4e9950b2f..c87497bc1 100644
--- a/src/ext/plantuml/com/ctreber/aclib/sort/CTSort.java
+++ b/src/ext/plantuml/com/ctreber/aclib/sort/CTSort.java
@@ -11,6 +11,7 @@ import java.util.Comparator;
*/
abstract public class CTSort
{
+ // :: remove folder when WASM
public void sort(Object[] items)
{
sort(items, new DefaultComparator());
diff --git a/src/ext/plantuml/com/google/zxing/BarcodeFormat.java b/src/ext/plantuml/com/google/zxing/BarcodeFormat.java
index 13567630c..35a649542 100644
--- a/src/ext/plantuml/com/google/zxing/BarcodeFormat.java
+++ b/src/ext/plantuml/com/google/zxing/BarcodeFormat.java
@@ -24,6 +24,7 @@ import java.util.Hashtable;
* @author Sean Owen
*/
public final class BarcodeFormat {
+ // :: remove folder when WASM
// No, we can't use an enum here. J2ME doesn't support it.
diff --git a/src/jcckit/GraphicsPlotCanvas.java b/src/jcckit/GraphicsPlotCanvas.java
index f2e346573..687bce1e8 100644
--- a/src/jcckit/GraphicsPlotCanvas.java
+++ b/src/jcckit/GraphicsPlotCanvas.java
@@ -48,6 +48,7 @@ import jcckit.util.Factory;
* @author Franz-Josef Elmer
*/
public class GraphicsPlotCanvas extends PlotCanvas {
+ // ::remove folder when WASM
/** Key of a configuration parameter. */
public static final String BACKGROUND_KEY = "background";
public static final String FOREGROUND_KEY = "foreground";
diff --git a/src/net/sourceforge/plantuml/AbstractPSystem.java b/src/net/sourceforge/plantuml/AbstractPSystem.java
index 23c1ccd30..0de274cab 100644
--- a/src/net/sourceforge/plantuml/AbstractPSystem.java
+++ b/src/net/sourceforge/plantuml/AbstractPSystem.java
@@ -78,10 +78,12 @@ public abstract class AbstractPSystem implements Diagram {
toAppend.append(Version.versionString());
toAppend.append("(" + Version.compileTimeString() + ")\n");
toAppend.append("(" + License.getCurrent() + " source distribution)\n");
+ // ::comment when WASM
for (String name : OptionPrint.interestingProperties()) {
toAppend.append(name);
toAppend.append(BackSlash.CHAR_NEWLINE);
}
+ // ::done
return toAppend.toString();
}
@@ -178,10 +180,12 @@ public abstract class AbstractPSystem implements Diagram {
// }
return exportDiagramNow(os, index, fileFormatOption);
} finally {
- if (OptionFlags.getInstance().isEnableStats()) {
+ // ::comment when WASM
+ if (OptionFlags.getInstance().isEnableStats())
StatsUtilsIncrement.onceMoreGenerate(System.currentTimeMillis() - now, getClass(),
fileFormatOption.getFileFormat());
- }
+
+ // ::done
}
}
diff --git a/src/net/sourceforge/plantuml/DirWatcher.java b/src/net/sourceforge/plantuml/DirWatcher.java
index 9511e0fc5..6877e1783 100644
--- a/src/net/sourceforge/plantuml/DirWatcher.java
+++ b/src/net/sourceforge/plantuml/DirWatcher.java
@@ -49,6 +49,7 @@ import net.sourceforge.plantuml.preproc.FileWithSuffix;
@Deprecated
public class DirWatcher {
+ // ::remove file when WASM
final private File dir;
final private Option option;
diff --git a/src/net/sourceforge/plantuml/DirWatcher2.java b/src/net/sourceforge/plantuml/DirWatcher2.java
index ac185198a..d849574ac 100644
--- a/src/net/sourceforge/plantuml/DirWatcher2.java
+++ b/src/net/sourceforge/plantuml/DirWatcher2.java
@@ -53,6 +53,7 @@ import net.sourceforge.plantuml.log.Logme;
import net.sourceforge.plantuml.preproc.FileWithSuffix;
public class DirWatcher2 {
+ // ::remove file when WASM
final private File dir;
final private Option option;
diff --git a/src/net/sourceforge/plantuml/EmptyImageBuilder.java b/src/net/sourceforge/plantuml/EmptyImageBuilder.java
index c0abd7111..dc1ae5f6f 100644
--- a/src/net/sourceforge/plantuml/EmptyImageBuilder.java
+++ b/src/net/sourceforge/plantuml/EmptyImageBuilder.java
@@ -74,6 +74,7 @@ public class EmptyImageBuilder {
if (width <= 0 || height <= 0)
throw new IllegalArgumentException("width and height must be positive");
+ // ::comment when WASM
if (width > GraphvizUtils.getenvImageLimit()) {
Log.info("Width too large " + width + ". You should set PLANTUML_LIMIT_SIZE");
width = GraphvizUtils.getenvImageLimit();
@@ -82,6 +83,7 @@ public class EmptyImageBuilder {
Log.info("Height too large " + height + ". You should set PLANTUML_LIMIT_SIZE");
height = GraphvizUtils.getenvImageLimit();
}
+ // ::done
this.background = background;
this.stringBounder = stringBounder;
Log.info("Creating image " + width + "x" + height);
diff --git a/src/net/sourceforge/plantuml/FileFormat.java b/src/net/sourceforge/plantuml/FileFormat.java
index ad51d62b3..762c24264 100644
--- a/src/net/sourceforge/plantuml/FileFormat.java
+++ b/src/net/sourceforge/plantuml/FileFormat.java
@@ -63,8 +63,7 @@ import net.sourceforge.plantuml.ugraphic.debug.StringBounderDebug;
*/
public enum FileFormat {
- PNG("image/png"), //
- SVG("image/svg+xml"), //
+ // ::comment when WASM
EPS("application/postscript"), //
EPS_TEXT("application/postscript"), //
ATXT("text/plain"), //
@@ -85,7 +84,10 @@ public enum FileFormat {
BASE64("text/plain; charset=x-user-defined"), //
BRAILLE_PNG("image/png"), //
PREPROC("text/plain"), //
- DEBUG("text/plain"); //
+ DEBUG("text/plain"), //
+ // ::done
+ PNG("image/png"), //
+ SVG("image/svg+xml"); //
private final String mimeType;
@@ -103,6 +105,7 @@ public enum FileFormat {
* @return a string starting by a point.
*/
public String getFileSuffix() {
+ // ::comment when WASM
if (name().startsWith("XMI"))
return ".xmi";
@@ -120,6 +123,7 @@ public enum FileFormat {
if (this == EPS_TEXT)
return EPS.getFileSuffix();
+ // ::done
return "." + StringUtils.goLowerCase(name());
}
@@ -136,17 +140,19 @@ public enum FileFormat {
}
public StringBounder getDefaultStringBounder(TikzFontDistortion tikzFontDistortion, SvgCharSizeHack charSizeHack) {
+ // ::comment when WASM
if (this == LATEX || this == LATEX_NO_PREAMBLE)
return getTikzStringBounder(tikzFontDistortion);
if (this == BRAILLE_PNG)
return getBrailleStringBounder();
- if (this == SVG)
- return getSvgStringBounder(charSizeHack);
-
if (this == DEBUG)
return new StringBounderDebug();
+ // ::done
+
+ if (this == SVG)
+ return getSvgStringBounder(charSizeHack);
return getNormalStringBounder();
}
@@ -193,6 +199,7 @@ public enum FileFormat {
return new XDimension2D(rect.getWidth(), rect.getHeight());
}
+ // ::comment when WASM
private StringBounder getBrailleStringBounder() {
return new StringBounderRaw() {
public String toString() {
@@ -320,5 +327,6 @@ public enum FileFormat {
}
return false;
}
+ // ::done
}
diff --git a/src/net/sourceforge/plantuml/ISourceFileReader.java b/src/net/sourceforge/plantuml/ISourceFileReader.java
index b7a36aeb1..2aa1fdbb7 100644
--- a/src/net/sourceforge/plantuml/ISourceFileReader.java
+++ b/src/net/sourceforge/plantuml/ISourceFileReader.java
@@ -39,6 +39,7 @@ import java.io.IOException;
import java.util.List;
public interface ISourceFileReader {
+ // ::remove file when WASM
public List getGeneratedImages() throws IOException;
diff --git a/src/net/sourceforge/plantuml/Option.java b/src/net/sourceforge/plantuml/Option.java
index f23f0726f..b89ad3e06 100644
--- a/src/net/sourceforge/plantuml/Option.java
+++ b/src/net/sourceforge/plantuml/Option.java
@@ -115,6 +115,7 @@ public class Option {
this.fileFormatOption = newFormat;
}
+ // ::comment when WASM
public Option(String... arg) throws InterruptedException, IOException {
if (arg.length == 0)
OptionFlags.getInstance().setGui(true);
@@ -403,6 +404,7 @@ public class Option {
}
}
}
+ // ::done
public Stdrpt getStdrpt() {
if (stdrpt == 1)
diff --git a/src/net/sourceforge/plantuml/OptionFlags.java b/src/net/sourceforge/plantuml/OptionFlags.java
index 7099fd1f2..a6fba2570 100644
--- a/src/net/sourceforge/plantuml/OptionFlags.java
+++ b/src/net/sourceforge/plantuml/OptionFlags.java
@@ -77,6 +77,7 @@ public class OptionFlags {
// static public final boolean LINK_BETWEEN_FIELDS = true;
+ // ::comment when WASM
public void reset() {
reset(false);
GraphvizUtils.setDotExecutable(null);
@@ -85,6 +86,7 @@ public class OptionFlags {
public final void setDotExecutable(String dotExecutable) {
GraphvizUtils.setDotExecutable(dotExecutable);
}
+ // ::done
private OptionFlags() {
reset(true);
@@ -195,6 +197,7 @@ public class OptionFlags {
private final AtomicBoolean logDataInitized = new AtomicBoolean(false);
public void logData(final SFile file, Diagram system) {
+ // ::comment when WASM
final String warnOrError = system.getWarningOrError();
if (warnOrError == null) {
return;
@@ -222,6 +225,7 @@ public class OptionFlags {
Logme.error(e);
}
}
+ // ::done
}
public final void setLogData(SFile logData) {
diff --git a/src/net/sourceforge/plantuml/OptionPrint.java b/src/net/sourceforge/plantuml/OptionPrint.java
index 1d6a8195a..740c2efe2 100644
--- a/src/net/sourceforge/plantuml/OptionPrint.java
+++ b/src/net/sourceforge/plantuml/OptionPrint.java
@@ -56,6 +56,7 @@ import net.sourceforge.plantuml.version.PSystemVersion;
import net.sourceforge.plantuml.version.Version;
public class OptionPrint {
+ //::remove file when WASM
static public void printTestDot() throws InterruptedException {
final List result = new ArrayList<>();
diff --git a/src/net/sourceforge/plantuml/PSystemBuilder.java b/src/net/sourceforge/plantuml/PSystemBuilder.java
index a5748e6c5..1ea4ba3fb 100644
--- a/src/net/sourceforge/plantuml/PSystemBuilder.java
+++ b/src/net/sourceforge/plantuml/PSystemBuilder.java
@@ -148,11 +148,13 @@ public class PSystemBuilder {
result = PSystemErrorUtils.merge(errors);
return result;
} finally {
+ // ::comment when WASM
if (result != null && OptionFlags.getInstance().isEnableStats()) {
StatsUtilsIncrement.onceMoreParse(System.currentTimeMillis() - now, result.getClass());
}
Log.info("Compilation duration " + (System.currentTimeMillis() - now));
RegexConcat.printCacheInfo();
+ // ::done
}
}
@@ -174,46 +176,63 @@ public class PSystemBuilder {
factories.add(new PSystemVersionFactory());
factories.add(new PSystemDonorsFactory());
factories.add(new PSystemSkinparameterListFactory());
+ // ::comment when WASM
factories.add(new PSystemListFontsFactory());
+ // ::done
factories.add(new PSystemListEmojiFactory());
+ // ::comment when WASM
factories.add(new PSystemOpenIconicFactory());
factories.add(new PSystemListOpenIconicFactory());
factories.add(new PSystemListInternalSpritesFactory());
+ // ::done
factories.add(new PSystemSaltFactory2(DiagramType.SALT));
factories.add(new PSystemSaltFactory2(DiagramType.UML));
+ // ::comment when WASM
factories.add(new PSystemDotFactory(DiagramType.DOT));
factories.add(new PSystemDotFactory(DiagramType.UML));
+ // ::done
factories.add(new NwDiagramFactory(DiagramType.NW));
factories.add(new NwDiagramFactory(DiagramType.UML));
factories.add(new MindMapDiagramFactory());
factories.add(new WBSDiagramFactory());
+ // ::comment when WASM
factories.add(new PSystemDitaaFactory(DiagramType.DITAA));
factories.add(new PSystemDitaaFactory(DiagramType.UML));
+ // ::done
if (License.getCurrent() == License.GPL || License.getCurrent() == License.GPLV2) {
+ // ::comment when WASM
factories.add(new PSystemJcckitFactory(DiagramType.JCCKIT));
factories.add(new PSystemJcckitFactory(DiagramType.UML));
+ // ::done
// factories.add(new PSystemLogoFactory());
factories.add(new PSystemSudokuFactory());
}
+ // ::comment when WASM
factories.add(new PSystemDefinitionFactory());
+ // ::done
factories.add(new ListSpriteDiagramFactory());
+ // ::comment when WASM
factories.add(new StdlibDiagramFactory());
factories.add(new PSystemMathFactory(DiagramType.MATH));
factories.add(new PSystemLatexFactory(DiagramType.LATEX));
+ // ::done
// factories.add(new PSystemStatsFactory());
factories.add(new PSystemCreoleFactory());
factories.add(new PSystemEggFactory());
factories.add(new PSystemAppleTwoFactory());
factories.add(new PSystemRIPFactory());
// factories.add(new PSystemLostFactory());
- if (SecurityUtils.getSecurityProfile() == SecurityProfile.UNSECURE) {
+ // ::comment when WASM
+ if (SecurityUtils.getSecurityProfile() == SecurityProfile.UNSECURE)
factories.add(new PSystemPathFactory());
- }
+ // ::done
factories.add(new PSystemOregonFactory());
factories.add(new PSystemCharlieFactory());
+ // ::comment when WASM
if (License.getCurrent() == License.GPL || License.getCurrent() == License.GPLV2) {
factories.add(new PSystemXearthFactory());
}
+ // ::done
factories.add(new GanttDiagramFactory());
factories.add(new FlowDiagramFactory());
// factories.add(new PSystemTreeFactory(DiagramType.JUNGLE));
diff --git a/src/net/sourceforge/plantuml/PSystemUtils.java b/src/net/sourceforge/plantuml/PSystemUtils.java
index 71184850a..1d3941860 100644
--- a/src/net/sourceforge/plantuml/PSystemUtils.java
+++ b/src/net/sourceforge/plantuml/PSystemUtils.java
@@ -56,6 +56,7 @@ import net.sourceforge.plantuml.ugraphic.color.HColors;
import net.sourceforge.plantuml.utils.Log;
public class PSystemUtils {
+ // :: remove file when WASM
public static List exportDiagrams(Diagram system, SuggestedFile suggested,
FileFormatOption fileFormatOption) throws IOException {
@@ -65,6 +66,7 @@ public class PSystemUtils {
public static List exportDiagrams(Diagram system, SuggestedFile suggestedFile,
FileFormatOption fileFormatOption, boolean checkMetadata) throws IOException {
+ // ::comment when WASM
final SFile existingFile = suggestedFile.getFile(0);
if (checkMetadata && fileFormatOption.getFileFormat().doesSupportMetadata() && existingFile.exists()) {
// && system.getNbImages() == 1) {
@@ -75,6 +77,7 @@ public class PSystemUtils {
return Arrays.asList(new FileImageData(existingFile, null));
}
}
+ // ::done
if (system instanceof NewpagedDiagram)
return exportDiagramsNewpaged((NewpagedDiagram) system, suggestedFile, fileFormatOption);
@@ -82,8 +85,10 @@ public class PSystemUtils {
if (system instanceof SequenceDiagram)
return exportDiagramsSequence((SequenceDiagram) system, suggestedFile, fileFormatOption);
+ // ::comment when WASM
if (system instanceof CucaDiagram && fileFormatOption.getFileFormat() == FileFormat.HTML)
return createFilesHtml((CucaDiagram) system, suggestedFile);
+ // ::done
return exportDiagramsDefault(system, suggestedFile, fileFormatOption);
}
@@ -146,10 +151,12 @@ public class PSystemUtils {
} finally {
fos.close();
}
+ // ::comment when SPAM
if (cmap != null && cmap.containsCMapData())
system.exportCmap(suggestedFile, i, cmap);
Log.info("File size : " + f.length());
+ // ::done
result.add(new FileImageData(f, cmap));
}
return result;
@@ -200,8 +207,10 @@ public class PSystemUtils {
if (imageData == null)
return emptyList();
+ // ::comment when SPAM
if (imageData.containsCMapData() && system instanceof UmlDiagram)
((UmlDiagram) system).exportCmap(suggestedFile, 0, imageData);
+ // ::done
if (system instanceof TitledDiagram && fileFormatOption.getFileFormat() == FileFormat.PNG)
return splitPng((TitledDiagram) system, suggestedFile, imageData, fileFormatOption);
diff --git a/src/net/sourceforge/plantuml/Run.java b/src/net/sourceforge/plantuml/Run.java
index e6d65c199..2f5d1c64c 100644
--- a/src/net/sourceforge/plantuml/Run.java
+++ b/src/net/sourceforge/plantuml/Run.java
@@ -75,6 +75,7 @@ import net.sourceforge.plantuml.utils.Log;
import net.sourceforge.plantuml.version.Version;
public class Run {
+ // ::remove file when WASM
private static Cypher cypher;
@@ -335,7 +336,8 @@ public class Run {
}
private static void goPicoweb(Option option) throws IOException {
- PicoWebServer.startServer(option.getPicowebPort(), option.getPicowebBindAddress(), option.getPicowebEnableStop());
+ PicoWebServer.startServer(option.getPicowebPort(), option.getPicowebBindAddress(),
+ option.getPicowebEnableStop());
}
public static void printFonts() {
diff --git a/src/net/sourceforge/plantuml/SourceFileReader.java b/src/net/sourceforge/plantuml/SourceFileReader.java
index ecde8f320..08718acd2 100644
--- a/src/net/sourceforge/plantuml/SourceFileReader.java
+++ b/src/net/sourceforge/plantuml/SourceFileReader.java
@@ -48,6 +48,7 @@ import net.sourceforge.plantuml.utils.Log;
@HaxeIgnored
public class SourceFileReader extends SourceFileReaderAbstract implements ISourceFileReader {
+ // ::remove file when WASM
private File outputDirectory;
diff --git a/src/net/sourceforge/plantuml/SourceFileReaderAbstract.java b/src/net/sourceforge/plantuml/SourceFileReaderAbstract.java
index 1bfcfd7db..3bf229cf5 100644
--- a/src/net/sourceforge/plantuml/SourceFileReaderAbstract.java
+++ b/src/net/sourceforge/plantuml/SourceFileReaderAbstract.java
@@ -65,6 +65,7 @@ import net.sourceforge.plantuml.security.SecurityUtils;
import net.sourceforge.plantuml.utils.Log;
public abstract class SourceFileReaderAbstract implements ISourceFileReader {
+ // ::remove file when WASM
final private File file;
diff --git a/src/net/sourceforge/plantuml/SourceFileReaderCopyCat.java b/src/net/sourceforge/plantuml/SourceFileReaderCopyCat.java
index 306415249..5cd923cef 100644
--- a/src/net/sourceforge/plantuml/SourceFileReaderCopyCat.java
+++ b/src/net/sourceforge/plantuml/SourceFileReaderCopyCat.java
@@ -42,6 +42,7 @@ import java.util.List;
import net.sourceforge.plantuml.preproc.Defines;
public class SourceFileReaderCopyCat extends SourceFileReaderAbstract implements ISourceFileReader {
+ // ::remove file when WASM
private final File outputDirectory;
diff --git a/src/net/sourceforge/plantuml/SourceFileReaderHardFile.java b/src/net/sourceforge/plantuml/SourceFileReaderHardFile.java
index 32bae2111..095f09c22 100644
--- a/src/net/sourceforge/plantuml/SourceFileReaderHardFile.java
+++ b/src/net/sourceforge/plantuml/SourceFileReaderHardFile.java
@@ -43,6 +43,7 @@ import net.sourceforge.plantuml.preproc.Defines;
import net.sourceforge.plantuml.security.SFile;
public class SourceFileReaderHardFile extends SourceFileReaderAbstract implements ISourceFileReader {
+ // ::remove file when WASM
private final File outputFile;
diff --git a/src/net/sourceforge/plantuml/StringUtils.java b/src/net/sourceforge/plantuml/StringUtils.java
index e6a4c912d..598b2ce04 100644
--- a/src/net/sourceforge/plantuml/StringUtils.java
+++ b/src/net/sourceforge/plantuml/StringUtils.java
@@ -353,6 +353,7 @@ public class StringUtils {
return result;
}
+ // ::comment when WASM
public static int getWcWidth(Display stringsToDisplay) {
int result = 1;
for (CharSequence s : stringsToDisplay) {
@@ -366,6 +367,7 @@ public class StringUtils {
}
return result;
}
+ // ::done
public static int getHeight(List extends CharSequence> stringsToDisplay) {
return stringsToDisplay.size();
diff --git a/src/net/sourceforge/plantuml/SuggestedFile.java b/src/net/sourceforge/plantuml/SuggestedFile.java
index 9e4453eab..82d6bae28 100644
--- a/src/net/sourceforge/plantuml/SuggestedFile.java
+++ b/src/net/sourceforge/plantuml/SuggestedFile.java
@@ -38,6 +38,7 @@ package net.sourceforge.plantuml;
import net.sourceforge.plantuml.security.SFile;
public class SuggestedFile {
+ // ::remove file when WASM
private final FileFormat fileFormat;
private final int initialCpt;
diff --git a/src/net/sourceforge/plantuml/TitledDiagram.java b/src/net/sourceforge/plantuml/TitledDiagram.java
index 377d32f5a..038e0d6b0 100644
--- a/src/net/sourceforge/plantuml/TitledDiagram.java
+++ b/src/net/sourceforge/plantuml/TitledDiagram.java
@@ -81,7 +81,9 @@ public abstract class TitledDiagram extends AbstractPSystem implements Diagram,
private final SkinParam skinParam;
+ // ::comment when WASM
private Animation animation;
+ // ::done
private final Pragma pragma = new Pragma();
@@ -252,6 +254,7 @@ public abstract class TitledDiagram extends AbstractPSystem implements Diagram,
return ClockwiseTopRightBottomLeft.same(10);
}
+ // ::comment when WASM
final public void setAnimation(Iterable animationData) {
// try {
final AnimationDecoder animationDecoder = new AnimationDecoder(animationData);
@@ -264,6 +267,7 @@ public abstract class TitledDiagram extends AbstractPSystem implements Diagram,
final public Animation getAnimation() {
return animation;
}
+ // ::done
@Override
public ImageBuilder createImageBuilder(FileFormatOption fileFormatOption) throws IOException {
diff --git a/src/net/sourceforge/plantuml/UmlDiagram.java b/src/net/sourceforge/plantuml/UmlDiagram.java
index 354846265..dd7eb0b94 100644
--- a/src/net/sourceforge/plantuml/UmlDiagram.java
+++ b/src/net/sourceforge/plantuml/UmlDiagram.java
@@ -129,8 +129,10 @@ public abstract class UmlDiagram extends TitledDiagram implements Diagram, Annot
fileFormatOption = fileFormatOption.withTikzFontDistortion(getSkinParam().getTikzFontDistortion());
+ // ::comment when WASM
if (fileFormatOption.getFileFormat() == FileFormat.PDF)
return exportDiagramInternalPdf(os, index);
+ // ::done
try {
final ImageData imageData = exportDiagramInternal(os, index, fileFormatOption);
@@ -158,14 +160,17 @@ public abstract class UmlDiagram extends TitledDiagram implements Diagram, Annot
public static void exportDiagramError(OutputStream os, Throwable exception, FileFormatOption fileFormat, long seed,
String metadata, String flash, List strings) throws IOException {
+ // ::comment when WASM
if (fileFormat.getFileFormat() == FileFormat.ATXT || fileFormat.getFileFormat() == FileFormat.UTXT) {
exportDiagramErrorText(os, exception, strings);
return;
}
+ // ::done
strings.addAll(CommandExecutionResult.getStackTrace(exception));
BufferedImage im2 = null;
+ // ::comment when WASM
if (flash != null) {
final FlashCodeUtils utils = FlashCodeFactory.getFlashCodeUtils();
try {
@@ -176,8 +181,9 @@ public abstract class UmlDiagram extends TitledDiagram implements Diagram, Annot
}
if (im2 != null)
GraphvizCrash.addDecodeHint(strings);
-
}
+ // ::done
+
final BufferedImage im = im2;
final TextBlockBackcolored graphicStrings = GraphicStrings.createBlackOnWhite(strings, IconLoader.getRandom(),
GraphicPosition.BACKGROUND_CORNER_TOP_RIGHT);
@@ -245,6 +251,7 @@ public abstract class UmlDiagram extends TitledDiagram implements Diagram, Annot
return strings;
}
+ // ::comment when WASM
private void exportDiagramInternalMjpeg(OutputStream os) throws IOException {
final SFile f = new SFile("c:/test.avi");
final int nb = 150;
@@ -266,8 +273,6 @@ public abstract class UmlDiagram extends TitledDiagram implements Diagram, Annot
}
- private XDimension2D lastInfo;
-
private ImageData exportDiagramInternalPdf(OutputStream os, int index) throws IOException {
final File svg = FileUtils.createTempFileLegacy("pdf", ".svf");
final File pdfFile = FileUtils.createTempFileLegacy("pdf", ".pdf");
@@ -280,9 +285,6 @@ public abstract class UmlDiagram extends TitledDiagram implements Diagram, Annot
return result;
}
- protected abstract ImageData exportDiagramInternal(OutputStream os, int index, FileFormatOption fileFormatOption)
- throws IOException;
-
final protected void exportCmap(SuggestedFile suggestedFile, int index, final ImageData cmapdata)
throws FileNotFoundException {
final String name = changeName(suggestedFile.getFile(index).getAbsolutePath());
@@ -298,6 +300,12 @@ public abstract class UmlDiagram extends TitledDiagram implements Diagram, Annot
static String changeName(String name) {
return name.replaceAll("(?i)\\.\\w{3}$", ".cmapx");
}
+ // ::done
+
+ private XDimension2D lastInfo;
+
+ protected abstract ImageData exportDiagramInternal(OutputStream os, int index, FileFormatOption fileFormatOption)
+ throws IOException;
@Override
public String getWarningOrError() {
diff --git a/src/net/sourceforge/plantuml/Url.java b/src/net/sourceforge/plantuml/Url.java
index 399c698ad..75b9d2af3 100644
--- a/src/net/sourceforge/plantuml/Url.java
+++ b/src/net/sourceforge/plantuml/Url.java
@@ -93,9 +93,11 @@ public class Url implements EnsureVisible {
}
public String getCoords(double scale) {
- if (DotMaker2.isJunit() && visible.getCoords(1.0).contains("0,0,0,0")) {
+ // ::comment when WASM
+ if (DotMaker2.isJunit() && visible.getCoords(1.0).contains("0,0,0,0"))
throw new IllegalStateException(toString());
- }
+ // ::done
+
return visible.getCoords(scale);
}
diff --git a/src/net/sourceforge/plantuml/acearth/PSystemXearth.java b/src/net/sourceforge/plantuml/acearth/PSystemXearth.java
index 2e9bf6ec0..4b47169f8 100644
--- a/src/net/sourceforge/plantuml/acearth/PSystemXearth.java
+++ b/src/net/sourceforge/plantuml/acearth/PSystemXearth.java
@@ -58,6 +58,7 @@ import net.sourceforge.plantuml.core.ImageData;
import net.sourceforge.plantuml.core.UmlSource;
public class PSystemXearth extends AbstractPSystem {
+ // :: remove folder when WASM
final private int width;
final private int height;
diff --git a/src/net/sourceforge/plantuml/activitydiagram/ActivityDiagram.java b/src/net/sourceforge/plantuml/activitydiagram/ActivityDiagram.java
index f281f57d7..77fdd3017 100644
--- a/src/net/sourceforge/plantuml/activitydiagram/ActivityDiagram.java
+++ b/src/net/sourceforge/plantuml/activitydiagram/ActivityDiagram.java
@@ -42,23 +42,19 @@ import java.util.Objects;
import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.baraye.CucaDiagram;
-import net.sourceforge.plantuml.baraye.IEntity;
-import net.sourceforge.plantuml.baraye.ILeaf;
+import net.sourceforge.plantuml.baraye.EntityImp;
+import net.sourceforge.plantuml.baraye.Quark;
import net.sourceforge.plantuml.core.DiagramDescription;
import net.sourceforge.plantuml.core.UmlSource;
-import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.GroupType;
-import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.cucadiagram.LeafType;
-import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
-import net.sourceforge.plantuml.graphic.USymbol;
import net.sourceforge.plantuml.utils.Direction;
public class ActivityDiagram extends CucaDiagram {
- private IEntity lastEntityConsulted;
- private IEntity lastEntityBrancheConsulted;
+ private EntityImp lastEntityConsulted;
+ private EntityImp lastEntityBrancheConsulted;
private ConditionalContext currentContext;
public ActivityDiagram(UmlSource source, Map skinParam) {
@@ -66,34 +62,33 @@ public class ActivityDiagram extends CucaDiagram {
setNamespaceSeparator(null);
}
- public ILeaf getOrCreateLeaf(Ident ident, Code code, LeafType type, USymbol symbol) {
- return getOrCreateLeafDefault(Objects.requireNonNull(ident), code, type, symbol);
- }
-
private String getAutoBranch() {
return "#" + this.getUniqueSequence();
}
- public IEntity getOrCreate(Ident idNewLong, Code code, Display display, LeafType type) {
- final IEntity result;
- final boolean leafExist = leafExist(code);
- if (leafExist) {
- result = getOrCreateLeafDefault(idNewLong, code, type, null);
- if (result.getLeafType() != type) {
- return null;
- }
- } else {
- result = createLeaf(idNewLong, code, display, type, null);
- }
- updateLasts(result);
- return result;
- }
+// public final IEntity getOrCreateInActivity(Quark idNewLong, String codeString, Display display, LeafType type) {
+// final Quark code = buildFromFullPath(codeString);
+// final IEntity result;
+// if (code.getData() == null) {
+// final Quark quark = getPlasma().getIfExistsFromName(code.getName());
+// if (quark != null && quark.getData() != null)
+// result = getFromName(code.getName());
+// else
+// result = reallyCreateLeaf(idNewLong, display, type, null);
+// } else {
+// result = (ILeaf) code.getData();
+// if (result.getLeafType() != type)
+// return null;
+// }
+// updateLasts(result);
+// return result;
+// }
public void startIf(String optionalCodeString) {
final String idShort = optionalCodeString == null ? getAutoBranch() : optionalCodeString;
- final Ident idNewLong = buildLeafIdent(idShort);
- final Code code = buildCode(idShort);
- final IEntity br = createLeaf(idNewLong, code, Display.create(""), LeafType.BRANCH, null);
+ final Quark quark = quarkInContext(cleanIdForQuark(idShort), false);
+ // final Quark code = buildCode(idShort);
+ final EntityImp br = reallyCreateLeaf(quark, Display.create(""), LeafType.BRANCH, null);
currentContext = new ConditionalContext(currentContext, br, Direction.DOWN);
}
@@ -101,38 +96,37 @@ public class ActivityDiagram extends CucaDiagram {
currentContext = currentContext.getParent();
}
- public ILeaf getStart() {
- final Ident ident = buildLeafIdent("start");
- final Code code = buildCode("start");
- return (ILeaf) getOrCreate(ident, code, Display.getWithNewlines("start"), LeafType.CIRCLE_START);
+ public EntityImp getStart() {
+ final Quark quark = quarkInContext("start", false);
+ if (quark.getData() == null) {
+ quark.setData(reallyCreateLeaf(quark, Display.getWithNewlines("start"), LeafType.CIRCLE_START, null));
+ }
+ return (EntityImp) quark.getData();
}
- public ILeaf getEnd(String suppId) {
+ public EntityImp getEnd(String suppId) {
final String tmp = suppId == null ? "end" : "end$" + suppId;
- final Ident ident = buildLeafIdent(tmp);
- final Code code = buildCode(tmp);
- return (ILeaf) getOrCreate(ident, code, Display.getWithNewlines("end"), LeafType.CIRCLE_END);
- }
-
- private void updateLasts(final IEntity result) {
- if (result == null || result.getLeafType() == LeafType.NOTE) {
- return;
- }
- this.lastEntityConsulted = result;
- if (result.getLeafType() == LeafType.BRANCH) {
- lastEntityBrancheConsulted = result;
+ final Quark quark = quarkInContext(tmp, false);
+ if (quark.getData() == null) {
+ quark.setData(reallyCreateLeaf(quark, Display.getWithNewlines("end"), LeafType.CIRCLE_END, null));
}
+ return (EntityImp) quark.getData();
}
@Override
- public ILeaf createLeaf(Ident idNewLong, Code code, Display display, LeafType type, USymbol symbol) {
- final ILeaf result = super.createLeaf(Objects.requireNonNull(idNewLong), code, display, type, symbol);
- updateLasts(result);
- return result;
+ protected void updateLasts(EntityImp result) {
+ if (result == null || result.getLeafType() == LeafType.NOTE)
+ return;
+
+ // System.err.println("updateLasts " + result);
+ this.lastEntityConsulted = result;
+ if (result.getLeafType() == LeafType.BRANCH)
+ lastEntityBrancheConsulted = result;
+
}
- public IEntity createNote(Ident idNewLong, Code code, Display display) {
- return super.createLeaf(Objects.requireNonNull(idNewLong), code, display, LeafType.NOTE, null);
+ public EntityImp createNote(Quark idNewLong, String code__, Display display) {
+ return reallyCreateLeaf(Objects.requireNonNull(idNewLong), display, LeafType.NOTE, null);
}
final protected List getDotStrings() {
@@ -144,12 +138,12 @@ public class ActivityDiagram extends CucaDiagram {
return new DiagramDescription("(" + getLeafssize() + " activities)");
}
- public IEntity getLastEntityConsulted() {
+ public EntityImp getLastEntityConsulted() {
return lastEntityConsulted;
}
@Deprecated
- public IEntity getLastEntityBrancheConsulted() {
+ public EntityImp getLastEntityBrancheConsulted() {
return lastEntityBrancheConsulted;
}
@@ -157,41 +151,36 @@ public class ActivityDiagram extends CucaDiagram {
return currentContext;
}
- public final void setLastEntityConsulted(IEntity lastEntityConsulted) {
+ public final void setLastEntityConsulted(EntityImp lastEntityConsulted) {
+ // System.err.println("setLastEntityConsulted " + lastEntityConsulted);
this.lastEntityConsulted = lastEntityConsulted;
}
- public IEntity createInnerActivity() {
- // Log.println("createInnerActivity A");
+ public EntityImp createInnerActivity() {
+
final String idShort = "##" + this.getUniqueSequence();
- final Ident idNewLong = buildLeafIdent(idShort);
- final Code code = buildCode(idShort);
- gotoGroup(idNewLong, code, Display.getWithNewlines(code), GroupType.INNER_ACTIVITY, getCurrentGroup(),
- NamespaceStrategy.SINGLE);
- final IEntity g = getCurrentGroup();
- // g.setRankdir(Rankdir.LEFT_TO_RIGHT);
+
+ final Quark quark = quarkInContext(idShort, false);
+ gotoGroup(quark, Display.getWithNewlines(quark.getName()), GroupType.INNER_ACTIVITY);
+ final EntityImp g = getCurrentGroup();
+
lastEntityConsulted = null;
lastEntityBrancheConsulted = null;
- // Log.println("createInnerActivity B "+getCurrentGroup());
+
return g;
}
public void concurrentActivity(String name) {
- // Log.println("concurrentActivity A name=" + name+" "+getCurrentGroup());
- if (getCurrentGroup().getGroupType() == GroupType.CONCURRENT_ACTIVITY) {
- // getCurrentGroup().setRankdir(Rankdir.LEFT_TO_RIGHT);
+ if (getCurrentGroup().getGroupType() == GroupType.CONCURRENT_ACTIVITY)
endGroup();
- // Log.println("endgroup");
- }
+
final String idShort = "##" + this.getUniqueSequence();
- // Log.println("concurrentActivity A name=" + name+" "+getCurrentGroup());
- final Code code = buildCode(idShort);
- if (getCurrentGroup().getGroupType() != GroupType.INNER_ACTIVITY) {
+
+ if (getCurrentGroup().getGroupType() != GroupType.INNER_ACTIVITY)
throw new IllegalStateException("type=" + getCurrentGroup().getGroupType());
- }
- final Ident idNewLong = buildLeafIdent(idShort);
- gotoGroup(idNewLong, code, Display.getWithNewlines("code"), GroupType.CONCURRENT_ACTIVITY, getCurrentGroup(),
- NamespaceStrategy.SINGLE);
+
+ final Quark idNewLong = quarkInContext(idShort, false);
+ gotoGroup(idNewLong, Display.getWithNewlines("code"), GroupType.CONCURRENT_ACTIVITY);
lastEntityConsulted = null;
lastEntityBrancheConsulted = null;
}
diff --git a/src/net/sourceforge/plantuml/activitydiagram/ConditionalContext.java b/src/net/sourceforge/plantuml/activitydiagram/ConditionalContext.java
index 4e8177f64..06f7c394b 100644
--- a/src/net/sourceforge/plantuml/activitydiagram/ConditionalContext.java
+++ b/src/net/sourceforge/plantuml/activitydiagram/ConditionalContext.java
@@ -37,17 +37,17 @@ package net.sourceforge.plantuml.activitydiagram;
import java.util.Objects;
-import net.sourceforge.plantuml.baraye.IEntity;
+import net.sourceforge.plantuml.baraye.EntityImp;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.utils.Direction;
public class ConditionalContext {
- private final IEntity branch;
+ private final EntityImp branch;
private final Direction direction;
private final ConditionalContext parent;
- public ConditionalContext(ConditionalContext parent, IEntity branch, Direction direction) {
+ public ConditionalContext(ConditionalContext parent, EntityImp branch, Direction direction) {
this.branch = Objects.requireNonNull(branch);
if (branch.getLeafType() != LeafType.BRANCH) {
throw new IllegalArgumentException();
@@ -64,7 +64,7 @@ public class ConditionalContext {
return parent;
}
- public final IEntity getBranch() {
+ public final EntityImp getBranch() {
return branch;
}
diff --git a/src/net/sourceforge/plantuml/activitydiagram/command/CommandElse.java b/src/net/sourceforge/plantuml/activitydiagram/command/CommandElse.java
index 4646d779a..0eee8df0d 100644
--- a/src/net/sourceforge/plantuml/activitydiagram/command/CommandElse.java
+++ b/src/net/sourceforge/plantuml/activitydiagram/command/CommandElse.java
@@ -36,7 +36,7 @@
package net.sourceforge.plantuml.activitydiagram.command;
import net.sourceforge.plantuml.activitydiagram.ActivityDiagram;
-import net.sourceforge.plantuml.baraye.IEntity;
+import net.sourceforge.plantuml.baraye.EntityImp;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
@@ -66,7 +66,7 @@ public class CommandElse extends SingleLineCommand2 {
if (system.getCurrentContext() == null) {
return CommandExecutionResult.error("No if for this else");
}
- final IEntity branch = system.getCurrentContext().getBranch();
+ final EntityImp branch = system.getCurrentContext().getBranch();
system.setLastEntityConsulted(branch);
diff --git a/src/net/sourceforge/plantuml/activitydiagram/command/CommandIf.java b/src/net/sourceforge/plantuml/activitydiagram/command/CommandIf.java
index 54dfe55de..d014901d0 100644
--- a/src/net/sourceforge/plantuml/activitydiagram/command/CommandIf.java
+++ b/src/net/sourceforge/plantuml/activitydiagram/command/CommandIf.java
@@ -37,7 +37,7 @@ package net.sourceforge.plantuml.activitydiagram.command;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.activitydiagram.ActivityDiagram;
-import net.sourceforge.plantuml.baraye.IEntity;
+import net.sourceforge.plantuml.baraye.EntityImp;
import net.sourceforge.plantuml.classdiagram.command.CommandLinkClass;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
@@ -94,7 +94,7 @@ public class CommandIf extends SingleLineCommand2 {
@Override
protected CommandExecutionResult executeArg(ActivityDiagram diagram, LineLocation location, RegexResult arg) {
- final IEntity entity1 = CommandLinkActivity.getEntity(diagram, arg, true);
+ final EntityImp entity1 = CommandLinkActivity.getEntity(diagram, arg, true);
if (entity1 == null)
return CommandExecutionResult.error("No if possible at this point");
@@ -122,10 +122,10 @@ public class CommandIf extends SingleLineCommand2 {
lenght = arrow.length() - 1;
}
- final IEntity branch = diagram.getCurrentContext().getBranch();
+ final EntityImp branch = diagram.getCurrentContext().getBranch();
final LinkArg linkArg = LinkArg.build(Display.getWithNewlines(arg.get("BRACKET", 0)), lenght);
- Link link = new Link(diagram.getIEntityFactory(), diagram.getSkinParam().getCurrentStyleBuilder(), entity1,
+ Link link = new Link(diagram.getEntityFactory(), diagram.getSkinParam().getCurrentStyleBuilder(), entity1,
branch, new LinkType(LinkDecor.ARROW, LinkDecor.NONE), linkArg.withQuantifier(null, ifLabel)
.withDistanceAngle(diagram.getLabeldistance(), diagram.getLabelangle()));
if (arg.get("ARROW", 0) != null) {
diff --git a/src/net/sourceforge/plantuml/activitydiagram/command/CommandInnerConcurrent.java b/src/net/sourceforge/plantuml/activitydiagram/command/CommandInnerConcurrent.java
index 491960e29..3201acba5 100644
--- a/src/net/sourceforge/plantuml/activitydiagram/command/CommandInnerConcurrent.java
+++ b/src/net/sourceforge/plantuml/activitydiagram/command/CommandInnerConcurrent.java
@@ -61,7 +61,7 @@ public class CommandInnerConcurrent extends SingleLineCommand2
@Override
protected CommandExecutionResult executeArg(ActivityDiagram diagram, LineLocation location, RegexResult arg) {
- if (EntityUtils.groupRoot(diagram.getCurrentGroup())) {
+ if (diagram.getCurrentGroup().getQuark().isRoot()) {
return CommandExecutionResult.error("No inner activity");
}
diagram.concurrentActivity(arg.get("NAME", 0));
diff --git a/src/net/sourceforge/plantuml/activitydiagram/command/CommandLinkActivity.java b/src/net/sourceforge/plantuml/activitydiagram/command/CommandLinkActivity.java
index 4b2caf65d..2afba240c 100644
--- a/src/net/sourceforge/plantuml/activitydiagram/command/CommandLinkActivity.java
+++ b/src/net/sourceforge/plantuml/activitydiagram/command/CommandLinkActivity.java
@@ -40,7 +40,8 @@ import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.UrlBuilder;
import net.sourceforge.plantuml.UrlMode;
import net.sourceforge.plantuml.activitydiagram.ActivityDiagram;
-import net.sourceforge.plantuml.baraye.IEntity;
+import net.sourceforge.plantuml.baraye.EntityImp;
+import net.sourceforge.plantuml.baraye.Quark;
import net.sourceforge.plantuml.classdiagram.command.CommandLinkClass;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
@@ -51,16 +52,13 @@ import net.sourceforge.plantuml.command.regex.RegexOptional;
import net.sourceforge.plantuml.command.regex.RegexOr;
import net.sourceforge.plantuml.command.regex.RegexPartialMatch;
import net.sourceforge.plantuml.command.regex.RegexResult;
-import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.GroupType;
-import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.Link;
import net.sourceforge.plantuml.cucadiagram.LinkArg;
import net.sourceforge.plantuml.cucadiagram.LinkDecor;
import net.sourceforge.plantuml.cucadiagram.LinkType;
-import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.descdiagram.command.CommandLinkElement;
import net.sourceforge.plantuml.graphic.color.ColorParser;
@@ -124,7 +122,8 @@ public class CommandLinkActivity extends SingleLineCommand2 {
@Override
protected CommandExecutionResult executeArg(ActivityDiagram diagram, LineLocation location, RegexResult arg)
throws NoSuchColorException {
- final IEntity entity1 = getEntity(diagram, arg, true);
+ final EntityImp entity1 = getEntity(diagram, arg, true);
+
if (entity1 == null)
return CommandExecutionResult.error("No such activity");
@@ -136,10 +135,12 @@ public class CommandLinkActivity extends SingleLineCommand2 {
entity1.setSpecificColorTOBEREMOVED(ColorType.BACK, diagram.getSkinParam().getIHtmlColorSet().getColor(s));
}
- final IEntity entity2 = getEntity(diagram, arg, false);
+ final EntityImp entity2 = getEntity(diagram, arg, false);
if (entity2 == null)
return CommandExecutionResult.error("No such activity");
+ diagram.setLastEntityConsulted(entity2);
+
if (arg.get("BACKCOLOR2", 0) != null) {
String s = arg.get("BACKCOLOR2", 0);
entity2.setSpecificColorTOBEREMOVED(ColorType.BACK, diagram.getSkinParam().getIHtmlColorSet().getColor(s));
@@ -163,7 +164,7 @@ public class CommandLinkActivity extends SingleLineCommand2 {
type = type.goDotted();
final LinkArg linkArg = LinkArg.build(linkLabel, lenght, diagram.getSkinParam().classAttributeIconSize() > 0);
- Link link = new Link(diagram.getIEntityFactory(), diagram.getSkinParam().getCurrentStyleBuilder(), entity1,
+ Link link = new Link(diagram.getEntityFactory(), diagram.getSkinParam().getCurrentStyleBuilder(), entity1,
entity2, type, linkArg);
if (arrowDirection.contains("*"))
link.setConstraint(false);
@@ -185,7 +186,7 @@ public class CommandLinkActivity extends SingleLineCommand2 {
}
- static IEntity getEntity(ActivityDiagram diagram, RegexResult arg, final boolean start) {
+ static EntityImp getEntity(ActivityDiagram diagram, RegexResult arg, final boolean start) {
final String suf = start ? "" : "2";
final String openBracket2 = arg.get("OPENBRACKET" + suf, 0);
@@ -208,15 +209,16 @@ public class CommandLinkActivity extends SingleLineCommand2 {
final String idShort = arg.get("CODE" + suf, 0);
if (idShort != null) {
if (partition != null) {
- final Ident idNewLong = diagram.buildLeafIdent(partition);
- final Code codeP = diagram.buildCode(partition);
- diagram.gotoGroup(idNewLong, codeP, Display.getWithNewlines(partition), GroupType.PACKAGE,
- diagram.getRootGroup(), NamespaceStrategy.SINGLE);
+ final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(partition), false);
+ diagram.gotoGroup(quark, Display.getWithNewlines(quark), GroupType.PACKAGE);
}
- final Ident ident = diagram.buildLeafIdent(idShort);
- final Code code = diagram.buildCode(idShort);
- final LeafType type = getTypeIfExisting(diagram, code);
- final IEntity result = diagram.getOrCreate(ident, code, Display.getWithNewlines(code), type);
+ final Quark ident = diagram.quarkInContext(diagram.cleanIdForQuark(idShort), false);
+
+ final LeafType type = getTypeIfExisting(diagram, ident);
+ EntityImp result = (EntityImp) ident.getData();
+ if (result == null)
+ result = diagram.reallyCreateLeaf(ident, Display.getWithNewlines(idShort), type, null);
+
if (partition != null)
diagram.endGroup();
@@ -224,24 +226,26 @@ public class CommandLinkActivity extends SingleLineCommand2 {
}
final String bar = arg.get("BAR" + suf, 0);
if (bar != null) {
- final Ident identBar = diagram.buildLeafIdent(bar);
- final Code codeBar = diagram.buildCode(bar);
- return diagram.getOrCreate(identBar, codeBar, Display.getWithNewlines(bar), LeafType.SYNCHRO_BAR);
+ final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(bar), false);
+ EntityImp result = (EntityImp) quark.getData();
+ if (result == null)
+ result = diagram.reallyCreateLeaf(quark, Display.getWithNewlines(bar), LeafType.SYNCHRO_BAR, null);
+ return result;
}
final RegexPartialMatch quoted = arg.get("QUOTED" + suf);
if (quoted.get(0) != null) {
final String quotedString = quoted.get(1) == null ? quoted.get(0) : quoted.get(1);
if (partition != null) {
- final Ident idNewLong = diagram.buildLeafIdent(partition);
- final Code codeP = diagram.buildCode(partition);
- diagram.gotoGroup(idNewLong, codeP, Display.getWithNewlines(partition), GroupType.PACKAGE,
- diagram.getRootGroup(), NamespaceStrategy.SINGLE);
+ final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(partition), false);
+ diagram.gotoGroup(quark, Display.getWithNewlines(partition), GroupType.PACKAGE);
}
- final Ident quotedIdent = diagram.buildLeafIdent(quotedString);
- final Code quotedCode = diagram.buildCode(quotedString);
- final LeafType type = getTypeIfExisting(diagram, quotedCode);
- final IEntity result = diagram.getOrCreate(quotedIdent, quotedCode, Display.getWithNewlines(quoted.get(0)),
- type);
+
+ final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(quotedString), false);
+
+ final LeafType type = getTypeIfExisting(diagram, quark);
+ EntityImp result = (EntityImp) quark.getData();
+ if (result == null)
+ result = diagram.reallyCreateLeaf(quark, Display.getWithNewlines(quoted.get(0)), type, null);
if (partition != null)
diagram.endGroup();
@@ -250,15 +254,14 @@ public class CommandLinkActivity extends SingleLineCommand2 {
final String quoteInvisibleString = arg.get("QUOTED_INVISIBLE" + suf, 0);
if (quoteInvisibleString != null) {
if (partition != null) {
- final Ident idNewLong = diagram.buildLeafIdent(partition);
- final Code codeP = diagram.buildCode(partition);
- diagram.gotoGroup(idNewLong, codeP, Display.getWithNewlines(partition), GroupType.PACKAGE,
- diagram.getRootGroup(), NamespaceStrategy.SINGLE);
+ final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(partition), false);
+ diagram.gotoGroup(quark, Display.getWithNewlines(quark), GroupType.PACKAGE);
}
- final Ident identInvisible = diagram.buildLeafIdent(quoteInvisibleString);
- final Code quotedInvisible = diagram.buildCode(quoteInvisibleString);
- final IEntity result = diagram.getOrCreate(identInvisible, quotedInvisible,
- Display.getWithNewlines(quotedInvisible), LeafType.ACTIVITY);
+ final Quark identInvisible = diagram.quarkInContext(diagram.cleanIdForQuark(quoteInvisibleString), false);
+ EntityImp result = (EntityImp) identInvisible.getData();
+ if (result == null)
+ result = diagram.reallyCreateLeaf(identInvisible, Display.getWithNewlines(identInvisible.getName()),
+ LeafType.ACTIVITY, null);
if (partition != null)
diagram.endGroup();
@@ -271,13 +274,13 @@ public class CommandLinkActivity extends SingleLineCommand2 {
return null;
}
- private static LeafType getTypeIfExisting(ActivityDiagram system, Code code) {
- if (system.leafExist(code)) {
- final IEntity ent = system.getLeaf(code);
- if (ent.getLeafType() == LeafType.BRANCH)
- return LeafType.BRANCH;
-
- }
+ private static LeafType getTypeIfExisting(ActivityDiagram system, Quark code) {
+// if (code.getData() == null) {
+// final Quark quark = system.getPlasma().getIfExistsFromName(code.getName());
+// final IEntity ent = quark == null ? null : (ILeaf) quark.getData();
+// if (ent.getLeafType() == LeafType.BRANCH)
+// return LeafType.BRANCH;
+// }
return LeafType.ACTIVITY;
}
diff --git a/src/net/sourceforge/plantuml/activitydiagram/command/CommandLinkLongActivity.java b/src/net/sourceforge/plantuml/activitydiagram/command/CommandLinkLongActivity.java
index ddc6047dd..bc8cf5e5d 100644
--- a/src/net/sourceforge/plantuml/activitydiagram/command/CommandLinkLongActivity.java
+++ b/src/net/sourceforge/plantuml/activitydiagram/command/CommandLinkLongActivity.java
@@ -43,7 +43,8 @@ import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.UrlBuilder;
import net.sourceforge.plantuml.UrlMode;
import net.sourceforge.plantuml.activitydiagram.ActivityDiagram;
-import net.sourceforge.plantuml.baraye.IEntity;
+import net.sourceforge.plantuml.baraye.EntityImp;
+import net.sourceforge.plantuml.baraye.Quark;
import net.sourceforge.plantuml.classdiagram.command.CommandLinkClass;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.CommandMultilines2;
@@ -56,16 +57,13 @@ import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexOptional;
import net.sourceforge.plantuml.command.regex.RegexOr;
import net.sourceforge.plantuml.command.regex.RegexResult;
-import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.GroupType;
-import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.Link;
import net.sourceforge.plantuml.cucadiagram.LinkArg;
import net.sourceforge.plantuml.cucadiagram.LinkDecor;
import net.sourceforge.plantuml.cucadiagram.LinkType;
-import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.descdiagram.command.CommandLinkElement;
import net.sourceforge.plantuml.graphic.color.ColorType;
@@ -122,7 +120,7 @@ public class CommandLinkLongActivity extends CommandMultilines2
lines = lines.trim();
final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString());
- final IEntity entity1 = CommandLinkActivity.getEntity(diagram, line0, true);
+ final EntityImp entity1 = CommandLinkActivity.getEntity(diagram, line0, true);
if (entity1 == null)
return CommandExecutionResult.error("No such entity");
@@ -178,15 +176,16 @@ public class CommandLinkLongActivity extends CommandMultilines2
partition = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(partition);
}
if (partition != null) {
- final Ident idNewLong = diagram.buildLeafIdent(partition);
- diagram.gotoGroup(idNewLong, diagram.buildCode(partition), Display.getWithNewlines(partition),
- GroupType.PACKAGE, null, NamespaceStrategy.SINGLE);
+ final Quark idNewLong = diagram.quarkInContext(diagram.cleanIdForQuark(partition), false);
+ diagram.gotoGroup(idNewLong, Display.getWithNewlines(partition), GroupType.PACKAGE);
}
- final Ident ident = diagram.buildLeafIdent(idShort);
- final Code code = diagram.buildCode(idShort);
- final IEntity entity2 = diagram.getOrCreate(ident, code, Display.getWithNewlines(display), LeafType.ACTIVITY);
+ final Quark ident = diagram.quarkInContext(diagram.cleanIdForQuark(idShort), false);
+
+ EntityImp entity2 = (EntityImp) ident.getData();
if (entity2 == null)
- return CommandExecutionResult.error("No such entity");
+ entity2 = diagram.reallyCreateLeaf(ident, Display.getWithNewlines(display), LeafType.ACTIVITY, null);
+
+ diagram.setLastEntityConsulted(entity2);
if (partition != null)
diagram.endGroup();
@@ -217,7 +216,7 @@ public class CommandLinkLongActivity extends CommandMultilines2
type = type.goDotted();
final LinkArg linkArg = LinkArg.build(linkLabel, lenght, diagram.getSkinParam().classAttributeIconSize() > 0);
- Link link = new Link(diagram.getIEntityFactory(), diagram.getSkinParam().getCurrentStyleBuilder(), entity1,
+ Link link = new Link(diagram.getEntityFactory(), diagram.getSkinParam().getCurrentStyleBuilder(), entity1,
entity2, type, linkArg);
final Direction direction = StringUtils.getArrowDirection(arrowBody1 + arrowDirection + arrowBody2 + ">");
if (direction == Direction.LEFT || direction == Direction.UP)
diff --git a/src/net/sourceforge/plantuml/activitydiagram/command/CommandPartition.java b/src/net/sourceforge/plantuml/activitydiagram/command/CommandPartition.java
index dd88036eb..d6dfedce7 100644
--- a/src/net/sourceforge/plantuml/activitydiagram/command/CommandPartition.java
+++ b/src/net/sourceforge/plantuml/activitydiagram/command/CommandPartition.java
@@ -35,10 +35,9 @@
*/
package net.sourceforge.plantuml.activitydiagram.command;
-import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.activitydiagram.ActivityDiagram;
-import net.sourceforge.plantuml.baraye.IEntity;
-import net.sourceforge.plantuml.baraye.IGroup;
+import net.sourceforge.plantuml.baraye.EntityImp;
+import net.sourceforge.plantuml.baraye.Quark;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
@@ -46,11 +45,8 @@ import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexOr;
import net.sourceforge.plantuml.command.regex.RegexResult;
-import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.GroupType;
-import net.sourceforge.plantuml.cucadiagram.Ident;
-import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.graphic.color.ColorParser;
import net.sourceforge.plantuml.graphic.color.ColorType;
@@ -87,13 +83,13 @@ public class CommandPartition extends SingleLineCommand2 {
@Override
protected CommandExecutionResult executeArg(ActivityDiagram diagram, LineLocation location, RegexResult arg)
throws NoSuchColorException {
- final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("NAME", 0));
- final Ident ident = diagram.buildLeafIdent(idShort);
- final Code code = diagram.buildCode(idShort);
- final IGroup currentPackage = diagram.getCurrentGroup();
- diagram.gotoGroup(ident, code, Display.getWithNewlines(code), GroupType.PACKAGE, currentPackage,
- NamespaceStrategy.SINGLE);
- final IEntity p = diagram.getCurrentGroup();
+ final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(arg.get("NAME", 0)), false);
+// final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("NAME", 0));
+// final Quark ident = diagram.buildFromName(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(idShort));
+// final Quark code = diagram.buildFromFullPath(idShort);
+
+ diagram.gotoGroup(quark, Display.getWithNewlines(quark.getName()), GroupType.PACKAGE);
+ final EntityImp p = diagram.getCurrentGroup();
final Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet());
if (colors.isEmpty() == false) {
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorAssembly.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorAssembly.java
index 0d84fc5a4..ec26185fb 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorAssembly.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorAssembly.java
@@ -45,7 +45,6 @@ import net.sourceforge.plantuml.awt.geom.XPoint2D;
import net.sourceforge.plantuml.graphic.Rainbow;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock;
-import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.ugraphic.UTranslate;
public class FtileFactoryDelegatorAssembly extends FtileFactoryDelegator {
diff --git a/src/net/sourceforge/plantuml/anim/AffineTransformation.java b/src/net/sourceforge/plantuml/anim/AffineTransformation.java
index 1aca82064..255813091 100644
--- a/src/net/sourceforge/plantuml/anim/AffineTransformation.java
+++ b/src/net/sourceforge/plantuml/anim/AffineTransformation.java
@@ -47,6 +47,7 @@ import net.sourceforge.plantuml.awt.geom.XPoint2D;
import net.sourceforge.plantuml.ugraphic.MinMax;
public class AffineTransformation {
+ // ::remove folder when WASM
static private final Pattern rotate = Pattern.compile("rotate\\s+(-?\\d+\\.?\\d*)");
static private final Pattern shear = Pattern.compile("shear\\s+(-?\\d+\\.?\\d*)\\s+(-?\\d+\\.?\\d*)");
@@ -143,12 +144,12 @@ public class AffineTransformation {
public MinMax getMinMax(XDimension2D rect) {
MinMax result = MinMax.getEmpty(false);
final AffineTransform tmp = getAffineTransform(rect);
-
+
result = result.addPoint(new XPoint2D(0, 0).transform(tmp));
result = result.addPoint(new XPoint2D(0, rect.getHeight()).transform(tmp));
result = result.addPoint(new XPoint2D(rect.getWidth(), 0).transform(tmp));
result = result.addPoint(new XPoint2D(rect.getWidth(), rect.getHeight()).transform(tmp));
-
+
return result;
}
diff --git a/src/net/sourceforge/plantuml/ant/CheckZipTask.java b/src/net/sourceforge/plantuml/ant/CheckZipTask.java
index f6c628a20..05c5bdae9 100644
--- a/src/net/sourceforge/plantuml/ant/CheckZipTask.java
+++ b/src/net/sourceforge/plantuml/ant/CheckZipTask.java
@@ -54,6 +54,7 @@ import net.sourceforge.plantuml.security.SFile;
import net.sourceforge.plantuml.security.SecurityUtils;
public class CheckZipTask extends Task {
+ // ::remove folder when WASM
private String zipfile = null;
private List filesets = new ArrayList<>();
diff --git a/src/net/sourceforge/plantuml/asciiart/AbstractComponentText.java b/src/net/sourceforge/plantuml/asciiart/AbstractComponentText.java
index baed1386c..8bf96d6e1 100644
--- a/src/net/sourceforge/plantuml/asciiart/AbstractComponentText.java
+++ b/src/net/sourceforge/plantuml/asciiart/AbstractComponentText.java
@@ -42,13 +42,14 @@ import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.style.StyleSignatureBasic;
public abstract class AbstractComponentText implements Component {
+ // ::remove folder when WASM
public final XDimension2D getPreferredDimension(StringBounder stringBounder) {
final double w = getPreferredWidth(stringBounder);
final double h = getPreferredHeight(stringBounder);
return new XDimension2D(w, h);
}
-
+
public Style[] getUsedStyles() {
throw new UnsupportedOperationException();
}
@@ -57,5 +58,4 @@ public abstract class AbstractComponentText implements Component {
throw new UnsupportedOperationException();
}
-
}
diff --git a/src/net/sourceforge/plantuml/baraye/CucaDiagram.java b/src/net/sourceforge/plantuml/baraye/CucaDiagram.java
index 382e7cae7..c11b6a826 100644
--- a/src/net/sourceforge/plantuml/baraye/CucaDiagram.java
+++ b/src/net/sourceforge/plantuml/baraye/CucaDiagram.java
@@ -50,15 +50,13 @@ import java.util.concurrent.atomic.AtomicInteger;
import net.sourceforge.plantuml.BackSlash;
import net.sourceforge.plantuml.FileFormat;
import net.sourceforge.plantuml.FileFormatOption;
+import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.UmlDiagram;
import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.api.ImageDataSimple;
import net.sourceforge.plantuml.command.CommandExecutionResult;
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.CodeImpl;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.EntityGender;
import net.sourceforge.plantuml.cucadiagram.EntityPortion;
@@ -67,17 +65,14 @@ import net.sourceforge.plantuml.cucadiagram.GroupHierarchy;
import net.sourceforge.plantuml.cucadiagram.GroupType;
import net.sourceforge.plantuml.cucadiagram.HideOrShow2;
import net.sourceforge.plantuml.cucadiagram.ICucaDiagram;
-import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.Link;
import net.sourceforge.plantuml.cucadiagram.LinkConstraint;
import net.sourceforge.plantuml.cucadiagram.Magma;
import net.sourceforge.plantuml.cucadiagram.MagmaList;
-import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
import net.sourceforge.plantuml.cucadiagram.PortionShower;
import net.sourceforge.plantuml.cucadiagram.Together;
import net.sourceforge.plantuml.cucadiagram.dot.CucaDiagramTxtMaker;
-import net.sourceforge.plantuml.cucadiagram.entity.IEntityFactory;
import net.sourceforge.plantuml.elk.CucaDiagramFileMakerElk;
import net.sourceforge.plantuml.graphic.USymbol;
import net.sourceforge.plantuml.graphml.CucaDiagramGraphmlMaker;
@@ -88,64 +83,57 @@ import net.sourceforge.plantuml.statediagram.StateDiagram;
import net.sourceforge.plantuml.style.ClockwiseTopRightBottomLeft;
import net.sourceforge.plantuml.svek.CucaDiagramFileMaker;
import net.sourceforge.plantuml.svek.CucaDiagramFileMakerSvek;
-import net.sourceforge.plantuml.utils.Log;
import net.sourceforge.plantuml.xmi.CucaDiagramXmiMaker;
import net.sourceforge.plantuml.xmlsc.StateDiagramScxmlMaker;
public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy, PortionShower, ICucaDiagram {
- static public final boolean QUARK = false;
-
private String namespaceSeparator = null;
private boolean namespaceSeparatorHasBeenSet = false;
- public Quark currentQuark() {
- throw new UnsupportedOperationException();
- }
-
- public /* protected */ Plasma getPlasma() {
- throw new UnsupportedOperationException();
+ public final boolean mergeIntricated() {
+ return false;
}
private final List hides2 = new ArrayList<>();
private final List removed = new ArrayList<>();
protected final EntityFactory entityFactory = new EntityFactory(hides2, removed, this);
- private IGroup currentGroup = entityFactory.getRootGroup();
- private List stacks2 = new ArrayList<>();
- private List stacks = new ArrayList<>();
+
+ private List stacks = new ArrayList<>();
private boolean visibilityModifierPresent;
- private NamespaceStrategy lastNamespaceStrategy;
+ // private NamespaceStrategy lastNamespaceStrategy;
private Together currentTogether;
- public abstract IEntity getOrCreateLeaf(Ident ident, Code code, LeafType type, USymbol symbol);
-
- public Ident cleanIdent(Ident ident) {
- return ident;
- }
-
public CucaDiagram(UmlSource source, UmlDiagramType type, Map orig) {
super(source, type, orig);
- this.stacks2.add(Ident.empty());
+ this.stacks.add(entityFactory.getPlasma().root());
}
- final public String getPortFor(String ent1String, Ident ident1) {
+ public String getPortFor(String entString, Quark ident) {
+ final int x = entString.lastIndexOf("::");
+ if (x == -1)
+ return null;
+ if (entString.startsWith(ident.getName()))
+ return entString.substring(x + 2);
return null;
}
- private Ident getLastID() {
- if (stacks2.size() == 0) {
- // Thread.dumpStack();
- return Ident.empty();
- // throw new IllegalArgumentException();
- }
- return this.stacks2.get(stacks2.size() - 1);
+ public Quark currentQuark() {
+ return this.stacks.get(stacks.size() - 1);
+ }
+
+ public String cleanIdForQuark(String id) {
+ if (id == null)
+ return null;
+ return StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(id);
}
final public void setNamespaceSeparator(String namespaceSeparator) {
this.namespaceSeparatorHasBeenSet = true;
this.namespaceSeparator = namespaceSeparator;
+ getPlasma().setSeparator(namespaceSeparator);
}
final public String getNamespaceSeparator() {
@@ -157,103 +145,127 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
@Override
public boolean hasUrl() {
- for (IEntity entity : getGroups(true))
- if (entity.hasUrl())
- return true;
-
- for (IEntity entity : entityFactory.leafs())
- if (entity.hasUrl())
- return true;
-
- for (Link link : getLinks())
- if (link.hasUrl())
+ for (Quark quark : getPlasma().quarks()) {
+ final EntityImp ent = (EntityImp) quark.getData();
+ if (ent != null && ent.hasUrl())
return true;
+ }
return false;
}
- final public void setLastEntity(ILeaf foo) {
- this.lastEntity = foo;
+ final public void setLastEntity(EntityImp foo) {
+ this.lastEntity = (EntityImp) foo;
}
- final protected ILeaf getOrCreateLeafDefault(Ident idNewLong, Code code, LeafType type, USymbol symbol) {
- Objects.requireNonNull(idNewLong);
+ protected void updateLasts(EntityImp result) {
+ }
+
+ final public EntityImp reallyCreateLeaf(Quark ident, Display display, LeafType type, USymbol symbol) {
Objects.requireNonNull(type);
- ILeaf result = entityFactory.getLeaf(code);
-
- if (result == null) {
- result = createLeafInternal(idNewLong, code, Display.getWithNewlines(code), type, symbol);
- result.setUSymbol(symbol);
- }
-
- if (result.getLeafType() == LeafType.CLASS && type == LeafType.OBJECT)
- if (result.muteToType(type, symbol) == false)
- return null;
-
- this.lastEntity = result;
- return result;
- }
-
- public ILeaf createLeaf(Ident idNewLong, Code code, Display display, LeafType type, USymbol symbol) {
- Objects.requireNonNull(idNewLong);
- if (entityFactory.getLeafStrict(idNewLong) != null) {
- return null;
- // throw new IllegalArgumentException("Already known: " + code);
- }
- return createLeafInternal(idNewLong, code, display, type, symbol);
- }
-
- final protected ILeaf createLeafInternal(Ident newIdent, Code code, Display display, LeafType type,
- USymbol symbol) {
- Objects.requireNonNull(newIdent);
+ if (ident.getData() != null)
+ throw new IllegalStateException();
if (Display.isNull(display))
- display = Display.getWithNewlines(code).withCreoleMode(CreoleMode.SIMPLE_LINE);
+ throw new IllegalArgumentException();
+
+ final EntityImp result = entityFactory.createLeaf(ident, display, type, getHides());
+ result.setUSymbol(symbol);
+ ident.setData(result);
+ this.lastEntity = result;
+ result.setTogether(currentTogether);
+ updateLasts(result);
+// if (type == LeafType.OBJECT)
+// ((EntityImp) parent.getData()).muteToType2(type);
+ return result;
- final ILeaf leaf = entityFactory.createLeaf(currentTogether, newIdent, code, display, type, getCurrentGroup(),
- getHides(), getNamespaceSeparator());
- entityFactory.addLeaf(leaf);
- this.lastEntity = leaf;
- leaf.setUSymbol(symbol);
- return leaf;
}
- final public Ident buildLeafIdent(String id) {
- return getLastID().add(id, getNamespaceSeparator());
+ final public Quark quarkInContext(String full, boolean specialForCreateClass) {
+ final String sep = getNamespaceSeparator();
+ if (sep == null) {
+ final Quark result = getPlasma().getIfExistsFromName(full);
+ if (result != null)
+ return result;
+ return currentQuark().child(full);
+ }
+
+ final Quark currentQuark = currentQuark();
+ if (full.startsWith(sep))
+ return getPlasma().root().child(full.substring(sep.length()));
+ final int x = full.indexOf(sep);
+ if (x == -1) {
+ if (specialForCreateClass == false && getPlasma().countByName(full) == 1) {
+ final Quark byName = getPlasma().getIfExistsFromName(full);
+ assert byName != null;
+ if (byName != currentQuark)
+ return byName;
+ }
+ return currentQuark.child(full);
+ }
+
+ final String first = full.substring(0, x);
+ final boolean firstPackageDoesExist = getPlasma().root().childIfExists(first) != null;
+
+ if (firstPackageDoesExist)
+ return getPlasma().root().child(full);
+ return currentQuark.child(full);
+
}
- final public Ident buildLeafIdentSpecial(String id) {
- return buildFullyQualified(id);
+ public String removePortId(String id) {
+ // To be kept
+ if ("::".equals(namespaceSeparator))
+ return id;
+ final int x = id.lastIndexOf("::");
+ if (x == -1)
+ return id;
+ return id.substring(0, x);
}
- final public Ident buildLeafIdentSpecial2(String id) {
- return buildFullyQualified(id);
+ public String getPortId(String id) {
+ // To be kept
+ if ("::".equals(namespaceSeparator))
+ return null;
+ final int x = id.lastIndexOf("::");
+ if (x == -1)
+ return null;
+ return id.substring(x + 2);
}
- final public Ident buildFullyQualified(String id) {
- return entityFactory.buildFullyQualified(getLastID(), Ident.empty().add(id, getNamespaceSeparator()));
+ public /* protected */ Plasma getPlasma() {
+ return entityFactory.getPlasma();
}
- final public Code buildCode(String s) {
- return CodeImpl.of(s);
- }
+ final public Collection getChildrenGroups(EntityImp parent) {
+ final Collection result = new ArrayList<>();
- public boolean leafExist(Code code) {
- return entityFactory.getLeaf(code) != null;
- }
+ final Quark parent__;
+ if (parent.instanceofGroupRoot())
+ parent__ = getPlasma().root();
+ else
+ parent__ = ((EntityImp) parent).getQuark();
- public boolean leafExistStrict(Ident ident) {
- return entityFactory.getLeafStrict(ident) != null;
- }
-
- final public Collection getChildrenGroups(IGroup parent) {
- final Collection result = new ArrayList<>();
- for (IGroup gg : getGroups(false))
- if (gg.getParentContainer() == parent)
+ for (EntityImp gg : getGroups(false))
+ if (gg.getQuark().getParent() == parent__)
result.add(gg);
return Collections.unmodifiableCollection(result);
}
+ private void eventuallyBuildPhantomGroups() {
+ for (Quark quark : getPlasma().quarks()) {
+ if (quark.getData() != null)
+ continue;
+ int countChildren = quark.countChildren();
+ if (countChildren > 0) {
+ final Display display = Display.getWithNewlines(quark.getQualifiedName());
+ final EntityImp result = entityFactory.createGroup(quark, display, GroupType.PACKAGE, getHides());
+ quark.setData(result);
+ }
+ }
+
+ }
+
final public CommandExecutionResult gotoTogether() {
if (currentTogether != null)
return CommandExecutionResult.error("Cannot nest together");
@@ -262,69 +274,21 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
return CommandExecutionResult.ok();
}
- final public CommandExecutionResult gotoGroup(Ident ident, Code code, Display display, GroupType type,
- IGroup parent, NamespaceStrategy strategy) {
+ final public CommandExecutionResult gotoGroup(Quark ident, Display display, GroupType type) {
if (currentTogether != null)
return CommandExecutionResult.error("Cannot be done inside 'together'");
- if (this.lastNamespaceStrategy != null && strategy != this.lastNamespaceStrategy)
- return CommandExecutionResult.error("Cannot mix packages and namespaces");
- this.lastNamespaceStrategy = strategy;
-
- if (strategy == NamespaceStrategy.MULTIPLE) {
- if (getNamespaceSeparator() != null)
- code = getFullyQualifiedCode1972(code);
-
- gotoGroupInternalWithNamespace(ident, code, display, code, type, parent);
- } else if (strategy == NamespaceStrategy.SINGLE) {
- final Ident newIdLong = buildLeafIdentSpecial(ident.toString(this.getNamespaceSeparator()));
- gotoGroupExternal(newIdLong, code, display, null, type, parent);
- stacks2.add(newIdLong);
- } else {
- throw new IllegalArgumentException();
+ if (ident.getData() == null) {
+ final EntityImp result = entityFactory.createGroup(ident, display, type, getHides());
+ ident.setData(result);
}
+ final EntityImp ent = (EntityImp) ident.getData();
+ ent.setDisplay(display);
+ ent.muteToType2(type);
+
+ this.stacks.add(ident);
+
return CommandExecutionResult.ok();
- }
-
- protected final String getNamespace1972(Code fullyCode, String separator) {
- String name = fullyCode.getName();
- Objects.requireNonNull(separator);
- do {
- final int x = name.lastIndexOf(separator);
- if (x == -1)
- return null;
-
- name = name.substring(0, x);
- } while (entityFactory.getLeaf(buildCode(name)) != null);
- return name;
- }
-
- private void gotoGroupInternalWithNamespace(Ident idNewLong, Code code, Display display, Code namespaceNew,
- GroupType type, IGroup parent) {
- this.stacks.add(currentGroup);
- this.stacks2.add(idNewLong);
-
- if (getNamespaceSeparator() == null) {
- gotoGroupInternal(idNewLong, code, display, namespaceNew, type, parent);
- return;
- }
-
- final String namespaceCurrent = getNamespace1972(code, getNamespaceSeparator());
- if (namespaceCurrent == null) {
- gotoGroupInternal(idNewLong, code, display, namespaceNew, type, parent);
- return;
- }
- final IGroup realParent = entityFactory.getGroup(buildCode(namespaceCurrent));
- if (realParent == null) {
- gotoGroupInternal(idNewLong, code, display, namespaceNew, type, parent);
- return;
- }
- display = Display.create(idNewLong.getLast());
- IGroup result = entityFactory.createGroup(idNewLong, code, display, namespaceNew, type, realParent, getHides(),
- getNamespaceSeparator());
-
- entityFactory.addGroup(result);
- currentGroup = result;
}
@@ -335,145 +299,75 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
return true;
}
-// if (currentGroup.getGroupType() == GroupType.TOGETHER) {
-// currentGroup = currentGroup.getParentContainer();
-// return true;
-// }
-
- if (stacks2.size() > 0) {
- // Thread.dumpStack();
- stacks2.remove(stacks2.size() - 1);
+ if (stacks.size() > 0) {
+ stacks.remove(stacks.size() - 1);
+ return true;
}
- if (EntityUtils.groupRoot(currentGroup)) {
- Log.error("No parent group");
+
+ return false;
+
+ }
+
+ public final EntityImp getCurrentGroup() {
+ return (EntityImp) currentQuark().getData();
+ }
+
+ public final EntityImp getGroup(String code) {
+ final Quark quark = getPlasma().getIfExistsFromName(code);
+ if (quark == null)
+ return null;
+ return (EntityImp) quark.getData();
+ }
+
+ public final boolean isGroup(String code) {
+ final Quark quark = getPlasma().getIfExistsFromName(code);
+ if (quark == null)
return false;
+ return isGroup(quark);
+ }
+
+ public final boolean isGroup(final Quark quark) {
+ final EntityImp ent = (EntityImp) quark.getData();
+ if (ent == null)
+ return false;
+ return ent.isGroup();
+ }
+
+ public final Collection getGroups(boolean withRootGroup) {
+ final List result = new ArrayList<>();
+ for (Quark quark : getPlasma().quarks()) {
+ if (quark.isRoot()) {
+ if (withRootGroup)
+ result.add((EntityImp) quark.getData());
+ } else {
+ final EntityImp data = (EntityImp) quark.getData();
+ if (data != null && data.isGroup())
+ result.add(data);
+ }
}
- if (stacks.size() > 0)
- currentGroup = stacks.remove(stacks.size() - 1);
- else
- currentGroup = currentGroup.getParentContainer();
- return true;
- }
-
- private void gotoGroupInternal(Ident idNewLong, final Code code, Display display, final Code namespace,
- GroupType type, IGroup parent) {
- IGroup result = entityFactory.getGroup(code);
- if (result != null) {
- currentGroup = result;
- return;
- }
- if (entityFactory.getLeafStrict(idNewLong) != null) {
- result = entityFactory.muteToGroup(code.getName(), namespace, type, parent);
- result.setDisplay(display);
- } else {
- result = entityFactory.createGroup(idNewLong, code, display, namespace, type, parent, getHides(),
- getNamespaceSeparator());
- }
- entityFactory.addGroup(result);
- currentGroup = result;
- }
-
- final protected void gotoGroupExternal(Ident newIdLong, final Code code, Display display, final Code namespace,
- GroupType type, IGroup parent) {
- IGroup result = entityFactory.getGroup(code);
- if (result != null) {
- currentGroup = result;
- return;
- }
- if (entityFactory.getLeaf(code) != null) {
- result = entityFactory.muteToGroup(code.getName(), namespace, type, parent);
- result.setDisplay(display);
- } else {
- result = entityFactory.createGroup(newIdLong, code, display, namespace, type, parent, getHides(),
- getNamespaceSeparator());
- }
- entityFactory.addGroup(result);
- // entityFactory.thisIsNotArealGroup(newIdLong);
- currentGroup = result;
- }
-
- public final void gotoThisGroup(IGroup group) {
- currentGroup = group;
- }
-
- final protected Code getFullyQualifiedCode1972(Code code) {
- final String separator = Objects.requireNonNull(getNamespaceSeparator());
- final String full = code.getName();
- if (full.startsWith(separator))
- return buildCode(full.substring(separator.length()));
-
- if (full.contains(separator))
- return buildCode(full);
-
- if (EntityUtils.groupRoot(currentGroup))
- return buildCode(full);
-
- final Code namespace = currentGroup.getNamespace();
- if (namespace == null)
- return buildCode(full);
-
- return buildCode(namespace.getName() + separator + full);
- }
-
- public final IGroup getCurrentGroup() {
- return currentGroup;
- }
-
- public final IGroup getGroup(Code code) {
- final IGroup p = entityFactory.getGroup(code);
- return Objects.requireNonNull(p);
- }
-
- public final IGroup getGroupStrict(Ident ident) {
- throw new UnsupportedOperationException();
- }
-
- public final IGroup getGroupVerySmart(Ident ident) {
- throw new UnsupportedOperationException();
- }
-
- public final boolean isGroup(Code code) {
- return leafExist(code) == false && entityFactory.getGroup(code) != null;
- }
-
- public final boolean isGroupStrict(Ident ident) {
- throw new UnsupportedOperationException();
- }
-
- public final boolean isGroupVerySmart(Ident ident) {
- throw new UnsupportedOperationException();
- }
-
- public final Collection getGroups(boolean withRootGroup) {
- if (withRootGroup == false)
- return entityFactory.groups();
-
- final Collection result = new ArrayList<>();
- result.add(getRootGroup());
- result.addAll(entityFactory.groups());
return Collections.unmodifiableCollection(result);
}
- public IGroup getRootGroup() {
- return entityFactory.getRootGroup();
+ public EntityImp getRootGroup() {
+ return (EntityImp) getPlasma().root().getData();
}
- public final Collection getLeafsvalues() {
- return entityFactory.leafs2();
+ public final Collection getLeafsvalues() {
+ final List result = new ArrayList<>();
+ for (Quark quark : getPlasma().quarks()) {
+ if (quark.isRoot())
+ continue;
+ final EntityImp data = (EntityImp) quark.getData();
+ if (data != null && data.isGroup() == false)
+ result.add(data);
+ }
+ return Collections.unmodifiableCollection(result);
}
public final int getLeafssize() {
return getLeafsvalues().size();
}
- public final ILeaf getLeaf(Code code) {
- return entityFactory.getLeaf(code);
- }
-
- public final ILeaf getLeafStrict(Ident ident) {
- return entityFactory.getLeafStrict(ident);
- }
-
final public void addLink(Link link) {
entityFactory.addLink(link);
}
@@ -506,6 +400,7 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
return result.toArray(new String[result.size()]);
}
+ // ::comment when WASM
private void createFilesGraphml(OutputStream suggestedFile) throws IOException {
final CucaDiagramGraphmlMaker maker = new CucaDiagramGraphmlMaker(this);
maker.createFiles(suggestedFile);
@@ -521,11 +416,18 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
maker.createFiles(suggestedFile);
}
+ private void createFilesTxt(OutputStream os, int index, FileFormat fileFormat) throws IOException {
+ final CucaDiagramTxtMaker maker = new CucaDiagramTxtMaker(this, fileFormat);
+ maker.createFiles(os, index);
+ }
+ // ::done
+
@Override
protected ImageData exportDiagramInternal(OutputStream os, int index, FileFormatOption fileFormatOption)
throws IOException {
final FileFormat fileFormat = fileFormatOption.getFileFormat();
+ // ::comment when WASM
if (fileFormat == FileFormat.ATXT || fileFormat == FileFormat.UTXT) {
try {
createFilesTxt(os, index, fileFormat);
@@ -549,18 +451,24 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
createFilesScxml(os);
return ImageDataSimple.ok();
}
+ // ::done
if (getUmlDiagramType() == UmlDiagramType.COMPOSITE) {
throw new UnsupportedOperationException();
}
+ this.eventuallyBuildPhantomGroups();
final CucaDiagramFileMaker maker;
+ // ::comment when WASM
if (this.isUseElk())
maker = new CucaDiagramFileMakerElk(this, fileFormatOption.getDefaultStringBounder(getSkinParam()));
else if (this.isUseSmetana())
+ // ::done
maker = new CucaDiagramFileMakerSmetana(this, fileFormatOption.getDefaultStringBounder(getSkinParam()));
+ // ::comment when WASM
else
maker = new CucaDiagramFileMakerSvek(this);
+ // ::done
final ImageData result = maker.createFile(os, getDotStrings(), fileFormatOption);
@@ -585,15 +493,7 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
return generalWarningOrError + BackSlash.NEWLINE + warningOrError;
}
- private void createFilesTxt(OutputStream os, int index, FileFormat fileFormat) throws IOException {
- final CucaDiagramTxtMaker maker = new CucaDiagramTxtMaker(this, fileFormat);
- maker.createFiles(os, index);
- }
-
- public boolean isAutarkic(IGroup g) {
-// if (g.getGroupType() == GroupType.TOGETHER)
-// return false;
-
+ public boolean isAutarkic(EntityImp g) {
if (g.getGroupType() == GroupType.PACKAGE)
return false;
@@ -613,7 +513,7 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
if (EntityUtils.isPureInnerLink3(g, link) == false)
return false;
- for (ILeaf leaf : g.getLeafsDirect())
+ for (EntityImp leaf : g.getLeafsDirect())
if (leaf.getEntityPosition() != EntityPosition.NORMAL)
return false;
@@ -663,8 +563,8 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
return "25";
}
- final public boolean isEmpty(IGroup gToTest) {
- for (IEntity gg : getGroups(false)) {
+ final public boolean isEmpty(EntityImp gToTest) {
+ for (EntityImp gg : getGroups(false)) {
if (gg == gToTest)
continue;
@@ -683,7 +583,7 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
this.visibilityModifierPresent = visibilityModifierPresent;
}
- public final boolean showPortion(EntityPortion portion, IEntity entity) {
+ public final boolean showPortion(EntityPortion portion, EntityImp entity) {
if (getSkinParam().strictUmlStyle() && portion == EntityPortion.CIRCLED_CHARACTER)
return false;
@@ -735,7 +635,7 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
return Collections.unmodifiableSet(hides);
}
- final public boolean isStandalone(IEntity ent) {
+ final public boolean isStandalone(EntityImp ent) {
for (final Link link : getLinks())
if (link.getEntity1() == ent || link.getEntity2() == ent)
return false;
@@ -743,7 +643,7 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
return true;
}
- final public boolean isStandaloneForArgo(IEntity ent) {
+ final public boolean isStandaloneForArgo(EntityImp ent) {
for (final Link link : getLinks()) {
if (link.isHidden() || link.isInvis())
continue;
@@ -780,27 +680,24 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
return null;
}
- private ILeaf lastEntity = null;
+ protected EntityImp lastEntity = null;
- final public ILeaf getLastEntity() {
+ final public EntityImp getLastEntity() {
return lastEntity;
}
- final public IEntityFactory getIEntityFactory() {
- return entityFactory;
- }
-
final public EntityFactory getEntityFactory() {
+ // throw new UnsupportedOperationException();
return entityFactory;
}
public void applySingleStrategy() {
final MagmaList magmaList = new MagmaList();
- for (IGroup g : getGroups(true)) {
- final List standalones = new ArrayList<>();
+ for (EntityImp g : getGroups(true)) {
+ final List standalones = new ArrayList<>();
- for (ILeaf ent : g.getLeafsDirect())
+ for (EntityImp ent : g.getLeafsDirect())
if (isStandalone(ent))
standalones.add(ent);
@@ -812,7 +709,7 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
magmaList.add(magma);
}
- for (IGroup g : getGroups(true)) {
+ for (EntityImp g : getGroups(true)) {
final MagmaList magmas = magmaList.getMagmas(g);
if (magmas.size() < 3)
continue;
diff --git a/src/net/sourceforge/plantuml/baraye/EntityFactory.java b/src/net/sourceforge/plantuml/baraye/EntityFactory.java
index f9075ba89..c2d78e0a3 100644
--- a/src/net/sourceforge/plantuml/baraye/EntityFactory.java
+++ b/src/net/sourceforge/plantuml/baraye/EntityFactory.java
@@ -38,11 +38,7 @@ package net.sourceforge.plantuml.baraye;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
import java.util.Objects;
import java.util.Set;
@@ -51,73 +47,58 @@ import net.sourceforge.plantuml.cucadiagram.Bodier;
import net.sourceforge.plantuml.cucadiagram.BodierJSon;
import net.sourceforge.plantuml.cucadiagram.BodierMap;
import net.sourceforge.plantuml.cucadiagram.BodyFactory;
-import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.Display;
-import net.sourceforge.plantuml.cucadiagram.GroupRoot;
import net.sourceforge.plantuml.cucadiagram.GroupType;
import net.sourceforge.plantuml.cucadiagram.HideOrShow2;
-import net.sourceforge.plantuml.cucadiagram.Ident;
+import net.sourceforge.plantuml.cucadiagram.ICucaDiagram;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.Link;
-import net.sourceforge.plantuml.cucadiagram.Stereotag;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
-import net.sourceforge.plantuml.cucadiagram.Together;
import net.sourceforge.plantuml.cucadiagram.entity.IEntityFactory;
-import net.sourceforge.plantuml.graphic.USymbol;
import net.sourceforge.plantuml.skin.VisibilityModifier;
public final class EntityFactory implements IEntityFactory {
- private final Map leafsByCode;
- private final Map groupsByCode;
-
- /* private */public final Map leafs2 = new LinkedHashMap();
- /* private */public final Map groups2 = new LinkedHashMap();
-
private final List links = new ArrayList<>();
private int rawLayout;
- private final IGroup rootGroup = new GroupRoot(this);
+ private final Plasma plasma;
+
+ private final EntityImp rootGroup;
private final List hides2;
private final List removed;
- /* private */ final public CucaDiagram namespaceSeparator;
- private Map emptyGroupsAsNode = new HashMap();
+ /* private */ final public ICucaDiagram namespaceSeparator;
- public ILeaf getLeafForEmptyGroup(IGroup g) {
- return emptyGroupsAsNode.get(g);
+ public EntityImp getLeafForEmptyGroup(EntityImp g) {
+ throw new UnsupportedOperationException();
}
- public ILeaf createLeafForEmptyGroup(IGroup g, ISkinParam skinParam) {
- final ILeaf folder = this.createLeaf(null, g.getIdent(), g.getCode(), g.getDisplay(), LeafType.EMPTY_PACKAGE,
- g.getParentContainer(), null, this.namespaceSeparator.getNamespaceSeparator());
- ((EntityImp) folder).setOriginalGroup(g);
- final USymbol symbol = g.getUSymbol();
- folder.setUSymbol(symbol);
- folder.setStereotype(g.getStereotype());
- folder.setColors(g.getColors());
- if (g.getUrl99() != null)
- folder.addUrl(g.getUrl99());
- for (Stereotag tag : g.stereotags())
- folder.addStereotag(tag);
-
- emptyGroupsAsNode.put(g, folder);
- return folder;
+ public EntityImp createLeafForEmptyGroup(EntityImp g, ISkinParam skinPdaram) {
+ final EntityImp ent = (EntityImp) g;
+ ent.muteToType2(LeafType.EMPTY_PACKAGE);
+ return ent;
}
- public EntityFactory(List hides2, List removed, CucaDiagram namespaceSeparator) {
+//
+ public EntityImp isIntricated(EntityImp parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public EntityFactory(List hides2, List removed, ICucaDiagram namespaceSeparator) {
this.hides2 = hides2;
this.removed = removed;
this.namespaceSeparator = namespaceSeparator;
- this.leafsByCode = new LinkedHashMap();
- this.groupsByCode = new LinkedHashMap();
+ this.plasma = new Plasma(".");
+ this.rootGroup = new EntityImp(this.plasma.root(), this, null, GroupType.ROOT, 0);
+ this.plasma.root().setData(rootGroup);
}
- public boolean isHidden(ILeaf leaf) {
- final IEntity other = isNoteWithSingleLinkAttachedTo(leaf);
- if (other instanceof ILeaf)
- return isHidden((ILeaf) other);
+ public boolean isHidden(EntityImp leaf) {
+ final EntityImp other = isNoteWithSingleLinkAttachedTo(leaf);
+ if (other != null && other != leaf)
+ return isHidden(other);
boolean hidden = false;
for (HideOrShow2 hide : hides2)
@@ -134,10 +115,10 @@ public final class EntityFactory implements IEntityFactory {
return result;
}
- public boolean isRemoved(ILeaf leaf) {
- final IEntity other = isNoteWithSingleLinkAttachedTo(leaf);
- if (other instanceof ILeaf)
- return isRemoved((ILeaf) other);
+ public boolean isRemoved(EntityImp leaf) {
+ final EntityImp other = isNoteWithSingleLinkAttachedTo(leaf);
+ if (other instanceof EntityImp)
+ return isRemoved((EntityImp) other);
boolean result = false;
for (HideOrShow2 hide : removed)
@@ -146,11 +127,11 @@ public final class EntityFactory implements IEntityFactory {
return result;
}
- private IEntity isNoteWithSingleLinkAttachedTo(ILeaf note) {
+ private EntityImp isNoteWithSingleLinkAttachedTo(EntityImp note) {
if (note.getLeafType() != LeafType.NOTE)
return null;
assert note.getLeafType() == LeafType.NOTE;
- IEntity other = null;
+ EntityImp other = null;
for (Link link : this.getLinks()) {
if (link.getType().isInvisible())
continue;
@@ -167,7 +148,7 @@ public final class EntityFactory implements IEntityFactory {
}
- public boolean isRemovedIgnoreUnlinked(ILeaf leaf) {
+ public boolean isRemovedIgnoreUnlinked(EntityImp leaf) {
boolean result = false;
for (HideOrShow2 hide : removed)
if (hide.isAboutUnlinked() == false)
@@ -176,8 +157,8 @@ public final class EntityFactory implements IEntityFactory {
return result;
}
- public ILeaf createLeaf(Together together, Ident ident, Code code, Display display, LeafType entityType,
- IGroup parentContainer, Set hides, String namespaceSeparator) {
+ final public EntityImp createLeaf(Quark quark, Display display, LeafType entityType,
+ Set hides) {
final Bodier bodier;
if (Objects.requireNonNull(entityType) == LeafType.MAP)
bodier = new BodierMap();
@@ -186,169 +167,68 @@ public final class EntityFactory implements IEntityFactory {
else
bodier = BodyFactory.createLeaf(entityType, hides);
- final EntityImp result = new EntityImp(ident, code, this, bodier, parentContainer, entityType,
- namespaceSeparator, rawLayout);
+ final EntityImp result = new EntityImp(quark, this, bodier, entityType, rawLayout);
bodier.setLeaf(result);
result.setDisplay(display);
- result.setTogether(together);
return result;
}
- public IGroup createGroup(Ident ident, Code code, Display display, Code namespace, GroupType groupType,
- IGroup parentContainer, Set hides, String namespaceSeparator) {
+ public EntityImp createGroup(Quark quark, Display display, GroupType groupType, Set hides) {
Objects.requireNonNull(groupType);
- for (Entry ent : groups2.entrySet())
- if (ent.getKey().equals(ident))
- return ent.getValue();
+ if (quark.getData() != null)
+ return (EntityImp) quark.getData();
+// for (Entry ent : groups2.entrySet())
+// if (ent.getKey().equals(ident))
+// return ent.getValue();
final Bodier bodier = BodyFactory.createGroup(hides);
- final EntityImp result = new EntityImp(ident, code, this, bodier, parentContainer, groupType, namespace,
- namespaceSeparator, rawLayout);
+ final EntityImp result = new EntityImp(quark, this, bodier, groupType, rawLayout);
if (Display.isNull(display) == false)
result.setDisplay(display);
return result;
}
- public void addLeaf(ILeaf entity) {
- leafsByCode.put(entity.getCodeGetName(), entity);
- leafs2.put(entity.getIdent(), entity);
- }
-
- public void addGroup(IGroup group) {
- groupsByCode.put(group.getCodeGetName(), group);
- groups2.put(group.getIdent(), group);
- }
-
- private void ensureParentIsCreated(Ident ident) {
- if (groups2.get(ident.parent()) != null)
- return;
- getParentContainer(ident, null);
- }
-
- public /* private */ void removeGroup(String name) {
- final IEntity removed = Objects.requireNonNull(groupsByCode.remove(name));
- final IEntity removed2 = groups2.remove(removed.getIdent());
- if (removed != removed2) {
- bigError();
- }
- }
-
- public /* private */ void removeGroup(Ident ident) {
- Objects.requireNonNull(groups2.remove(Objects.requireNonNull(ident)));
- }
-
- public static void bigError() {
- // Thread.dumpStack();
- // System.exit(0);
- // throw new IllegalArgumentException();
- }
-
- public /* private */ void removeLeaf(String name) {
- final IEntity removed = Objects.requireNonNull(leafsByCode.remove(Objects.requireNonNull(name)));
- final IEntity removed2 = leafs2.remove(removed.getIdent());
- if (removed != removed2) {
- bigError();
- }
- }
-
- public /* private */ void removeLeaf(Ident ident) {
- final IEntity removed = leafs2.remove(Objects.requireNonNull(ident));
- if (removed == null) {
- System.err.println("leafs2=" + leafs2.keySet());
- throw new IllegalArgumentException(ident.toString());
- }
- }
-
- public IGroup muteToGroup(String name, Code namespace, GroupType type, IGroup parent) {
- final ILeaf leaf = leafsByCode.get(name);
- ((EntityImp) leaf).muteToGroup(namespace, type, parent);
- final IGroup result = (IGroup) leaf;
- removeLeaf(name);
- return result;
- }
-
- public IGroup getRootGroup() {
+ public EntityImp getRootGroup() {
return rootGroup;
}
- public final ILeaf getLeafStrict(Ident ident) {
- return leafs2.get(ident);
- }
-
- public Ident buildFullyQualified(Ident currentPath, Ident id) {
- if (currentPath.equals(id) == false)
- if (leafs2.containsKey(id) || groups2.containsKey(id))
- return id;
-
- if (id.size() > 1)
- return id;
-
- return currentPath.add(id);
- }
-
- public final IGroup getGroupStrict(Ident ident) {
- if (namespaceSeparator.getNamespaceSeparator() == null)
- return getGroupVerySmart(ident);
-
- final IGroup result = groups2.get(ident);
- return result;
- }
-
- public final IGroup getGroupVerySmart(Ident ident) {
- final IGroup result = groups2.get(ident);
+ public final EntityImp getLeafStrict(Quark ident) {
+ if (ident instanceof Quark == false)
+ throw new UnsupportedOperationException();
+ final Quark quark = (Quark) ident;
+ final EntityImp result = (EntityImp) quark.getData();
if (result == null)
- for (Entry ent : groups2.entrySet())
- if (ent.getKey().getLast().equals(ident.getLast()))
- return ent.getValue();
-
+ throw new UnsupportedOperationException();
return result;
}
- public final ILeaf getLeaf(Code code) {
- final ILeaf result = leafsByCode.get(code.getName());
- if (result != null && result != leafs2.get(result.getIdent()))
- bigError();
+ public final Collection leafs() {
- for (ILeaf tmp : leafsByCode.values())
- if (tmp.getIdent().equals(code))
- return tmp;
-
- return result;
- }
-
- public final IGroup getGroup(Code code) {
- final IGroup result = groupsByCode.get(code.getName());
- if (result != null && result != groups2.get(result.getIdent()))
- bigError();
-
- return result;
- }
-
- public final Collection leafs() {
- final Collection result = Collections.unmodifiableCollection(leafsByCode.values());
- if (new ArrayList<>(result).equals(new ArrayList<>(leafs2())) == false)
- bigError();
-
- return result;
- }
-
- public final Collection groups() {
- final Collection result = Collections.unmodifiableCollection(groupsByCode.values());
- if (new ArrayList<>(result).equals(new ArrayList<>(groups2())) == false)
- bigError();
-
- return result;
- }
-
- public final Collection groups2() {
- final Collection result = Collections.unmodifiableCollection(groups2.values());
+ final List result = new ArrayList<>();
+ for (Quark quark : getPlasma().quarks()) {
+ if (quark.isRoot())
+ continue;
+ final EntityImp data = (EntityImp) quark.getData();
+ if (data != null && data.isGroup() == false)
+ result.add(data);
+ }
return Collections.unmodifiableCollection(result);
+
}
- public final Collection leafs2() {
- final Collection result = Collections.unmodifiableCollection(leafs2.values());
+ public final Collection groups() {
+ final List result = new ArrayList<>();
+ for (Quark quark : getPlasma().quarks()) {
+ if (quark.isRoot())
+ continue;
+ final EntityImp data = (EntityImp) quark.getData();
+ if (data != null && data.isGroup())
+ result.add(data);
+ }
+ // System.err.println("GROUPS=" + result.size());
return Collections.unmodifiableCollection(result);
+
}
public void incRawLayout() {
@@ -381,12 +261,11 @@ public final class EntityFactory implements IEntityFactory {
}
- public IGroup getParentContainer(Ident ident, IGroup parentContainer) {
- return Objects.requireNonNull(parentContainer);
- }
-
- public CucaDiagram getDiagram() {
+ public ICucaDiagram getDiagram() {
return namespaceSeparator;
}
+ public Plasma getPlasma() {
+ return plasma;
+ }
}
diff --git a/src/net/sourceforge/plantuml/baraye/EntityImp.java b/src/net/sourceforge/plantuml/baraye/EntityImp.java
index cbe47fca5..aa8e804c0 100644
--- a/src/net/sourceforge/plantuml/baraye/EntityImp.java
+++ b/src/net/sourceforge/plantuml/baraye/EntityImp.java
@@ -50,19 +50,21 @@ import java.util.Set;
import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.Guillemet;
+import net.sourceforge.plantuml.Hideable;
import net.sourceforge.plantuml.ISkinParam;
+import net.sourceforge.plantuml.LineConfigurable;
+import net.sourceforge.plantuml.Removeable;
+import net.sourceforge.plantuml.SpecificBackcolorable;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.command.Position;
import net.sourceforge.plantuml.cucadiagram.Bodier;
-import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.CucaNote;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.DisplayPositioned;
import net.sourceforge.plantuml.cucadiagram.EntityPosition;
-import net.sourceforge.plantuml.cucadiagram.GroupRoot;
import net.sourceforge.plantuml.cucadiagram.GroupType;
-import net.sourceforge.plantuml.cucadiagram.Ident;
+import net.sourceforge.plantuml.cucadiagram.ICucaDiagram;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.Link;
import net.sourceforge.plantuml.cucadiagram.Stereostyles;
@@ -91,13 +93,11 @@ import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.utils.Direction;
import net.sourceforge.plantuml.utils.LineLocation;
-final public class EntityImp implements ILeaf, IGroup {
+final public class EntityImp implements SpecificBackcolorable, Hideable, Removeable, LineConfigurable {
private final EntityFactory entityFactory;
- // Entity
- private/* final */Code code;
- private/* final */Ident ident;
+ private Quark quark;
private Url url;
@@ -110,10 +110,6 @@ final public class EntityImp implements ILeaf, IGroup {
private Stereotype stereotype;
private Stereostyles stereostyles = Stereostyles.NONE;
private String generic;
- private IGroup parentContainer;
-
- // Group
- private Code namespace;
private GroupType groupType;
@@ -134,7 +130,7 @@ final public class EntityImp implements ILeaf, IGroup {
private Together together;
- @Override
+ //
public void addNote(Display note, Position position, Colors colors) {
if (position == Position.TOP)
notesTop.add(CucaNote.build(note, position, colors));
@@ -142,7 +138,7 @@ final public class EntityImp implements ILeaf, IGroup {
notesBottom.add(CucaNote.build(note, position, colors));
}
- @Override
+ //
public List getNotes(Position position) {
if (position == Position.TOP)
return Collections.unmodifiableList(notesTop);
@@ -160,47 +156,45 @@ final public class EntityImp implements ILeaf, IGroup {
}
// Back to Entity
- private EntityImp(Ident ident, EntityFactory entityFactory, Code code, Bodier bodier, IGroup parentContainer,
- String namespaceSeparator, int rawLayout) {
- this.ident = Objects.requireNonNull(ident);
- this.uid = StringUtils.getUid("cl", entityFactory.getDiagram().getUniqueSequence());
- this.code = Objects.requireNonNull(code);
+ private EntityImp(Quark quark, EntityFactory entityFactory, Bodier bodier, int rawLayout) {
+ this.quark = Objects.requireNonNull(quark);
+ if (quark.isRoot())
+ this.uid = "clroot";
+ else
+ this.uid = StringUtils.getUid("cl", entityFactory.getDiagram().getUniqueSequence());
this.entityFactory = entityFactory;
this.bodier = bodier;
- this.parentContainer = parentContainer;
this.rawLayout = rawLayout;
}
- public EntityImp(Ident ident, Code code, EntityFactory entityFactory, Bodier bodier, IGroup parentContainer,
- LeafType leafType, String namespaceSeparator, int rawLayout) {
- this(Objects.requireNonNull(ident), entityFactory, code, bodier, parentContainer, namespaceSeparator,
- rawLayout);
- // System.err.println("ID for leaf=" + code + " " + ident);
- // ident.checkSameAs(code, namespaceSeparator);
+ EntityImp(Quark quark, EntityFactory entityFactory, Bodier bodier, LeafType leafType, int rawLayout) {
+ this(Objects.requireNonNull(quark), entityFactory, bodier, rawLayout);
this.leafType = leafType;
}
- public EntityImp(Ident ident, Code code, EntityFactory entityFactory, Bodier bodier, IGroup parentContainer,
- GroupType groupType, Code namespace, String namespaceSeparator, int rawLayout) {
- this(Objects.requireNonNull(ident), entityFactory, code, bodier, parentContainer, namespaceSeparator,
- rawLayout);
- // System.err.println("ID for group=" + code + " " + ident);
- ident.checkSameAs(code, namespaceSeparator, entityFactory.namespaceSeparator);
+ EntityImp(Quark quark, EntityFactory entityFactory, Bodier bodier, GroupType groupType, int rawLayout) {
+ this(Objects.requireNonNull(quark), entityFactory, bodier, rawLayout);
this.groupType = groupType;
- this.namespace = namespace;
- }
-
- public void setContainer(IGroup container) {
- checkNotGroup();
- this.parentContainer = Objects.requireNonNull(container);
}
public LeafType getLeafType() {
return leafType;
}
+ public void muteToType2(LeafType newType) {
+ if (leafType == LeafType.CLASS && newType == LeafType.OBJECT)
+ bodier.muteClassToObject();
+ this.groupType = null;
+ this.leafType = newType;
+ }
+
+ public void muteToType2(GroupType newType) {
+ this.groupType = newType;
+ this.leafType = null;
+ }
+
public boolean muteToType(LeafType newType, USymbol newSymbol) {
- checkNotGroup();
+ // checkNotGroup();
Objects.requireNonNull(newType);
if (leafType != LeafType.STILL_UNKNOWN) {
if (newType == this.leafType)
@@ -225,16 +219,16 @@ final public class EntityImp implements ILeaf, IGroup {
return true;
}
- public Code getCode() {
- return code;
+ public Quark getQuark() {
+ return quark;
+ }
+
+ public String getCode() {
+ return getQuark().getName();
}
public String getCodeGetName() {
- return getCode().getName();
- }
-
- public Ident getIdent() {
- return ident;
+ return getQuark().getName();
}
public Display getDisplay() {
@@ -257,18 +251,8 @@ final public class EntityImp implements ILeaf, IGroup {
this.stereotype = stereotype;
}
- public final IGroup getParentContainer() {
- return entityFactory.getParentContainer(ident, parentContainer);
- // Objects.requireNonNull(parentContainer);
- // return parentContainer;
- }
-
- @Override
public String toString() {
- // return super.toString() + code + " " + display + "(" + leafType + ")[" +
- // groupType + "] " + xposition + " "
- // + getUid();
- return "EntityImpl " + code + ident + " " + display + "(" + leafType + ")[" + groupType + "] " + getUid();
+ return quark.toString() + " " + display + "(" + leafType + ")[" + groupType + "] " + getUid();
}
public final Url getUrl99() {
@@ -346,7 +330,7 @@ final public class EntityImp implements ILeaf, IGroup {
if (leafType != LeafType.STATE)
return EntityPosition.NORMAL;
- if (getParentContainer() instanceof GroupRoot)
+ if (quark.isRoot())
return EntityPosition.NORMAL;
final Stereotype stereotype = getStereotype();
@@ -371,145 +355,11 @@ final public class EntityImp implements ILeaf, IGroup {
}
- public boolean containsLeafRecurse(ILeaf leaf) {
- if (Objects.requireNonNull(leaf).isGroup())
- throw new IllegalArgumentException();
-
- checkGroup();
- if (leaf.getParentContainer() == this)
- return true;
-
- for (IGroup child : getChildren())
- if (child.containsLeafRecurse(leaf))
- return true;
-
- return false;
- }
-
- public Collection getLeafsDirect() {
- checkGroup();
- final List result = new ArrayList<>();
- for (ILeaf ent : entityFactory.leafs()) {
- if (ent.isGroup())
- throw new IllegalStateException();
-
- if (ent.getParentContainer() == this)
- result.add(ent);
-
- }
- return Collections.unmodifiableCollection(result);
- }
-
- public Collection getChildren() {
- checkGroup();
- final Collection result = new ArrayList<>();
- for (IGroup g : entityFactory.groups())
- if (g != this && g.getParentContainer() == this)
- result.add(g);
-
- return Collections.unmodifiableCollection(result);
- }
-
- public void moveEntitiesTo(IGroup dest) {
- checkGroup();
- if (dest.isGroup() == false)
- throw new UnsupportedOperationException();
-
- for (ILeaf ent : getLeafsDirect())
- ((EntityImp) ent).parentContainer = dest;
-
- for (IGroup g : dest.getChildren())
- // ((EntityImpl) g).parentContainer = dest;
- throw new IllegalStateException();
-
- for (IGroup g : getChildren()) {
- if (g == dest)
- continue;
-
- ((EntityImp) g).parentContainer = dest;
- }
-
- }
-
- private void moveEntitiesTo1972(IGroup dest) {
- checkGroup();
- if (dest.isGroup() == false)
- throw new UnsupportedOperationException();
-
- // System.err.println("moveEntitiesTo1972::before1::groups2=" +
- // entityFactory.groups2());
- final Ident firstIdent = getIdent();
- final Ident destIdent = dest.getIdent();
- // System.err.println("moveEntitiesTo1972::this=" + firstIdent);
- // System.err.println("moveEntitiesTo1972::dest=" + destIdent);
- if (destIdent.startsWith(firstIdent) == false)
- throw new UnsupportedOperationException();
-
- // System.err.println("moveEntitiesTo1972::before2::groups2=" +
- // entityFactory.groups2());
- for (ILeaf ent : new ArrayList<>(entityFactory.leafs2())) {
- Ident ident = ent.getIdent();
- if (ident.equals(firstIdent) == false && ident.startsWith(firstIdent)
- && ident.startsWith(destIdent) == false) {
- // System.err.print("moving leaf ident1=" + ident);
- entityFactory.leafs2.remove(ident);
- ident = ident.move(firstIdent, destIdent);
- // System.err.println(" to ident2=" + ident);
- ((EntityImp) ent).ident = ident;
- ((EntityImp) ent).code = ident;
- entityFactory.leafs2.put(ident, ent);
- }
- }
- // System.err.println("moveEntitiesTo1972::before3::groups2=" +
- // entityFactory.groups2());
- for (IGroup ent : new ArrayList<>(entityFactory.groups2())) {
- Ident ident = ent.getIdent();
- // System.err.println("found=" + ident + " " + ident.startsWith(firstIdent) + "
- // "
- // + ident.startsWith(destIdent));
- if (ident.equals(firstIdent) == false && ident.startsWith(firstIdent)
- && ident.startsWith(destIdent) == false) {
- // System.err.print("moving gr ident1=" + ident);
- entityFactory.groups2.remove(ident);
- ident = ident.move(firstIdent, destIdent);
- // System.err.println(" to ident2=" + ident);
- ((EntityImp) ent).ident = ident;
- ((EntityImp) ent).code = ident;
- entityFactory.groups2.put(ident, ent);
- // System.err.println("-->groups2=" + entityFactory.groups2());
- }
- }
- // System.err.println("moveEntitiesTo1972::after::groups2=" +
- // entityFactory.groups2());
- // for (IGroup g : dest.getChildren()) {
- // // ((EntityImpl) g).parentContainer = dest;
- // throw new IllegalStateException();
- // }
- //
- // for (IGroup g : getChildren()) {
- // if (g == dest) {
- // continue;
- // }
- // ((EntityImpl) g).parentContainer = dest;
- // }
-
- }
-
- public int size() {
- checkGroup();
- return getLeafsDirect().size();
- }
-
public GroupType getGroupType() {
checkGroup();
return groupType;
}
- public Code getNamespace() {
- checkGroup();
- return namespace;
- }
-
public PackageStyle getPackageStyle() {
checkGroup();
if (stereotype == null)
@@ -543,26 +393,34 @@ final public class EntityImp implements ILeaf, IGroup {
if (EntityUtils.isPureInnerLink12(this, link))
entityFactory.removeLink(link);
- entityFactory.removeGroup(getCodeGetName());
- for (ILeaf ent : new ArrayList<>(entityFactory.leafs()))
- if (this != ent && this == ent.getParentContainer())
- entityFactory.removeLeaf(ent.getCodeGetName());
-
- entityFactory.addLeaf(this);
+// if (entityFactory.namespaceSeparator.V1972()) {
+// entityFactory.removeGroup(getIdent());
+// for (ILeaf ent : new ArrayList<>(entityFactory.leafs()))
+// if (this != ent && getIdent().equals(ent.getIdent().parent()))
+// entityFactory.removeLeaf(ent.getIdent());
+//
+// } else {
+// entityFactory.removeGroup(getCodeGetName());
+// for (ILeaf ent : new ArrayList<>(entityFactory.leafs()))
+// if (this != ent && this == ent.getParentContainer())
+// entityFactory.removeLeaf(ent.getCodeGetName());
+// }
+//
+// entityFactory.addLeaf(this);
this.groupType = null;
this.leafType = leafType;
}
- public /* private */ void muteToGroup(Code namespaceNew, GroupType groupType, IGroup parentContainer) {
- checkNotGroup();
- if (parentContainer.isGroup() == false)
- throw new IllegalArgumentException();
-
- this.namespace = namespaceNew;
- this.groupType = groupType;
- this.leafType = null;
- this.parentContainer = parentContainer;
- }
+// void muteToGroup(Code namespaceNew, GroupType groupType, IGroup parentContainer) {
+// checkNotGroup();
+// if (parentContainer.isGroup() == false)
+// throw new IllegalArgumentException();
+//
+// this.namespace = namespaceNew;
+// this.groupType = groupType;
+// this.leafType = null;
+// this.parentContainer = parentContainer;
+// }
public USymbol getUSymbol() {
if (getLeafType() == LeafType.CIRCLE)
@@ -583,13 +441,15 @@ final public class EntityImp implements ILeaf, IGroup {
}
public boolean isHidden() {
- if (parentContainer != null && parentContainer.isHidden())
+ if (getParentContainer() != null && getParentContainer().isHidden())
return true;
return isHiddenInternal();
}
private boolean isHiddenInternal() {
+ if (quark.isRoot())
+ return false;
if (isGroup()) {
if (entityFactory.isHidden(this))
return true;
@@ -597,12 +457,12 @@ final public class EntityImp implements ILeaf, IGroup {
if (getLeafsDirect().size() == 0)
return false;
- for (ILeaf leaf : getLeafsDirect())
- if (((EntityImp) leaf).isHiddenInternal() == false)
+ for (EntityImp leaf : getLeafsDirect())
+ if (leaf.isHiddenInternal() == false)
return false;
- for (IGroup g : getChildren())
- if (((EntityImp) g).isHiddenInternal() == false)
+ for (EntityImp g : getChildren())
+ if (g.isHiddenInternal() == false)
return false;
return true;
@@ -611,7 +471,7 @@ final public class EntityImp implements ILeaf, IGroup {
}
public boolean isRemoved() {
- if (parentContainer != null && parentContainer.isRemoved())
+ if (getParentContainer() != null && getParentContainer().isRemoved())
return true;
return isRemovedInternal();
@@ -625,11 +485,11 @@ final public class EntityImp implements ILeaf, IGroup {
if (getLeafsDirect().size() == 0 && getChildren().size() == 0)
return false;
- for (ILeaf leaf : getLeafsDirect())
+ for (EntityImp leaf : getLeafsDirect())
if (((EntityImp) leaf).isRemovedInternal() == false)
return false;
- for (IGroup g : getChildren())
+ for (EntityImp g : getChildren())
if (((EntityImp) g).isRemovedInternal() == false)
return false;
@@ -644,7 +504,7 @@ final public class EntityImp implements ILeaf, IGroup {
for (Link link : entityFactory.getLinks())
if (link.contains(this)) {
- final ILeaf other = (ILeaf) link.getOther(this);
+ final EntityImp other = (EntityImp) link.getOther(this);
final boolean removed = entityFactory.isRemovedIgnoreUnlinked(other);
if (removed == false && link.getType().isInvisible() == false)
return false;
@@ -743,17 +603,6 @@ final public class EntityImp implements ILeaf, IGroup {
return legend;
}
- private IGroup originalGroup;
-
- public void setOriginalGroup(IGroup originalGroup) {
- this.originalGroup = originalGroup;
- this.legend = originalGroup.getLegend();
- }
-
- public IGroup getOriginalGroup() {
- return originalGroup;
- }
-
public String getCodeLine() {
if (this.codeLine == null)
return null;
@@ -765,12 +614,12 @@ final public class EntityImp implements ILeaf, IGroup {
this.codeLine = codeLine;
}
- @Override
+ //
public void setStereostyle(String stereo) {
this.stereostyles = Stereostyles.build(stereo);
}
- @Override
+ //
public Stereostyles getStereostyles() {
return stereostyles;
}
@@ -794,18 +643,18 @@ final public class EntityImp implements ILeaf, IGroup {
return Collections.unmodifiableList(result);
}
- public CucaDiagram getDiagram() {
+ public ICucaDiagram getDiagram() {
return entityFactory.getDiagram();
}
private boolean isStatic;
- @Override
+ //
public void setStatic(boolean isStatic) {
this.isStatic = isStatic;
}
- @Override
+ //
public boolean isStatic() {
return isStatic;
}
@@ -835,14 +684,46 @@ final public class EntityImp implements ILeaf, IGroup {
}
- @Override
public Together getTogether() {
return together;
}
- @Override
public void setTogether(Together together) {
this.together = together;
}
+ public EntityImp getParentContainer() {
+ if (quark.isRoot())
+ return null;
+ return (EntityImp) quark.getParent().getData();
+ }
+
+ public Collection getLeafsDirect() {
+ final List result = new ArrayList<>();
+ for (Quark quark : quark.getChildren()) {
+ final EntityImp data = (EntityImp) quark.getData();
+ if (data != null && data.isGroup() == false)
+ result.add(data);
+ }
+ return Collections.unmodifiableCollection(result);
+ }
+
+ public Collection getChildren() {
+ final List result = new ArrayList<>();
+ for (Quark quark : quark.getChildren()) {
+ final EntityImp data = (EntityImp) quark.getData();
+ if (data != null && data.isGroup())
+ result.add(data);
+ }
+ return Collections.unmodifiableCollection(result);
+ }
+
+ public int size() {
+ return getQuark().countChildren();
+ }
+
+ public boolean instanceofGroupRoot() {
+ return getQuark().isRoot();
+ }
+
}
diff --git a/src/net/sourceforge/plantuml/baraye/EntityUtils.java b/src/net/sourceforge/plantuml/baraye/EntityUtils.java
index 078e87b1e..da28abfdc 100644
--- a/src/net/sourceforge/plantuml/baraye/EntityUtils.java
+++ b/src/net/sourceforge/plantuml/baraye/EntityUtils.java
@@ -35,19 +35,11 @@
*/
package net.sourceforge.plantuml.baraye;
-import net.sourceforge.plantuml.cucadiagram.GroupRoot;
import net.sourceforge.plantuml.cucadiagram.Link;
public abstract class EntityUtils {
- public static boolean groupRoot(IGroup g) {
- if (g == null)
- throw new IllegalStateException();
-
- return g instanceof GroupRoot;
- }
-
- private static boolean isParent(IGroup groupToBeTested, IGroup parentGroup) {
+ private static boolean isParent(EntityImp groupToBeTested, EntityImp parentGroup) {
if (groupToBeTested.isGroup() == false)
// Very strange!
return false;
@@ -55,40 +47,72 @@ public abstract class EntityUtils {
if (groupToBeTested.isGroup() == false)
throw new IllegalArgumentException();
- while (EntityUtils.groupRoot(groupToBeTested) == false) {
+ while (groupToBeTested.getQuark().isRoot() == false) {
if (groupToBeTested == parentGroup)
return true;
groupToBeTested = groupToBeTested.getParentContainer();
if (groupToBeTested.isGroup() == false)
- throw new IllegalStateException();
+ return false;
+ // throw new IllegalStateException();
}
return false;
}
- public static boolean isPureInnerLink12(IGroup group, Link link) {
+ public static boolean isPureInnerLink12(EntityImp group, Link link) {
if (group.isGroup() == false)
throw new IllegalArgumentException();
- final IEntity e1 = link.getEntity1();
- final IEntity e2 = link.getEntity2();
- final IGroup group1 = e1.getParentContainer();
- final IGroup group2 = e2.getParentContainer();
+ final EntityImp e1 = link.getEntity1();
+ final EntityImp e2 = link.getEntity2();
+ final EntityImp group1 = e1.getParentContainer();
+ final EntityImp group2 = e2.getParentContainer();
+
if (isParent(group1, group) && isParent(group2, group))
return true;
return false;
}
- public static boolean isPureInnerLink3(IGroup group, Link link) {
+// public static boolean isPureInnerLink12(EntityImp group, Link link) {
+// if (group.isGroup() == false)
+// throw new IllegalArgumentException();
+//
+// final EntityImp e1 = (EntityImp) link.getZEntity1();
+// final EntityImp e2 = (EntityImp) link.getZEntity2();
+// final Quark group1 = e1.getQuark().getParent();
+// final Quark group2 = e2.getQuark().getParent();
+// if (group.getQuark().containsLarge(group1) && group.getQuark().containsLarge(group2))
+// return true;
+//// if (isParent(group1, group) && isParent(group2, group))
+//// return true;
+//
+// return false;
+// }
+//
+// public static boolean isPureInnerLink12(EntityImp group, Link link) {
+// if (group.isGroup() == false)
+// throw new IllegalArgumentException();
+//
+// final EntityImp e1 = link.getEntity1();
+// final EntityImp e2 = link.getEntity2();
+// final EntityImp group1 = e1.getParentContainer();
+// final EntityImp group2 = e2.getParentContainer();
+// if (isParent(group1, group) && isParent(group2, group))
+// return true;
+//
+// return false;
+// }
+
+ public static boolean isPureInnerLink3(EntityImp group, Link link) {
if (group.isGroup() == false)
throw new IllegalArgumentException();
- final IEntity e1 = link.getEntity1();
- final IEntity e2 = link.getEntity2();
- final IGroup group1 = e1.getParentContainer();
- final IGroup group2 = e2.getParentContainer();
+ final EntityImp e1 = link.getEntity1();
+ final EntityImp e2 = link.getEntity2();
+ final EntityImp group1 = e1.getParentContainer();
+ final EntityImp group2 = e2.getParentContainer();
if (isParent(group2, group) == isParent(group1, group))
return true;
diff --git a/src/net/sourceforge/plantuml/baraye/IEntity.java b/src/net/sourceforge/plantuml/baraye/IEntity.java
deleted file mode 100644
index 2751ce300..000000000
--- a/src/net/sourceforge/plantuml/baraye/IEntity.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/* ========================================================================
- * PlantUML : a free UML diagram generator
- * ========================================================================
- *
- * (C) Copyright 2009-2023, Arnaud Roques
- *
- * Project Info: http://plantuml.com
- *
- * If you like this project or if you find it useful, you can support us at:
- *
- * http://plantuml.com/patreon (only 1$ per month!)
- * http://plantuml.com/paypal
- *
- * This file is part of PlantUML.
- *
- * PlantUML is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * PlantUML distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
- * License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- * USA.
- *
- *
- * Original Author: Arnaud Roques
- * Contribution: Miguel Esteves
- *
- */
-package net.sourceforge.plantuml.baraye;
-
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import net.sourceforge.plantuml.Hideable;
-import net.sourceforge.plantuml.LineConfigurable;
-import net.sourceforge.plantuml.Removeable;
-import net.sourceforge.plantuml.SpecificBackcolorable;
-import net.sourceforge.plantuml.Url;
-import net.sourceforge.plantuml.command.Position;
-import net.sourceforge.plantuml.cucadiagram.Bodier;
-import net.sourceforge.plantuml.cucadiagram.Code;
-import net.sourceforge.plantuml.cucadiagram.CucaNote;
-import net.sourceforge.plantuml.cucadiagram.Display;
-import net.sourceforge.plantuml.cucadiagram.EntityPosition;
-import net.sourceforge.plantuml.cucadiagram.Ident;
-import net.sourceforge.plantuml.cucadiagram.LeafType;
-import net.sourceforge.plantuml.cucadiagram.Stereostyles;
-import net.sourceforge.plantuml.cucadiagram.Stereotag;
-import net.sourceforge.plantuml.cucadiagram.Stereotype;
-import net.sourceforge.plantuml.graphic.USymbol;
-import net.sourceforge.plantuml.graphic.color.Colors;
-import net.sourceforge.plantuml.utils.LineLocation;
-
-public interface IEntity extends SpecificBackcolorable, Hideable, Removeable, LineConfigurable {
-
- public Code getCode();
-
- public String getCodeGetName();
-
- public Ident getIdent();
-
- public USymbol getUSymbol();
-
- public void setUSymbol(USymbol symbol);
-
- public LeafType getLeafType();
-
- public Display getDisplay();
-
- public IGroup getParentContainer();
-
- public void setDisplay(Display display);
-
- public String getUid();
-
- public Url getUrl99();
-
- public Stereotype getStereotype();
-
- public void setStereotype(Stereotype stereotype);
-
- public Bodier getBodier();
-
- public void addUrl(Url url);
-
- public boolean isGroup();
-
- public boolean hasUrl();
-
- public int getRawLayout();
-
- public void putTip(String member, Display display);
-
- public Map getTips();
-
- public void addStereotag(Stereotag tag);
-
- public Set stereotags();
-
- public boolean isAloneAndUnlinked();
-
- public String getCodeLine();
-
- public void setCodeLine(LineLocation codeLine);
-
- public void setStereostyle(String stereo);
-
- public Stereostyles getStereostyles();
-
- public void addNote(Display note, Position position, Colors colors);
-
- public EntityPosition getEntityPosition();
-
- public List getNotes(Position position);
-
-}
diff --git a/src/net/sourceforge/plantuml/baraye/IGroup.java b/src/net/sourceforge/plantuml/baraye/IGroup.java
deleted file mode 100644
index 55b350597..000000000
--- a/src/net/sourceforge/plantuml/baraye/IGroup.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/* ========================================================================
- * PlantUML : a free UML diagram generator
- * ========================================================================
- *
- * (C) Copyright 2009-2023, Arnaud Roques
- *
- * Project Info: http://plantuml.com
- *
- * If you like this project or if you find it useful, you can support us at:
- *
- * http://plantuml.com/patreon (only 1$ per month!)
- * http://plantuml.com/paypal
- *
- * This file is part of PlantUML.
- *
- * PlantUML is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * PlantUML distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
- * License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- * USA.
- *
- *
- * Original Author: Arnaud Roques
- *
- *
- */
-package net.sourceforge.plantuml.baraye;
-
-import java.util.Collection;
-
-import net.sourceforge.plantuml.ISkinParam;
-import net.sourceforge.plantuml.cucadiagram.Code;
-import net.sourceforge.plantuml.cucadiagram.DisplayPositioned;
-import net.sourceforge.plantuml.cucadiagram.GroupType;
-import net.sourceforge.plantuml.cucadiagram.LeafType;
-import net.sourceforge.plantuml.graphic.FontConfiguration;
-import net.sourceforge.plantuml.svek.IEntityImage;
-import net.sourceforge.plantuml.svek.PackageStyle;
-import net.sourceforge.plantuml.svek.SingleStrategy;
-
-public interface IGroup extends IEntity {
-
- public boolean containsLeafRecurse(ILeaf entity);
-
- public Collection getLeafsDirect();
-
- public Collection getChildren();
-
- public void moveEntitiesTo(IGroup dest);
-
- public int size();
-
- public GroupType getGroupType();
-
- public Code getNamespace();
-
- public PackageStyle getPackageStyle();
-
- public void overrideImage(IEntityImage img, LeafType state);
-
- public SingleStrategy getSingleStrategy();
-
- public FontConfiguration getFontConfigurationForTitle(ISkinParam skinParam);
-
- public char getConcurrentSeparator();
-
- public void setConcurrentSeparator(char separator);
-
- public void setLegend(DisplayPositioned legend);
-
- public DisplayPositioned getLegend();
-
-}
diff --git a/src/net/sourceforge/plantuml/baraye/ILeaf.java b/src/net/sourceforge/plantuml/baraye/ILeaf.java
deleted file mode 100644
index 20cd97db8..000000000
--- a/src/net/sourceforge/plantuml/baraye/ILeaf.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/* ========================================================================
- * PlantUML : a free UML diagram generator
- * ========================================================================
- *
- * (C) Copyright 2009-2023, Arnaud Roques
- *
- * Project Info: http://plantuml.com
- *
- * If you like this project or if you find it useful, you can support us at:
- *
- * http://plantuml.com/patreon (only 1$ per month!)
- * http://plantuml.com/paypal
- *
- * This file is part of PlantUML.
- *
- * PlantUML is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * PlantUML distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
- * License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- * USA.
- *
- *
- * Original Author: Arnaud Roques
- *
- *
- */
-package net.sourceforge.plantuml.baraye;
-
-import java.util.Collection;
-
-import net.sourceforge.plantuml.cucadiagram.LeafType;
-import net.sourceforge.plantuml.cucadiagram.Together;
-import net.sourceforge.plantuml.cucadiagram.dot.Neighborhood;
-import net.sourceforge.plantuml.graphic.USymbol;
-import net.sourceforge.plantuml.skin.VisibilityModifier;
-import net.sourceforge.plantuml.svek.IEntityImage;
-import net.sourceforge.plantuml.svek.Margins;
-
-public interface ILeaf extends IEntity {
-
- public void setContainer(IGroup container);
-
- public Margins getMargins();
-
- public int getXposition();
-
- public void setXposition(int pos);
-
- public IEntityImage getSvekImage();
-
- public String getGeneric();
-
- public boolean muteToType(LeafType newType, USymbol newSymbol);
-
- public void setGeneric(String generic);
-
- public void setSvekImage(IEntityImage svekImage);
-
- public void setNeighborhood(Neighborhood neighborhood);
-
- public Neighborhood getNeighborhood();
-
- public Collection getPortShortNames();
-
- public void addPortShortName(String portShortName);
-
- public void setVisibilityModifier(VisibilityModifier visibility);
-
- public VisibilityModifier getVisibilityModifier();
-
- public void setStatic(boolean isStatic);
-
- public boolean isStatic();
-
- public Together getTogether();
-
- public void setTogether(Together together);
-
-}
diff --git a/src/net/sourceforge/plantuml/baraye/Plasma.java b/src/net/sourceforge/plantuml/baraye/Plasma.java
index ad84da55a..30345714c 100644
--- a/src/net/sourceforge/plantuml/baraye/Plasma.java
+++ b/src/net/sourceforge/plantuml/baraye/Plasma.java
@@ -38,20 +38,18 @@ package net.sourceforge.plantuml.baraye;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
-import java.util.LinkedHashMap;
import java.util.List;
-import java.util.Map;
public class Plasma {
private String separator;
private final Quark root;
- private final Map, Quark> quarks = new LinkedHashMap<>();
+ private final List quarks = new ArrayList<>();
public Plasma(String separator) {
- final List empty = Collections.emptyList();
- this.root = ensurePresent(empty);
+ this.root = new Quark(this, null, "");
this.separator = separator;
+ this.quarks.add(root);
}
public Quark root() {
@@ -68,6 +66,10 @@ public class Plasma {
this.separator = separator;
}
+ public final boolean hasSeparator() {
+ return this.separator != null && this.separator != "\u0000";
+ }
+
public Quark parse(Quark root, String full) {
final List result = root.getSignature();
@@ -87,53 +89,63 @@ public class Plasma {
}
Quark ensurePresent(List result) {
- Quark quark = quarks.get(result);
+ Quark quark = getIfExists(result);
if (quark == null) {
- if (result.size() == 0)
- quark = new Quark(this, null, result);
- else {
+ if (result.size() == 0) {
+ // quark = new Quark(this, null, result);
+ throw new UnsupportedOperationException();
+ } else {
final Quark parent = ensurePresent(result.subList(0, result.size() - 1));
- quark = new Quark(this, parent, result);
+ quark = new Quark(this, parent, result.get(result.size() - 1));
}
- System.err.println("PUTTING " + quark);
- quarks.put(result, quark);
+ // System.err.println("PUTTING " + quark);
+ quarks.add(quark);
}
return quark;
}
public Collection quarks() {
- return Collections.unmodifiableCollection(new ArrayList<>(quarks.values()));
+ return Collections.unmodifiableCollection(quarks);
}
-// public boolean exists(String name) {
-// for (Quark quark : quarks.values())
-// if (quark.getName().equals(name))
-// return true;
-// return false;
-// }
-
public Quark getIfExistsFromName(String name) {
- for (Quark quark : quarks.values())
+ Quark result = null;
+ for (Quark quark : quarks)
+ if (quark.getName().equals(name)) {
+// if (result != null)
+// throw new IllegalArgumentException("Duplicate name: " + name);
+ result = quark;
+ return result;
+ }
+ return result;
+ }
+
+ public int countByName(String name) {
+ int count = 0;
+ for (Quark quark : quarks)
if (quark.getName().equals(name))
- return quark;
- return null;
+ count++;
+ return count;
}
public Quark getIfExistsFromFullPath(String full) {
- for (Quark quark : quarks.values())
+ for (Quark quark : quarks)
if (quark.toString(separator).equals(full))
return quark;
return null;
}
public Quark getIfExists(List signature) {
- return quarks.get(signature);
+ for (Quark quark : quarks)
+ if (quark.getSignature().equals(signature))
+ return quark;
+ return null;
}
public int countChildren(Quark parent) {
int count = 0;
- for (Quark quark : new ArrayList<>(quarks.values()))
+ for (Quark quark : quarks)
if (quark.getParent() == parent)
count++;
return count;
@@ -141,21 +153,19 @@ public class Plasma {
public List getChildren(Quark parent) {
final List result = new ArrayList<>();
- for (Quark quark : new ArrayList<>(quarks.values()))
+ for (Quark quark : quarks)
if (quark.getParent() == parent)
result.add(quark);
return Collections.unmodifiableList(result);
}
- public void moveAllTo(Quark src, Quark dest) {
- for (Quark quark : new ArrayList<>(quarks.values())) {
- if (quark == dest)
+ public void moveAllChildOfToAnewFather(Quark oldFather, Quark newFather) {
+ for (Quark quark : quarks) {
+ if (quark == newFather)
continue;
- if (src.containsLarge(quark)) {
- quarks.remove(quark.getSignature());
- quark.internalMove(src, dest);
- quarks.put(quark.getSignature(), quark);
- }
+
+ if (quark.getParent() == oldFather)
+ quark.setParent(newFather);
}
}
diff --git a/src/net/sourceforge/plantuml/baraye/Quark.java b/src/net/sourceforge/plantuml/baraye/Quark.java
index a10b398b7..204dd258d 100644
--- a/src/net/sourceforge/plantuml/baraye/Quark.java
+++ b/src/net/sourceforge/plantuml/baraye/Quark.java
@@ -38,50 +38,46 @@ package net.sourceforge.plantuml.baraye;
import java.util.ArrayList;
import java.util.List;
-import net.sourceforge.plantuml.cucadiagram.Code;
-import net.sourceforge.plantuml.cucadiagram.Ident;
-
-public class Quark extends Ident implements Code {
+public class Quark {
private final Plasma plasma;
private /* final */ Quark parent;
- // private final List parts;
+ private final String name;
private Object data;
- Quark(Plasma plasma, Quark parent, List parts) {
- super(new ArrayList(parts));
+ Quark(Plasma plasma, Quark parent, String name) {
+ this.name = name;
this.plasma = plasma;
this.parent = parent;
- if (parent == null) {
- if (parts.size() != 0)
- throw new IllegalStateException();
- } else {
- if (parent.parts.equals(parts.subList(0, parts.size() - 1)) == false)
- throw new IllegalStateException();
-
- }
- // this.parts = new ArrayList(parts);
}
public Quark getParent() {
return parent;
-// if (parts.size() == 0)
-// return null;
-// return plasma.ensurePresent(parts.subList(0, parts.size() - 1));
}
@Override
public String toString() {
// return parts.toString() + "(parent=" + parent + ")";
- return parts.toString();
+ return getSignature().toString();
}
public List getSignature() {
- return new ArrayList<>(parts);
+ final List result = new ArrayList<>();
+ if (parent != null)
+ result.addAll(parent.getSignature());
+ result.add(name);
+ return result;
+ }
+
+ public List parts() {
+ return getSignature();
}
public boolean containsLarge(Quark other) {
- return other.parts.size() > this.parts.size() && other.parts.subList(0, this.parts.size()).equals(this.parts);
+ final List signature = this.parts();
+ final List otherSignature = other.parts();
+ return otherSignature.size() > signature.size()
+ && otherSignature.subList(0, signature.size()).equals(signature);
}
// @Override
@@ -97,23 +93,12 @@ public class Quark extends Ident implements Code {
// return parts.hashCode();
// }
- public boolean startsWith(Quark other) {
- if (other.parts.size() > this.parts.size())
- return false;
-
- for (int i = 0; i < other.parts.size(); i++)
- if (other.parts.get(i).equals(this.parts.get(i)) == false)
- return false;
-
- return true;
- }
-
public String toString(String sep) {
if (sep == null)
sep = ".";
final StringBuilder sb = new StringBuilder();
- for (String s : parts) {
+ for (String s : parts()) {
if (sb.length() > 0)
sb.append(sep);
@@ -123,24 +108,21 @@ public class Quark extends Ident implements Code {
}
public String getName() {
- if (parts.size() == 0)
- return "";
+ return name;
+ }
- return parts.get(parts.size() - 1);
+ public String getQualifiedName() {
+ if (plasma.hasSeparator())
+ return toString(plasma.getSeparator());
+ return name;
}
public boolean isRoot() {
- return parts.size() == 0;
+ return parent == null;
+ // throw new UnsupportedOperationException();
+ // return parts.size() == 0;
}
- public int getDepth() {
- return parts.size();
- }
-
-// public int size() {
-// return parts.size();
-// }
-
public final Plasma getPlasma() {
return plasma;
}
@@ -153,26 +135,14 @@ public class Quark extends Ident implements Code {
this.data = data;
}
- @Override
- public Ident eventuallyRemoveStartingAndEndingDoubleQuote(String format) {
- return this;
- // throw new UnsupportedOperationException();
- }
-
public Quark childIfExists(String name) {
final List sig = new ArrayList<>(getSignature());
sig.add(name);
return plasma.getIfExists(sig);
}
- public Quark parse(Quark path) {
- final List sig = new ArrayList<>(getSignature());
- sig.addAll(path.getSignature());
- return plasma.ensurePresent(sig);
- }
-
- public Quark child(String name) {
- return plasma.parse(this, name);
+ public Quark child(String full) {
+ return plasma.parse(this, full);
}
public int countChildren() {
@@ -183,20 +153,28 @@ public class Quark extends Ident implements Code {
return plasma.getChildren(this);
}
- public void moveTo(Quark dest) {
- plasma.moveAllTo(this, dest);
+ public String forXmi() {
+ final StringBuilder sb = new StringBuilder();
+ for (String s : parts()) {
+ if (sb.length() > 0)
+ sb.append(".");
+
+ sb.append(s);
+ }
+ return sb.toString();
}
- public void internalMove(Quark src, Quark dest) {
- System.err.print("Intermal move from " + this + " to ");
- if (src.getDepth() + 1 != dest.getDepth())
- throw new UnsupportedOperationException("to be finished");
- final List previous = this.getSignature();
- parts.clear();
- parts.addAll(dest.getSignature());
- parts.addAll(previous.subList(src.getDepth(), previous.size()));
- this.parent = plasma.ensurePresent(parts.subList(0, parts.size() - 1));
- System.err.println(toString());
+ public String getPortMember() {
+ final String last = getName();
+ final int x = last.lastIndexOf("::");
+ if (x == -1) {
+ return null;
+ }
+ return last.substring(x + 2);
+ }
+
+ void setParent(Quark newFather) {
+ this.parent = newFather;
}
}
diff --git a/src/net/sourceforge/plantuml/braille/BrailleChar.java b/src/net/sourceforge/plantuml/braille/BrailleChar.java
index acc320957..2485c873a 100644
--- a/src/net/sourceforge/plantuml/braille/BrailleChar.java
+++ b/src/net/sourceforge/plantuml/braille/BrailleChar.java
@@ -36,6 +36,7 @@
package net.sourceforge.plantuml.braille;
public class BrailleChar {
+ // ::remove folder when WASM
private final int id;
diff --git a/src/net/sourceforge/plantuml/brotli/BitReader.java b/src/net/sourceforge/plantuml/brotli/BitReader.java
index 35d4ba1f6..19780129a 100644
--- a/src/net/sourceforge/plantuml/brotli/BitReader.java
+++ b/src/net/sourceforge/plantuml/brotli/BitReader.java
@@ -12,6 +12,7 @@ package net.sourceforge.plantuml.brotli;
* Bit reading helpers.
*/
final class BitReader {
+ // ::remove folder when WASM
// Added by Arnaud... not very beautifull
private static final boolean CHECK_UNUSED_BYTES_AFTER_END = false;
diff --git a/src/net/sourceforge/plantuml/classdiagram/ClassDiagram.java b/src/net/sourceforge/plantuml/classdiagram/ClassDiagram.java
index 59a992d9d..66c17e01d 100644
--- a/src/net/sourceforge/plantuml/classdiagram/ClassDiagram.java
+++ b/src/net/sourceforge/plantuml/classdiagram/ClassDiagram.java
@@ -38,24 +38,14 @@ package net.sourceforge.plantuml.classdiagram;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Map;
-import java.util.Objects;
import net.sourceforge.plantuml.FileFormatOption;
import net.sourceforge.plantuml.UmlDiagramType;
-import net.sourceforge.plantuml.baraye.EntityUtils;
-import net.sourceforge.plantuml.baraye.IGroup;
-import net.sourceforge.plantuml.baraye.ILeaf;
+import net.sourceforge.plantuml.baraye.EntityImp;
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;
-import net.sourceforge.plantuml.cucadiagram.GroupType;
-import net.sourceforge.plantuml.cucadiagram.Ident;
-import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.Link;
import net.sourceforge.plantuml.graphic.TextBlock;
-import net.sourceforge.plantuml.graphic.USymbol;
import net.sourceforge.plantuml.objectdiagram.AbstractClassOrObjectDiagram;
import net.sourceforge.plantuml.svek.image.EntityImageClass;
@@ -65,91 +55,49 @@ public class ClassDiagram extends AbstractClassOrObjectDiagram {
super(source, UmlDiagramType.CLASS, skinParam);
}
- private Code getShortName1972(Code code) {
- final String separator = Objects.requireNonNull(getNamespaceSeparator());
- final String codeString = code.getName();
- final String namespace = getNamespace1972(code, getNamespaceSeparator());
- if (namespace == null)
- return buildCode(codeString);
+// @Override
+// protected ILeaf getOrCreateLeaf2(Quark ident, Quark code, LeafType type, USymbol symbol) {
+// Objects.requireNonNull(ident);
+// if (type == null) {
+// code = code.eventuallyRemoveStartingAndEndingDoubleQuote("\"([:");
+// if (code.getData() != null)
+// return (ILeaf) code.getData();
+// if (getNamespaceSeparator() == null)
+// return reallyCreateLeaf(ident, Display.getWithNewlines(code.getName()), LeafType.CLASS, symbol);
+// // return getOrCreateLeafDefault(ident, code.getName(), LeafType.CLASS, symbol);
+//
+// if (ident.getData() != null)
+// return (ILeaf) ident.getData();
+// final ILeaf result = reallyCreateLeaf(ident, Display.getWithNewlines(ident.getName()), LeafType.CLASS, symbol);
+// this.lastEntity = (EntityImp) result;
+// return result;
+// }
+// if (code.getData() != null)
+// return (ILeaf) code.getData();
+// if (getNamespaceSeparator() == null)
+// return reallyCreateLeaf(ident, Display.getWithNewlines(code.getName()), type, symbol);
+// // return getOrCreateLeafDefault(ident, code.getName(), type, symbol);
+//
+// final ILeaf result = reallyCreateLeaf(ident, Display.getWithNewlines(ident.getName()), type, symbol);
+// this.lastEntity = (EntityImp) result;
+// return result;
+// }
- return buildCode(codeString.substring(namespace.length() + separator.length()));
- }
-
- @Override
- public ILeaf getOrCreateLeaf(Ident ident, Code code, LeafType type, USymbol symbol) {
- Objects.requireNonNull(ident);
- if (type == null) {
- code = code.eventuallyRemoveStartingAndEndingDoubleQuote("\"([:");
- if (getNamespaceSeparator() == null)
- return getOrCreateLeafDefault(ident, code, LeafType.CLASS, symbol);
-
- code = getFullyQualifiedCode1972(code);
- if (super.leafExist(code))
- return getOrCreateLeafDefault(ident, code, LeafType.CLASS, symbol);
-
- return createEntityWithNamespace1972(ident, code, Display.getWithNewlines(ident.getLast()), LeafType.CLASS,
- symbol);
- }
- if (getNamespaceSeparator() == null)
- return getOrCreateLeafDefault(ident, code, type, symbol);
-
- code = getFullyQualifiedCode1972(code);
- if (super.leafExist(code))
- return getOrCreateLeafDefault(ident, code, type, symbol);
-
- return createEntityWithNamespace1972(ident, code, Display.getWithNewlines(ident.getLast()), type, symbol);
- }
-
- @Override
- public ILeaf createLeaf(Ident idNewLong, Code code, Display display, LeafType type, USymbol symbol) {
- Objects.requireNonNull(idNewLong);
- if (type != LeafType.ABSTRACT_CLASS && type != LeafType.ANNOTATION && type != LeafType.CLASS
- && type != LeafType.INTERFACE && type != LeafType.ENUM && type != LeafType.LOLLIPOP_FULL
- && type != LeafType.LOLLIPOP_HALF && type != LeafType.NOTE)
- return super.createLeaf(idNewLong, code, display, type, symbol);
-
- if (getNamespaceSeparator() == null)
- return super.createLeaf(idNewLong, code, display, type, symbol);
-
- code = getFullyQualifiedCode1972(code);
- if (super.leafExist(code))
- throw new IllegalArgumentException("Already known: " + code);
-
- return createEntityWithNamespace1972(idNewLong, code, display, type, symbol);
- }
-
- private ILeaf createEntityWithNamespace1972(Ident id, Code fullyCode, Display display, LeafType type,
- USymbol symbol) {
- Objects.requireNonNull(id);
- final IGroup backupCurrentGroup = getCurrentGroup();
- final IGroup group = backupCurrentGroup;
- final String namespaceString = getNamespace1972(fullyCode, getNamespaceSeparator());
- if (namespaceString != null
- && (EntityUtils.groupRoot(group) || group.getCodeGetName().equals(namespaceString) == false)) {
- final Code namespace = buildCode(namespaceString);
- final Display tmp = Display.getWithNewlines(namespaceString);
- final Ident newIdLong = buildLeafIdentSpecial(namespaceString);
- // final Ident newIdLong = buildLeafIdentSpecial2(namespaceString);
- gotoGroupExternal(newIdLong, namespace, tmp, namespace, GroupType.PACKAGE, getRootGroup());
- }
- final Display tmpDisplay;
- if (Display.isNull(display))
- tmpDisplay = Display.getWithNewlines(getShortName1972(fullyCode)).withCreoleMode(CreoleMode.SIMPLE_LINE);
- else
- tmpDisplay = display;
-
- final ILeaf result = createLeafInternal(id, fullyCode, tmpDisplay, type, symbol);
- gotoThisGroup(backupCurrentGroup);
- return result;
- }
-
- @Override
- public final boolean leafExist(Code code) {
- if (getNamespaceSeparator() == null)
- return super.leafExist(code);
-
- return super.leafExist(getFullyQualifiedCode1972(code));
- }
+// @Override
+// public ILeaf createLeaf(Quark idNewLong, String displayString, Display display, LeafType type, USymbol symbol) {
+// Objects.requireNonNull(idNewLong);
+// if (type != LeafType.ABSTRACT_CLASS && type != LeafType.ANNOTATION && type != LeafType.CLASS
+// && type != LeafType.INTERFACE && type != LeafType.ENUM && type != LeafType.LOLLIPOP_FULL
+// && type != LeafType.LOLLIPOP_HALF && type != LeafType.NOTE)
+// return super.createLeaf(idNewLong, displayString, display, type, symbol);
+//
+// if (getNamespaceSeparator() == null)
+// return super.createLeaf(idNewLong, displayString, display, type, symbol);
+//
+// final ILeaf result = createLeafInternal(idNewLong, display, type, symbol);
+// this.lastEntity = (EntityImp) result;
+// return result;
+// }
private boolean allowMixing;
@@ -191,14 +139,14 @@ public class ClassDiagram extends AbstractClassOrObjectDiagram {
private RowLayout getRawLayout(int raw) {
final RowLayout rawLayout = new RowLayout();
- for (ILeaf leaf : entityFactory.leafs())
+ for (EntityImp leaf : entityFactory.leafs())
if (leaf.getRawLayout() == raw)
rawLayout.addLeaf(getEntityImageClass(leaf));
return rawLayout;
}
- private TextBlock getEntityImageClass(ILeaf entity) {
+ private TextBlock getEntityImageClass(EntityImp entity) {
return new EntityImageClass(entity, getSkinParam(), this);
}
diff --git a/src/net/sourceforge/plantuml/classdiagram/command/CommandAddMethod.java b/src/net/sourceforge/plantuml/classdiagram/command/CommandAddMethod.java
index a869f884e..bba96c61d 100644
--- a/src/net/sourceforge/plantuml/classdiagram/command/CommandAddMethod.java
+++ b/src/net/sourceforge/plantuml/classdiagram/command/CommandAddMethod.java
@@ -35,7 +35,8 @@
*/
package net.sourceforge.plantuml.classdiagram.command;
-import net.sourceforge.plantuml.baraye.IEntity;
+import net.sourceforge.plantuml.baraye.EntityImp;
+import net.sourceforge.plantuml.baraye.Quark;
import net.sourceforge.plantuml.classdiagram.ClassDiagram;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
@@ -43,8 +44,8 @@ import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
-import net.sourceforge.plantuml.cucadiagram.Code;
-import net.sourceforge.plantuml.cucadiagram.Ident;
+import net.sourceforge.plantuml.cucadiagram.Display;
+import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.skin.VisibilityModifier;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
import net.sourceforge.plantuml.utils.LineLocation;
@@ -69,9 +70,13 @@ public class CommandAddMethod extends SingleLineCommand2 {
protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg)
throws NoSuchColorException {
final String idShort = arg.get("NAME", 0);
- final Ident ident = diagram.buildLeafIdent(idShort);
- final Code code = diagram.buildCode(idShort);
- final IEntity entity = diagram.getOrCreateLeaf(ident, code, null, null);
+ final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(idShort), false);
+ EntityImp entity = (EntityImp) quark.getData();
+ if (entity == null)
+ entity = diagram.reallyCreateLeaf(quark, Display.getWithNewlines(quark), LeafType.CLASS, null);
+// final Quark ident = diagram.buildFromName(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(idShort));
+// final Quark code = diagram.buildFromFullPath(idShort);
+// final IEntity entity = diagram.getOrCreateLeaf(ident, code, null, null);
final String field = arg.get("DATA", 0);
if (field.length() > 0 && VisibilityModifier.isVisibilityCharacter(field))
diff --git a/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClass.java b/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClass.java
index 9f02478b6..cf2ec2a28 100644
--- a/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClass.java
+++ b/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClass.java
@@ -40,9 +40,7 @@ import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.UrlBuilder;
import net.sourceforge.plantuml.UrlMode;
-import net.sourceforge.plantuml.baraye.CucaDiagram;
import net.sourceforge.plantuml.baraye.EntityImp;
-import net.sourceforge.plantuml.baraye.ILeaf;
import net.sourceforge.plantuml.baraye.Quark;
import net.sourceforge.plantuml.classdiagram.ClassDiagram;
import net.sourceforge.plantuml.command.CommandExecutionResult;
@@ -53,9 +51,8 @@ import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexOptional;
import net.sourceforge.plantuml.command.regex.RegexOr;
import net.sourceforge.plantuml.command.regex.RegexResult;
-import net.sourceforge.plantuml.cucadiagram.Code;
+import net.sourceforge.plantuml.creole.CreoleMode;
import net.sourceforge.plantuml.cucadiagram.Display;
-import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.Stereotag;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
@@ -135,48 +132,65 @@ public class CommandCreateClass extends SingleLineCommand2 {
throws NoSuchColorException {
final String typeString = StringUtils.goUpperCase(arg.get("TYPE", 0));
final LeafType type = LeafType.getLeafType(typeString);
- final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.getLazzy("CODE", 0),
- "\"([:");
- final String display = arg.getLazzy("DISPLAY", 0);
+ final String idShort = diagram.cleanIdForQuark(arg.getLazzy("CODE", 0));
+ final String displayString = arg.getLazzy("DISPLAY", 0);
final String genericOption = arg.getLazzy("DISPLAY", 1);
final String generic = genericOption != null ? genericOption : arg.get("GENERIC", 0);
final String stereo = arg.get("STEREO", 0);
- /* final */ ILeaf entity;
- if (CucaDiagram.QUARK) {
- final Quark current = diagram.currentQuark();
- final Quark idNewLong = (Quark) diagram.buildLeafIdent(idShort);
- if (idNewLong.getData() == null)
- entity = diagram.createLeaf(idNewLong, idNewLong, Display.getWithNewlines(display), type, null);
- else
- entity = (ILeaf) idNewLong.getData();
- if (entity == null || entity.isGroup()) {
- for (Quark tmp : diagram.getPlasma().quarks())
- if (tmp.getData() instanceof EntityImp) {
- final EntityImp tmp2 = (EntityImp) tmp.getData();
- if (tmp2 != null && tmp.getName().equals(idShort) && tmp2.isGroup() == false) {
- entity = (ILeaf) tmp.getData();
- break;
- }
- }
- }
- if (entity == null) {
- final Display withNewlines = Display.getWithNewlines(display);
- entity = diagram.createLeaf(idNewLong, idNewLong, withNewlines, type, null);
- }
+ final Quark quark = diagram.quarkInContext(idShort, true);
+
+ Display display = Display.getWithNewlines(displayString);
+ if (Display.isNull(display))
+ display = Display.getWithNewlines(quark.getName()).withCreoleMode(CreoleMode.SIMPLE_LINE);
+
+ EntityImp entity = (EntityImp) quark.getData();
+
+ if (entity == null) {
+ entity = diagram.reallyCreateLeaf(quark, display, type, null);
} else {
- final Ident idNewLong = diagram.buildLeafIdent(idShort);
- final Code code = diagram.buildCode(idShort);
- if (diagram.leafExist(code)) {
- entity = diagram.getOrCreateLeaf(idNewLong, code, type, null);
- if (entity.muteToType(type, null) == false)
- return CommandExecutionResult.error("Bad name");
+ if (entity.muteToType(type, null) == false)
+ return CommandExecutionResult.error("Bad name");
+ entity.setDisplay(display);
- } else {
- entity = diagram.createLeaf(idNewLong, code, Display.getWithNewlines(display), type, null);
- }
}
+// final Quark quark = diagram.getPlasma().getIfExistsFromName(idShort);
+// if (quark != null && quark.getData() != null)
+// entity = diagram.getFromName(idShort);
+// else
+
+ // } else
+// entity = (ILeaf) quark.getData();
+// if (entity == null || entity.isGroup()) {
+// for (Quark tmp : diagram.getPlasma().quarks())
+// if (tmp.getData() instanceof EntityImp) {
+// final EntityImp tmp2 = (EntityImp) tmp.getData();
+// if (tmp2 != null && tmp.getName().equals(idShort) && tmp2.isGroup() == false) {
+// entity = (ILeaf) tmp.getData();
+// break;
+// }
+// }
+// }
+// if (entity == null) {
+// entity = diagram.reallyCreateLeaf(quark, display, type, null);
+// } else {
+// if (entity.muteToType(type, null) == false)
+// return CommandExecutionResult.error("Bad name");
+// }
+// } else {
+// final Quark idNewLong = diagram.buildLeafIdent(idShort);
+// final Quark code = diagram.buildCode(idShort);
+// if (diagram.leafExist(code)) {
+// entity = diagram.getOrCreateLeaf(idNewLong, code, type, null);
+// if (entity.muteToType(type, null) == false)
+// return CommandExecutionResult.error("Bad name");
+//
+// } else {
+// entity = diagram.createLeaf(idNewLong, code, Display.getWithNewlines(display), type, null);
+// }
+// }
+ diagram.setLastEntity(entity);
if (stereo != null) {
entity.setStereotype(Stereotype.build(stereo, diagram.getSkinParam().getCircledCharacterRadius(),
diagram.getSkinParam().getFont(null, false, FontParam.CIRCLED_CHARACTER),
diff --git a/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClassMultilines.java b/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClassMultilines.java
index 62424f75d..859872ed9 100644
--- a/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClassMultilines.java
+++ b/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClassMultilines.java
@@ -40,10 +40,7 @@ import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.UrlBuilder;
import net.sourceforge.plantuml.UrlMode;
-import net.sourceforge.plantuml.baraye.CucaDiagram;
import net.sourceforge.plantuml.baraye.EntityImp;
-import net.sourceforge.plantuml.baraye.IEntity;
-import net.sourceforge.plantuml.baraye.ILeaf;
import net.sourceforge.plantuml.baraye.Quark;
import net.sourceforge.plantuml.classdiagram.ClassDiagram;
import net.sourceforge.plantuml.command.CommandExecutionResult;
@@ -56,9 +53,8 @@ import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexOptional;
import net.sourceforge.plantuml.command.regex.RegexOr;
import net.sourceforge.plantuml.command.regex.RegexResult;
-import net.sourceforge.plantuml.cucadiagram.Code;
+import net.sourceforge.plantuml.creole.CreoleMode;
import net.sourceforge.plantuml.cucadiagram.Display;
-import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.Link;
import net.sourceforge.plantuml.cucadiagram.LinkArg;
@@ -156,9 +152,71 @@ public class CommandCreateClassMultilines extends CommandMultilines2 1) {
entity.setCodeLine(lines.getAt(0).getLocation());
@@ -192,7 +250,7 @@ public class CommandCreateClassMultilines extends CommandMultilines2
}
final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(codeRaw);
- final Ident ident = diagram.buildLeafIdent(idShort);
- final Code code = diagram.buildCode(idShort);
- String display = displayRaw;
- if (display == null)
- display = code.getName();
+ final Display display = Display.getWithNewlines(displayRaw == null ? idShort : displayRaw);
+ final Quark quark = diagram.quarkInContext(idShort, false);
+ EntityImp entity = (EntityImp) quark.getData();
+ if (entity == null)
+ entity = diagram.reallyCreateLeaf(quark, display, type, usymbol);
- display = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(display);
+// final Quark ident = diagram.buildFromName(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(idShort));
+// final Quark code = diagram.buildFromFullPath(idShort);
+// String display = displayRaw;
+// if (display == null)
+// display = code.getName();
+//
+// display = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(display);
final String stereotype = arg.getLazzy("STEREOTYPE", 0);
- final IEntity entity = diagram.getOrCreateLeaf(ident, code, type, usymbol);
- entity.setDisplay(Display.getWithNewlines(display));
+// final IEntity entity = diagram.getOrCreateLeaf(ident, code, type, usymbol);
+ entity.setDisplay(display);
entity.setUSymbol(usymbol);
if (stereotype != null)
entity.setStereotype(Stereotype.build(stereotype, diagram.getSkinParam().getCircledCharacterRadius(),
diff --git a/src/net/sourceforge/plantuml/classdiagram/command/CommandDiamondAssociation.java b/src/net/sourceforge/plantuml/classdiagram/command/CommandDiamondAssociation.java
index 38048e193..a0e59a721 100644
--- a/src/net/sourceforge/plantuml/classdiagram/command/CommandDiamondAssociation.java
+++ b/src/net/sourceforge/plantuml/classdiagram/command/CommandDiamondAssociation.java
@@ -35,6 +35,7 @@
*/
package net.sourceforge.plantuml.classdiagram.command;
+import net.sourceforge.plantuml.baraye.Quark;
import net.sourceforge.plantuml.classdiagram.ClassDiagram;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
@@ -42,9 +43,7 @@ import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
-import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.Display;
-import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.utils.LineLocation;
@@ -65,13 +64,14 @@ public class CommandDiamondAssociation extends SingleLineCommand2
@Override
protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg) {
final String idShort = arg.get("CODE", 0);
- final Ident ident = diagram.buildLeafIdent(idShort);
- final Code code = diagram.buildCode(idShort);
- final boolean leafExist = diagram.leafExist(code);
- if (leafExist)
- return CommandExecutionResult.error("Already existing : " + code.getName());
+ final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(idShort), false);
+// final Quark ident = diagram.buildFromName(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(idShort));
+// final Quark code = diagram.buildFromFullPath(idShort);
+// final boolean leafExist = diagram.leafExist(code);
+ if (quark.getData() != null)
+ return CommandExecutionResult.error("Already existing : " + quark.getName());
- diagram.createLeaf(ident, code, Display.NULL, LeafType.ASSOCIATION, null);
+ diagram.reallyCreateLeaf(quark, Display.getWithNewlines(""), LeafType.ASSOCIATION, null);
return CommandExecutionResult.ok();
}
diff --git a/src/net/sourceforge/plantuml/classdiagram/command/CommandHideShowByGender.java b/src/net/sourceforge/plantuml/classdiagram/command/CommandHideShowByGender.java
index 1cbbd988b..276e16062 100644
--- a/src/net/sourceforge/plantuml/classdiagram/command/CommandHideShowByGender.java
+++ b/src/net/sourceforge/plantuml/classdiagram/command/CommandHideShowByGender.java
@@ -37,8 +37,9 @@ package net.sourceforge.plantuml.classdiagram.command;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.UmlDiagram;
+import net.sourceforge.plantuml.baraye.EntityImp;
import net.sourceforge.plantuml.baraye.EntityUtils;
-import net.sourceforge.plantuml.baraye.IEntity;
+import net.sourceforge.plantuml.baraye.Quark;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
@@ -46,11 +47,9 @@ import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexOptional;
import net.sourceforge.plantuml.command.regex.RegexResult;
-import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.EntityGender;
import net.sourceforge.plantuml.cucadiagram.EntityGenderUtils;
import net.sourceforge.plantuml.cucadiagram.EntityPortion;
-import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.descdiagram.DescriptionDiagram;
import net.sourceforge.plantuml.objectdiagram.AbstractClassOrObjectDiagram;
@@ -146,8 +145,12 @@ public class CommandHideShowByGender extends SingleLineCommand2 {
} else if (arg1.startsWith("<<")) {
gender = EntityGenderUtils.byStereotype(arg1);
} else {
- final IEntity entity = diagram.getOrCreateLeaf(diagram.buildLeafIdent(arg1), diagram.buildCode(arg1), null,
- null);
+ final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(arg1), false);
+ if (quark.getData() == null)
+ return CommandExecutionResult.error("No such element " + quark.getName());
+ // final IEntity entity = diagram.getOrCreateLeaf(quark,
+ // diagram.buildFromFullPath(arg1), null, null);
+ final EntityImp entity = (EntityImp) quark.getData();
gender = EntityGenderUtils.byEntityAlone(entity);
}
@@ -189,9 +192,15 @@ public class CommandHideShowByGender extends SingleLineCommand2 {
gender = EntityGenderUtils.byStereotype(arg1);
} else {
arg1 = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg1);
- final Ident ident = diagram.buildLeafIdent(arg1);
- final Code code = diagram.buildCode(arg1);
- final IEntity entity = diagram.getOrCreateLeaf(ident, code, null, null);
+ final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(arg1), false);
+ EntityImp entity = (EntityImp) quark.getData();
+ if (entity == null)
+ return CommandExecutionResult.error("No such element " + quark.getName());
+ // entity = diagram.reallyCreateLeaf(quark,
+ // Display.getWithNewlines(quark.getParent()), LeafType.CLASS, null);
+// final Quark ident = diagram.buildFromName(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg1));
+// final Quark code = diagram.buildFromFullPath(arg1);
+// final IEntity entity = diagram.getOrCreateLeaf(ident, code, null, null);
gender = EntityGenderUtils.byEntityAlone(entity);
}
if (gender != null) {
@@ -200,7 +209,7 @@ public class CommandHideShowByGender extends SingleLineCommand2 {
if (empty == true && emptyMembers == false) {
gender = EntityGenderUtils.and(gender, emptyByGender(portion));
}
- if (EntityUtils.groupRoot(diagram.getCurrentGroup()) == false) {
+ if (diagram.getCurrentGroup().getQuark().isRoot() == false) {
gender = EntityGenderUtils.and(gender, EntityGenderUtils.byPackage(diagram.getCurrentGroup()));
}
diff --git a/src/net/sourceforge/plantuml/classdiagram/command/CommandLinkClass.java b/src/net/sourceforge/plantuml/classdiagram/command/CommandLinkClass.java
index ae67c8689..7858d26f3 100644
--- a/src/net/sourceforge/plantuml/classdiagram/command/CommandLinkClass.java
+++ b/src/net/sourceforge/plantuml/classdiagram/command/CommandLinkClass.java
@@ -41,7 +41,8 @@ import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.UrlBuilder;
import net.sourceforge.plantuml.UrlMode;
-import net.sourceforge.plantuml.baraye.IEntity;
+import net.sourceforge.plantuml.baraye.EntityImp;
+import net.sourceforge.plantuml.baraye.Quark;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.RegexConcat;
@@ -49,9 +50,8 @@ import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexOptional;
import net.sourceforge.plantuml.command.regex.RegexOr;
import net.sourceforge.plantuml.command.regex.RegexResult;
-import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.Display;
-import net.sourceforge.plantuml.cucadiagram.Ident;
+import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.Link;
import net.sourceforge.plantuml.cucadiagram.LinkArg;
import net.sourceforge.plantuml.cucadiagram.LinkDecor;
@@ -157,8 +157,8 @@ final public class CommandLinkClass extends SingleLineCommand2 0);
- final Link link = new Link(diagram.getIEntityFactory(), diagram.getSkinParam().getCurrentStyleBuilder(), cl1,
+ final Link link = new Link(diagram.getEntityFactory(), diagram.getSkinParam().getCurrentStyleBuilder(), cl1,
cl2, linkType, linkArg.withQuantifier(firstLabel, secondLabel)
.withDistanceAngle(diagram.getLabeldistance(), diagram.getLabelangle()));
link.setColors(color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet()));
@@ -321,22 +299,63 @@ final public class CommandLinkClass extends SingleLineCommand2 {
-
- 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]*\\)";
-
- public CommandLinkClass2(UmlDiagramType umlDiagramType) {
- super(getRegexConcat(umlDiagramType));
- }
-
- static private RegexConcat getRegexConcat(UmlDiagramType umlDiagramType) {
- return RegexConcat.build(CommandLinkClass2.class.getName() + umlDiagramType, RegexLeaf.start(), //
- new RegexOptional( //
- new RegexConcat( //
- new RegexLeaf("HEADER", "@([\\d.]+)"), //
- RegexLeaf.spaceOneOrMore() //
- )), new RegexOr( //
- new RegexLeaf("ENT1", getClassIdentifier()), //
- new RegexLeaf("COUPLE1", COUPLE)), //
-
- RegexLeaf.spaceZeroOrMore(), //
-
- new RegexOptional(new RegexConcat( //
- RegexLeaf.spaceOneOrMore(), //
- new RegexLeaf("[\\[]"), //
- new RegexLeaf("QUALIFIER1", "([^\\[\\]]+)"), //
- new RegexLeaf("[\\]]"), //
- RegexLeaf.spaceOneOrMore() //
- )), //
- new RegexOptional(new RegexLeaf("FIRST_LABEL", "[%g]([^%g]+)[%g]")), //
-
- RegexLeaf.spaceZeroOrMore(), //
-
- new RegexConcat(
- //
- new RegexLeaf("ARROW_HEAD1",
- "((?<=[%s])+[ox]|[)#\\[<*+^}]|\\<_|\\<\\|[\\:\\|]|[<\\[]\\||\\}o|\\}\\||\\|o|\\|\\|)?"), //
- new RegexLeaf("ARROW_BODY1", "([-=.]+)"), //
- new RegexLeaf("ARROW_STYLE1", "(?:\\[(" + CommandLinkElement.LINE_STYLE + ")\\])?"), //
- new RegexLeaf("ARROW_DIRECTION", "(left|right|up|down|le?|ri?|up?|do?)?"), //
- new RegexOptional(new RegexLeaf("INSIDE", "(0|\\(0\\)|\\(0|0\\))(?=[-=.~])")), //
- new RegexLeaf("ARROW_STYLE2", "(?:\\[(" + CommandLinkElement.LINE_STYLE + ")\\])?"), //
- new RegexLeaf("ARROW_BODY2", "([-=.]*)"), //
- new RegexLeaf("ARROW_HEAD2",
- "([ox][%s]+|:\\>\\>?|_\\>|[(#\\]>*+^\\{]|[\\|\\:]\\|\\>|\\|[>\\]]|o\\{|\\|\\{|o\\||\\|\\|)?")), //
-
- RegexLeaf.spaceZeroOrMore(), //
-
- new RegexOptional(new RegexLeaf("SECOND_LABEL", "[%g]([^%g]+)[%g]")), //
- new RegexOptional(new RegexConcat( //
- RegexLeaf.spaceOneOrMore(), //
- new RegexLeaf("[\\[]"), //
- new RegexLeaf("QUALIFIER2", "([^\\[\\]]+)"), //
- new RegexLeaf("[\\]]"), //
- RegexLeaf.spaceOneOrMore() //
- )), //
-
- RegexLeaf.spaceZeroOrMore(), //
-
- new RegexOr( //
- new RegexLeaf("ENT2", getClassIdentifier()), //
- new RegexLeaf("COUPLE2", COUPLE)), //
- RegexLeaf.spaceZeroOrMore(), //
- color().getRegex(), //
- RegexLeaf.spaceZeroOrMore(), //
- UrlBuilder.OPTIONAL, //
- RegexLeaf.spaceZeroOrMore(), //
- new RegexOptional( //
- new RegexConcat( //
- new RegexLeaf(":"), //
- RegexLeaf.spaceZeroOrMore(), //
- new RegexLeaf("LABEL_LINK", "(.+)") //
- )), RegexLeaf.end());
- }
-
- private static ColorParser color() {
- return ColorParser.simpleColor(ColorType.LINE);
- }
-
- private static String getClassIdentifier() {
- return "(" + getSeparator() + "?[%pLN_$]+(?:" + getSeparator() + "[%pLN_$]+)*|[%g][^%g]+[%g])";
- }
-
- public static String getSeparator() {
- return "(?:\\.|::|\\\\|\\\\\\\\)";
- }
-
- @Override
- protected CommandExecutionResult executeArg(AbstractClassOrObjectDiagram diagram, LineLocation location,
- RegexResult arg) throws NoSuchColorException {
-
- final String ent1String = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("ENT1", 0), "\"");
- final String ent2String = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("ENT2", 0), "\"");
- if (ent1String == null && ent2String == null)
- return executeArgSpecial3(diagram, arg);
-
- if (ent1String == null)
- return executeArgSpecial1(diagram, arg);
-
- if (ent2String == null)
- return executeArgSpecial2(diagram, arg);
-
- Ident ident1 = diagram.buildLeafIdentSpecial(ent1String);
- Ident ident2 = diagram.buildLeafIdentSpecial(ent2String);
- Ident ident1pure = Ident.empty().add(ent1String, diagram.getNamespaceSeparator());
- Ident ident2pure = Ident.empty().add(ent2String, diagram.getNamespaceSeparator());
- Code code1 = diagram.buildCode(ent1String);
- Code code2 = diagram.buildCode(ent2String);
- if (isGroupButNotTheCurrentGroup(diagram, code1, ident1)
- && isGroupButNotTheCurrentGroup(diagram, code2, ident2)) {
- return executePackageLink(diagram, arg);
- }
-
- String port1 = null;
- String port2 = null;
-
- if (removeMemberPartLegacy1972(diagram, ident1) != null) {
- port1 = ident1.getPortMember();
- code1 = removeMemberPartLegacy1972(diagram, ident1);
- ident1 = ident1.removeMemberPart();
- }
- if (removeMemberPartLegacy1972(diagram, ident2) != null) {
- port2 = ident2.getPortMember();
- code2 = removeMemberPartLegacy1972(diagram, ident2);
- ident2 = ident2.removeMemberPart();
- }
-
- final IEntity cl1 = getFoo1(diagram, code1, ident1, ident1pure);
- final IEntity cl2 = getFoo1(diagram, code2, ident2, ident2pure);
-
- final LinkType linkType = getLinkType(arg);
- final Direction dir = getDirection(arg);
- final int queue;
- if (dir == Direction.LEFT || dir == Direction.RIGHT)
- queue = 1;
- else
- queue = getQueueLength(arg);
-
- final Labels labels = new Labels(arg);
-
- final String kal1 = arg.get("QUALIFIER1", 0);
- final String kal2 = arg.get("QUALIFIER2", 0);
-
- final LinkArg linkArg = LinkArg
- .build(labels.getDisplay(), queue, diagram.getSkinParam().classAttributeIconSize() > 0)
- .withQuantifier(labels.getFirstLabel(), labels.getSecondLabel())
- .withDistanceAngle(diagram.getLabeldistance(), diagram.getLabelangle()).withKal(kal1, kal2);
-
- Link link = new Link(diagram.getIEntityFactory(), diagram.getSkinParam().getCurrentStyleBuilder(), cl1, cl2,
- linkType, linkArg);
- if (arg.get("URL", 0) != null) {
- final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), UrlMode.STRICT);
- final Url url = urlBuilder.getUrl(arg.get("URL", 0));
- link.setUrl(url);
- }
- link.setPortMembers(port1, port2);
-
- if (dir == Direction.LEFT || dir == Direction.UP)
- link = link.getInv();
-
- link.setLinkArrow(labels.getLinkArrow());
- link.setColors(color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet()));
- link.applyStyle(arg.getLazzy("ARROW_STYLE", 0));
- link.setCodeLine(location);
-
- addLink(diagram, link, arg.get("HEADER", 0));
-
- return CommandExecutionResult.ok();
- }
-
- private IEntity getFoo1(AbstractClassOrObjectDiagram diagram, Code code, Ident ident, Ident pure) {
- if (isGroupButNotTheCurrentGroup(diagram, code, ident))
- return diagram.getGroupVerySmart(ident);
-
- return diagram.getOrCreateLeaf(ident, code, null, null);
- }
-
- private boolean isGroupButNotTheCurrentGroup(AbstractClassOrObjectDiagram diagram, Code code, Ident ident) {
- if (diagram.getCurrentGroup().getCodeGetName().equals(code.getName()))
- return false;
-
- if (diagram.isGroupStrict(ident))
- return true;
-
- return diagram.isGroup(code);
- }
-
- private Code removeMemberPartLegacy1972(AbstractClassOrObjectDiagram diagram, Ident ident) {
- if (diagram.leafExist(ident))
- return null;
-
- final Ident before = ident.removeMemberPart();
- if (before == null)
- return null;
-
- final Code code = before.toCode(diagram);
- if (diagram.leafExist(code) == false)
- return null;
-
- return code;
- }
-
- private void addLink(AbstractClassOrObjectDiagram diagram, Link link, String weight) {
- diagram.addLink(link);
- if (weight == null) {
- // final LinkType type = link.getType();
- // --|> highest
- // --*, -->, --o normal
- // ..*, ..>, ..o lowest
- // if (type.isDashed() == false) {
- // if (type.contains(LinkDecor.EXTENDS)) {
- // link.setWeight(3);
- // }
- // if (type.contains(LinkDecor.ARROW) ||
- // type.contains(LinkDecor.COMPOSITION)
- // || type.contains(LinkDecor.AGREGATION)) {
- // link.setWeight(2);
- // }
- // }
- } else {
- link.setWeight(Double.parseDouble(weight));
- }
- }
-
- private CommandExecutionResult executePackageLink(AbstractClassOrObjectDiagram diagram, RegexResult arg)
- throws NoSuchColorException {
- final String ent1String = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("ENT1", 0), "\"");
- final String ent2String = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("ENT2", 0), "\"");
-
- Ident ident1 = diagram.buildLeafIdentSpecial(ent1String);
- Ident ident2 = diagram.buildLeafIdentSpecial(ent2String);
- final Ident ident1pure = Ident.empty().add(ent1String, diagram.getNamespaceSeparator());
- final Ident ident2pure = Ident.empty().add(ent2String, diagram.getNamespaceSeparator());
- Code code1 = diagram.buildCode(ent1String);
- Code code2 = diagram.buildCode(ent2String);
-
- if (removeMemberPartLegacy1972(diagram, ident1) != null) {
- code1 = removeMemberPartLegacy1972(diagram, ident1);
- ident1 = ident1.removeMemberPart();
- }
- if (removeMemberPartLegacy1972(diagram, ident2) != null) {
- code2 = removeMemberPartLegacy1972(diagram, ident2);
- ident2 = ident2.removeMemberPart();
- }
-
- final IEntity cl1 = getFoo1(diagram, code1, ident1, ident1pure);
- final IEntity cl2 = getFoo1(diagram, code2, ident2, ident2pure);
-
- final LinkType linkType = getLinkType(arg);
- final Direction dir = getDirection(arg);
- final int queue;
- if (dir == Direction.LEFT || dir == Direction.RIGHT)
- queue = 1;
- else
- queue = getQueueLength(arg);
-
- final Display labelLink = Display.getWithNewlines(arg.get("LABEL_LINK", 0));
- final String firstLabel = arg.get("FIRST_LABEL", 0);
- final String secondLabel = arg.get("SECOND_LABEL", 0);
- final LinkArg linkArg = LinkArg.build(labelLink, queue, diagram.getSkinParam().classAttributeIconSize() > 0);
- final Link link = new Link(diagram.getIEntityFactory(), diagram.getSkinParam().getCurrentStyleBuilder(), cl1,
- cl2, linkType, linkArg.withQuantifier(firstLabel, secondLabel)
- .withDistanceAngle(diagram.getLabeldistance(), diagram.getLabelangle()));
- link.setColors(color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet()));
-
- diagram.resetPragmaLabel();
-
- link.applyStyle(arg.getLazzy("ARROW_STYLE", 0));
-
- addLink(diagram, link, arg.get("HEADER", 0));
- return CommandExecutionResult.ok();
- }
-
- private CommandExecutionResult executeArgSpecial1(AbstractClassOrObjectDiagram diagram, RegexResult arg) {
- final String name1A = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("COUPLE1", 0));
- final String name1B = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("COUPLE1", 1));
- final Code clName1A = diagram.buildCode(name1A);
- final Code clName1B = diagram.buildCode(name1B);
- if (diagram.leafExist(clName1A) == false)
- return CommandExecutionResult.error("No class " + clName1A);
-
- if (diagram.leafExist(clName1B) == false)
- return CommandExecutionResult.error("No class " + clName1B);
-
- final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("ENT2", 0), "\"");
- final Code ent2 = diagram.buildCode(idShort);
- final IEntity cl2 = diagram.getOrCreateLeaf(diagram.buildLeafIdent(idShort), ent2, null, null);
-
- final LinkType linkType = getLinkType(arg);
- final Display label = Display.getWithNewlines(arg.get("LABEL_LINK", 0));
-
- final boolean result = diagram.associationClass(1, name1A, name1B, cl2, linkType, label);
- if (result == false)
- return CommandExecutionResult.error("Cannot have more than 2 assocications");
-
- return CommandExecutionResult.ok();
- }
-
- private CommandExecutionResult executeArgSpecial3(AbstractClassOrObjectDiagram diagram, RegexResult arg) {
- final String name1A = arg.get("COUPLE1", 0);
- final String name1B = arg.get("COUPLE1", 1);
- final String name2A = arg.get("COUPLE2", 0);
- final String name2B = arg.get("COUPLE2", 1);
- final Code clName1A = diagram.buildCode(name1A);
- final Code clName1B = diagram.buildCode(name1B);
- final Code clName2A = diagram.buildCode(name2A);
- final Code clName2B = diagram.buildCode(name2B);
- if (diagram.leafExist(clName1A) == false)
- return CommandExecutionResult.error("No class " + clName1A);
-
- if (diagram.leafExist(clName1B) == false)
- return CommandExecutionResult.error("No class " + clName1B);
-
- if (diagram.leafExist(clName2A) == false)
- return CommandExecutionResult.error("No class " + clName2A);
-
- if (diagram.leafExist(clName2B) == false)
- return CommandExecutionResult.error("No class " + clName2B);
-
- final LinkType linkType = getLinkType(arg);
- final Display label = Display.getWithNewlines(arg.get("LABEL_LINK", 0));
-
- return diagram.associationClass(name1A, name1B, name2A, name2B, linkType, label);
- }
-
- private CommandExecutionResult executeArgSpecial2(AbstractClassOrObjectDiagram diagram, RegexResult arg) {
- final String name2A = arg.get("COUPLE2", 0);
- final String name2B = arg.get("COUPLE2", 1);
- final Code clName2A = diagram.buildCode(name2A);
- final Code clName2B = diagram.buildCode(name2B);
- if (diagram.leafExist(clName2A) == false)
- return CommandExecutionResult.error("No class " + clName2A);
-
- if (diagram.leafExist(clName2B) == false)
- return CommandExecutionResult.error("No class " + clName2B);
-
- final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("ENT1", 0), "\"");
- final Code ent1 = diagram.buildCode(idShort);
- final IEntity cl1 = diagram.getOrCreateLeaf(diagram.buildLeafIdent(idShort), ent1, null, null);
-
- final LinkType linkType = getLinkType(arg);
- final Display label = Display.getWithNewlines(arg.get("LABEL_LINK", 0));
-
- final boolean result = diagram.associationClass(2, name2A, name2B, cl1, linkType, label);
- if (result == false)
- return CommandExecutionResult.error("Cannot have more than 2 assocications");
-
- return CommandExecutionResult.ok();
- }
-
- private LinkDecor getDecors1(String s) {
- if (s == null) {
- return LinkDecor.NONE;
- }
- s = StringUtils.trin(s);
- if ("<|".equals(s))
- return LinkDecor.EXTENDS;
-
- if ("<|:".equals(s))
- return LinkDecor.DEFINEDBY;
-
- if ("<||".equals(s))
- return LinkDecor.REDEFINES;
-
- if ("}".equals(s))
- return LinkDecor.CROWFOOT;
-
- if ("}o".equals(s))
- return LinkDecor.CIRCLE_CROWFOOT;
-
- if ("}|".equals(s))
- return LinkDecor.LINE_CROWFOOT;
-
- if ("|o".equals(s))
- return LinkDecor.CIRCLE_LINE;
-
- if ("||".equals(s))
- return LinkDecor.DOUBLE_LINE;
-
- if ("<".equals(s))
- return LinkDecor.ARROW;
-
- if ("^".equals(s))
- return LinkDecor.EXTENDS;
-
- if ("+".equals(s))
- return LinkDecor.PLUS;
-
- if ("o".equals(s))
- return LinkDecor.AGREGATION;
-
- if ("x".equals(s))
- return LinkDecor.NOT_NAVIGABLE;
-
- if ("*".equals(s))
- return LinkDecor.COMPOSITION;
-
- if ("#".equals(s))
- return LinkDecor.SQUARE;
-
- if (")".equals(s))
- return LinkDecor.PARENTHESIS;
-
- return LinkDecor.NONE;
- }
-
- private LinkDecor getDecors2(String s) {
- if (s == null)
- return LinkDecor.NONE;
-
- s = StringUtils.trin(s);
- if ("|>".equals(s))
- return LinkDecor.EXTENDS;
-
- if (":|>".equals(s))
- return LinkDecor.DEFINEDBY;
-
- if ("||>".equals(s))
- return LinkDecor.REDEFINES;
-
- if (">".equals(s))
- return LinkDecor.ARROW;
-
- if ("{".equals(s))
- return LinkDecor.CROWFOOT;
-
- if ("o{".equals(s))
- return LinkDecor.CIRCLE_CROWFOOT;
-
- if ("|{".equals(s))
- return LinkDecor.LINE_CROWFOOT;
-
- if ("o|".equals(s))
- return LinkDecor.CIRCLE_LINE;
-
- if ("||".equals(s))
- return LinkDecor.DOUBLE_LINE;
-
- if ("^".equals(s))
- return LinkDecor.EXTENDS;
-
- if ("+".equals(s))
- return LinkDecor.PLUS;
-
- if ("o".equals(s))
- return LinkDecor.AGREGATION;
-
- if ("x".equals(s))
- return LinkDecor.NOT_NAVIGABLE;
-
- if ("*".equals(s))
- return LinkDecor.COMPOSITION;
-
- if ("#".equals(s))
- return LinkDecor.SQUARE;
-
- if ("(".equals(s))
- return LinkDecor.PARENTHESIS;
-
- return LinkDecor.NONE;
- }
-
- private LinkType getLinkType(RegexResult arg) {
- final LinkDecor decors1 = getDecors1(getArrowHead1(arg));
- final LinkDecor decors2 = getDecors2(getArrowHead2(arg));
-
- LinkType result = new LinkType(decors2, decors1);
- if (arg.get("ARROW_BODY1", 0).contains(".") || arg.get("ARROW_BODY2", 0).contains("."))
- result = result.goDashed();
-
- final String middle = arg.get("INSIDE", 0);
- if ("0".equals(middle))
- result = result.withMiddleCircle();
- else if ("0)".equals(middle))
- result = result.withMiddleCircleCircled1();
- else if ("(0".equals(middle))
- result = result.withMiddleCircleCircled2();
- else if ("(0)".equals(middle))
- result = result.withMiddleCircleCircled();
-
- return result;
- }
-
- private int getQueueLength(RegexResult arg) {
- String s = getFullArrow(arg);
- s = s.replaceAll("[^-.=]", "");
- return s.length();
- }
-
- private Direction getDirection(RegexResult arg) {
-// final LinkDecor decors1 = getDecors1(getArrowHead1(arg));
-// final LinkDecor decors2 = getDecors2(getArrowHead2(arg));
-
- String s = getFullArrow(arg);
- s = s.replaceAll("[^-.=\\w]", "");
- if (s.startsWith("o"))
- s = s.substring(1);
-
- if (s.endsWith("o"))
- s = s.substring(0, s.length() - 1);
-
- Direction result = StringUtils.getQueueDirection(s);
-// if (isInversed(decors1, decors2) && s.matches(".*\\w.*")) {
- // result = result.getInv();
-// }
-
- return result;
- }
-
- private String getArrowHead1(RegexResult arg) {
- return getArrowHead(arg, "ARROW_HEAD1");
- }
-
- private String getArrowHead2(RegexResult arg) {
- return getArrowHead(arg, "ARROW_HEAD2");
- }
-
- private String getArrowHead(RegexResult arg, final String key) {
- return notNull(arg.get(key, 0));
- }
-
- private String getFullArrow(RegexResult arg) {
- return getArrowHead1(arg) + notNull(arg.get("ARROW_BODY1", 0)) + notNull(arg.get("ARROW_DIRECTION", 0))
- + notNull(arg.get("ARROW_BODY2", 0)) + getArrowHead2(arg);
- }
-
- public static String notNull(String s) {
- if (s == null)
- return "";
- return s;
- }
-
-}
diff --git a/src/net/sourceforge/plantuml/classdiagram/command/CommandLinkLollipop.java b/src/net/sourceforge/plantuml/classdiagram/command/CommandLinkLollipop.java
index fc175bec0..f94687114 100644
--- a/src/net/sourceforge/plantuml/classdiagram/command/CommandLinkLollipop.java
+++ b/src/net/sourceforge/plantuml/classdiagram/command/CommandLinkLollipop.java
@@ -37,7 +37,8 @@ package net.sourceforge.plantuml.classdiagram.command;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.UmlDiagramType;
-import net.sourceforge.plantuml.baraye.IEntity;
+import net.sourceforge.plantuml.baraye.EntityImp;
+import net.sourceforge.plantuml.baraye.Quark;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.Matcher2;
@@ -48,9 +49,7 @@ import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexOptional;
import net.sourceforge.plantuml.command.regex.RegexOr;
import net.sourceforge.plantuml.command.regex.RegexResult;
-import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.Display;
-import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.Link;
import net.sourceforge.plantuml.cucadiagram.LinkArg;
@@ -119,27 +118,40 @@ final public class CommandLinkLollipop extends SingleLineCommand2 0);
- final Link link = new Link(diagram.getIEntityFactory(), diagram.getSkinParam().getCurrentStyleBuilder(), cl1,
+ final Link link = new Link(diagram.getEntityFactory(), diagram.getSkinParam().getCurrentStyleBuilder(), cl1,
cl2, linkType, linkArg.withQuantifier(firstLabel, secondLabel)
.withDistanceAngle(diagram.getLabeldistance(), diagram.getLabelangle()));
diagram.resetPragmaLabel();
@@ -198,10 +210,6 @@ final public class CommandLinkLollipop extends SingleLineCommand2 {
protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg)
throws NoSuchColorException {
final String name = arg.get("NAME", 0);
- final Ident ident = diagram.buildLeafIdent(name);
- final Code code = diagram.buildCode(name);
final String stereotype = arg.get("STEREO", 0);
- final IEntity entity = diagram.getOrCreateLeaf(ident, code, null, null);
+
+// final Quark ident = diagram.buildFromName(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(name));
+// final Quark code = diagram.buildFromFullPath(name);
+// final IEntity entity = diagram.getOrCreateLeaf(ident, code, null, null);
+ final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(name), false);
+ final EntityImp entity = (EntityImp) quark.getData();
+ if (entity == null)
+ return CommandExecutionResult.error("No such class " + quark.getName());
+
entity.setStereotype(Stereotype.build(stereotype, diagram.getSkinParam().getCircledCharacterRadius(),
diagram.getSkinParam().getFont(null, false, FontParam.CIRCLED_CHARACTER),
diagram.getSkinParam().getIHtmlColorSet()));
diff --git a/src/net/sourceforge/plantuml/classdiagram/command/CommandUrl.java b/src/net/sourceforge/plantuml/classdiagram/command/CommandUrl.java
index 2965c2525..46b307b22 100644
--- a/src/net/sourceforge/plantuml/classdiagram/command/CommandUrl.java
+++ b/src/net/sourceforge/plantuml/classdiagram/command/CommandUrl.java
@@ -38,7 +38,8 @@ package net.sourceforge.plantuml.classdiagram.command;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.UrlBuilder;
import net.sourceforge.plantuml.UrlMode;
-import net.sourceforge.plantuml.baraye.IEntity;
+import net.sourceforge.plantuml.baraye.EntityImp;
+import net.sourceforge.plantuml.baraye.Quark;
import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
@@ -47,8 +48,6 @@ import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexOptional;
import net.sourceforge.plantuml.command.regex.RegexResult;
-import net.sourceforge.plantuml.cucadiagram.Code;
-import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.utils.LineLocation;
public class CommandUrl extends SingleLineCommand2 {
@@ -75,17 +74,22 @@ public class CommandUrl extends SingleLineCommand2 {
@Override
protected CommandExecutionResult executeArg(AbstractEntityDiagram diagram, LineLocation location, RegexResult arg) {
final String idShort = arg.get("CODE", 0);
- final Ident ident = diagram.buildLeafIdent(idShort);
- final Code code = diagram.buildCode(idShort);
+// final Quark ident = diagram.buildFromName(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(idShort));
+// final Quark code = diagram.buildFromFullPath(idShort);
+
+ final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(idShort), false);
+ final EntityImp entity = (EntityImp) quark.getData();
+ if (entity == null)
+ return CommandExecutionResult.error(quark.getName() + " does not exist");
+
final String urlString = arg.get("URL", 0);
- final IEntity entity;
- final boolean leafExist = diagram.leafExist(code);
- if (leafExist)
- entity = diagram.getOrCreateLeaf(ident, code, null, null);
- else if (diagram.isGroup(code))
- entity = diagram.getGroup(code);
- else
- return CommandExecutionResult.error(code + " does not exist");
+// final boolean leafExist = code.getData() != null;
+// if (leafExist)
+// entity = diagram.getOrCreateLeaf(ident, code, null, null);
+// else if (diagram.isGroup(idShort))
+// entity = diagram.getGroup(idShort);
+// else
+// return CommandExecutionResult.error(code + " does not exist");
// final IEntity entity = diagram.getOrCreateLeaf(code, null);
final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), UrlMode.STRICT);
diff --git a/src/net/sourceforge/plantuml/code/CompressionBrotli.java b/src/net/sourceforge/plantuml/code/CompressionBrotli.java
index d443e34b3..ebaebeb03 100644
--- a/src/net/sourceforge/plantuml/code/CompressionBrotli.java
+++ b/src/net/sourceforge/plantuml/code/CompressionBrotli.java
@@ -44,16 +44,15 @@ import net.sourceforge.plantuml.brotli.BrotliInputStream;
import net.sourceforge.plantuml.log.Logme;
public class CompressionBrotli implements Compression {
+ // ::remove file when WASM
public byte[] compress(byte[] in) {
throw new UnsupportedOperationException();
}
public ByteArray decompress(byte[] in) throws NoPlantumlCompressionException {
- try (
- final BrotliInputStream brotli = new BrotliInputStream(new ByteArrayInputStream(in));
- final ByteArrayOutputStream result = new ByteArrayOutputStream();
- ) {
+ try (final BrotliInputStream brotli = new BrotliInputStream(new ByteArrayInputStream(in));
+ final ByteArrayOutputStream result = new ByteArrayOutputStream();) {
FileUtils.copyToStream(brotli, result);
return ByteArray.from(result.toByteArray());
} catch (IOException e) {
diff --git a/src/net/sourceforge/plantuml/code/CompressionZlib.java b/src/net/sourceforge/plantuml/code/CompressionZlib.java
index 8973afee9..f1418f9cf 100644
--- a/src/net/sourceforge/plantuml/code/CompressionZlib.java
+++ b/src/net/sourceforge/plantuml/code/CompressionZlib.java
@@ -43,12 +43,16 @@ import net.sourceforge.plantuml.code.deflate.Decompressor;
public class CompressionZlib implements Compression {
+ // ::comment when WASM
private static boolean USE_ZOPFLI = false;
+ // ::done
private static final int COMPRESSION_LEVEL = 9;
public byte[] compress(byte[] in) {
+ // ::comment when WASM
if (USE_ZOPFLI)
return new CompressionZopfliZlib().compress(in);
+ // ::done
if (in.length == 0)
return null;
diff --git a/src/net/sourceforge/plantuml/code/CompressionZlibAttic.java b/src/net/sourceforge/plantuml/code/CompressionZlibAttic.java
index 3f97ec042..40483ae97 100644
--- a/src/net/sourceforge/plantuml/code/CompressionZlibAttic.java
+++ b/src/net/sourceforge/plantuml/code/CompressionZlibAttic.java
@@ -42,6 +42,7 @@ import java.util.zip.Inflater;
@Deprecated
public class CompressionZlibAttic implements Compression {
+ // ::remove file when WASM
private static boolean USE_ZOPFLI = false;
private static final int COMPRESSION_LEVEL = 9;
diff --git a/src/net/sourceforge/plantuml/code/CompressionZopfliZlib.java b/src/net/sourceforge/plantuml/code/CompressionZopfliZlib.java
index 7e6d5ea12..a968c49f9 100644
--- a/src/net/sourceforge/plantuml/code/CompressionZopfliZlib.java
+++ b/src/net/sourceforge/plantuml/code/CompressionZopfliZlib.java
@@ -41,6 +41,7 @@ import net.sourceforge.plantuml.zopfli.Options.OutputFormat;
import net.sourceforge.plantuml.zopfli.Zopfli;
public class CompressionZopfliZlib implements Compression {
+ // ::remove file when WASM
public byte[] compress(byte[] in) {
if (in.length == 0)
diff --git a/src/net/sourceforge/plantuml/command/CommandAffineTransform.java b/src/net/sourceforge/plantuml/command/CommandAffineTransform.java
index d95314522..3076543cd 100644
--- a/src/net/sourceforge/plantuml/command/CommandAffineTransform.java
+++ b/src/net/sourceforge/plantuml/command/CommandAffineTransform.java
@@ -62,7 +62,9 @@ public class CommandAffineTransform extends SingleLineCommand2 {
@Override
protected CommandExecutionResult executeArg(UmlDiagram diagram, LineLocation location, RegexResult arg) {
final CharSequence value = arg.get("ANIMATION", 0);
+ // ::comment when WASM
diagram.setAnimation(Collections.singletonList(value));
+ // ::done
return CommandExecutionResult.ok();
}
diff --git a/src/net/sourceforge/plantuml/command/CommandNamespace.java b/src/net/sourceforge/plantuml/command/CommandNamespace.java
index 32cb32b13..0182aed1b 100644
--- a/src/net/sourceforge/plantuml/command/CommandNamespace.java
+++ b/src/net/sourceforge/plantuml/command/CommandNamespace.java
@@ -38,20 +38,15 @@ package net.sourceforge.plantuml.command;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.UrlBuilder;
import net.sourceforge.plantuml.UrlMode;
-import net.sourceforge.plantuml.baraye.CucaDiagram;
-import net.sourceforge.plantuml.baraye.IEntity;
-import net.sourceforge.plantuml.baraye.IGroup;
+import net.sourceforge.plantuml.baraye.EntityImp;
import net.sourceforge.plantuml.baraye.Quark;
import net.sourceforge.plantuml.classdiagram.ClassDiagram;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
-import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.GroupType;
-import net.sourceforge.plantuml.cucadiagram.Ident;
-import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.graphic.USymbol;
import net.sourceforge.plantuml.graphic.USymbols;
@@ -87,27 +82,14 @@ public class CommandNamespace extends SingleLineCommand2 {
protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg)
throws NoSuchColorException {
final String idShort = arg.get("NAME", 0);
- final Code code;
- final IGroup currentPackage;
- final Display display;
- final Ident idNewLong;
- if (CucaDiagram.QUARK) {
- final Quark current = diagram.currentQuark();
- code = current;
- display = Display.getWithNewlines(idShort);
- idNewLong = current.child(idShort);
- currentPackage = (IGroup) current.getData();
- } else {
- idNewLong = diagram.buildLeafIdent(idShort);
- code = diagram.buildCode(idShort);
- currentPackage = diagram.getCurrentGroup();
- display = Display.getWithNewlines(code);
- }
- final CommandExecutionResult status = diagram.gotoGroup(idNewLong, code, display, GroupType.PACKAGE,
- currentPackage, NamespaceStrategy.MULTIPLE);
+// final Quark current = diagram.currentQuark();
+// final Quark idNewLong = current.child(idShort);
+ final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(idShort), true);
+ final CommandExecutionResult status = diagram.gotoGroup(quark,
+ Display.getWithNewlines(quark.getQualifiedName()), GroupType.PACKAGE);
if (status.isOk() == false)
return status;
- final IEntity p = diagram.getCurrentGroup();
+ final EntityImp p = diagram.getCurrentGroup();
final String stereotype = arg.get("STEREOTYPE", 0);
if (stereotype != null) {
final USymbol usymbol = USymbols.fromString(stereotype, diagram.getSkinParam().actorStyle(),
diff --git a/src/net/sourceforge/plantuml/command/CommandNamespace2.java b/src/net/sourceforge/plantuml/command/CommandNamespace2.java
index c07efccca..bbb98e1ad 100644
--- a/src/net/sourceforge/plantuml/command/CommandNamespace2.java
+++ b/src/net/sourceforge/plantuml/command/CommandNamespace2.java
@@ -38,18 +38,15 @@ package net.sourceforge.plantuml.command;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.UrlBuilder;
import net.sourceforge.plantuml.UrlMode;
-import net.sourceforge.plantuml.baraye.IEntity;
-import net.sourceforge.plantuml.baraye.IGroup;
+import net.sourceforge.plantuml.baraye.EntityImp;
+import net.sourceforge.plantuml.baraye.Quark;
import net.sourceforge.plantuml.classdiagram.ClassDiagram;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
-import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.GroupType;
-import net.sourceforge.plantuml.cucadiagram.Ident;
-import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.graphic.color.ColorParser;
import net.sourceforge.plantuml.graphic.color.ColorType;
@@ -89,16 +86,15 @@ public class CommandNamespace2 extends SingleLineCommand2 {
protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg)
throws NoSuchColorException {
final String idShort = arg.get("NAME", 0);
- final Ident ident = diagram.buildLeafIdent(idShort);
- final Code code = diagram.buildCode(idShort);
- final IGroup currentPackage = diagram.getCurrentGroup();
+ // final Quark ident = diagram.buildFromName(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(idShort));
+ final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(idShort), true);
+
final String disp = arg.getLazzy("DISPLAY", 0);
final Display display = Display.getWithNewlines(disp);
- final CommandExecutionResult status = diagram.gotoGroup(ident, code, display, GroupType.PACKAGE, currentPackage,
- NamespaceStrategy.MULTIPLE);
+ final CommandExecutionResult status = diagram.gotoGroup(quark, display, GroupType.PACKAGE);
if (status.isOk() == false)
return status;
- final IEntity p = diagram.getCurrentGroup();
+ final EntityImp p = diagram.getCurrentGroup();
final String stereotype = arg.get("STEREOTYPE", 0);
if (stereotype != null)
p.setStereotype(Stereotype.build(stereotype));
diff --git a/src/net/sourceforge/plantuml/command/CommandNamespaceEmpty.java b/src/net/sourceforge/plantuml/command/CommandNamespaceEmpty.java
index 56fa8546b..374d731a0 100644
--- a/src/net/sourceforge/plantuml/command/CommandNamespaceEmpty.java
+++ b/src/net/sourceforge/plantuml/command/CommandNamespaceEmpty.java
@@ -38,18 +38,15 @@ package net.sourceforge.plantuml.command;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.UrlBuilder;
import net.sourceforge.plantuml.UrlMode;
-import net.sourceforge.plantuml.baraye.IEntity;
-import net.sourceforge.plantuml.baraye.IGroup;
+import net.sourceforge.plantuml.baraye.EntityImp;
+import net.sourceforge.plantuml.baraye.Quark;
import net.sourceforge.plantuml.classdiagram.ClassDiagram;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
-import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.GroupType;
-import net.sourceforge.plantuml.cucadiagram.Ident;
-import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.graphic.color.ColorParser;
import net.sourceforge.plantuml.graphic.color.ColorType;
@@ -84,15 +81,20 @@ public class CommandNamespaceEmpty extends SingleLineCommand2 {
protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg)
throws NoSuchColorException {
final String idShort = arg.get("NAME", 0);
- final Ident idNewLong = diagram.buildLeafIdent(idShort);
- final Code code = diagram.buildCode(idShort);
- final IGroup currentPackage = diagram.getCurrentGroup();
- final Display display = Display.getWithNewlines(code);
- final CommandExecutionResult status = diagram.gotoGroup(idNewLong, code, display, GroupType.PACKAGE,
- currentPackage, NamespaceStrategy.MULTIPLE);
+
+ final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(idShort), true);
+ if (quark.getData() != null)
+ return CommandExecutionResult.error("Already exists " + quark.getName());
+
+// final Quark idNewLong = diagram
+// .buildFromName(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(idShort));
+// final Quark code = diagram.buildFromFullPath(idShort);
+
+ final Display display = Display.getWithNewlines(quark.getQualifiedName());
+ final CommandExecutionResult status = diagram.gotoGroup(quark, display, GroupType.PACKAGE);
if (status.isOk() == false)
return status;
- final IEntity p = diagram.getCurrentGroup();
+ final EntityImp p = diagram.getCurrentGroup();
final String stereotype = arg.get("STEREOTYPE", 0);
if (stereotype != null)
p.setStereotype(Stereotype.build(stereotype));
diff --git a/src/net/sourceforge/plantuml/command/CommandPackage.java b/src/net/sourceforge/plantuml/command/CommandPackage.java
index 62e1933e6..e7754f261 100644
--- a/src/net/sourceforge/plantuml/command/CommandPackage.java
+++ b/src/net/sourceforge/plantuml/command/CommandPackage.java
@@ -39,9 +39,7 @@ import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.UrlBuilder;
import net.sourceforge.plantuml.UrlMode;
-import net.sourceforge.plantuml.baraye.CucaDiagram;
-import net.sourceforge.plantuml.baraye.IEntity;
-import net.sourceforge.plantuml.baraye.IGroup;
+import net.sourceforge.plantuml.baraye.EntityImp;
import net.sourceforge.plantuml.baraye.Quark;
import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram;
import net.sourceforge.plantuml.classdiagram.command.CommandCreateClassMultilines;
@@ -50,11 +48,8 @@ import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexOptional;
import net.sourceforge.plantuml.command.regex.RegexResult;
-import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.GroupType;
-import net.sourceforge.plantuml.cucadiagram.Ident;
-import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
import net.sourceforge.plantuml.cucadiagram.Stereotag;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.graphic.USymbol;
@@ -108,42 +103,41 @@ public class CommandPackage extends SingleLineCommand2 {
@Override
protected CommandExecutionResult executeArg(AbstractEntityDiagram diagram, LineLocation location, RegexResult arg)
throws NoSuchColorException {
- final String idShort;
- /* final */String display;
+ String idShort;
+ String display;
final String name = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("NAME", 0));
- boolean override1972 = false;
+
if (arg.get("AS", 0) == null) {
if (name.length() == 0) {
idShort = "##" + diagram.getUniqueSequence();
display = null;
+ throw new IllegalStateException("AS");
} else {
idShort = name;
display = idShort;
- override1972 = true;
}
} else {
- display = name;
+ display = name;
idShort = arg.get("AS", 0);
}
- final Ident ident;
- final Code code;
-
- if (CucaDiagram.QUARK) {
- final Quark current = diagram.currentQuark();
- code = current;
- ident = current.child(idShort);
+// final Quark current = diagram.currentQuark();
+// final Quark ident = current.child(idShort);
+ final Quark quark;
+ if (arg.get("AS", 0) == null) {
+ quark = diagram.quarkInContext(diagram.cleanIdForQuark(name), true);
+ display = quark.getQualifiedName();
} else {
- ident = diagram.buildLeafIdent(idShort);
- code = diagram.buildCode(idShort);
+ quark = diagram.quarkInContext(diagram.cleanIdForQuark(arg.get("AS", 0)), true);
+ display = name;
}
- final IGroup currentPackage = diagram.getCurrentGroup();
- final CommandExecutionResult status = diagram.gotoGroup(ident, code, Display.getWithNewlines(display),
- GroupType.PACKAGE, currentPackage, NamespaceStrategy.SINGLE);
+
+ final CommandExecutionResult status = diagram.gotoGroup(quark, Display.getWithNewlines(display),
+ GroupType.PACKAGE);
if (status.isOk() == false)
return status;
- final IEntity p = diagram.getCurrentGroup();
+ final EntityImp p = diagram.getCurrentGroup();
final String stereotype = arg.get("STEREOTYPE", 0);
diff --git a/src/net/sourceforge/plantuml/command/CommandPackageEmpty.java b/src/net/sourceforge/plantuml/command/CommandPackageEmpty.java
index 90e9bcc24..0fa96b171 100644
--- a/src/net/sourceforge/plantuml/command/CommandPackageEmpty.java
+++ b/src/net/sourceforge/plantuml/command/CommandPackageEmpty.java
@@ -36,19 +36,16 @@
package net.sourceforge.plantuml.command;
import net.sourceforge.plantuml.StringUtils;
-import net.sourceforge.plantuml.baraye.IEntity;
-import net.sourceforge.plantuml.baraye.IGroup;
+import net.sourceforge.plantuml.baraye.EntityImp;
+import net.sourceforge.plantuml.baraye.Quark;
import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexOptional;
import net.sourceforge.plantuml.command.regex.RegexResult;
-import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.GroupType;
-import net.sourceforge.plantuml.cucadiagram.Ident;
-import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
import net.sourceforge.plantuml.utils.LineLocation;
@@ -97,14 +94,12 @@ public class CommandPackageEmpty extends SingleLineCommand2 {
}
} else {
system.getPragma().define(name, value);
- if (name.equalsIgnoreCase("graphviz_dot") && value.equalsIgnoreCase("jdot")) {
+ // ::comment when WASM
+ if (name.equalsIgnoreCase("graphviz_dot") && value.equalsIgnoreCase("jdot"))
return CommandExecutionResult.error(
"This directive has been renamed to '!pragma layout smetana'. Please update your diagram.");
- }
- if (name.equalsIgnoreCase("graphviz_dot")) {
+
+ if (name.equalsIgnoreCase("graphviz_dot"))
return CommandExecutionResult.error("This directive has been renamed to '!pragma layout " + value
+ "'. Please update your diagram.");
- }
- if (name.equalsIgnoreCase("layout") && value.equalsIgnoreCase("smetana")) {
+
+ if (name.equalsIgnoreCase("layout") && value.equalsIgnoreCase("smetana"))
system.setUseSmetana(true);
- }
- if (name.equalsIgnoreCase("layout") && value.equalsIgnoreCase("elk")) {
+
+ if (name.equalsIgnoreCase("layout") && value.equalsIgnoreCase("elk"))
system.setUseElk(true);
- }
- if (name.equalsIgnoreCase("layout") && value.equalsIgnoreCase(GraphvizUtils.VIZJS)) {
+
+ if (name.equalsIgnoreCase("layout") && value.equalsIgnoreCase(GraphvizUtils.VIZJS))
system.getSkinParam().setUseVizJs(true);
- }
+ // ::done
+
}
return CommandExecutionResult.ok();
}
diff --git a/src/net/sourceforge/plantuml/command/note/CommandFactoryNote.java b/src/net/sourceforge/plantuml/command/note/CommandFactoryNote.java
index ab7b2433a..31ad4460e 100644
--- a/src/net/sourceforge/plantuml/command/note/CommandFactoryNote.java
+++ b/src/net/sourceforge/plantuml/command/note/CommandFactoryNote.java
@@ -35,7 +35,8 @@
*/
package net.sourceforge.plantuml.command.note;
-import net.sourceforge.plantuml.baraye.IEntity;
+import net.sourceforge.plantuml.baraye.EntityImp;
+import net.sourceforge.plantuml.baraye.Quark;
import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram;
import net.sourceforge.plantuml.classdiagram.command.CommandCreateClassMultilines;
import net.sourceforge.plantuml.command.Command;
@@ -48,8 +49,6 @@ import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
-import net.sourceforge.plantuml.cucadiagram.Code;
-import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.Stereotag;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
@@ -136,13 +135,19 @@ public final class CommandFactoryNote implements SingleMultiFactoryCommand {
@@ -72,12 +73,15 @@ public class CommandCreateBlock extends SingleLineCommand2 {
protected CommandExecutionResult executeArg(CompositeDiagram diagram, LineLocation location, RegexResult arg) {
String display = arg.get("DISPLAY", 0);
final String idShort = arg.get("CODE", 0);
- final Code code = diagram.buildCode(idShort);
- if (display == null) {
- display = code.getName();
- }
- final IEntity ent = diagram.getOrCreateLeaf(diagram.buildLeafIdent(idShort), code, null, null);
- ent.setDisplay(Display.getWithNewlines(display));
+ final Quark quark = diagram.quarkInContext(idShort, false);
+ if (display == null)
+ display = quark.getName();
+
+ if (quark.getData() != null)
+ return CommandExecutionResult.error("Already exists " + quark.getName());
+
+ final EntityImp ent = diagram.reallyCreateLeaf(quark, Display.getWithNewlines(quark), LeafType.BLOCK, null);
+ // ent.setDisplay(Display.getWithNewlines(display));
return CommandExecutionResult.ok();
}
diff --git a/src/net/sourceforge/plantuml/compositediagram/command/CommandCreatePackageBlock.java b/src/net/sourceforge/plantuml/compositediagram/command/CommandCreatePackageBlock.java
index d07d7342f..cc416cf69 100644
--- a/src/net/sourceforge/plantuml/compositediagram/command/CommandCreatePackageBlock.java
+++ b/src/net/sourceforge/plantuml/compositediagram/command/CommandCreatePackageBlock.java
@@ -35,7 +35,7 @@
*/
package net.sourceforge.plantuml.compositediagram.command;
-import net.sourceforge.plantuml.baraye.IGroup;
+import net.sourceforge.plantuml.baraye.Quark;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
@@ -44,11 +44,8 @@ import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexOptional;
import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.compositediagram.CompositeDiagram;
-import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.GroupType;
-import net.sourceforge.plantuml.cucadiagram.Ident;
-import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
import net.sourceforge.plantuml.utils.LineLocation;
public class CommandCreatePackageBlock extends SingleLineCommand2 {
@@ -74,16 +71,14 @@ public class CommandCreatePackageBlock extends SingleLineCommand2 {
protected CommandExecutionResult executeArg(CompositeDiagram diagram, LineLocation location, RegexResult arg) {
final String ent1 = arg.get("ENT1", 0);
final String ent2 = arg.get("ENT2", 0);
- final IEntity cl1 = diagram.getOrCreateLeaf(diagram.buildLeafIdent(ent1), diagram.buildCode(ent1), null, null);
- final IEntity cl2 = diagram.getOrCreateLeaf(diagram.buildLeafIdent(ent2), diagram.buildCode(ent2), null, null);
+ final Quark quark1 = diagram.quarkInContext(diagram.cleanIdForQuark(ent1), false);
+ final Quark quark2 = diagram.quarkInContext(diagram.cleanIdForQuark(ent2), false);
+ final EntityImp cl1 = (EntityImp) quark1.getData();
+ if (cl1 == null)
+ return CommandExecutionResult.error("No such element " + quark1.getName());
+
+ final EntityImp cl2 = (EntityImp) quark2.getData();
+ if (cl2 == null)
+ return CommandExecutionResult.error("No such element " + quark2.getName());
+// final IEntity cl1 = diagram.getOrCreateLeaf(quark1, diagram.buildFromFullPath(ent1), null, null);
+// final IEntity cl2 = diagram.getOrCreateLeaf(quark2, diagram.buildFromFullPath(ent2), null, null);
final String deco1 = arg.get("DECO1", 0);
final String deco2 = arg.get("DECO2", 0);
@@ -95,7 +105,7 @@ public class CommandLinkBlock extends SingleLineCommand2 {
final LinkArg linkArg = LinkArg.build(Display.getWithNewlines(arg.get("DISPLAY", 0)), queue.length(),
diagram.getSkinParam().classAttributeIconSize() > 0);
- final Link link = new Link(diagram.getIEntityFactory(), diagram.getSkinParam().getCurrentStyleBuilder(), cl1,
+ final Link link = new Link(diagram.getEntityFactory(), diagram.getSkinParam().getCurrentStyleBuilder(), cl1,
cl2, linkType, linkArg);
diagram.addLink(link);
return CommandExecutionResult.ok();
diff --git a/src/net/sourceforge/plantuml/creole/atom/AtomImg.java b/src/net/sourceforge/plantuml/creole/atom/AtomImg.java
index 89d555317..6fdac3703 100644
--- a/src/net/sourceforge/plantuml/creole/atom/AtomImg.java
+++ b/src/net/sourceforge/plantuml/creole/atom/AtomImg.java
@@ -48,7 +48,6 @@ import net.sourceforge.plantuml.awt.geom.XDimension2D;
import net.sourceforge.plantuml.code.Base64Coder;
import net.sourceforge.plantuml.creole.legacy.AtomTextUtils;
import net.sourceforge.plantuml.flashcode.FlashCodeFactory;
-import net.sourceforge.plantuml.flashcode.FlashCodeUtils;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.ImgValign;
import net.sourceforge.plantuml.graphic.StringBounder;
@@ -82,9 +81,11 @@ public class AtomImg extends AbstractAtom implements Atom {
}
public static Atom createQrcode(String flash, double scale) {
- final FlashCodeUtils utils = FlashCodeFactory.getFlashCodeUtils();
- BufferedImage im = utils.exportFlashcode(flash, Color.BLACK, Color.WHITE);
+ BufferedImage im = null;
+ // :: comment when WASM
+ im = FlashCodeFactory.getFlashCodeUtils().exportFlashcode(flash, Color.BLACK, Color.WHITE);
if (im == null)
+ // ::done
im = new BufferedImage(10, 10, BufferedImage.TYPE_INT_RGB);
return new AtomImg(
diff --git a/src/net/sourceforge/plantuml/creole/atom/AtomMath.java b/src/net/sourceforge/plantuml/creole/atom/AtomMath.java
index 8c20cf726..5dbf5703f 100644
--- a/src/net/sourceforge/plantuml/creole/atom/AtomMath.java
+++ b/src/net/sourceforge/plantuml/creole/atom/AtomMath.java
@@ -49,6 +49,7 @@ import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColorSimple;
public class AtomMath extends AbstractAtom implements Atom {
+ // ::remove file when WASM
private final ScientificEquationSafe math;
private final HColor foreground;
diff --git a/src/net/sourceforge/plantuml/creole/command/CommandCreoleLatex.java b/src/net/sourceforge/plantuml/creole/command/CommandCreoleLatex.java
index c97beb801..fb92ad197 100644
--- a/src/net/sourceforge/plantuml/creole/command/CommandCreoleLatex.java
+++ b/src/net/sourceforge/plantuml/creole/command/CommandCreoleLatex.java
@@ -43,6 +43,7 @@ import net.sourceforge.plantuml.graphic.Splitter;
import net.sourceforge.plantuml.math.ScientificEquationSafe;
public class CommandCreoleLatex implements Command {
+ // ::remove file when WASM
@Override
public String startingChars() {
diff --git a/src/net/sourceforge/plantuml/creole/command/CommandCreoleMath.java b/src/net/sourceforge/plantuml/creole/command/CommandCreoleMath.java
index 9cd8916df..2585d30e9 100644
--- a/src/net/sourceforge/plantuml/creole/command/CommandCreoleMath.java
+++ b/src/net/sourceforge/plantuml/creole/command/CommandCreoleMath.java
@@ -43,6 +43,7 @@ import net.sourceforge.plantuml.graphic.Splitter;
import net.sourceforge.plantuml.math.ScientificEquationSafe;
public class CommandCreoleMath implements Command {
+ // ::remove file when WASM
@Override
public String startingChars() {
diff --git a/src/net/sourceforge/plantuml/creole/legacy/CreoleParser.java b/src/net/sourceforge/plantuml/creole/legacy/CreoleParser.java
index 500b4ae2e..54b19353c 100644
--- a/src/net/sourceforge/plantuml/creole/legacy/CreoleParser.java
+++ b/src/net/sourceforge/plantuml/creole/legacy/CreoleParser.java
@@ -104,8 +104,10 @@ public class CreoleParser implements SheetBuilder {
return new StripeTree(fontConfiguration, skinParam, line);
} else if (Parser.isCodeStart(line)) {
return new StripeCode(fontConfiguration.changeFamily(Parser.MONOSPACED));
+ // ::comment when WASM
} else if (Parser.isLatexStart(line)) {
return new StripeLatex(fontConfiguration);
+ // ::done
}
return new CreoleStripeSimpleParser(line, context, fontConfiguration, skinParam, creoleMode)
.createStripe(context);
diff --git a/src/net/sourceforge/plantuml/creole/legacy/StripeLatex.java b/src/net/sourceforge/plantuml/creole/legacy/StripeLatex.java
index c322b9078..aa1a5e5aa 100644
--- a/src/net/sourceforge/plantuml/creole/legacy/StripeLatex.java
+++ b/src/net/sourceforge/plantuml/creole/legacy/StripeLatex.java
@@ -49,7 +49,7 @@ import net.sourceforge.plantuml.math.ScientificEquationSafe;
import net.sourceforge.plantuml.ugraphic.UGraphic;
public class StripeLatex implements StripeRaw {
-
+ // ::remove file when WASM
final private FontConfiguration fontConfiguration;
final private StringBuilder formula = new StringBuilder();
private AtomMath atom;
diff --git a/src/net/sourceforge/plantuml/creole/legacy/StripeSimple.java b/src/net/sourceforge/plantuml/creole/legacy/StripeSimple.java
index f2e044cae..909206b96 100644
--- a/src/net/sourceforge/plantuml/creole/legacy/StripeSimple.java
+++ b/src/net/sourceforge/plantuml/creole/legacy/StripeSimple.java
@@ -162,8 +162,10 @@ public class StripeSimple implements Stripe {
addCommand(CommandCreoleQrcode.create());
addCommand(CommandCreoleOpenIcon.create());
addCommand(CommandCreoleEmoji.create());
+ // ::comment when WASM
addCommand(CommandCreoleMath.create());
addCommand(CommandCreoleLatex.create());
+ // ::done
addCommand(CommandCreoleSprite.create());
addCommand(CommandCreoleSpace.create());
addCommand(CommandCreoleFontFamilyChange.create());
@@ -284,9 +286,11 @@ public class StripeSimple implements Stripe {
atoms.add(new AtomEmoji(emoji, 1, fontConfiguration.getSize2D(), col));
}
+ // ::comment when WASM
public void addMath(ScientificEquationSafe math) {
atoms.add(new AtomMath(math, fontConfiguration.getColor(), fontConfiguration.getExtendedColor()));
}
+ // ::done
private void modifyStripe(String line) {
final StringBuilder pending = new StringBuilder();
diff --git a/src/net/sourceforge/plantuml/cucadiagram/Bodier.java b/src/net/sourceforge/plantuml/cucadiagram/Bodier.java
index 427550f7d..f2e96773f 100644
--- a/src/net/sourceforge/plantuml/cucadiagram/Bodier.java
+++ b/src/net/sourceforge/plantuml/cucadiagram/Bodier.java
@@ -38,7 +38,7 @@ package net.sourceforge.plantuml.cucadiagram;
import java.util.List;
import net.sourceforge.plantuml.ISkinParam;
-import net.sourceforge.plantuml.baraye.ILeaf;
+import net.sourceforge.plantuml.baraye.EntityImp;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.style.Style;
@@ -46,7 +46,7 @@ import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public interface Bodier {
- public void setLeaf(ILeaf leaf);
+ public void setLeaf(EntityImp leaf);
public Display getFieldsToDisplay();
diff --git a/src/net/sourceforge/plantuml/cucadiagram/BodierJSon.java b/src/net/sourceforge/plantuml/cucadiagram/BodierJSon.java
index ab906c63b..9e25839eb 100644
--- a/src/net/sourceforge/plantuml/cucadiagram/BodierJSon.java
+++ b/src/net/sourceforge/plantuml/cucadiagram/BodierJSon.java
@@ -39,7 +39,7 @@ import java.util.List;
import java.util.Objects;
import net.sourceforge.plantuml.ISkinParam;
-import net.sourceforge.plantuml.baraye.ILeaf;
+import net.sourceforge.plantuml.baraye.EntityImp;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.json.JsonValue;
@@ -48,7 +48,7 @@ import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class BodierJSon implements Bodier {
- private ILeaf leaf;
+ private EntityImp leaf;
private JsonValue json;
@Override
@@ -60,7 +60,7 @@ public class BodierJSon implements Bodier {
}
@Override
- public void setLeaf(ILeaf leaf) {
+ public void setLeaf(EntityImp leaf) {
this.leaf = Objects.requireNonNull(leaf);
}
diff --git a/src/net/sourceforge/plantuml/cucadiagram/BodierLikeClassOrObject.java b/src/net/sourceforge/plantuml/cucadiagram/BodierLikeClassOrObject.java
index 4123872e9..bdfe765b8 100644
--- a/src/net/sourceforge/plantuml/cucadiagram/BodierLikeClassOrObject.java
+++ b/src/net/sourceforge/plantuml/cucadiagram/BodierLikeClassOrObject.java
@@ -44,7 +44,7 @@ import java.util.Set;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.UrlBuilder;
-import net.sourceforge.plantuml.baraye.ILeaf;
+import net.sourceforge.plantuml.baraye.EntityImp;
import net.sourceforge.plantuml.creole.Parser;
import net.sourceforge.plantuml.creole.legacy.CreoleParser;
import net.sourceforge.plantuml.graphic.FontConfiguration;
@@ -63,7 +63,7 @@ public class BodierLikeClassOrObject implements Bodier {
private LeafType type;
private List methodsToDisplay;
private List fieldsToDisplay;
- private ILeaf leaf;
+ private EntityImp leaf;
@Override
public void muteClassToObject() {
@@ -82,7 +82,7 @@ public class BodierLikeClassOrObject implements Bodier {
}
@Override
- public void setLeaf(ILeaf leaf) {
+ public void setLeaf(EntityImp leaf) {
this.leaf = Objects.requireNonNull(leaf);
}
diff --git a/src/net/sourceforge/plantuml/cucadiagram/BodierMap.java b/src/net/sourceforge/plantuml/cucadiagram/BodierMap.java
index 744dd0d3d..a7e32cae1 100644
--- a/src/net/sourceforge/plantuml/cucadiagram/BodierMap.java
+++ b/src/net/sourceforge/plantuml/cucadiagram/BodierMap.java
@@ -46,7 +46,7 @@ import java.util.regex.Pattern;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.LineBreakStrategy;
-import net.sourceforge.plantuml.baraye.ILeaf;
+import net.sourceforge.plantuml.baraye.EntityImp;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.style.Style;
@@ -55,7 +55,7 @@ public class BodierMap implements Bodier {
private final List rawBody = new ArrayList<>();
private final Map map = new LinkedHashMap();
- private ILeaf leaf;
+ private EntityImp leaf;
@Override
public void muteClassToObject() {
@@ -66,7 +66,7 @@ public class BodierMap implements Bodier {
}
@Override
- public void setLeaf(ILeaf leaf) {
+ public void setLeaf(EntityImp leaf) {
this.leaf = Objects.requireNonNull(leaf);
}
diff --git a/src/net/sourceforge/plantuml/cucadiagram/BodierSimple.java b/src/net/sourceforge/plantuml/cucadiagram/BodierSimple.java
index 7dab8f8c9..1b6f96497 100644
--- a/src/net/sourceforge/plantuml/cucadiagram/BodierSimple.java
+++ b/src/net/sourceforge/plantuml/cucadiagram/BodierSimple.java
@@ -41,7 +41,7 @@ import java.util.List;
import java.util.Objects;
import net.sourceforge.plantuml.ISkinParam;
-import net.sourceforge.plantuml.baraye.ILeaf;
+import net.sourceforge.plantuml.baraye.EntityImp;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.TextBlock;
@@ -51,7 +51,7 @@ import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class BodierSimple implements Bodier {
private final List rawBody = new ArrayList<>();
- private ILeaf leaf;
+ private EntityImp leaf;
@Override
public void muteClassToObject() {
@@ -62,7 +62,7 @@ public class BodierSimple implements Bodier {
}
@Override
- public void setLeaf(ILeaf leaf) {
+ public void setLeaf(EntityImp leaf) {
this.leaf = Objects.requireNonNull(leaf);
}
diff --git a/src/net/sourceforge/plantuml/cucadiagram/BodyEnhanced1.java b/src/net/sourceforge/plantuml/cucadiagram/BodyEnhanced1.java
index 6a9f10156..2135f81f0 100644
--- a/src/net/sourceforge/plantuml/cucadiagram/BodyEnhanced1.java
+++ b/src/net/sourceforge/plantuml/cucadiagram/BodyEnhanced1.java
@@ -46,7 +46,7 @@ import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.awt.geom.XRectangle2D;
-import net.sourceforge.plantuml.baraye.ILeaf;
+import net.sourceforge.plantuml.baraye.EntityImp;
import net.sourceforge.plantuml.creole.CreoleMode;
import net.sourceforge.plantuml.creole.Parser;
import net.sourceforge.plantuml.creole.legacy.CreoleParser;
@@ -70,11 +70,11 @@ public class BodyEnhanced1 extends BodyEnhancedAbstract implements TextBlock, Wi
private final boolean lineFirst;
private final List urls = new ArrayList<>();
- private final ILeaf entity;
+ private final EntityImp entity;
private final boolean inEllipse;
private final Style style;
- BodyEnhanced1(HorizontalAlignment align, List rawBody, ISkinParam skinParam, ILeaf entity,
+ BodyEnhanced1(HorizontalAlignment align, List rawBody, ISkinParam skinParam, EntityImp entity,
Style style) {
super(align, style.getFontConfiguration(skinParam.getIHtmlColorSet(), entity.getColors()), style);
this.style = style;
@@ -88,7 +88,7 @@ public class BodyEnhanced1 extends BodyEnhancedAbstract implements TextBlock, Wi
this.inEllipse = false;
}
- BodyEnhanced1(HorizontalAlignment align, Display display, ISkinParam skinParam, ILeaf entity, Style style) {
+ BodyEnhanced1(HorizontalAlignment align, Display display, ISkinParam skinParam, EntityImp entity, Style style) {
super(align, style.getFontConfiguration(skinParam.getIHtmlColorSet(), entity.getColors()), style);
this.style = style;
diff --git a/src/net/sourceforge/plantuml/cucadiagram/BodyFactory.java b/src/net/sourceforge/plantuml/cucadiagram/BodyFactory.java
index 5a6a0de84..abcea8ec9 100644
--- a/src/net/sourceforge/plantuml/cucadiagram/BodyFactory.java
+++ b/src/net/sourceforge/plantuml/cucadiagram/BodyFactory.java
@@ -41,7 +41,7 @@ import java.util.Set;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.LineBreakStrategy;
-import net.sourceforge.plantuml.baraye.ILeaf;
+import net.sourceforge.plantuml.baraye.EntityImp;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.TextBlock;
@@ -64,12 +64,12 @@ public class BodyFactory {
}
public static TextBlock create1(HorizontalAlignment align, List rawBody, ISkinParam skinParam,
- Stereotype stereotype, ILeaf entity, Style style) {
+ Stereotype stereotype, EntityImp entity, Style style) {
return new BodyEnhanced1(align, rawBody, skinParam, entity, style);
}
public static TextBlock create2(HorizontalAlignment align, Display display, ISkinParam skinParam,
- Stereotype stereotype, ILeaf entity, Style style) {
+ Stereotype stereotype, EntityImp entity, Style style) {
return new BodyEnhanced1(align, display, skinParam, entity, style);
}
diff --git a/src/net/sourceforge/plantuml/cucadiagram/CodeImpl.java b/src/net/sourceforge/plantuml/cucadiagram/CodeImpl.java
deleted file mode 100644
index 639130f76..000000000
--- a/src/net/sourceforge/plantuml/cucadiagram/CodeImpl.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/* ========================================================================
- * PlantUML : a free UML diagram generator
- * ========================================================================
- *
- * (C) Copyright 2009-2023, Arnaud Roques
- *
- * Project Info: http://plantuml.com
- *
- * If you like this project or if you find it useful, you can support us at:
- *
- * http://plantuml.com/patreon (only 1$ per month!)
- * http://plantuml.com/paypal
- *
- * This file is part of PlantUML.
- *
- * PlantUML is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * PlantUML distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
- * License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- * USA.
- *
- *
- * Original Author: Arnaud Roques
- *
- *
- */
-package net.sourceforge.plantuml.cucadiagram;
-
-import java.util.Objects;
-
-import net.sourceforge.plantuml.StringUtils;
-import net.sourceforge.plantuml.baraye.EntityFactory;
-
-public class CodeImpl implements Code {
-
- private final String name;
-
- private CodeImpl(String name) {
- this.name = Objects.requireNonNull(name);
- }
-
- public static Code of(String code) {
- if (code == null)
- EntityFactory.bigError();
-
- return new CodeImpl(code);
- }
-
- public final String getName() {
- return name;
- }
-
- @Override
- public String toString() {
- return name;
- }
-
- @Override
- public int hashCode() {
- return name.hashCode();
- }
-
- @Override
- public boolean equals(Object obj) {
- final CodeImpl other = (CodeImpl) obj;
- return this.name.equals(other.name);
- }
-
- public Code eventuallyRemoveStartingAndEndingDoubleQuote(String format) {
- return CodeImpl.of(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(getName(), format));
- }
-
-}
diff --git a/src/net/sourceforge/plantuml/cucadiagram/Display.java b/src/net/sourceforge/plantuml/cucadiagram/Display.java
index c075fd123..bf4858efc 100644
--- a/src/net/sourceforge/plantuml/cucadiagram/Display.java
+++ b/src/net/sourceforge/plantuml/cucadiagram/Display.java
@@ -52,6 +52,7 @@ import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.SpriteContainer;
import net.sourceforge.plantuml.UrlBuilder;
import net.sourceforge.plantuml.UrlMode;
+import net.sourceforge.plantuml.baraye.Quark;
import net.sourceforge.plantuml.command.regex.Matcher2;
import net.sourceforge.plantuml.command.regex.MyPattern;
import net.sourceforge.plantuml.command.regex.Pattern2;
@@ -102,6 +103,8 @@ public class Display implements Iterable {
// }
public boolean equalsLike(Display other) {
+ if (isNull(this))
+ return isNull(other);
return this.displayData.equals(other.displayData);
}
@@ -197,7 +200,7 @@ public class Display implements Iterable {
return new Display(true, other, null, false, CreoleMode.FULL);
}
- public static Display getWithNewlines(Code s) {
+ public static Display getWithNewlines(Quark s) {
return getWithNewlines(s.getName());
}
diff --git a/src/net/sourceforge/plantuml/cucadiagram/EntityGender.java b/src/net/sourceforge/plantuml/cucadiagram/EntityGender.java
index 703036619..6679ca263 100644
--- a/src/net/sourceforge/plantuml/cucadiagram/EntityGender.java
+++ b/src/net/sourceforge/plantuml/cucadiagram/EntityGender.java
@@ -35,8 +35,8 @@
*/
package net.sourceforge.plantuml.cucadiagram;
-import net.sourceforge.plantuml.baraye.IEntity;
+import net.sourceforge.plantuml.baraye.EntityImp;
public interface EntityGender {
- public boolean contains(IEntity test);
+ public boolean contains(EntityImp test);
}
diff --git a/src/net/sourceforge/plantuml/cucadiagram/EntityGenderUtils.java b/src/net/sourceforge/plantuml/cucadiagram/EntityGenderUtils.java
index 85eb73bb5..98442d4af 100644
--- a/src/net/sourceforge/plantuml/cucadiagram/EntityGenderUtils.java
+++ b/src/net/sourceforge/plantuml/cucadiagram/EntityGenderUtils.java
@@ -36,23 +36,22 @@
package net.sourceforge.plantuml.cucadiagram;
import net.sourceforge.plantuml.Guillemet;
+import net.sourceforge.plantuml.baraye.EntityImp;
import net.sourceforge.plantuml.baraye.EntityUtils;
-import net.sourceforge.plantuml.baraye.IEntity;
-import net.sourceforge.plantuml.baraye.IGroup;
public class EntityGenderUtils {
static public EntityGender byEntityType(final LeafType type) {
return new EntityGender() {
- public boolean contains(IEntity test) {
+ public boolean contains(EntityImp test) {
return test.getLeafType() == type;
}
};
}
- static public EntityGender byEntityAlone(final IEntity entity) {
+ static public EntityGender byEntityAlone(final EntityImp entity) {
return new EntityGender() {
- public boolean contains(IEntity test) {
+ public boolean contains(EntityImp test) {
return test.getUid().equals(entity.getUid());
}
};
@@ -60,7 +59,7 @@ public class EntityGenderUtils {
static public EntityGender byStereotype(final String stereotype) {
return new EntityGender() {
- public boolean contains(IEntity test) {
+ public boolean contains(EntityImp test) {
if (test.getStereotype() == null) {
return false;
}
@@ -69,13 +68,13 @@ public class EntityGenderUtils {
};
}
- static public EntityGender byPackage(final IGroup group) {
- if (EntityUtils.groupRoot(group)) {
+ static public EntityGender byPackage(final EntityImp group) {
+ if (group.getQuark().isRoot()) {
throw new IllegalArgumentException();
}
return new EntityGender() {
- public boolean contains(IEntity test) {
- if (EntityUtils.groupRoot(test.getParentContainer())) {
+ public boolean contains(EntityImp test) {
+ if (test.getParentContainer().getQuark().isRoot()) {
return false;
}
if (group == test.getParentContainer()) {
@@ -88,7 +87,7 @@ public class EntityGenderUtils {
static public EntityGender and(final EntityGender g1, final EntityGender g2) {
return new EntityGender() {
- public boolean contains(IEntity test) {
+ public boolean contains(EntityImp test) {
return g1.contains(test) && g2.contains(test);
}
};
@@ -96,7 +95,7 @@ public class EntityGenderUtils {
static public EntityGender all() {
return new EntityGender() {
- public boolean contains(IEntity test) {
+ public boolean contains(EntityImp test) {
return true;
}
};
@@ -104,7 +103,7 @@ public class EntityGenderUtils {
static public EntityGender emptyMethods() {
return new EntityGender() {
- public boolean contains(IEntity test) {
+ public boolean contains(EntityImp test) {
return test.getBodier().getMethodsToDisplay().size() == 0;
}
};
@@ -112,7 +111,7 @@ public class EntityGenderUtils {
static public EntityGender emptyFields() {
return new EntityGender() {
- public boolean contains(IEntity test) {
+ public boolean contains(EntityImp test) {
return test.getBodier().getFieldsToDisplay().size() == 0;
}
};
diff --git a/src/net/sourceforge/plantuml/cucadiagram/GroupHierarchy.java b/src/net/sourceforge/plantuml/cucadiagram/GroupHierarchy.java
index 20e10681e..1cdad08a9 100644
--- a/src/net/sourceforge/plantuml/cucadiagram/GroupHierarchy.java
+++ b/src/net/sourceforge/plantuml/cucadiagram/GroupHierarchy.java
@@ -37,13 +37,13 @@ package net.sourceforge.plantuml.cucadiagram;
import java.util.Collection;
-import net.sourceforge.plantuml.baraye.IGroup;
+import net.sourceforge.plantuml.baraye.EntityImp;
public interface GroupHierarchy {
- public IGroup getRootGroup();
+ public EntityImp getRootGroup();
- public Collection getChildrenGroups(IGroup parent);
+ public Collection getChildrenGroups(EntityImp parent);
- public boolean isEmpty(IGroup g);
+ public boolean isEmpty(EntityImp g);
}
diff --git a/src/net/sourceforge/plantuml/cucadiagram/GroupPrinter.java b/src/net/sourceforge/plantuml/cucadiagram/GroupPrinter.java
index 4824cdff9..df090f6bd 100644
--- a/src/net/sourceforge/plantuml/cucadiagram/GroupPrinter.java
+++ b/src/net/sourceforge/plantuml/cucadiagram/GroupPrinter.java
@@ -38,8 +38,7 @@ package net.sourceforge.plantuml.cucadiagram;
import java.io.IOException;
import java.io.PrintWriter;
-import net.sourceforge.plantuml.baraye.IGroup;
-import net.sourceforge.plantuml.baraye.ILeaf;
+import net.sourceforge.plantuml.baraye.EntityImp;
import net.sourceforge.plantuml.log.Logme;
import net.sourceforge.plantuml.security.SFile;
@@ -51,7 +50,7 @@ public class GroupPrinter {
this.pw = pw;
}
- private void printGroup(IGroup group) {
+ private void printGroup(EntityImp group) {
pw.println("
");
pw.println("
");
pw.println("
");
@@ -61,7 +60,7 @@ public class GroupPrinter {
if (group.getLeafsDirect().size() == 0) {
pw.println("No direct leaf");
} else {
- for (ILeaf leaf : group.getLeafsDirect()) {
+ for (EntityImp leaf : group.getLeafsDirect()) {
pw.println("
");
printLeaf(leaf);
pw.println("
");
@@ -72,7 +71,7 @@ public class GroupPrinter {
if (group.getChildren().size() > 0) {
pw.println("
");
pw.println("
");
- for (IGroup g : group.getChildren()) {
+ for (EntityImp g : group.getChildren()) {
pw.println(" ");
printGroup(g);
pw.println(" ");
@@ -83,11 +82,11 @@ public class GroupPrinter {
pw.println("