From 151fa30a5db99e7218fb6700ce0d745cbb84c668 Mon Sep 17 00:00:00 2001 From: Dietrich Travkin Date: Mon, 24 Jul 2023 16:42:31 +0200 Subject: [PATCH 1/3] Make source code Java-7-compatible --- src/net/sourceforge/plantuml/svek/SvekNode.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/net/sourceforge/plantuml/svek/SvekNode.java b/src/net/sourceforge/plantuml/svek/SvekNode.java index 722d7963c..606601bd7 100644 --- a/src/net/sourceforge/plantuml/svek/SvekNode.java +++ b/src/net/sourceforge/plantuml/svek/SvekNode.java @@ -41,6 +41,7 @@ import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.abel.Entity; import net.sourceforge.plantuml.abel.EntityPosition; import net.sourceforge.plantuml.abel.Hideable; +import net.sourceforge.plantuml.abel.Link; import net.sourceforge.plantuml.abel.Together; import net.sourceforge.plantuml.klimt.Shadowable; import net.sourceforge.plantuml.klimt.UTranslate; @@ -389,10 +390,15 @@ public class SvekNode implements Positionable, Hideable { // Instead, only check if we will have a shield (size is irrelevant here) // This node will have a shield if it is target of a qualified association (will have a qualifier label // placed besides this type's bounding box.) - return this.leaf.getDiagram().getLinks().stream() - .filter(link -> link.getEntity1() == this.leaf || link.getEntity2() == this.leaf) - .anyMatch(link -> (this.leaf == link.getEntity1() && link.hasKal1()) - || (this.leaf == link.getEntity2() && link.hasKal2())); + for (Link link: this.leaf.getDiagram().getLinks()) { + if (link.getEntity1() == this.leaf || link.getEntity2() == this.leaf) { + if ((this.leaf == link.getEntity1() && link.hasKal1()) + || (this.leaf == link.getEntity2() && link.hasKal2())) { + return true; + } + } + } + return false; } public void resetMoveSvek() { From 659b723dd3339e36dd797e4d4d61d0dcbc58b9e5 Mon Sep 17 00:00:00 2001 From: Dietrich Travkin Date: Mon, 24 Jul 2023 16:43:57 +0200 Subject: [PATCH 2/3] Avoid too early shield size calculation in some additional cases (#1467) --- src/net/sourceforge/plantuml/svek/SvekNode.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/net/sourceforge/plantuml/svek/SvekNode.java b/src/net/sourceforge/plantuml/svek/SvekNode.java index 606601bd7..097813da9 100644 --- a/src/net/sourceforge/plantuml/svek/SvekNode.java +++ b/src/net/sourceforge/plantuml/svek/SvekNode.java @@ -146,7 +146,7 @@ public class SvekNode implements Positionable, Hideable { SvekUtils.println(sb); return; } - if (type == ShapeType.RECTANGLE && shield().isZero() == false) { + if (type == ShapeType.RECTANGLE && isShielded()) { appendHtml(sb); SvekUtils.println(sb); return; @@ -326,7 +326,7 @@ public class SvekNode implements Positionable, Hideable { } private void appendShapeInternal(StringBuilder sb) { - if (type == ShapeType.RECTANGLE && shield().isZero() == false) + if (type == ShapeType.RECTANGLE && isShielded()) throw new UnsupportedOperationException(); else if (type == ShapeType.RECTANGLE || type == ShapeType.RECTANGLE_WITH_CIRCLE_INSIDE || type == ShapeType.FOLDER) From 4765c77d9279fba8b884a6ef3cbdd6a5b865a916 Mon Sep 17 00:00:00 2001 From: Dietrich Travkin Date: Mon, 24 Jul 2023 16:44:18 +0200 Subject: [PATCH 3/3] Simplify code a little --- src/net/sourceforge/plantuml/svek/SvekNode.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/net/sourceforge/plantuml/svek/SvekNode.java b/src/net/sourceforge/plantuml/svek/SvekNode.java index 097813da9..649f272e5 100644 --- a/src/net/sourceforge/plantuml/svek/SvekNode.java +++ b/src/net/sourceforge/plantuml/svek/SvekNode.java @@ -223,7 +223,7 @@ public class SvekNode implements Positionable, Hideable { private Margins shield() { if (shield == null) { this.shield = image.getShield(stringBounder); - if (shield.isZero() == false && type != ShapeType.RECTANGLE && type != ShapeType.RECTANGLE_HTML_FOR_PORTS + if (!shield.isZero() && type != ShapeType.RECTANGLE && type != ShapeType.RECTANGLE_HTML_FOR_PORTS && type != ShapeType.RECTANGLE_WITH_CIRCLE_INSIDE) throw new IllegalStateException(); } @@ -383,7 +383,7 @@ public class SvekNode implements Positionable, Hideable { public boolean isShielded() { if (this.shield != null) { - return this.shield.isZero() == false; + return !this.shield.isZero(); } // Avoid calculating "shield" size through this.shield() before finishing creation of all SvekLines (#1467)