emptyList());
- imageData = ssr.noStartumlFound(os, option.getFileFormatOption());
+ imageData = ssr.noValidStartFound(os, option.getFileFormatOption());
} else {
system = ssr.getBlocks().get(0).getDiagram();
imageData = system.exportDiagram(os, 0, option.getFileFormatOption());
diff --git a/src/net/sourceforge/plantuml/picoweb/package-info.java b/src/net/sourceforge/plantuml/picoweb/package-info.java
new file mode 100644
index 000000000..bd80e1feb
--- /dev/null
+++ b/src/net/sourceforge/plantuml/picoweb/package-info.java
@@ -0,0 +1,7 @@
+/**
+ * Provides classes used to manage
+ *
+ * PlantUML PicoWeb Server.
+ *
+ */
+package net.sourceforge.plantuml.picoweb;
diff --git a/src/net/sourceforge/plantuml/picoweb/readme.md b/src/net/sourceforge/plantuml/picoweb/readme.md
new file mode 100644
index 000000000..3b772dbd1
--- /dev/null
+++ b/src/net/sourceforge/plantuml/picoweb/readme.md
@@ -0,0 +1,18 @@
+# Directory Documentation for `picoweb`
+
+## Description
+This package provides classes used to manage a [PlantUML PicoWeb Server](https://plantuml.com/picoweb).
+
+## Link
+- [PlantUML PicoWeb server](https://plantuml.com/picoweb)
+
+## Reference
+
+## Credit or Inspiration
+- ["Create a simple HTTP Web Server in Java"](https://www.ssaurel.com/blog/create-a-simple-http-web-server-in-java) on the [Sylvain Saurel Blog](https://www.ssaurel.com/blog/)
+- [`JavaHTTPServer.java` of Sylvain Saurel](https://gist.github.com/ssaurel/2e8462d70b9e61c4dd6df2dc2cd725d7)
+ (on a [@ssaurel's gist](https://gist.github.com/ssaurel))
+
+ ## Misc.
+- [`pico` on "Metric prefix" _(on Wikipedia)_](https://en.wikipedia.org/wiki/Metric_prefix)
+- [`pico-` on "Orders of magnitude" _(on Wikipedia)_](https://en.wikipedia.org/wiki/Orders_of_magnitude_(numbers)#10%E2%88%9212)
diff --git a/src/net/sourceforge/plantuml/plasma/PEntry.java b/src/net/sourceforge/plantuml/plasma/PEntry.java
index 8c84e31ee..9fefcedc7 100644
--- a/src/net/sourceforge/plantuml/plasma/PEntry.java
+++ b/src/net/sourceforge/plantuml/plasma/PEntry.java
@@ -35,6 +35,16 @@
*/
package net.sourceforge.plantuml.plasma;
+/**
+ * Keeps track of the {@link Quark} objects that have a given name. Short for
+ * "{@link Plasma} entry".
+ *
+ *
+ * Tracks the first instace created with that name, as well as the number of
+ * quarks with that name.
+ *
+ * @see Plasma#stats
+ */
class PEntry {
// ::remove folder when __HAXE__
diff --git a/src/net/sourceforge/plantuml/plasma/Plasma.java b/src/net/sourceforge/plantuml/plasma/Plasma.java
index b592d6221..b5a01931c 100644
--- a/src/net/sourceforge/plantuml/plasma/Plasma.java
+++ b/src/net/sourceforge/plantuml/plasma/Plasma.java
@@ -42,6 +42,11 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
+/**
+ * A namespace for {@link Quark} objects.
+ *
+ * @see net.sourceforge.plantuml.plasma
+ */
public class Plasma {
private String separator = "\u0000";
diff --git a/src/net/sourceforge/plantuml/plasma/Quark.java b/src/net/sourceforge/plantuml/plasma/Quark.java
index 9c0b26fc1..b20106ef5 100644
--- a/src/net/sourceforge/plantuml/plasma/Quark.java
+++ b/src/net/sourceforge/plantuml/plasma/Quark.java
@@ -40,6 +40,11 @@ import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.Map;
+/**
+ * A named node in the entity graph.
+ *
+ * @see net.sourceforge.plantuml.plasma
+ */
public class Quark {
private final Plasma plasma;
diff --git a/src/net/sourceforge/plantuml/posimo/Mirror.java b/src/net/sourceforge/plantuml/plasma/package-info.java
similarity index 74%
rename from src/net/sourceforge/plantuml/posimo/Mirror.java
rename to src/net/sourceforge/plantuml/plasma/package-info.java
index 16b7d0a2a..b6b3b0c57 100644
--- a/src/net/sourceforge/plantuml/posimo/Mirror.java
+++ b/src/net/sourceforge/plantuml/plasma/package-info.java
@@ -30,25 +30,18 @@
*
*
* Original Author: Arnaud Roques
- *
*
+ *
*/
-package net.sourceforge.plantuml.posimo;
-public class Mirror {
-
- private final double max;
-
- public Mirror(double max) {
- this.max = max;
- }
-
- public double getMirrored(double v) {
- if (v < 0 || v > max) {
- throw new IllegalArgumentException();
- }
- // return v;
- return max - v;
- }
-
-}
+/**
+ * Provides {@link Plasma} and {@link Quark} classes.
+ *
+ *
+ * Class diagrams (and other free-form graphs) are represented as a tree of
+ * enities. The tree structure is represented using {@link Quark} objects, each
+ * of which corresponds to an {@link net.sourceforge.plantuml.abel.Entity}. The
+ * quark for an entity can be retrieved using a method on the entity, and
+ * vice-versa.
+ */
+package net.sourceforge.plantuml.plasma;
diff --git a/src/net/sourceforge/plantuml/png/PngIO.java b/src/net/sourceforge/plantuml/png/PngIO.java
index 68448753b..c3136d72f 100644
--- a/src/net/sourceforge/plantuml/png/PngIO.java
+++ b/src/net/sourceforge/plantuml/png/PngIO.java
@@ -35,23 +35,20 @@
*/
package net.sourceforge.plantuml.png;
-import java.awt.image.BufferedImage;
import java.awt.image.RenderedImage;
import java.io.IOException;
import java.io.OutputStream;
import net.sourceforge.plantuml.klimt.color.ColorMapper;
-import net.sourceforge.plantuml.quantization.Quantizer;
import net.sourceforge.plantuml.security.SFile;
import net.sourceforge.plantuml.security.SImageIO;
import net.sourceforge.plantuml.utils.Log;
public class PngIO {
- // ::remove folder when __HAXE__
+ // ::remove folder when __HAXE__
// ::comment when __CORE__
private static final String copyleft = "Generated by https://plantuml.com";
- public static boolean USE_QUANTIZATION = false;
public static void write(RenderedImage image, ColorMapper mapper, SFile file, String metadata, int dpi)
throws IOException {
@@ -76,9 +73,6 @@ public class PngIO {
String debugData) throws IOException {
// ::comment when __CORE__
- if (USE_QUANTIZATION)
- image = Quantizer.quantizeNow(mapper, (BufferedImage) image);
-
if (metadata == null)
// ::done
SImageIO.write(image, "png", os);
diff --git a/src/net/sourceforge/plantuml/png/package-info.java b/src/net/sourceforge/plantuml/png/package-info.java
new file mode 100644
index 000000000..51f7678f5
--- /dev/null
+++ b/src/net/sourceforge/plantuml/png/package-info.java
@@ -0,0 +1,7 @@
+/**
+ * Provides classes used to manage
+ *
+ * PNG output format.
+ *
+ */
+package net.sourceforge.plantuml.png;
diff --git a/src/net/sourceforge/plantuml/png/readme.md b/src/net/sourceforge/plantuml/png/readme.md
new file mode 100644
index 000000000..94f8de7b2
--- /dev/null
+++ b/src/net/sourceforge/plantuml/png/readme.md
@@ -0,0 +1,10 @@
+# Directory Documentation for `png`
+
+## Description
+This package provides classes used to export diagram to a [PNG](https://plantuml.com/en/command-line#458de91d76a8569c) output format.
+
+## Link
+- [PNG output format](https://plantuml.com/en/command-line#458de91d76a8569c)
+
+## Reference
+- [PNG _(on Wikipedia)_](https://en.wikipedia.org/wiki/PNG)
diff --git a/src/net/sourceforge/plantuml/posimo/IEntityImageBlock.java b/src/net/sourceforge/plantuml/posimo/IEntityImageBlock.java
deleted file mode 100644
index c9e0cf009..000000000
--- a/src/net/sourceforge/plantuml/posimo/IEntityImageBlock.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/* ========================================================================
- * PlantUML : a free UML diagram generator
- * ========================================================================
- *
- * (C) Copyright 2009-2024, Arnaud Roques
- *
- * Project Info: https://plantuml.com
- *
- * If you like this project or if you find it useful, you can support us at:
- *
- * https://plantuml.com/patreon (only 1$ per month!)
- * https://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.posimo;
-
-import net.sourceforge.plantuml.klimt.drawing.UGraphic;
-import net.sourceforge.plantuml.klimt.font.StringBounder;
-import net.sourceforge.plantuml.klimt.geom.XDimension2D;
-
-public interface IEntityImageBlock {
-
- XDimension2D getDimension(StringBounder stringBounder);
-
- void drawU(UGraphic ug, double xTheoricalPosition, double yTheoricalPosition, double marginWidth,
- double marginHeight);
-}
\ No newline at end of file
diff --git a/src/net/sourceforge/plantuml/posimo/LineRectIntersection.java b/src/net/sourceforge/plantuml/posimo/LineRectIntersection.java
deleted file mode 100644
index 18db7ad58..000000000
--- a/src/net/sourceforge/plantuml/posimo/LineRectIntersection.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/* ========================================================================
- * PlantUML : a free UML diagram generator
- * ========================================================================
- *
- * (C) Copyright 2009-2024, Arnaud Roques
- *
- * Project Info: https://plantuml.com
- *
- * If you like this project or if you find it useful, you can support us at:
- *
- * https://plantuml.com/patreon (only 1$ per month!)
- * https://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.posimo;
-
-import net.sourceforge.plantuml.klimt.geom.XLine2D;
-import net.sourceforge.plantuml.klimt.geom.XPoint2D;
-import net.sourceforge.plantuml.klimt.geom.XRectangle2D;
-
-public class LineRectIntersection {
-
- private final XPoint2D inter;
-
- public LineRectIntersection(XLine2D line, XRectangle2D rect) {
- final XPoint2D p1 = new XPoint2D(rect.getMinX(), rect.getMinY());
- final XPoint2D p2 = new XPoint2D(rect.getMaxX(), rect.getMinY());
- final XPoint2D p3 = new XPoint2D(rect.getMaxX(), rect.getMaxY());
- final XPoint2D p4 = new XPoint2D(rect.getMinX(), rect.getMaxY());
-
- final XPoint2D inter1 = new LineSegmentIntersection(XLine2D.line(p1, p2), line).getIntersection();
- final XPoint2D inter2 = new LineSegmentIntersection(XLine2D.line(p2, p3), line).getIntersection();
- final XPoint2D inter3 = new LineSegmentIntersection(XLine2D.line(p3, p4), line).getIntersection();
- final XPoint2D inter4 = new LineSegmentIntersection(XLine2D.line(p4, p1), line).getIntersection();
-
- final XPoint2D o = line.getP1();
- inter = getCloser(o, inter1, inter2, inter3, inter4);
-
- }
-
- public static XPoint2D getCloser(final XPoint2D o, final XPoint2D... other) {
- double minDist = Double.MAX_VALUE;
- XPoint2D result = null;
-
- for (XPoint2D pt : other)
- if (pt != null) {
- final double dist = pt.distanceSq(o);
- if (dist < minDist) {
- minDist = dist;
- result = pt;
- }
- }
-
- return result;
- }
-
- public final XPoint2D getIntersection() {
- return inter;
- }
-
-}
diff --git a/src/net/sourceforge/plantuml/posimo/LineSegmentIntersection.java b/src/net/sourceforge/plantuml/posimo/LineSegmentIntersection.java
deleted file mode 100644
index 6d830c68f..000000000
--- a/src/net/sourceforge/plantuml/posimo/LineSegmentIntersection.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/* ========================================================================
- * PlantUML : a free UML diagram generator
- * ========================================================================
- *
- * (C) Copyright 2009-2024, Arnaud Roques
- *
- * Project Info: https://plantuml.com
- *
- * If you like this project or if you find it useful, you can support us at:
- *
- * https://plantuml.com/patreon (only 1$ per month!)
- * https://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.posimo;
-
-import net.sourceforge.plantuml.klimt.geom.XLine2D;
-import net.sourceforge.plantuml.klimt.geom.XPoint2D;
-
-public class LineSegmentIntersection {
-
- private final XPoint2D inter;
-
- // http://local.wasp.uwa.edu.au/~pbourke/geometry/lineline2d/
-
- public LineSegmentIntersection(XLine2D segment, XLine2D lineB) {
- final double x1 = segment.getX1();
- final double y1 = segment.getY1();
- final double x2 = segment.getX2();
- final double y2 = segment.getY2();
- final double x3 = lineB.getX1();
- final double y3 = lineB.getY1();
- final double x4 = lineB.getX2();
- final double y4 = lineB.getY2();
-
- final double den = (y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1);
-
- if (den == 0) {
- inter = null;
- } else {
-
- final double uA1 = (x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3);
- final double uA = uA1 / den;
-
- final double x = x1 + uA * (x2 - x1);
- final double y = y1 + uA * (y2 - y1);
-
- if (uA >= 0 && uA <= 1) {
- inter = new XPoint2D(x, y);
- } else {
- inter = null;
- }
- }
- }
-
- public final XPoint2D getIntersection() {
- return inter;
- }
-
-}
diff --git a/src/net/sourceforge/plantuml/posimo/MargedBlock.java b/src/net/sourceforge/plantuml/posimo/MargedBlock.java
deleted file mode 100644
index ab4bdfb4c..000000000
--- a/src/net/sourceforge/plantuml/posimo/MargedBlock.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/* ========================================================================
- * PlantUML : a free UML diagram generator
- * ========================================================================
- *
- * (C) Copyright 2009-2024, Arnaud Roques
- *
- * Project Info: https://plantuml.com
- *
- * If you like this project or if you find it useful, you can support us at:
- *
- * https://plantuml.com/patreon (only 1$ per month!)
- * https://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.posimo;
-
-import net.sourceforge.plantuml.klimt.font.StringBounder;
-import net.sourceforge.plantuml.klimt.geom.Positionable;
-import net.sourceforge.plantuml.klimt.geom.XDimension2D;
-import net.sourceforge.plantuml.klimt.geom.XPoint2D;
-
-public class MargedBlock {
-
- private final Block block;
- private final IEntityImageBlock imageBlock;
- private final double marginDecorator;
- private final XDimension2D imageDimension;
-
- static private int uid = 1;
-
- public MargedBlock(StringBounder stringBounder, IEntityImageBlock imageBlock, double marginDecorator,
- Cluster parent) {
- this.imageBlock = imageBlock;
- this.marginDecorator = marginDecorator;
- this.imageDimension = imageBlock.getDimension(stringBounder);
- this.block = new Block(uid++, imageDimension.getWidth() + 2 * marginDecorator,
- imageDimension.getHeight() + 2 * marginDecorator, parent);
- }
-
- public Block getBlock() {
- return block;
- }
-
- public double getMarginDecorator() {
- return marginDecorator;
- }
-
- public IEntityImageBlock getImageBlock() {
- return imageBlock;
- }
-
- public Positionable getImagePosition() {
- return new Positionable() {
-
- public XDimension2D getSize() {
- return imageDimension;
- }
-
- public XPoint2D getPosition() {
- final XPoint2D pos = block.getPosition();
- return new XPoint2D(pos.getX() + marginDecorator, pos.getY() + marginDecorator);
- }
-
- public void moveSvek(double deltaX, double deltaY) {
- throw new UnsupportedOperationException();
- }
- };
- }
-
-}
diff --git a/src/net/sourceforge/plantuml/posimo/Racorder.java b/src/net/sourceforge/plantuml/posimo/Racorder.java
deleted file mode 100644
index faa2835c2..000000000
--- a/src/net/sourceforge/plantuml/posimo/Racorder.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/* ========================================================================
- * PlantUML : a free UML diagram generator
- * ========================================================================
- *
- * (C) Copyright 2009-2024, Arnaud Roques
- *
- * Project Info: https://plantuml.com
- *
- * If you like this project or if you find it useful, you can support us at:
- *
- * https://plantuml.com/patreon (only 1$ per month!)
- * https://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.posimo;
-
-import net.sourceforge.plantuml.klimt.geom.XLine2D;
-import net.sourceforge.plantuml.klimt.geom.XRectangle2D;
-import net.sourceforge.plantuml.klimt.shape.DotPath;
-
-public interface Racorder {
- // ::remove folder when __HAXE__
- public DotPath getRacordIn(XRectangle2D rect, XLine2D tangeante);
-
- public DotPath getRacordOut(XRectangle2D rect, XLine2D tangeante);
-}
diff --git a/src/net/sourceforge/plantuml/posimo/RacorderAbstract.java b/src/net/sourceforge/plantuml/posimo/RacorderAbstract.java
deleted file mode 100644
index 8f0d2f887..000000000
--- a/src/net/sourceforge/plantuml/posimo/RacorderAbstract.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/* ========================================================================
- * PlantUML : a free UML diagram generator
- * ========================================================================
- *
- * (C) Copyright 2009-2024, Arnaud Roques
- *
- * Project Info: https://plantuml.com
- *
- * If you like this project or if you find it useful, you can support us at:
- *
- * https://plantuml.com/patreon (only 1$ per month!)
- * https://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.posimo;
-
-import net.sourceforge.plantuml.klimt.geom.XLine2D;
-import net.sourceforge.plantuml.klimt.geom.XRectangle2D;
-import net.sourceforge.plantuml.klimt.shape.DotPath;
-
-public abstract class RacorderAbstract implements Racorder {
-
- public final DotPath getRacordOut(XRectangle2D rect, XLine2D tangeante) {
- tangeante = symetric(tangeante);
- return getRacordIn(rect, tangeante).reverse();
- }
-
- private static XLine2D symetric(XLine2D line) {
- final double x1 = line.getX1();
- final double y1 = line.getY1();
- final double x2 = line.getX2();
- final double y2 = line.getY2();
- final double dx = x2 - x1;
- final double dy = y2 - y1;
- return new XLine2D(x1, y1, x1 - dx, y1 - dy);
- }
-
-}
diff --git a/src/net/sourceforge/plantuml/posimo/RacorderFollowTangeante.java b/src/net/sourceforge/plantuml/posimo/RacorderFollowTangeante.java
deleted file mode 100644
index db4faa9b8..000000000
--- a/src/net/sourceforge/plantuml/posimo/RacorderFollowTangeante.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/* ========================================================================
- * PlantUML : a free UML diagram generator
- * ========================================================================
- *
- * (C) Copyright 2009-2024, Arnaud Roques
- *
- * Project Info: https://plantuml.com
- *
- * If you like this project or if you find it useful, you can support us at:
- *
- * https://plantuml.com/patreon (only 1$ per month!)
- * https://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.posimo;
-
-import net.sourceforge.plantuml.klimt.geom.XCubicCurve2D;
-import net.sourceforge.plantuml.klimt.geom.XLine2D;
-import net.sourceforge.plantuml.klimt.geom.XPoint2D;
-import net.sourceforge.plantuml.klimt.geom.XRectangle2D;
-import net.sourceforge.plantuml.klimt.shape.DotPath;
-
-public class RacorderFollowTangeante extends RacorderAbstract implements Racorder {
-
- @Override
- public DotPath getRacordIn(XRectangle2D rect, XLine2D tangeante) {
-
- final DotPath result = new DotPath();
-
- XPoint2D inter = new LineRectIntersection(tangeante, rect).getIntersection();
-
- if (inter == null) {
- final XPoint2D p1 = new XPoint2D(rect.getMinX(), rect.getMinY());
- final XPoint2D p2 = new XPoint2D(rect.getMaxX(), rect.getMinY());
- final XPoint2D p3 = new XPoint2D(rect.getMaxX(), rect.getMaxY());
- final XPoint2D p4 = new XPoint2D(rect.getMinX(), rect.getMaxY());
-
- inter = LineRectIntersection.getCloser(tangeante.getP1(), p1, p2, p3, p4);
- }
-
- final XCubicCurve2D curv = new XCubicCurve2D(tangeante.getX1(), tangeante.getY1(), tangeante.getX1(),
- tangeante.getY1(), inter.getX(), inter.getY(), inter.getX(), inter.getY());
- return result.addAfter(curv);
- }
-
-}
diff --git a/src/net/sourceforge/plantuml/posimo/RacorderFollowTangeanteOld.java b/src/net/sourceforge/plantuml/posimo/RacorderFollowTangeanteOld.java
deleted file mode 100644
index df5891681..000000000
--- a/src/net/sourceforge/plantuml/posimo/RacorderFollowTangeanteOld.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/* ========================================================================
- * PlantUML : a free UML diagram generator
- * ========================================================================
- *
- * (C) Copyright 2009-2024, Arnaud Roques
- *
- * Project Info: https://plantuml.com
- *
- * If you like this project or if you find it useful, you can support us at:
- *
- * https://plantuml.com/patreon (only 1$ per month!)
- * https://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.posimo;
-
-import net.sourceforge.plantuml.klimt.geom.BezierUtils;
-import net.sourceforge.plantuml.klimt.geom.XCubicCurve2D;
-import net.sourceforge.plantuml.klimt.geom.XLine2D;
-import net.sourceforge.plantuml.klimt.geom.XPoint2D;
-import net.sourceforge.plantuml.klimt.geom.XRectangle2D;
-import net.sourceforge.plantuml.klimt.shape.DotPath;
-
-public class RacorderFollowTangeanteOld extends RacorderAbstract implements Racorder {
-
- public DotPath getRacordIn(XRectangle2D rect, XLine2D tangeante) {
-
- final DotPath result = new DotPath();
-
- final XPoint2D center = new XPoint2D(rect.getCenterX(), rect.getCenterY());
- final XLine2D line = XLine2D.line(tangeante.getP1(), center);
- final XPoint2D inter = BezierUtils.intersect(line, rect);
-
- final XCubicCurve2D curv = new XCubicCurve2D(tangeante.getX1(), tangeante.getY1(), tangeante.getX2(),
- tangeante.getY2(), tangeante.getX2(), tangeante.getY2(), inter.getX(), inter.getY());
- return result.addAfter(curv);
- }
-
-}
diff --git a/src/net/sourceforge/plantuml/posimo/RacorderInToCenter.java b/src/net/sourceforge/plantuml/posimo/RacorderInToCenter.java
deleted file mode 100644
index 732a19467..000000000
--- a/src/net/sourceforge/plantuml/posimo/RacorderInToCenter.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/* ========================================================================
- * PlantUML : a free UML diagram generator
- * ========================================================================
- *
- * (C) Copyright 2009-2024, Arnaud Roques
- *
- * Project Info: https://plantuml.com
- *
- * If you like this project or if you find it useful, you can support us at:
- *
- * https://plantuml.com/patreon (only 1$ per month!)
- * https://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.posimo;
-
-import net.sourceforge.plantuml.klimt.geom.BezierUtils;
-import net.sourceforge.plantuml.klimt.geom.XCubicCurve2D;
-import net.sourceforge.plantuml.klimt.geom.XLine2D;
-import net.sourceforge.plantuml.klimt.geom.XPoint2D;
-import net.sourceforge.plantuml.klimt.geom.XRectangle2D;
-import net.sourceforge.plantuml.klimt.shape.DotPath;
-
-public class RacorderInToCenter extends RacorderAbstract implements Racorder {
-
- @Override
- public DotPath getRacordIn(XRectangle2D rect, XLine2D tangeante) {
- final DotPath result = new DotPath();
-
- final XPoint2D center = new XPoint2D(rect.getCenterX(), rect.getCenterY());
- final XLine2D line = XLine2D.line(tangeante.getP1(), center);
- final XPoint2D inter = BezierUtils.intersect(line, rect);
-
- final XCubicCurve2D curv = new XCubicCurve2D(line.getX1(), line.getY1(), line.getX1(), line.getY1(),
- inter.getX(), inter.getY(), inter.getX(), inter.getY());
- return result.addAfter(curv);
- }
-
-}
diff --git a/src/net/sourceforge/plantuml/posimo/RacorderOrthogonal.java b/src/net/sourceforge/plantuml/posimo/RacorderOrthogonal.java
deleted file mode 100644
index daf802cf5..000000000
--- a/src/net/sourceforge/plantuml/posimo/RacorderOrthogonal.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/* ========================================================================
- * PlantUML : a free UML diagram generator
- * ========================================================================
- *
- * (C) Copyright 2009-2024, Arnaud Roques
- *
- * Project Info: https://plantuml.com
- *
- * If you like this project or if you find it useful, you can support us at:
- *
- * https://plantuml.com/patreon (only 1$ per month!)
- * https://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.posimo;
-
-import net.sourceforge.plantuml.klimt.geom.XCubicCurve2D;
-import net.sourceforge.plantuml.klimt.geom.XLine2D;
-import net.sourceforge.plantuml.klimt.geom.XPoint2D;
-import net.sourceforge.plantuml.klimt.geom.XRectangle2D;
-import net.sourceforge.plantuml.klimt.shape.DotPath;
-
-public class RacorderOrthogonal extends RacorderAbstract implements Racorder {
-
- @Override
- public DotPath getRacordIn(XRectangle2D rect, XLine2D tangeante) {
-
- final XPoint2D in = tangeante.getP1();
-
- final DotPath result = new DotPath();
- XPoint2D inter = null;
-
- if (in.getX() > rect.getMinX() && in.getX() < rect.getMaxX()) {
- if (in.getY() < rect.getMinY())
- inter = new XPoint2D(in.getX(), rect.getMinY());
- else if (in.getY() > rect.getMaxY())
- inter = new XPoint2D(in.getX(), rect.getMaxY());
- else
- throw new IllegalArgumentException();
-
- } else if (in.getY() > rect.getMinY() && in.getY() < rect.getMaxY()) {
- if (in.getX() < rect.getMinX())
- inter = new XPoint2D(rect.getMinX(), in.getY());
- else if (in.getX() > rect.getMaxX())
- inter = new XPoint2D(rect.getMaxX(), in.getY());
- else
- throw new IllegalArgumentException();
-
- } else {
- final XPoint2D p1 = new XPoint2D(rect.getMinX(), rect.getMinY());
- final XPoint2D p2 = new XPoint2D(rect.getMaxX(), rect.getMinY());
- final XPoint2D p3 = new XPoint2D(rect.getMaxX(), rect.getMaxY());
- final XPoint2D p4 = new XPoint2D(rect.getMinX(), rect.getMaxY());
-
- inter = LineRectIntersection.getCloser(tangeante.getP1(), p1, p2, p3, p4);
-
- }
-
- final XCubicCurve2D curv = new XCubicCurve2D(tangeante.getX1(), tangeante.getY1(), tangeante.getX1(),
- tangeante.getY1(), inter.getX(), inter.getY(), inter.getX(), inter.getY());
- return result.addAfter(curv);
- }
-
-}
diff --git a/src/net/sourceforge/plantuml/posimo/SimpleDrawer.java b/src/net/sourceforge/plantuml/posimo/SimpleDrawer.java
deleted file mode 100644
index 434a6527b..000000000
--- a/src/net/sourceforge/plantuml/posimo/SimpleDrawer.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/* ========================================================================
- * PlantUML : a free UML diagram generator
- * ========================================================================
- *
- * (C) Copyright 2009-2024, Arnaud Roques
- *
- * Project Info: https://plantuml.com
- *
- * If you like this project or if you find it useful, you can support us at:
- *
- * https://plantuml.com/patreon (only 1$ per month!)
- * https://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.posimo;
-
-import java.awt.Color;
-import java.awt.Graphics2D;
-import java.awt.geom.Rectangle2D;
-import java.util.ArrayList;
-import java.util.Collection;
-
-import net.sourceforge.plantuml.klimt.geom.XDimension2D;
-import net.sourceforge.plantuml.klimt.geom.XPoint2D;
-
-public class SimpleDrawer {
-
- private final Cluster root;
- private final Collection paths;
-
- public SimpleDrawer(Cluster root, Collection paths) {
- this.root = root;
- this.paths = paths;
- }
-
- public void draw(Graphics2D g2d) {
- g2d.setColor(Color.BLACK);
- for (Clusterable cl : root.getContents()) {
- final Block b = (Block) cl;
- final XPoint2D pos = b.getPosition();
- final XDimension2D dim = b.getSize();
- // drawRectCentered(g2d, pos, dim);
- drawRect(g2d, pos, dim);
- }
-
- g2d.setColor(Color.GREEN);
- for (Path p : paths) {
- final Label label = p.getLabel();
- final XPoint2D labelPos = label.getPosition();
- final XDimension2D labelDim = label.getSize();
- // final double x1 = labelPos.getX();
- // final double y1 = labelPos.getY();
- // g2d.draw(new Ellipse2D.Double(x1 - 1, y1 - 1, 3, 3));
- // drawRectCentered(g2d, labelPos, labelDim);
- drawRect(g2d, labelPos, labelDim);
- }
-
- g2d.setColor(Color.RED);
- for (Path p : paths) {
- p.getDotPath().draw(g2d, 0, 0);
- }
-
- for (Cluster sub : root.getSubClusters()) {
- new SimpleDrawer(sub, new ArrayList()).draw(g2d);
- }
-
- }
-
- private void drawRectCentered(Graphics2D g2d, final XPoint2D pos, final XDimension2D dim) {
- final Rectangle2D rect = new Rectangle2D.Double(pos.getX() - dim.getWidth() / 2,
- pos.getY() - dim.getHeight() / 2, dim.getWidth(), dim.getHeight());
- g2d.draw(rect);
- }
-
- private void drawRect(Graphics2D g2d, final XPoint2D pos, final XDimension2D dim) {
- final Rectangle2D rect = new Rectangle2D.Double(pos.getX(), pos.getY(), dim.getWidth(), dim.getHeight());
- g2d.draw(rect);
- }
-}
diff --git a/src/net/sourceforge/plantuml/posimo/TwoLinesIntersection.java b/src/net/sourceforge/plantuml/posimo/TwoLinesIntersection.java
deleted file mode 100644
index 069eb5825..000000000
--- a/src/net/sourceforge/plantuml/posimo/TwoLinesIntersection.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/* ========================================================================
- * PlantUML : a free UML diagram generator
- * ========================================================================
- *
- * (C) Copyright 2009-2024, Arnaud Roques
- *
- * Project Info: https://plantuml.com
- *
- * If you like this project or if you find it useful, you can support us at:
- *
- * https://plantuml.com/patreon (only 1$ per month!)
- * https://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.posimo;
-
-import java.awt.geom.Line2D;
-
-import net.sourceforge.plantuml.klimt.geom.XPoint2D;
-
-public class TwoLinesIntersection {
-
- private final XPoint2D inter;
-
- public TwoLinesIntersection(Line2D lineA, Line2D lineB) {
- final double x1 = lineA.getX1();
- final double y1 = lineA.getY1();
- final double x2 = lineA.getX2();
- final double y2 = lineA.getY2();
- final double x3 = lineB.getX1();
- final double y3 = lineB.getY1();
- final double x4 = lineB.getX2();
- final double y4 = lineB.getY2();
-
- final double den = (y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1);
-
- final double uA1 = (x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3);
- final double uA = uA1 / den;
-
- // final double uB1 = (x2 - x1) * (y1 - y3) - (y2 - y1) * (x1 - x3);
- // uB = uB1 / den;
-
- final double x = x1 + uA * (x2 - x1);
- final double y = y1 + uA * (y2 - y1);
-
- inter = new XPoint2D(x, y);
- }
-
- public final XPoint2D getIntersection() {
- return inter;
- }
-
-}
diff --git a/src/net/sourceforge/plantuml/posimo/package-info.java b/src/net/sourceforge/plantuml/posimo/package-info.java
new file mode 100644
index 000000000..24e3131d9
--- /dev/null
+++ b/src/net/sourceforge/plantuml/posimo/package-info.java
@@ -0,0 +1,6 @@
+/**
+ * Provides classes used to manage
+ * Positioning Calculation.
+ *
+ */
+package net.sourceforge.plantuml.posimo;
diff --git a/src/net/sourceforge/plantuml/posimo/readme.md b/src/net/sourceforge/plantuml/posimo/readme.md
new file mode 100644
index 000000000..f9e2e8596
--- /dev/null
+++ b/src/net/sourceforge/plantuml/posimo/readme.md
@@ -0,0 +1,42 @@
+# Directory Documentation for `posimo`
+
+## Description
+This package provides classes used to manage Positioning Calculation.
+
+## Diagram
+
+```mermaid
+classDiagram
+class Positionable {
+ + Dimension2D getSize();
+ + Point2D getPosition();
+}
+
+class Clusterable {
+ +Cluster getParent();
+}
+
+Positionable <|-- Clusterable
+
+class Cluster
+
+Cluster *-- Cluster : subclusters
+Clusterable <|.. Cluster
+Cluster *-- Block
+Clusterable <|.. Block
+
+Path *-- "2" Cluster
+Path --> Label : has one
+Positionable <|-- Label
+
+SimpleDrawer --> Cluster
+SimpleDrawer *--> Path
+
+class GraphvizSolver {
+ + Dimension2D solve(Cluster root, Collection~Path~ paths)
+}
+GraphvizSolver --> Cluster
+GraphvizSolver *--> Path
+```
+
+_(src: [`data.txt`](./data.txt))_
\ No newline at end of file
diff --git a/src/net/sourceforge/plantuml/preproc/package-info.java b/src/net/sourceforge/plantuml/preproc/package-info.java
new file mode 100644
index 000000000..6178bc926
--- /dev/null
+++ b/src/net/sourceforge/plantuml/preproc/package-info.java
@@ -0,0 +1,10 @@
+/**
+ * Provides classes used to manage
+ *
+ * Preprocessing of PlantUML input.
+ *
+ * @see net.sourceforge.plantuml.preproc2
+ * @see net.sourceforge.plantuml.tim
+ *
+ */
+package net.sourceforge.plantuml.preproc;
diff --git a/src/net/sourceforge/plantuml/preproc/readme.md b/src/net/sourceforge/plantuml/preproc/readme.md
new file mode 100644
index 000000000..a2495b44a
--- /dev/null
+++ b/src/net/sourceforge/plantuml/preproc/readme.md
@@ -0,0 +1,10 @@
+# Directory Documentation for `preproc`
+
+## Description
+This package provides classes used to manage [PlantUML Preprocessing](https://plantuml.com/preprocessing).
+
+## See also
+### [Legacy] Preprocessing (directory)
+- [`preproc2`](../preproc2/)
+### Current Preprocessing (directory)
+- [`tim`](../tim/)
diff --git a/src/net/sourceforge/plantuml/preproc2/package-info.java b/src/net/sourceforge/plantuml/preproc2/package-info.java
new file mode 100644
index 000000000..f65a48f77
--- /dev/null
+++ b/src/net/sourceforge/plantuml/preproc2/package-info.java
@@ -0,0 +1,10 @@
+/**
+ * Provides classes used to manage
+ *
+ * Preprocessing of PlantUML input.
+ *
+ * @see net.sourceforge.plantuml.preproc
+ * @see net.sourceforge.plantuml.tim
+ *
+ */
+package net.sourceforge.plantuml.preproc2;
diff --git a/src/net/sourceforge/plantuml/preproc2/readme.md b/src/net/sourceforge/plantuml/preproc2/readme.md
new file mode 100644
index 000000000..2bb26f68f
--- /dev/null
+++ b/src/net/sourceforge/plantuml/preproc2/readme.md
@@ -0,0 +1,10 @@
+# Directory Documentation for `preproc`
+
+## Description
+This package provides classes used to manage [PlantUML Preprocessing](https://plantuml.com/preprocessing).
+
+## See also
+### [Legacy] Preprocessing (directory)
+- [`preproc`](../preproc/)
+### Current Preprocessing (directory)
+- [`tim`](../tim/)
diff --git a/src/net/sourceforge/plantuml/project/GanttDiagram.java b/src/net/sourceforge/plantuml/project/GanttDiagram.java
index 3690ed306..fdc8a18c0 100644
--- a/src/net/sourceforge/plantuml/project/GanttDiagram.java
+++ b/src/net/sourceforge/plantuml/project/GanttDiagram.java
@@ -662,7 +662,7 @@ public class GanttDiagram extends TitledDiagram implements ToTaskDraw, WithSprit
return colorSet;
}
- public void setStartingDate(Day start) {
+ public void setProjectStartingDate(Day start) {
openClose.setStartingDay(start);
this.min = start;
}
diff --git a/src/net/sourceforge/plantuml/project/draw/TimeHeaderCalendar.java b/src/net/sourceforge/plantuml/project/draw/TimeHeaderCalendar.java
index fcfba52e1..3d8274958 100644
--- a/src/net/sourceforge/plantuml/project/draw/TimeHeaderCalendar.java
+++ b/src/net/sourceforge/plantuml/project/draw/TimeHeaderCalendar.java
@@ -53,6 +53,10 @@ public abstract class TimeHeaderCalendar extends TimeHeader {
this.thParam = thParam;
}
+ protected final boolean isBold(Day wink) {
+ return thParam.getVerticalSeparatorBefore().contains(wink);
+ }
+
protected final Locale locale() {
return thParam.getLocale();
}
diff --git a/src/net/sourceforge/plantuml/project/draw/TimeHeaderDaily.java b/src/net/sourceforge/plantuml/project/draw/TimeHeaderDaily.java
index b8d509444..8fd5bf794 100644
--- a/src/net/sourceforge/plantuml/project/draw/TimeHeaderDaily.java
+++ b/src/net/sourceforge/plantuml/project/draw/TimeHeaderDaily.java
@@ -36,7 +36,6 @@
package net.sourceforge.plantuml.project.draw;
import java.util.Map;
-import java.util.Set;
import net.sourceforge.plantuml.klimt.UTranslate;
import net.sourceforge.plantuml.klimt.color.HColor;
@@ -59,16 +58,10 @@ public class TimeHeaderDaily extends TimeHeaderCalendar {
}
private final Map nameDays;
- private final Set verticalSeparators;
public TimeHeaderDaily(TimeHeaderParameters thParam, Map nameDays, Day printStart, Day printEnd) {
super(thParam, new TimeScaleDaily(thParam.getStartingDay(), thParam.getScale(), printStart));
this.nameDays = nameDays;
- this.verticalSeparators = thParam.getVerticalSeparatorBefore();
- }
-
- private boolean isBold(Day wink) {
- return verticalSeparators.contains(wink);
}
@Override
diff --git a/src/net/sourceforge/plantuml/project/draw/TimeHeaderMonthly.java b/src/net/sourceforge/plantuml/project/draw/TimeHeaderMonthly.java
index 6b8fab7ed..d8d6e2d67 100644
--- a/src/net/sourceforge/plantuml/project/draw/TimeHeaderMonthly.java
+++ b/src/net/sourceforge/plantuml/project/draw/TimeHeaderMonthly.java
@@ -62,11 +62,19 @@ public class TimeHeaderMonthly extends TimeHeaderCalendar {
drawTextsBackground(ug, totalHeightWithoutFooter);
drawYears(ug);
drawMonths(ug.apply(UTranslate.dy(16)));
+ printSmallVbars(ug, totalHeightWithoutFooter);
drawHline(ug, 0);
drawHline(ug, 16);
drawHline(ug, getFullHeaderHeight());
}
+ private void printSmallVbars(final UGraphic ug, double totalHeightWithoutFooter) {
+ for (Day wink = min; wink.compareTo(max) <= 0; wink = wink.increment())
+ if (isBold(wink))
+ drawVbar(ug, getTimeScale().getStartingPosition(wink), getFullHeaderHeight(), totalHeightWithoutFooter,
+ isBold(wink));
+ }
+
@Override
public void drawTimeFooter(UGraphic ug) {
ug = ug.apply(UTranslate.dy(3));
diff --git a/src/net/sourceforge/plantuml/project/draw/TimeHeaderQuarterly.java b/src/net/sourceforge/plantuml/project/draw/TimeHeaderQuarterly.java
index 9987b97d1..dcf03c017 100644
--- a/src/net/sourceforge/plantuml/project/draw/TimeHeaderQuarterly.java
+++ b/src/net/sourceforge/plantuml/project/draw/TimeHeaderQuarterly.java
@@ -62,11 +62,19 @@ public class TimeHeaderQuarterly extends TimeHeaderCalendar {
drawTextsBackground(ug, totalHeightWithoutFooter);
drawYears(ug);
drawQuarters(ug.apply(UTranslate.dy(16)));
+ printSmallVbars(ug, totalHeightWithoutFooter);
drawHline(ug, 0);
drawHline(ug, 16);
drawHline(ug, getFullHeaderHeight());
}
+ private void printSmallVbars(final UGraphic ug, double totalHeightWithoutFooter) {
+ for (Day wink = min; wink.compareTo(max) <= 0; wink = wink.increment())
+ if (isBold(wink))
+ drawVbar(ug, getTimeScale().getStartingPosition(wink), getFullHeaderHeight(), totalHeightWithoutFooter,
+ isBold(wink));
+ }
+
@Override
public void drawTimeFooter(UGraphic ug) {
ug = ug.apply(UTranslate.dy(3));
diff --git a/src/net/sourceforge/plantuml/project/draw/TimeHeaderWeekly.java b/src/net/sourceforge/plantuml/project/draw/TimeHeaderWeekly.java
index 6f39d8bb9..aa8374632 100644
--- a/src/net/sourceforge/plantuml/project/draw/TimeHeaderWeekly.java
+++ b/src/net/sourceforge/plantuml/project/draw/TimeHeaderWeekly.java
@@ -108,12 +108,17 @@ public class TimeHeaderWeekly extends TimeHeaderCalendar {
}
private void printSmallVbars(final UGraphic ug, double totalHeightWithoutFooter) {
- for (Day wink = min; wink.compareTo(max) <= 0; wink = wink.increment()) {
- if (wink.getDayOfWeek() == weekNumberStrategy.getFirstDayOfWeek()) {
+ for (Day wink = min; wink.compareTo(max) <= 0; wink = wink.increment())
+ if (wink.getDayOfWeek() == weekNumberStrategy.getFirstDayOfWeek())
drawVbar(ug, getTimeScale().getStartingPosition(wink), Y_POS_ROW16(), totalHeightWithoutFooter, false);
- }
- }
+
drawVbar(ug, getTimeScale().getEndingPosition(max), Y_POS_ROW16(), totalHeightWithoutFooter, false);
+
+ for (Day wink = min; wink.compareTo(max) <= 0; wink = wink.increment())
+ if (isBold(wink))
+ drawVbar(ug, getTimeScale().getStartingPosition(wink), getFullHeaderHeight(), totalHeightWithoutFooter,
+ isBold(wink));
+
}
private void printDaysOfMonth(final UGraphic ug) {
diff --git a/src/net/sourceforge/plantuml/project/draw/TimeHeaderYearly.java b/src/net/sourceforge/plantuml/project/draw/TimeHeaderYearly.java
index 81db29918..9d537fd41 100644
--- a/src/net/sourceforge/plantuml/project/draw/TimeHeaderYearly.java
+++ b/src/net/sourceforge/plantuml/project/draw/TimeHeaderYearly.java
@@ -61,10 +61,18 @@ public class TimeHeaderYearly extends TimeHeaderCalendar {
public void drawTimeHeader(final UGraphic ug, double totalHeightWithoutFooter) {
drawTextsBackground(ug, totalHeightWithoutFooter);
drawYears(ug);
+ printSmallVbars(ug, totalHeightWithoutFooter);
drawHline(ug, 0);
drawHline(ug, getFullHeaderHeight());
}
+ private void printSmallVbars(final UGraphic ug, double totalHeightWithoutFooter) {
+ for (Day wink = min; wink.compareTo(max) <= 0; wink = wink.increment())
+ if (isBold(wink))
+ drawVbar(ug, getTimeScale().getStartingPosition(wink), getFullHeaderHeight(), totalHeightWithoutFooter,
+ isBold(wink));
+ }
+
@Override
public void drawTimeFooter(UGraphic ug) {
ug = ug.apply(UTranslate.dy(3));
diff --git a/src/net/sourceforge/plantuml/project/lang/SentenceTaskEndsAbsolute.java b/src/net/sourceforge/plantuml/project/lang/SentenceTaskEndsAbsolute.java
index 101c186de..484f7a41b 100644
--- a/src/net/sourceforge/plantuml/project/lang/SentenceTaskEndsAbsolute.java
+++ b/src/net/sourceforge/plantuml/project/lang/SentenceTaskEndsAbsolute.java
@@ -50,11 +50,11 @@ public class SentenceTaskEndsAbsolute extends SentenceSimple {
public CommandExecutionResult execute(GanttDiagram project, Object subject, Object complement) {
final Task task = (Task) subject;
final Day end = (Day) complement;
-// final Day startingDate = project.getStartingDate();
-// if (startingDate == null) {
-// return CommandExecutionResult.error("No starting date for the project");
-// }
+ final Day startingDate = project.getStartingDate();
+ if (startingDate.getAbsoluteDayNum() == 0)
+ return CommandExecutionResult.error("No starting date for the project");
task.setEnd(end);
+
return CommandExecutionResult.ok();
}
diff --git a/src/net/sourceforge/plantuml/project/lang/SentenceTaskStarts.java b/src/net/sourceforge/plantuml/project/lang/SentenceTaskStarts.java
index 029b7d625..8737f4020 100644
--- a/src/net/sourceforge/plantuml/project/lang/SentenceTaskStarts.java
+++ b/src/net/sourceforge/plantuml/project/lang/SentenceTaskStarts.java
@@ -56,10 +56,10 @@ public class SentenceTaskStarts extends SentenceSimple {
HColor color = null;
when = (TaskInstant) complement;
task.setStart(when.getInstantPrecise());
- if (when.isTask()) {
+ if (when.isTask())
project.addContraint(new GanttConstraint(project.getIHtmlColorSet(), project.getCurrentStyleBuilder(), when,
new TaskInstant(task, TaskAttribute.START), color));
- }
+
return CommandExecutionResult.ok();
};
diff --git a/src/net/sourceforge/plantuml/project/lang/SentenceTaskStartsAbsolute.java b/src/net/sourceforge/plantuml/project/lang/SentenceTaskStartsAbsolute.java
index daa316ebe..e535412e0 100644
--- a/src/net/sourceforge/plantuml/project/lang/SentenceTaskStartsAbsolute.java
+++ b/src/net/sourceforge/plantuml/project/lang/SentenceTaskStartsAbsolute.java
@@ -50,10 +50,10 @@ public class SentenceTaskStartsAbsolute extends SentenceSimple {
public CommandExecutionResult execute(GanttDiagram project, Object subject, Object complement) {
final Task task = (Task) subject;
final Day start = (Day) complement;
-// final Day startingDate = project.getStartingDate();
-// if (startingDate == null) {
-// return CommandExecutionResult.error("No starting date for the project");
-// }
+ final Day startingDate = project.getStartingDate();
+ if (startingDate.getAbsoluteDayNum() == 0)
+ project.setProjectStartingDate(start);
+
task.setStart(start);
return CommandExecutionResult.ok();
}
diff --git a/src/net/sourceforge/plantuml/project/lang/SubjectProject.java b/src/net/sourceforge/plantuml/project/lang/SubjectProject.java
index a31264131..7b7a29c4d 100644
--- a/src/net/sourceforge/plantuml/project/lang/SubjectProject.java
+++ b/src/net/sourceforge/plantuml/project/lang/SubjectProject.java
@@ -75,7 +75,7 @@ public class SubjectProject implements Subject {
public CommandExecutionResult execute(GanttDiagram project, Object subject, Object complement) {
final Day start = (Day) complement;
assert project == subject;
- project.setStartingDate(start);
+ project.setProjectStartingDate(start);
return CommandExecutionResult.ok();
}
diff --git a/src/net/sourceforge/plantuml/project/package-info.java b/src/net/sourceforge/plantuml/project/package-info.java
new file mode 100644
index 000000000..4b5d58947
--- /dev/null
+++ b/src/net/sourceforge/plantuml/project/package-info.java
@@ -0,0 +1,7 @@
+/**
+ * Provides classes used to manage
+ *
+ * Gantt Diagram.
+ *
+ */
+package net.sourceforge.plantuml.project;
diff --git a/src/net/sourceforge/plantuml/project/readme.md b/src/net/sourceforge/plantuml/project/readme.md
new file mode 100644
index 000000000..aecf0ce87
--- /dev/null
+++ b/src/net/sourceforge/plantuml/project/readme.md
@@ -0,0 +1,10 @@
+# Directory Documentation for `project`
+
+## Description
+This package provides classes used to manage [PlantUML Gantt Diagram](https://plantuml.com/gantt-diagram).
+
+## Link
+- [Gantt Diagram](https://plantuml.com/gantt-diagram)
+
+## Reference
+- [Gantt chart _(on Wikipedia)_](https://en.wikipedia.org/wiki/Gantt_chart)
diff --git a/src/net/sourceforge/plantuml/quantization/ArbitraryComparator.java b/src/net/sourceforge/plantuml/quantization/ArbitraryComparator.java
deleted file mode 100644
index b7105c3d4..000000000
--- a/src/net/sourceforge/plantuml/quantization/ArbitraryComparator.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (C) 2015 Square, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sourceforge.plantuml.quantization;
-
-import java.util.Comparator;
-import java.util.WeakHashMap;
-
-/**
- * Provides a stable ordering of objects, such that:
- *
- *
- * - compare(a, b) == 0 iff a == b
- * - sign(compare(a, b)) == -sign(compare(b, a))
- *
- *
- *
- * Similar to Guava's {code Ordering.arbitrary()}.
- */
-final class ArbitraryComparator implements Comparator
+ *
+ * Ref.:
+ *
+ *
+ * @see net.sourceforge.plantuml.dot
+ * @see net.sourceforge.plantuml.elk
+ * @see net.sourceforge.plantuml.sdot
+ *
+ */
+package net.sourceforge.plantuml.vizjs;
diff --git a/src/net/sourceforge/plantuml/vizjs/readme.md b/src/net/sourceforge/plantuml/vizjs/readme.md
new file mode 100644
index 000000000..6f0a052a6
--- /dev/null
+++ b/src/net/sourceforge/plantuml/vizjs/readme.md
@@ -0,0 +1,23 @@
+# Directory Documentation for `vizjs`
+
+## Description
+This package provides classes used to export diagram with the [Vizjs _(a port to Javascript of GraphViz)_](https://plantuml.com/vizjs) layout engine.
+
+## Link
+- [PlantUML Vizjs _(a port to Javascript of GraphViz)_](https://plantuml.com/vizjs)
+
+## Credit
+- :octocat: [Mdaines/Viz.js](https://github.com/mdaines/viz.js) _(not included in `plantuml/plantuml`)_
+- :octocat: [Plantuml/Vizjs](https://github.com/plantuml/vizjs) _(not included in `plantuml/plantuml`)_
+
+## See also other engines
+- [GraphViz dot](https://plantuml.com/graphviz-dot)
+ - [`plantuml/dot`](../dot/) _(included in PlantUML)_
+- [PlantUML 'Eclipse Layout Kernel (ELK)' Engine](https://plantuml.com/elk)
+ - [`elk/proxy`](./proxy/) _(included in PlantUML)_
+- [Smetana _(internal port of GraphViz in plantuml)_](https://plantuml.com/smetana02) and :octocat: [plantuml/smetana](https://github.com/plantuml/smetana)
+ - [`plantuml/sdot`](../sdot/)
+ - [`src/gen`](../../../../gen)
+ - [`src/smetana/core`](../../../../smetana/core)
+ - [`src/h`](../../../../h)
+
diff --git a/src/net/sourceforge/plantuml/wbs/package-info.java b/src/net/sourceforge/plantuml/wbs/package-info.java
new file mode 100644
index 000000000..1090fa8d2
--- /dev/null
+++ b/src/net/sourceforge/plantuml/wbs/package-info.java
@@ -0,0 +1,7 @@
+/**
+ * Provides classes used to manage
+ *
+ * WBS Diagram.
+ *
+ */
+package net.sourceforge.plantuml.wbs;
diff --git a/src/net/sourceforge/plantuml/wbs/readme.md b/src/net/sourceforge/plantuml/wbs/readme.md
new file mode 100644
index 000000000..17236856e
--- /dev/null
+++ b/src/net/sourceforge/plantuml/wbs/readme.md
@@ -0,0 +1,16 @@
+# Directory Documentation for `wbs`
+
+## Description
+This package provides classes used to manage [PlantUML WBS Diagram](https://plantuml.com/wbs-diagram).
+
+## Link
+- [WBS Diagram](https://plantuml.com/wbs-diagram)
+
+## Reference
+- [Work breakdown structure (WBS) _(on Wikipedia)_](https://en.wikipedia.org/wiki/Work_breakdown_structure)
+- [Organizational chart _(on Wikipedia)_](https://en.wikipedia.org/wiki/Organizational_chart)
+
+## Credit
+
+## Misc.
+
diff --git a/src/net/sourceforge/plantuml/windowsdot/package-info.java b/src/net/sourceforge/plantuml/windowsdot/package-info.java
new file mode 100644
index 000000000..143c50882
--- /dev/null
+++ b/src/net/sourceforge/plantuml/windowsdot/package-info.java
@@ -0,0 +1,15 @@
+/**
+ * Provides classes used to manage
+ *
+ * an Embedded Windows Graphviz dot on plantuml.
+ *
+ *
+ * The source is:
+ *
+ *
+ *
+ */
+package net.sourceforge.plantuml.windowsdot;
diff --git a/src/net/sourceforge/plantuml/windowsdot/readme.md b/src/net/sourceforge/plantuml/windowsdot/readme.md
new file mode 100644
index 000000000..d13a6a60b
--- /dev/null
+++ b/src/net/sourceforge/plantuml/windowsdot/readme.md
@@ -0,0 +1,15 @@
+# Directory Documentation for `windowsdot`
+
+## Description
+This package provides classes used to manage [an Embedded Windows Graphviz dot](https://github.com/plantuml/graphviz-distributions) on plantuml.
+
+## Link
+- ["About the `graphviz.dat` file" on BUILDING.md](/BUILDING.md#-about-the-graphvizdat-file)
+
+## Reference
+- [Graphviz](https://graphviz.org)
+- [Graphviz _(on GitLab)_](https://gitlab.com/graphviz/graphviz/)
+
+## Credit
+ - :octocat: [Plantuml/Graphviz-distributions](https://github.com/plantuml/graphviz-distributions)
+
diff --git a/src/net/sourceforge/plantuml/wire/package-info.java b/src/net/sourceforge/plantuml/wire/package-info.java
new file mode 100644
index 000000000..cb8355dbe
--- /dev/null
+++ b/src/net/sourceforge/plantuml/wire/package-info.java
@@ -0,0 +1,7 @@
+/**
+ * Provides classes used to manage
+ *
+ * Wire or Block Diagram.
+ *
+ */
+package net.sourceforge.plantuml.wire;
diff --git a/src/net/sourceforge/plantuml/wire/readme.md b/src/net/sourceforge/plantuml/wire/readme.md
new file mode 100644
index 000000000..99ced0380
--- /dev/null
+++ b/src/net/sourceforge/plantuml/wire/readme.md
@@ -0,0 +1,10 @@
+# Directory Documentation for `wire`
+
+## Description
+This package provides classes used to manage [PlantUML Wire or Block Diagram](http://alphadoc.plantuml.com/doc/markdown/en/wire-diagram).
+
+## Link
+- [PlantUML Wire or Block Diagram](http://alphadoc.plantuml.com/doc/markdown/en/wire-diagram)
+
+## Reference
+- [Wiring diagram _(on Wikipedia)_](https://en.wikipedia.org/wiki/Wiring_diagram)
diff --git a/src/net/sourceforge/plantuml/xmi/package-info.java b/src/net/sourceforge/plantuml/xmi/package-info.java
new file mode 100644
index 000000000..5867ddc05
--- /dev/null
+++ b/src/net/sourceforge/plantuml/xmi/package-info.java
@@ -0,0 +1,7 @@
+/**
+ * Provides classes used to manage
+ *
+ * XML Metadata Interchange (XMI) output format.
+ *
+ */
+package net.sourceforge.plantuml.xmi;
diff --git a/src/net/sourceforge/plantuml/xmi/readme.md b/src/net/sourceforge/plantuml/xmi/readme.md
new file mode 100644
index 000000000..9217e2271
--- /dev/null
+++ b/src/net/sourceforge/plantuml/xmi/readme.md
@@ -0,0 +1,10 @@
+# Directory Documentation for `xmi`
+
+## Description
+This package provides classes used to export diagram to a [XML Metadata Interchange (XMI)](https://plantuml.com/xmi) output format.
+
+## Link
+- [XML Metadata Interchange (XMI) output format](https://plantuml.com/xmi)
+
+## Reference
+- [XML Metadata Interchange _(on Wikipedia)_](https://en.wikipedia.org/wiki/XML_Metadata_Interchange)
diff --git a/src/net/sourceforge/plantuml/xml/package-info.java b/src/net/sourceforge/plantuml/xml/package-info.java
new file mode 100644
index 000000000..c4db224ee
--- /dev/null
+++ b/src/net/sourceforge/plantuml/xml/package-info.java
@@ -0,0 +1,8 @@
+/**
+ * Provides classes used to manage
+ * XML thread-safe lazy initialization
+ * of expensive factories
+ * with the "initialization-on-demand holder" idiom.
+ *
+ */
+package net.sourceforge.plantuml.xml;
diff --git a/src/net/sourceforge/plantuml/xml/readme.md b/src/net/sourceforge/plantuml/xml/readme.md
new file mode 100644
index 000000000..aa4a9ddc0
--- /dev/null
+++ b/src/net/sourceforge/plantuml/xml/readme.md
@@ -0,0 +1,10 @@
+# Directory Documentation for `xml`
+
+## Description
+This package provides classes used to manage XML thread-safe lazy initialization of expensive factories with the "initialization-on-demand holder" idiom.
+
+## Reference
+- [Initialization-on-demand holder idiom _(on Wikipedia)_](https://en.wikipedia.org/wiki/Initialization-on-demand_holder_idiom)
+
+## Credit or Inspiration
+- [How to implement thread-safe lazy initialization? _(on Stackoverflow)_](https://stackoverflow.com/a/8297830/1848731)
\ No newline at end of file
diff --git a/src/net/sourceforge/plantuml/xmlsc/package-info.java b/src/net/sourceforge/plantuml/xmlsc/package-info.java
new file mode 100644
index 000000000..15a575b7e
--- /dev/null
+++ b/src/net/sourceforge/plantuml/xmlsc/package-info.java
@@ -0,0 +1,7 @@
+/**
+ * Provides classes used to manage
+ *
+ * State Chart XML (SCXML) output format.
+ *
+ */
+package net.sourceforge.plantuml.xmlsc;
diff --git a/src/net/sourceforge/plantuml/xmlsc/readme.md b/src/net/sourceforge/plantuml/xmlsc/readme.md
new file mode 100644
index 000000000..d7a5c235d
--- /dev/null
+++ b/src/net/sourceforge/plantuml/xmlsc/readme.md
@@ -0,0 +1,11 @@
+# Directory Documentation for `xmlsc`
+
+## Description
+This package provides classes used to export diagram to a [State Chart XML (SCXML)](https://plantuml.com/en/command-line#458de91d76a8569c) output format.
+
+## Link
+- [SCXML output format](https://plantuml.com/en/command-line#458de91d76a8569c)
+
+## Reference
+- [SCXML _(on Wikipedia)_](https://en.wikipedia.org/wiki/SCXML)
+- [SCXML _(on W3C)_](https://www.w3.org/TR/scxml/)
diff --git a/src/net/sourceforge/plantuml/yaml/package-info.java b/src/net/sourceforge/plantuml/yaml/package-info.java
new file mode 100644
index 000000000..d13069d1b
--- /dev/null
+++ b/src/net/sourceforge/plantuml/yaml/package-info.java
@@ -0,0 +1,7 @@
+/**
+ * Provides classes used to manage
+ *
+ * YAML Diagram.
+ *
+ */
+package net.sourceforge.plantuml.yaml;
diff --git a/src/net/sourceforge/plantuml/yaml/readme.md b/src/net/sourceforge/plantuml/yaml/readme.md
new file mode 100644
index 000000000..213a3f9f4
--- /dev/null
+++ b/src/net/sourceforge/plantuml/yaml/readme.md
@@ -0,0 +1,15 @@
+# Directory Documentation for `yaml`
+
+## Description
+This package provides classes used to manage [PlantUML YAML Diagram](https://plantuml.com/yaml).
+
+## Link
+- [PlantUML YAML Diagram](https://plantuml.com/yaml)
+
+## Reference
+- [YAML _(on Wikipedia)_](https://en.wikipedia.org/wiki/YAML)
+
+## Credit
+
+## Misc.
+
diff --git a/src/net/sourceforge/plantuml/zopfli/package-info.java b/src/net/sourceforge/plantuml/zopfli/package-info.java
new file mode 100644
index 000000000..ac248aecd
--- /dev/null
+++ b/src/net/sourceforge/plantuml/zopfli/package-info.java
@@ -0,0 +1,18 @@
+/**
+ * Provides classes used to manage
+ *
+ * Zopfli Compression Algorithm.
+ *
+ *
+ * The code is taken from:
+ *
+ *
+ *
+ * @see net.sourceforge.plantuml.brotli
+ * @see net.sourceforge.plantuml.code.deflate
+ *
+ */
+package net.sourceforge.plantuml.zopfli;
diff --git a/src/net/sourceforge/plantuml/zopfli/readme.md b/src/net/sourceforge/plantuml/zopfli/readme.md
new file mode 100644
index 000000000..91fc1986f
--- /dev/null
+++ b/src/net/sourceforge/plantuml/zopfli/readme.md
@@ -0,0 +1,18 @@
+# Directory Documentation for `zopfli`
+
+## Description
+This package provides classes used to manage [CafeUndZopfli Compression Algorithm](https://github.com/eustas/CafeUndZopfli).
+
+## Link
+- :octocat: [Eustas/CafeUndZopfli](https://github.com/eustas/CafeUndZopfli)
+
+## Reference
+- [Zopfli _(on Wikipedia)_](https://en.wikipedia.org/wiki/Zopfli)
+- :octocat: [Google/Zopfli](https://github.com/google/zopfli)
+
+## Credit
+- :octocat: [Eustas/CafeUndZopfli](https://github.com/eustas/CafeUndZopfli)
+
+## Misc.
+- [Zopf _(on Wikipedia)_](https://als.wikipedia.org/wiki/Zopf) _[als]_
+- [Zopf _(on Wikipedia)_](https://en.wikipedia.org/wiki/Zopf) _[en]_
diff --git a/src/smetana/core/package-info.java b/src/smetana/core/package-info.java
new file mode 100644
index 000000000..05aa05a4f
--- /dev/null
+++ b/src/smetana/core/package-info.java
@@ -0,0 +1,15 @@
+/**
+ * This package is part of Smetana:
+ * the internal port (from C
to Java
)
+ * of GraphViz/Dot
+ * in plantuml.
+ *
+ * @see h
+ * @see gen
+ * @see gen.annotation
+ * @see gen.lib
+ * @see gen.plugin.dot_layout
+ * @see net.sourceforge.plantuml.sdot
+ *
+ */
+package smetana.core;
diff --git a/src/smetana/core/readme.md b/src/smetana/core/readme.md
new file mode 100644
index 000000000..fb32b53cc
--- /dev/null
+++ b/src/smetana/core/readme.md
@@ -0,0 +1,28 @@
+# Directory Documentation for `core`
+
+## Description
+This package is part of Smetana: the internal port (from `C` to `Java`) of [GraphViz/Dot](https://graphviz.org) in [plantuml](https://plantuml.com/smetana02).
+
+## Link
+- [Smetana](https://plantuml.com/smetana02) and :octocat: [plantuml/smetana](https://github.com/plantuml/smetana)
+ - [`src/h`](../h)
+ - [`src/gen`](../gen)
+ - [`src/smetana/core`](../smetana/core)
+
+## Reference
+- [Graphviz](https://graphviz.org)
+- [Graphviz DOT Language](https://www.graphviz.org/doc/info/lang.html)
+- [Graphviz _(on GitLab)_](https://gitlab.com/graphviz/graphviz/)
+- [Graphviz _(on Wikipedia)_](https://en.wikipedia.org/wiki/Graphviz)
+
+## Credit
+- :octocat: [plantuml/smetana](https://github.com/plantuml/smetana)
+
+## Internaly use by
+- [`plantuml/sdot`](../net/sourceforge/plantuml/sdot)
+- [`plantuml/gitlog/SmetanaForGit.java`](../net/sourceforge/plantuml/gitlog/SmetanaForGit.java)
+- [`plantuml/jsondiagram/SmetanaForJson.java`](../net/sourceforge/plantuml/jsondiagram/SmetanaForJson.java)
+
+## Misc.
+- [BedΕich Smetana _(on Wikipedia)_](https://en.wikipedia.org/wiki/Bed%C5%99ich_Smetana)
+- [Smetana _(on Wikipedia)_](https://en.wikipedia.org/wiki/Smetana_(disambiguation))
diff --git a/stdlib/c4-abx.repx b/stdlib/c4-abx.repx
index 68f447b74..24cd069ab 100644
Binary files a/stdlib/c4-abx.repx and b/stdlib/c4-abx.repx differ
diff --git a/test/net/sourceforge/plantuml/PipeTest.java b/test/net/sourceforge/plantuml/PipeTest.java
index d88c0cca7..a975bf26c 100644
--- a/test/net/sourceforge/plantuml/PipeTest.java
+++ b/test/net/sourceforge/plantuml/PipeTest.java
@@ -217,12 +217,15 @@ class PipeTest {
}
@ParameterizedTest
- @ValueSource(strings = { "ab\nc", // *nix, macOsX
+ @ValueSource(strings = {
+ "ab\nc", // *nix, macOsX
"ab\rc", // pre-macOsX macs
"ab\r\nc", // Windows
// the case \n\r is handled as 2 new lines, thus not added
-
- "ab\nc\n", "ab\nc\r", "ab\nc\r\n" })
+ "ab\nc\n",
+ "ab\nc\r",
+ "ab\nc\r\n"
+ })
void should_readFirstDiagram_decode_correctly_different_line_endings(String input) throws IOException {
pipe = new Pipe(option, null, new ByteArrayInputStream(input.getBytes(UTF_8)), UTF_8.name());
@@ -247,6 +250,13 @@ class PipeTest {
l.add(InputExpected.of("this-is-garbage\n@startuml\nab\rcde\n@enduml\nthis-is-garbage\n",
"@startuml\nab\ncde\n@enduml\n"));
l.add(InputExpected.of("@startwhatever\nab\rcde\n@endwhatever", "@startwhatever\nab\ncde\n@endwhatever\n"));
+ l.add(InputExpected.of("@start\nab\rcde\n@end", "@start\nab\ncde\n@end\n"));
+ l.add(InputExpected.of("@startX\nab\rcde\n@endX", "@startX\nab\ncde\n@endX\n"));
+ l.add(InputExpected.of("@startXY\nab\rcde\n@endXY", "@startXY\nab\ncde\n@endXY\n"));
+ l.add(InputExpected.of("@startXYZ\nab\rcde\n@endXYZ", "@startXYZ\nab\ncde\n@endXYZ\n"));
+ l.add(InputExpected.of("@start1\nab\rcde\n@end1", "@start1\nab\ncde\n@end1\n"));
+ l.add(InputExpected.of("@start12\nab\rcde\n@end12", "@start12\nab\ncde\n@end12\n"));
+ l.add(InputExpected.of("@start123\nab\rcde\n@end123", "@start123\nab\ncde\n@end123\n"));
return l;
}
@@ -274,6 +284,14 @@ class PipeTest {
l.add(InputExpected.of("this-is-garbage\n@startuml\nab\rcde\n@enduml\nthis-is-garbage\n",
"@startuml\nab\ncde\n@enduml\n"));
l.add(InputExpected.of("@startwhatever\nab\rcde\n@endwhatever", "@startwhatever\nab\ncde\n@endwhatever\n"));
+ l.add(InputExpected.of("@start\nab\rcde\n@end", "@start\nab\ncde\n@end\n"));
+
+ l.add(InputExpected.of("@startX\nab\rcde\n@endX", "@startX\nab\ncde\n@endX\n"));
+ l.add(InputExpected.of("@startXY\nab\rcde\n@endXY", "@startXY\nab\ncde\n@endXY\n"));
+ l.add(InputExpected.of("@startXYZ\nab\rcde\n@endXYZ", "@startXYZ\nab\ncde\n@endXYZ\n"));
+ l.add(InputExpected.of("@start1\nab\rcde\n@end1", "@start1\nab\ncde\n@end1\n"));
+ l.add(InputExpected.of("@start12\nab\rcde\n@end12", "@start12\nab\ncde\n@end12\n"));
+ l.add(InputExpected.of("@start123\nab\rcde\n@end123", "@start123\nab\ncde\n@end123\n"));
return l;
}
diff --git a/test/net/sourceforge/plantuml/picoweb/PicoWebServerTest.java b/test/net/sourceforge/plantuml/picoweb/PicoWebServerTest.java
index cdd9285c3..df2bce9cc 100644
--- a/test/net/sourceforge/plantuml/picoweb/PicoWebServerTest.java
+++ b/test/net/sourceforge/plantuml/picoweb/PicoWebServerTest.java
@@ -197,13 +197,13 @@ public class PicoWebServerTest {
response = httpPostJson("/render", renderRequestJson("@startuml", "-ttxt"));
assert response.getResponseCode() == 200;
- assert response.getHeaderField("X-PlantUML-Diagram-Error").equals("No @startuml/@enduml found");
+ assert response.getHeaderField("X-PlantUML-Diagram-Error").equals("No valid @start/@end found, please check the version");
assert response.getHeaderField("X-PlantUML-Diagram-Error-Line").equals("0");
assert response.getContentType().equals("text/plain");
assert readStreamAsString(response.getInputStream()).equals("" +
" \n" +
" \n" +
- " No @startuml/@enduml found\n"
+ " No valid @start/@end found, please check the version\n"
);
response = httpPostJson("/render", "");
diff --git a/test/net/sourceforge/plantuml/test/JunitUtils.java b/test/net/sourceforge/plantuml/test/JunitUtils.java
new file mode 100644
index 000000000..8064ba1fc
--- /dev/null
+++ b/test/net/sourceforge/plantuml/test/JunitUtils.java
@@ -0,0 +1,26 @@
+package net.sourceforge.plantuml.test;
+
+import org.junit.jupiter.params.converter.ArgumentConversionException;
+import org.junit.jupiter.params.converter.SimpleArgumentConverter;
+
+import net.sourceforge.plantuml.json.Json;
+import net.sourceforge.plantuml.json.JsonValue;
+
+/**
+ * Class to help test with `Junit`.
+ */
+public class JunitUtils {
+ /**
+ * `StringJsonConverter` class to use with `@ConvertWith`.
+ */
+ public static class StringJsonConverter extends SimpleArgumentConverter {
+ @Override
+ protected Object convert(Object source, Class> targetType) throws ArgumentConversionException {
+ if (source instanceof String)
+ return (JsonValue) Json.parse((String) source);
+ else
+ throw new IllegalArgumentException("Conversion from " + source.getClass() + " to "
+ + targetType + " not supported.");
+ }
+ }
+}
\ No newline at end of file
diff --git a/test/net/sourceforge/plantuml/tim/TimTestUtils.java b/test/net/sourceforge/plantuml/tim/TimTestUtils.java
new file mode 100644
index 000000000..81993d3a2
--- /dev/null
+++ b/test/net/sourceforge/plantuml/tim/TimTestUtils.java
@@ -0,0 +1,43 @@
+package net.sourceforge.plantuml.tim;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import java.util.Collections;
+import java.util.List;
+
+import net.sourceforge.plantuml.tim.expression.TValue;
+import net.sourceforge.plantuml.json.JsonValue;
+
+/**
+ * Class to help test of `tim/stdlib`.
+ */
+public class TimTestUtils {
+
+ // Tfunc: () -> (String)
+ public static void assertTimExpectedOutput(TFunction func, String expected) throws EaterException, EaterExceptionLocated {
+ TValue tValue = func.executeReturnFunction(null, null, null, null, null);
+ assertEquals(expected, tValue.toString());
+ }
+
+ // Tfunc: (Integer) -> (String)
+ public static void assertTimExpectedOutputFromInput(TFunction func, Integer input, String expected) throws EaterException, EaterExceptionLocated {
+ List values = Collections.singletonList(TValue.fromInt(input));
+ TValue tValue = func.executeReturnFunction(null, null, null, values, null);
+ assertEquals(expected, tValue.toString());
+ }
+
+ // Tfunc: (String) -> (String)
+ public static void assertTimExpectedOutputFromInput(TFunction func, String input, String expected) throws EaterException, EaterExceptionLocated {
+ List values = Collections.singletonList(TValue.fromString(input));
+ TValue tValue = func.executeReturnFunction(null, null, null, values, null);
+ assertEquals(expected, tValue.toString());
+ }
+
+ // Tfunc: (JsonValue) -> (String)
+ public static void assertTimExpectedOutputFromInput(TFunction func, JsonValue input, String expected) throws EaterException, EaterExceptionLocated {
+ List values = Collections.singletonList(TValue.fromJson(input));
+ TValue tValue = func.executeReturnFunction(null, null, null, values, null);
+ assertEquals(expected, tValue.toString());
+ }
+
+}
\ No newline at end of file
diff --git a/test/net/sourceforge/plantuml/tim/stdlib/AlwaysFalseTest.java b/test/net/sourceforge/plantuml/tim/stdlib/AlwaysFalseTest.java
new file mode 100644
index 000000000..addb2050c
--- /dev/null
+++ b/test/net/sourceforge/plantuml/tim/stdlib/AlwaysFalseTest.java
@@ -0,0 +1,50 @@
+package net.sourceforge.plantuml.tim.stdlib;
+
+import static net.sourceforge.plantuml.tim.TimTestUtils.assertTimExpectedOutput;
+import static net.sourceforge.plantuml.tim.TimTestUtils.assertTimExpectedOutputFromInput;
+
+import org.junit.jupiter.api.DisplayNameGenerator.ReplaceUnderscores;
+import org.junit.jupiter.api.IndicativeSentencesGeneration;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.converter.ConvertWith;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.CsvSource;
+
+import net.sourceforge.plantuml.tim.EaterException;
+import net.sourceforge.plantuml.tim.EaterExceptionLocated;
+import net.sourceforge.plantuml.tim.TFunction;
+
+/**
+ * Tests the builtin function.
+ */
+@IndicativeSentencesGeneration(separator = ": ", generator = ReplaceUnderscores.class)
+
+class AlwaysFalseTest {
+ TFunction cut = new AlwaysFalse();
+ final String cutName = "AlwaysFalse";
+
+ @Test
+ void Test_without_Param() throws EaterException, EaterExceptionLocated {
+ assertTimExpectedOutput(cut, "0");
+ }
+
+ @ParameterizedTest(name = "[{index}] " + cutName + "(''{0}'') = {1}")
+ @CsvSource(nullValues = "null", value = {
+ " 0 , 0 ",
+ " 1 , 0 ",
+ " 'a' , 0 ",
+ })
+ void Test_with_String(String input, String expected) throws EaterException, EaterExceptionLocated {
+ assertTimExpectedOutputFromInput(cut, input, expected);
+ }
+
+ @ParameterizedTest(name = "[{index}] " + cutName + "({0}) = {1}")
+ @CsvSource(nullValues = "null", value = {
+ " 0 , 0 ",
+ " 1 , 0 ",
+ " 123 , 0 ",
+ })
+ void Test_with_Integer(Integer input, String expected) throws EaterException, EaterExceptionLocated {
+ assertTimExpectedOutputFromInput(cut, input, expected);
+ }
+}
diff --git a/test/net/sourceforge/plantuml/tim/stdlib/AlwaysTrueTest.java b/test/net/sourceforge/plantuml/tim/stdlib/AlwaysTrueTest.java
new file mode 100644
index 000000000..439bde93d
--- /dev/null
+++ b/test/net/sourceforge/plantuml/tim/stdlib/AlwaysTrueTest.java
@@ -0,0 +1,50 @@
+package net.sourceforge.plantuml.tim.stdlib;
+
+import static net.sourceforge.plantuml.tim.TimTestUtils.assertTimExpectedOutput;
+import static net.sourceforge.plantuml.tim.TimTestUtils.assertTimExpectedOutputFromInput;
+
+import org.junit.jupiter.api.DisplayNameGenerator.ReplaceUnderscores;
+import org.junit.jupiter.api.IndicativeSentencesGeneration;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.converter.ConvertWith;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.CsvSource;
+
+import net.sourceforge.plantuml.tim.EaterException;
+import net.sourceforge.plantuml.tim.EaterExceptionLocated;
+import net.sourceforge.plantuml.tim.TFunction;
+
+/**
+ * Tests the builtin function.
+ */
+@IndicativeSentencesGeneration(separator = ": ", generator = ReplaceUnderscores.class)
+
+class AlwaysTrueTest {
+ TFunction cut = new AlwaysTrue();
+ final String cutName = "AlwaysTrue";
+
+ @Test
+ void Test_without_Param() throws EaterException, EaterExceptionLocated {
+ assertTimExpectedOutput(cut, "1");
+ }
+
+ @ParameterizedTest(name = "[{index}] " + cutName + "(''{0}'') = {1}")
+ @CsvSource(nullValues = "null", value = {
+ " 0 , 1 ",
+ " 1 , 1 ",
+ " 'a' , 1 ",
+ })
+ void Test_with_String(String input, String expected) throws EaterException, EaterExceptionLocated {
+ assertTimExpectedOutputFromInput(cut, input, expected);
+ }
+
+ @ParameterizedTest(name = "[{index}] " + cutName + "({0}) = {1}")
+ @CsvSource(nullValues = "null", value = {
+ " 0 , 1 ",
+ " 1 , 1 ",
+ " 123 , 1 ",
+ })
+ void Test_with_Integer(Integer input, String expected) throws EaterException, EaterExceptionLocated {
+ assertTimExpectedOutputFromInput(cut, input, expected);
+ }
+}
diff --git a/test/net/sourceforge/plantuml/tim/stdlib/Dec2hexTest.java b/test/net/sourceforge/plantuml/tim/stdlib/Dec2hexTest.java
new file mode 100644
index 000000000..1134c293d
--- /dev/null
+++ b/test/net/sourceforge/plantuml/tim/stdlib/Dec2hexTest.java
@@ -0,0 +1,58 @@
+package net.sourceforge.plantuml.tim.stdlib;
+
+import static net.sourceforge.plantuml.tim.TimTestUtils.assertTimExpectedOutput;
+import static net.sourceforge.plantuml.tim.TimTestUtils.assertTimExpectedOutputFromInput;
+
+import org.junit.jupiter.api.DisplayNameGenerator.ReplaceUnderscores;
+import org.junit.jupiter.api.IndicativeSentencesGeneration;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.converter.ConvertWith;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.CsvSource;
+
+import net.sourceforge.plantuml.tim.EaterException;
+import net.sourceforge.plantuml.tim.EaterExceptionLocated;
+import net.sourceforge.plantuml.tim.TFunction;
+
+/**
+ * Tests the builtin function.
+ */
+@IndicativeSentencesGeneration(separator = ": ", generator = ReplaceUnderscores.class)
+
+class Dec2hexTest {
+ TFunction cut = new Dec2hex();
+ final String cutName = "Dec2hex";
+
+ @Test
+ void Test_without_Param() throws EaterException, EaterExceptionLocated {
+ assertTimExpectedOutput(cut, "");
+ }
+
+ @ParameterizedTest(name = "[{index}] " + cutName + "(''{0}'') = {1}")
+ @CsvSource(nullValues = "null", value = {
+ " 0 , 0 ",
+ " 1 , 0 ",
+ " 10 , 0 ",
+ " 15 , 0 ",
+ " 16 , 0 ",
+ " 255 , 0 ",
+ " 65535 , 0 ",
+ })
+ void Test_with_String(String input, String expected) throws EaterException, EaterExceptionLocated {
+ assertTimExpectedOutputFromInput(cut, input, expected);
+ }
+
+ @ParameterizedTest(name = "[{index}] " + cutName + "({0}) = {1}")
+ @CsvSource(nullValues = "null", value = {
+ " 0 , 0 ",
+ " 1 , 1 ",
+ " 10 , a ",
+ " 15 , f ",
+ " 16 , 10 ",
+ " 255 , ff ",
+ " 65535 , ffff ",
+ })
+ void Test_with_Integer(Integer input, String expected) throws EaterException, EaterExceptionLocated {
+ assertTimExpectedOutputFromInput(cut, input, expected);
+ }
+}
diff --git a/test/net/sourceforge/plantuml/tim/stdlib/FeatureTest.java b/test/net/sourceforge/plantuml/tim/stdlib/FeatureTest.java
new file mode 100644
index 000000000..74bdf712a
--- /dev/null
+++ b/test/net/sourceforge/plantuml/tim/stdlib/FeatureTest.java
@@ -0,0 +1,68 @@
+package net.sourceforge.plantuml.tim.stdlib;
+
+import static net.sourceforge.plantuml.test.JunitUtils.StringJsonConverter;
+import static net.sourceforge.plantuml.tim.TimTestUtils.assertTimExpectedOutput;
+import static net.sourceforge.plantuml.tim.TimTestUtils.assertTimExpectedOutputFromInput;
+
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.DisplayNameGenerator.ReplaceUnderscores;
+import org.junit.jupiter.api.IndicativeSentencesGeneration;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.converter.ConvertWith;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.CsvSource;
+
+import net.sourceforge.plantuml.json.JsonValue;
+import net.sourceforge.plantuml.tim.EaterException;
+import net.sourceforge.plantuml.tim.EaterExceptionLocated;
+import net.sourceforge.plantuml.tim.TFunction;
+
+/**
+ * Tests the builtin function.
+ */
+@IndicativeSentencesGeneration(separator = ": ", generator = ReplaceUnderscores.class)
+
+class FeatureTest {
+ TFunction cut = new Feature();
+ final String cutName = "Feature";
+
+ @Disabled
+ @Test
+ void Test_without_Param() throws EaterException, EaterExceptionLocated {
+ assertTimExpectedOutput(cut, "0");
+ }
+
+ @ParameterizedTest(name = "[{index}] " + cutName + "(''{0}'') = {1}")
+ @CsvSource(nullValues = "null", value = {
+ " style, 1",
+ " theme, 1",
+ " Style, 1",
+ " Theme, 1",
+ " 0 , 0",
+ " 1 , 0",
+ " abc , 0",
+
+ })
+ void Test_with_String(String input, String expected) throws EaterException, EaterExceptionLocated {
+ assertTimExpectedOutputFromInput(cut, input, expected);
+ }
+
+ @ParameterizedTest(name = "[{index}] " + cutName + "({0}) = {1}")
+ @CsvSource(nullValues = "null", value = {
+ " 0, 0",
+ " 10, 0",
+ })
+ void Test_with_Integer(Integer input, String expected) throws EaterException, EaterExceptionLocated {
+ assertTimExpectedOutputFromInput(cut, input, expected);
+ }
+
+ @ParameterizedTest(name = "[{index}] " + cutName + "({0}) = {1}")
+ @CsvSource(value = {
+ " \"style\", 1",
+ " \"theme\", 1",
+ " 0, 0",
+ })
+ void Test_with_Json(@ConvertWith(StringJsonConverter.class) JsonValue input, String expected) throws EaterException, EaterExceptionLocated {
+ assertTimExpectedOutputFromInput(cut, input, expected);
+ }
+}
diff --git a/test/net/sourceforge/plantuml/tim/stdlib/GetJsonKeyTest.java b/test/net/sourceforge/plantuml/tim/stdlib/GetJsonKeyTest.java
new file mode 100644
index 000000000..c9985befd
--- /dev/null
+++ b/test/net/sourceforge/plantuml/tim/stdlib/GetJsonKeyTest.java
@@ -0,0 +1,73 @@
+package net.sourceforge.plantuml.tim.stdlib;
+
+import static net.sourceforge.plantuml.test.JunitUtils.StringJsonConverter;
+import static net.sourceforge.plantuml.tim.TimTestUtils.assertTimExpectedOutput;
+import static net.sourceforge.plantuml.tim.TimTestUtils.assertTimExpectedOutputFromInput;
+
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.DisplayNameGenerator.ReplaceUnderscores;
+import org.junit.jupiter.api.IndicativeSentencesGeneration;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.converter.ConvertWith;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.CsvSource;
+
+import net.sourceforge.plantuml.json.JsonValue;
+import net.sourceforge.plantuml.tim.EaterException;
+import net.sourceforge.plantuml.tim.EaterExceptionLocated;
+import net.sourceforge.plantuml.tim.TFunction;
+
+/**
+ * Tests the builtin function.
+ */
+@IndicativeSentencesGeneration(separator = ": ", generator = ReplaceUnderscores.class)
+
+class GetJsonKeyTest {
+ TFunction cut = new GetJsonKey();
+ final String cutName = "GetJsonKey";
+
+ @Disabled
+ @Test
+ void Test_without_Param() throws EaterException, EaterExceptionLocated {
+ assertTimExpectedOutput(cut, "0");
+ }
+
+ @Disabled // EaterException: Not JSON data
+ @ParameterizedTest(name = "[{index}] " + cutName + "(''{0}'') = {1}")
+ @CsvSource(nullValues = "null", value = {
+ " 0, Not JSON data",
+ " a, Not JSON data",
+ " -1, Not JSON data",
+ })
+ void Test_with_String(String input, String expected) throws EaterException, EaterExceptionLocated {
+ assertTimExpectedOutputFromInput(cut, input, expected);
+ }
+
+ @Disabled // EaterException: Not JSON data
+ @ParameterizedTest(name = "[{index}] " + cutName + "({0}) = {1}")
+ @CsvSource(nullValues = "null", value = {
+ " 0, Not JSON data",
+ " -1, Not JSON data",
+ })
+ void Test_with_Integer(Integer input, String expected) throws EaterException, EaterExceptionLocated {
+ assertTimExpectedOutputFromInput(cut, input, expected);
+ }
+
+ @ParameterizedTest(name = "[{index}] " + cutName + "({0}) = {1}")
+ @CsvSource(value = {
+ " [] , []",
+ " '{\"a\":[1, 2]}' , [\"a\"]",
+ " '[{\"a\":[1, 2]}]' , [\"a\"]",
+ " '{\"a\":\"abc\"}' , [\"a\"]",
+ " '[{\"a\":[1, 2]}, {\"b\":[3, 4]}]' , '[\"a\",\"b\"]'",
+ " '{\"a\":[1, 2], \"b\":\"abc\", \"b\":true}' , '[\"a\",\"b\",\"b\"]'",
+ // TODO: Manage Array with different type inside
+ // Ref.:
+ // - https://datatracker.ietf.org/doc/html/rfc8259#section-5
+ // - https://json-schema.org/understanding-json-schema/reference/array.html
+ //" '[3, \"different\", { \"types\" : \"of values\" }]', [\"types\"]",
+ })
+ void Test_with_Json(@ConvertWith(StringJsonConverter.class) JsonValue input, String expected) throws EaterException, EaterExceptionLocated {
+ assertTimExpectedOutputFromInput(cut, input, expected);
+ }
+}
diff --git a/test/net/sourceforge/plantuml/tim/stdlib/GetJsonTypeTest.java b/test/net/sourceforge/plantuml/tim/stdlib/GetJsonTypeTest.java
new file mode 100644
index 000000000..1b720c9e5
--- /dev/null
+++ b/test/net/sourceforge/plantuml/tim/stdlib/GetJsonTypeTest.java
@@ -0,0 +1,73 @@
+package net.sourceforge.plantuml.tim.stdlib;
+
+import static net.sourceforge.plantuml.test.JunitUtils.StringJsonConverter;
+import static net.sourceforge.plantuml.tim.TimTestUtils.assertTimExpectedOutput;
+import static net.sourceforge.plantuml.tim.TimTestUtils.assertTimExpectedOutputFromInput;
+
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.DisplayNameGenerator.ReplaceUnderscores;
+import org.junit.jupiter.api.IndicativeSentencesGeneration;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.converter.ConvertWith;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.CsvSource;
+
+import net.sourceforge.plantuml.json.JsonValue;
+import net.sourceforge.plantuml.tim.EaterException;
+import net.sourceforge.plantuml.tim.EaterExceptionLocated;
+import net.sourceforge.plantuml.tim.TFunction;
+
+/**
+ * Tests the builtin function.
+ */
+@IndicativeSentencesGeneration(separator = ": ", generator = ReplaceUnderscores.class)
+
+class GetJsonTypeTest {
+ TFunction cut = new GetJsonType();
+ final String cutName = "GetJsonType";
+
+ @Disabled
+ @Test
+ void Test_without_Param() throws EaterException, EaterExceptionLocated {
+ assertTimExpectedOutput(cut, "0");
+ }
+
+ @ParameterizedTest(name = "[{index}] " + cutName + "(''{0}'') = {1}")
+ @CsvSource(nullValues = "null", value = {
+ " 0, string",
+ " a, string",
+ " -1, string",
+ })
+ void Test_with_String(String input, String expected) throws EaterException, EaterExceptionLocated {
+ assertTimExpectedOutputFromInput(cut, input, expected);
+ }
+
+ @ParameterizedTest(name = "[{index}] " + cutName + "({0}) = {1}")
+ @CsvSource(nullValues = "null", value = {
+ " 0, number",
+ " -1, number",
+ })
+ void Test_with_Integer(Integer input, String expected) throws EaterException, EaterExceptionLocated {
+ assertTimExpectedOutputFromInput(cut, input, expected);
+ }
+
+ @ParameterizedTest(name = "[{index}] " + cutName + "({0}) = {1}")
+ @CsvSource(value = {
+ " 0 , number",
+ " 123 , number",
+ " \"abc\" , string",
+ " \"string\" , string",
+ " '[1, 2]' , array",
+ " '[\"a\", \"b\"]' , array",
+ " '{\"a\":[1, 2]}' , object",
+ " '{\"a\":\"abc\"}' , object",
+ " true , boolean ",
+ " false , boolean ",
+ " 1 , number ",
+ " null , json ",
+ " '{\"a\":[1, 2], \"b\":\"abc\", \"b\":true}' , object",
+ })
+ void Test_with_Json(@ConvertWith(StringJsonConverter.class) JsonValue input, String expected) throws EaterException, EaterExceptionLocated {
+ assertTimExpectedOutputFromInput(cut, input, expected);
+ }
+}
diff --git a/test/net/sourceforge/plantuml/tim/stdlib/Hex2decTest.java b/test/net/sourceforge/plantuml/tim/stdlib/Hex2decTest.java
new file mode 100644
index 000000000..329347b79
--- /dev/null
+++ b/test/net/sourceforge/plantuml/tim/stdlib/Hex2decTest.java
@@ -0,0 +1,61 @@
+package net.sourceforge.plantuml.tim.stdlib;
+
+import static net.sourceforge.plantuml.tim.TimTestUtils.assertTimExpectedOutput;
+import static net.sourceforge.plantuml.tim.TimTestUtils.assertTimExpectedOutputFromInput;
+
+import org.junit.jupiter.api.DisplayNameGenerator.ReplaceUnderscores;
+import org.junit.jupiter.api.IndicativeSentencesGeneration;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.converter.ConvertWith;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.CsvSource;
+
+import net.sourceforge.plantuml.tim.EaterException;
+import net.sourceforge.plantuml.tim.EaterExceptionLocated;
+import net.sourceforge.plantuml.tim.TFunction;
+
+/**
+ * Tests the builtin function.
+ */
+@IndicativeSentencesGeneration(separator = ": ", generator = ReplaceUnderscores.class)
+
+class Hex2decTest {
+ TFunction cut = new Hex2dec();
+ final String cutName = "Hex2dec";
+
+ @Test
+ void Test_without_Param() throws EaterException, EaterExceptionLocated {
+ assertTimExpectedOutput(cut, "0");
+ }
+
+ @ParameterizedTest(name = "[{index}] " + cutName + "(''{0}'') = {1}")
+ @CsvSource(nullValues = "null", value = {
+ " 0 , 0 ",
+ " 1 , 1 ",
+ " a , 10 ",
+ " f , 15 ",
+ " 10 , 16 ",
+ " ff , 255 ",
+ " ffff , 65535 ",
+ " ' ' , 0 ",
+ " g , 0 ",
+ " -g , 0 ",
+ " Γ , 0 ",
+ " -1 , -1 ",
+ " -a , -10 ",
+ })
+ void Test_with_String(String input, String expected) throws EaterException, EaterExceptionLocated {
+ assertTimExpectedOutputFromInput(cut, input, expected);
+ }
+
+ @ParameterizedTest(name = "[{index}] " + cutName + "({0}) = {1}")
+ @CsvSource(nullValues = "null", value = {
+ " 0 , 0 ",
+ " 1 , 1 ",
+ " 10 , 16 ",
+ " -1 , -1 ",
+ })
+ void Test_with_Integer(Integer input, String expected) throws EaterException, EaterExceptionLocated {
+ assertTimExpectedOutputFromInput(cut, input, expected);
+ }
+}
diff --git a/test/net/sourceforge/plantuml/tim/stdlib/LowerTest.java b/test/net/sourceforge/plantuml/tim/stdlib/LowerTest.java
new file mode 100644
index 000000000..d149c26b9
--- /dev/null
+++ b/test/net/sourceforge/plantuml/tim/stdlib/LowerTest.java
@@ -0,0 +1,76 @@
+package net.sourceforge.plantuml.tim.stdlib;
+
+import static net.sourceforge.plantuml.test.JunitUtils.StringJsonConverter;
+import static net.sourceforge.plantuml.tim.TimTestUtils.assertTimExpectedOutput;
+import static net.sourceforge.plantuml.tim.TimTestUtils.assertTimExpectedOutputFromInput;
+
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.DisplayNameGenerator.ReplaceUnderscores;
+import org.junit.jupiter.api.IndicativeSentencesGeneration;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.converter.ConvertWith;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.CsvSource;
+
+import net.sourceforge.plantuml.json.JsonValue;
+import net.sourceforge.plantuml.tim.EaterException;
+import net.sourceforge.plantuml.tim.EaterExceptionLocated;
+import net.sourceforge.plantuml.tim.TFunction;
+
+/**
+ * Tests the builtin function.
+ */
+@IndicativeSentencesGeneration(separator = ": ", generator = ReplaceUnderscores.class)
+
+class LowerTest {
+ TFunction cut = new Lower();
+ final String cutName = "Lower";
+
+ // TODO: Manage Lower function without param. (today: we observe `Function not found %lower`)
+ @Disabled
+ @Test
+ void Test_without_Param() throws EaterException, EaterExceptionLocated {
+ assertTimExpectedOutput(cut, "");
+ }
+
+ @ParameterizedTest(name = "[{index}] " + cutName + "(''{0}'') = {1}")
+ @CsvSource(nullValues = "null", value = {
+ " 0 , 0 ",
+ " 1 , 1 ",
+ " A , a ",
+ " a , a ",
+ " F , f ",
+ " G , g ",
+ " Γ , Γ© ",
+ " π , π ",
+ })
+ void Test_with_String(String input, String expected) throws EaterException, EaterExceptionLocated {
+ assertTimExpectedOutputFromInput(cut, input, expected);
+ }
+
+ @ParameterizedTest(name = "[{index}] " + cutName + "({0}) = {1}")
+ @CsvSource(nullValues = "null", value = {
+ " 0 , 0 ",
+ " 1 , 1 ",
+ " 10 , 10 ",
+ " -1 , -1 ",
+ })
+ void Test_with_Integer(Integer input, String expected) throws EaterException, EaterExceptionLocated {
+ assertTimExpectedOutputFromInput(cut, input, expected);
+ }
+
+ @ParameterizedTest(name = "[{index}] " + cutName + "({0}) = {1}")
+ @CsvSource(value = {
+ " '{\"a\":[1, 2]}' , '{\"a\":[1,2]}'",
+ " '{\"A\":[1, 2]}' , '{\"a\":[1,2]}'",
+ " '[1, 2]' , '[1,2]'",
+ " '{\"a\":[1, 2], \"b\":\"abc\", \"b\":true}' , '{\"a\":[1,2],\"b\":\"abc\",\"b\":true}'",
+ " '{\"A\":[1, 2], \"B\":\"ABC\", \"B\":true}' , '{\"a\":[1,2],\"b\":\"abc\",\"b\":true}' ",
+ " true, true"
+ // TODO: See JSON management of TRUE/FALSE
+ //" TRUE , true ",
+ })
+ void Test_with_Json(@ConvertWith(StringJsonConverter.class) JsonValue input, String expected) throws EaterException, EaterExceptionLocated {
+ assertTimExpectedOutputFromInput(cut, input, expected);
+ }
+}
diff --git a/test/net/sourceforge/plantuml/tim/stdlib/SizeTest.java b/test/net/sourceforge/plantuml/tim/stdlib/SizeTest.java
new file mode 100644
index 000000000..137ff9bef
--- /dev/null
+++ b/test/net/sourceforge/plantuml/tim/stdlib/SizeTest.java
@@ -0,0 +1,81 @@
+package net.sourceforge.plantuml.tim.stdlib;
+
+import static net.sourceforge.plantuml.test.JunitUtils.StringJsonConverter;
+import static net.sourceforge.plantuml.tim.TimTestUtils.assertTimExpectedOutput;
+import static net.sourceforge.plantuml.tim.TimTestUtils.assertTimExpectedOutputFromInput;
+
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.DisplayNameGenerator.ReplaceUnderscores;
+import org.junit.jupiter.api.IndicativeSentencesGeneration;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.converter.ConvertWith;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.CsvSource;
+
+import net.sourceforge.plantuml.json.JsonValue;
+import net.sourceforge.plantuml.tim.EaterException;
+import net.sourceforge.plantuml.tim.EaterExceptionLocated;
+import net.sourceforge.plantuml.tim.TFunction;
+
+/**
+ * Tests the builtin function.
+ */
+@IndicativeSentencesGeneration(separator = ": ", generator = ReplaceUnderscores.class)
+
+class SizeTest {
+ TFunction cut = new Size();
+ final String cutName = "Size";
+
+ // TODO: Manage `Size` function without param. (today: we observe `Function not found`)
+ @Disabled
+ @Test
+ void Test_without_Param() throws EaterException, EaterExceptionLocated {
+ assertTimExpectedOutput(cut, "0");
+ }
+
+ @ParameterizedTest(name = "[{index}] " + cutName + "(''{0}'') = {1}")
+ @CsvSource(nullValues = "null", value = {
+ " 0 , 1 ",
+ " 1 , 1 ",
+ " 10 , 2 ",
+ " a , 1 ",
+ " A , 1 ",
+ " ABC , 3 ",
+ " '[1, 2]' , 6 ",
+ " '{[1, 2]}' , 8 ",
+ " Γ , 1 ",
+// TODO: fix `Size` to allow Unicode chars, the corresponding tests are here:
+// " π , 1 ",
+// " \uD83D\uDE00 , 1",
+ })
+ void Test_with_String(String input, String expected) throws EaterException, EaterExceptionLocated {
+ assertTimExpectedOutputFromInput(cut, input, expected);
+ }
+
+ @ParameterizedTest(name = "[{index}] " + cutName + "({0}) = {1}")
+ @CsvSource(nullValues = "null", value = {
+ " 0 , 0 ",
+ " 1 , 0 ",
+ " 10 , 0 ",
+ })
+ void Test_with_Integer(Integer input, String expected) throws EaterException, EaterExceptionLocated {
+ assertTimExpectedOutputFromInput(cut, input, expected);
+ }
+
+ @ParameterizedTest(name = "[{index}] " + cutName + "({0}) = {1}")
+ @CsvSource(value = {
+ " 0, 0",
+ " \"abc\", 0",
+ " '\"abc\"', 0",
+ " '{\"a\":[1, 2]}' , 1",
+ " '[1, 2]' , 2",
+ " '[\"a\", \"b\"]' , 2",
+ " '{\"a\":[1, 2], \"b\":\"abc\", \"b\":true}' , 3",
+ " true, 0 ",
+ " 1, 0 ",
+ " null, 0 ",
+ })
+ void Test_with_Json(@ConvertWith(StringJsonConverter.class) JsonValue input, String expected) throws EaterException, EaterExceptionLocated {
+ assertTimExpectedOutputFromInput(cut, input, expected);
+ }
+}
diff --git a/test/net/sourceforge/plantuml/tim/stdlib/UpperTest.java b/test/net/sourceforge/plantuml/tim/stdlib/UpperTest.java
new file mode 100644
index 000000000..049f0b531
--- /dev/null
+++ b/test/net/sourceforge/plantuml/tim/stdlib/UpperTest.java
@@ -0,0 +1,72 @@
+package net.sourceforge.plantuml.tim.stdlib;
+
+import static net.sourceforge.plantuml.test.JunitUtils.StringJsonConverter;
+import static net.sourceforge.plantuml.tim.TimTestUtils.assertTimExpectedOutput;
+import static net.sourceforge.plantuml.tim.TimTestUtils.assertTimExpectedOutputFromInput;
+
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.DisplayNameGenerator.ReplaceUnderscores;
+import org.junit.jupiter.api.IndicativeSentencesGeneration;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.converter.ConvertWith;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.CsvSource;
+
+import net.sourceforge.plantuml.json.JsonValue;
+import net.sourceforge.plantuml.tim.EaterException;
+import net.sourceforge.plantuml.tim.EaterExceptionLocated;
+import net.sourceforge.plantuml.tim.TFunction;
+
+/**
+ * Tests the builtin function.
+ */
+@IndicativeSentencesGeneration(separator = ": ", generator = ReplaceUnderscores.class)
+
+class UpperTest {
+ TFunction cut = new Upper();
+ final String cutName = "Upper";
+
+ // TODO: Manage Upper function without param. (today: we observe `Function not found %upper`)
+ @Disabled
+ @Test
+ void Test_without_Param() throws EaterException, EaterExceptionLocated {
+ assertTimExpectedOutput(cut, "");
+ }
+
+ @ParameterizedTest(name = "[{index}] " + cutName + "(''{0}'') = {1}")
+ @CsvSource(nullValues = "null", value = {
+ " 0 , 0 ",
+ " 1 , 1 ",
+ " a , A ",
+ " A , A ",
+ " f , F ",
+ " g , G ",
+ " Γ© , Γ ",
+ " π , π ",
+ })
+ void Test_with_String(String input, String expected) throws EaterException, EaterExceptionLocated {
+ assertTimExpectedOutputFromInput(cut, input, expected);
+ }
+
+ @ParameterizedTest(name = "[{index}] " + cutName + "({0}) = {1}")
+ @CsvSource(nullValues = "null", value = {
+ " 0 , 0 ",
+ " 1 , 1 ",
+ " 10 , 10 ",
+ " -1 , -1 ",
+ })
+ void Test_with_Integer(Integer input, String expected) throws EaterException, EaterExceptionLocated {
+ assertTimExpectedOutputFromInput(cut, input, expected);
+ }
+
+ @ParameterizedTest(name = "[{index}] " + cutName + "({0}) = {1}")
+ @CsvSource(value = {
+ " '{\"a\":[1, 2]}' , '{\"A\":[1,2]}'",
+ " '[1, 2]' , '[1,2]'",
+ " '{\"a\":[1, 2], \"b\":\"abc\", \"b\":true}' , '{\"A\":[1,2],\"B\":\"ABC\",\"B\":TRUE}'",
+ " true , TRUE ",
+ })
+ void Test_with_Json(@ConvertWith(StringJsonConverter.class) JsonValue input, String expected) throws EaterException, EaterExceptionLocated {
+ assertTimExpectedOutputFromInput(cut, input, expected);
+ }
+}
diff --git a/test/net/sourceforge/plantuml/tim/stdlib/_TemplateStdlibTest.template b/test/net/sourceforge/plantuml/tim/stdlib/_TemplateStdlibTest.template
new file mode 100644
index 000000000..a949f6023
--- /dev/null
+++ b/test/net/sourceforge/plantuml/tim/stdlib/_TemplateStdlibTest.template
@@ -0,0 +1,59 @@
+package net.sourceforge.plantuml.tim.stdlib;
+
+import static net.sourceforge.plantuml.test.JunitUtils.StringJsonConverter;
+import static net.sourceforge.plantuml.tim.TimTestUtils.assertTimExpectedOutput;
+import static net.sourceforge.plantuml.tim.TimTestUtils.assertTimExpectedOutputFromInput;
+
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.DisplayNameGenerator.ReplaceUnderscores;
+import org.junit.jupiter.api.IndicativeSentencesGeneration;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.converter.ConvertWith;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.CsvSource;
+
+import net.sourceforge.plantuml.json.JsonValue;
+import net.sourceforge.plantuml.tim.EaterException;
+import net.sourceforge.plantuml.tim.EaterExceptionLocated;
+import net.sourceforge.plantuml.tim.TFunction;
+
+/**
+ * Tests the builtin function.
+ */
+@IndicativeSentencesGeneration(separator = ": ", generator = ReplaceUnderscores.class)
+
+// Change `XXX` by the name of the tim.stdlib Class Under Test
+@Disabled
+class XXXTest {
+ TFunction cut = new XXX();
+ final String cutName = "XXX";
+
+ @Test
+ void Test_without_Param() throws EaterException, EaterExceptionLocated {
+ assertTimExpectedOutput(cut, "0"); // Change expected value here
+ }
+
+ @ParameterizedTest(name = "[{index}] " + cutName + "(''{0}'') = {1}")
+ @CsvSource(nullValues = "null", value = {
+ " 0, 0", // Put test values here
+ })
+ void Test_with_String(String input, String expected) throws EaterException, EaterExceptionLocated {
+ assertTimExpectedOutputFromInput(cut, input, expected);
+ }
+
+ @ParameterizedTest(name = "[{index}] " + cutName + "({0}) = {1}")
+ @CsvSource(nullValues = "null", value = {
+ " 0, 0", // Put test values here
+ })
+ void Test_with_Integer(Integer input, String expected) throws EaterException, EaterExceptionLocated {
+ assertTimExpectedOutputFromInput(cut, input, expected);
+ }
+
+ @ParameterizedTest(name = "[{index}] " + cutName + "({0}) = {1}")
+ @CsvSource(value = {
+ " 0, 0", // Put test values here
+ })
+ void Test_with_Json(@ConvertWith(StringJsonConverter.class) JsonValue input, String expected) throws EaterException, EaterExceptionLocated {
+ assertTimExpectedOutputFromInput(cut, input, expected);
+ }
+}
diff --git a/test/net/sourceforge/plantuml/utils/LineLocationImplTest.java b/test/net/sourceforge/plantuml/utils/LineLocationImplTest.java
new file mode 100644
index 000000000..184962e58
--- /dev/null
+++ b/test/net/sourceforge/plantuml/utils/LineLocationImplTest.java
@@ -0,0 +1,122 @@
+package net.sourceforge.plantuml.utils;
+
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+import io.github.glytching.junit.extension.random.Random;
+import io.github.glytching.junit.extension.random.RandomBeansExtension;
+
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.junit.jupiter.api.extension.Extensions;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.ValueSource;
+
+import org.mockito.Mock;
+import org.mockito.junit.jupiter.MockitoExtension;
+
+@Extensions({
+ @ExtendWith(MockitoExtension.class),
+ @ExtendWith(RandomBeansExtension.class)
+})
+
+class LineLocationImplTest {
+ @Mock
+ private LineLocation parent;
+ @Mock
+ private LineLocation parent2;
+
+ @Random
+ private String desc;
+ @Random
+ private String desc2;
+
+ @Test
+ void ctorDestArgMustNotBeNull() {
+ assertDoesNotThrow(() -> new LineLocationImpl(desc, null));
+ assertThrows(NullPointerException.class, () -> new LineLocationImpl(null, null));
+ }
+
+ @Test
+ void initialPositionIsNegativeOne() {
+ LineLocation loc = new LineLocationImpl(desc, null);
+ assertEquals(-1, loc.getPosition());
+ }
+
+ @Test
+ void parentSameAsProvided() {
+ LineLocation loc = new LineLocationImpl(desc, parent);
+ assertSame(parent, loc.getParent());
+ }
+
+ @Test
+ void descriptionSameAsProvided() {
+ LineLocation loc = new LineLocationImpl(desc, parent);
+ assertEquals(desc, loc.getDescription());
+ }
+
+ @Test
+ void toStringIsAConcatenationofDescAndPosition() {
+ LineLocationImpl loc = new LineLocationImpl(desc, parent);
+ assertEquals(desc + " : -1", loc.toString());
+ assertEquals(desc + " : 0", loc.oneLineRead().toString());
+ }
+
+ @Test
+ void oneLineReadMovesToNextLine() {
+ LineLocationImpl loc = new LineLocationImpl(desc, parent);
+
+ for (int i = 1; i < 5; ++i) {
+ LineLocationImpl next = loc.oneLineRead();
+ assertEquals(desc, next.getDescription());
+ assertSame(parent, next.getParent());
+ assertEquals(-1 + i, next.getPosition());
+ loc = next;
+ }
+ }
+
+ @Test
+ void comparisonStandardLibraryAlwaysDifferent() {
+ LineLocationImpl loc1 = new LineLocationImpl(desc, parent);
+ LineLocationImpl loc2 = new LineLocationImpl("<" + desc2, parent);
+
+ assertEquals(1, loc1.compareTo(loc2));
+ assertEquals(-1, loc2.compareTo(loc1));
+ }
+
+ @ParameterizedTest
+ @ValueSource(strings = {"", "<"})
+ void comparisonDisregardsDescription(String prefix) {
+ LineLocationImpl loc1 = new LineLocationImpl(prefix + desc, parent);
+ LineLocationImpl loc2 = new LineLocationImpl(prefix + desc2, parent);
+
+ assertEquals(0, loc1.compareTo(loc2));
+ assertEquals(0, loc2.compareTo(loc1));
+ }
+
+ @ParameterizedTest
+ @ValueSource(strings = {"", "<"})
+ void comparisonDisregardsParent(String prefix) {
+ LineLocationImpl loc1 = new LineLocationImpl(prefix + desc, parent);
+ LineLocationImpl loc2 = new LineLocationImpl(prefix + desc, parent2);
+
+ assertEquals(0, loc1.compareTo(loc2));
+ assertEquals(0, loc2.compareTo(loc1));
+ }
+
+ @ParameterizedTest
+ @ValueSource(strings = {"", "<"})
+ void comparisonLooksAtPositionOnly(String prefix) {
+ LineLocationImpl loc1 = new LineLocationImpl(prefix + desc, parent);
+ LineLocationImpl loc2 = loc1.oneLineRead();
+ LineLocationImpl loc3 = loc2.oneLineRead();
+
+ assertEquals(-1, loc1.compareTo(loc2));
+ assertEquals(1, loc2.compareTo(loc1));
+
+ assertEquals(-2, loc1.compareTo(loc3));
+ assertEquals(2, loc3.compareTo(loc1));
+ }
+}
\ No newline at end of file
diff --git a/test/nonreg/simple/A0004_TestResult.java b/test/nonreg/simple/A0004_TestResult.java
index 53cdcbf22..2c3e526de 100644
--- a/test/nonreg/simple/A0004_TestResult.java
+++ b/test/nonreg/simple/A0004_TestResult.java
@@ -5,7 +5,7 @@ public class A0004_TestResult {
/*
"""
DPI: 96
-dimension: [ 550.6156 ; 680.0000 ]
+dimension: [ 550.6156 ; 682.0000 ]
scaleFactor: 1.0000
seed: -1093380870564056548
svgLinkTarget: _top
@@ -19,7 +19,7 @@ ELLIPSE:
extend: 0.0
stroke: 0.0-0.0-1.0
shadow: 0
- color: NULL_COLOR
+ color: ff222222
backcolor: ff222222
RECTANGLE:
@@ -71,8 +71,8 @@ TEXT:
extendedColor: NULL_COLOR
ELLIPSE:
- pt1: [ 127.0000 ; 655.0000 ]
- pt2: [ 147.0000 ; 675.0000 ]
+ pt1: [ 126.0000 ; 655.0000 ]
+ pt2: [ 148.0000 ; 677.0000 ]
start: 0.0
extend: 0.0
stroke: 0.0-0.0-1.0
@@ -81,13 +81,13 @@ ELLIPSE:
backcolor: NULL_COLOR
ELLIPSE:
- pt1: [ 131.5000 ; 659.5000 ]
- pt2: [ 143.5000 ; 671.5000 ]
+ pt1: [ 131.0000 ; 660.0000 ]
+ pt2: [ 143.0000 ; 672.0000 ]
start: 0.0
extend: 0.0
stroke: 0.0-0.0-1.0
shadow: 0
- color: NULL_COLOR
+ color: middle(ff222222 & ff222222 )
backcolor: ff222222
RECTANGLE:
@@ -292,11 +292,11 @@ TEXT:
POLYGON:
points:
- - [ 126.9122 ; 660.5023 ]
- - [ 121.2339 ; 652.4551 ]
- - [ 122.6187 ; 657.9399 ]
- - [ 117.1340 ; 659.3247 ]
- - [ 126.9122 ; 660.5023 ]
+ - [ 125.8699 ; 659.8750 ]
+ - [ 120.2522 ; 651.7854 ]
+ - [ 121.5958 ; 657.2804 ]
+ - [ 116.1008 ; 658.6240 ]
+ - [ 125.8699 ; 659.8750 ]
stroke: 0.0-0.0-1.0
shadow: 0
color: ff181818
@@ -314,9 +314,9 @@ PATH:
pt2: [ 76.0000 ; 278.0000 ]
pt3: [ 76.0000 ; 597.0000 ]
- type: SEG_CUBICTO
- pt1: [ 76.0000 ; 624.0056 ]
- pt2: [ 99.8820 ; 641.9510 ]
- pt3: [ 115.7600 ; 651.4274 ]
+ pt1: [ 76.0000 ; 623.4248 ]
+ pt2: [ 98.6698 ; 641.0056 ]
+ pt3: [ 114.7410 ; 650.7615 ]
stroke: 0.0-0.0-1.0
shadow: 0
color: ff181818
@@ -604,11 +604,11 @@ PATH:
POLYGON:
points:
- - [ 147.1865 ; 661.4161 ]
- - [ 157.0353 ; 661.3705 ]
- - [ 151.7461 ; 659.3642 ]
- - [ 153.7524 ; 654.0751 ]
- - [ 147.1865 ; 661.4161 ]
+ - [ 148.1292 ; 660.9919 ]
+ - [ 157.9779 ; 660.9463 ]
+ - [ 152.6888 ; 658.9400 ]
+ - [ 154.6950 ; 653.6509 ]
+ - [ 148.1292 ; 660.9919 ]
stroke: 0.0-0.0-1.0
shadow: 0
color: ff181818
@@ -618,9 +618,9 @@ PATH:
- type: SEG_MOVETO
pt1: [ 237.4665 ; 612.0901 ]
- type: SEG_CUBICTO
- pt1: [ 206.0796 ; 626.2142 ]
- pt2: [ 166.5934 ; 643.9829 ]
- pt3: [ 146.6581 ; 652.9539 ]
+ pt1: [ 206.5650 ; 625.9958 ]
+ pt2: [ 167.9806 ; 643.3587 ]
+ pt3: [ 147.6007 ; 652.5297 ]
stroke: 0.0-0.0-1.0
shadow: 0
color: ff181818