1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-12-22 10:59:01 +00:00
This commit is contained in:
Arnaud Roques 2023-02-08 19:38:46 +01:00
parent 62d819dae4
commit 58cc4e096b
95 changed files with 772 additions and 935 deletions

View File

@ -46,7 +46,6 @@ import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import net.sourceforge.plantuml.api.ApiWarning; import net.sourceforge.plantuml.api.ApiWarning;
import net.sourceforge.plantuml.cucadiagram.dot.GraphvizUtils; import net.sourceforge.plantuml.cucadiagram.dot.GraphvizUtils;
import net.sourceforge.plantuml.klimt.color.ColorMapper; import net.sourceforge.plantuml.klimt.color.ColorMapper;

View File

@ -38,7 +38,6 @@ package net.sourceforge.plantuml;
import java.util.EnumMap; import java.util.EnumMap;
import java.util.Map; import java.util.Map;
import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.klimt.color.HColor; import net.sourceforge.plantuml.klimt.color.HColor;

View File

@ -41,7 +41,6 @@ import java.io.IOException;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import net.sourceforge.plantuml.preproc.Defines; import net.sourceforge.plantuml.preproc.Defines;
import net.sourceforge.plantuml.security.SFile; import net.sourceforge.plantuml.security.SFile;
import net.sourceforge.plantuml.utils.Log; import net.sourceforge.plantuml.utils.Log;

View File

@ -47,7 +47,6 @@ import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import net.sourceforge.plantuml.core.Diagram; import net.sourceforge.plantuml.core.Diagram;
import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.DiagramDescription;
import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.core.ImageData;

View File

@ -68,7 +68,7 @@ public class ActivityDiagram extends CucaDiagram {
public void startIf(String optionalCodeString) { public void startIf(String optionalCodeString) {
final String idShort = optionalCodeString == null ? getAutoBranch() : optionalCodeString; final String idShort = optionalCodeString == null ? getAutoBranch() : optionalCodeString;
final Quark quark = quarkInContext(cleanIdForQuark(idShort), false); final Quark<Entity> quark = quarkInContext(cleanId(idShort), false);
final Entity br = reallyCreateLeaf(quark, Display.create(""), LeafType.BRANCH, null); final Entity br = reallyCreateLeaf(quark, Display.create(""), LeafType.BRANCH, null);
currentContext = new ConditionalContext(currentContext, br, Direction.DOWN); currentContext = new ConditionalContext(currentContext, br, Direction.DOWN);
} }
@ -78,20 +78,20 @@ public class ActivityDiagram extends CucaDiagram {
} }
public Entity getStart() { public Entity getStart() {
final Quark quark = quarkInContext("start", false); final Quark<Entity> quark = quarkInContext("start", false);
if (quark.getData() == null) if (quark.getData() == null)
quark.setData(reallyCreateLeaf(quark, Display.getWithNewlines("start"), LeafType.CIRCLE_START, null)); reallyCreateLeaf(quark, Display.getWithNewlines("start"), LeafType.CIRCLE_START, null);
return (Entity) quark.getData(); return quark.getData();
} }
public Entity getEnd(String suppId) { public Entity getEnd(String suppId) {
final String tmp = suppId == null ? "end" : "end$" + suppId; final String tmp = suppId == null ? "end" : "end$" + suppId;
final Quark quark = quarkInContext(tmp, false); final Quark<Entity> quark = quarkInContext(tmp, false);
if (quark.getData() == null) if (quark.getData() == null)
quark.setData(reallyCreateLeaf(quark, Display.getWithNewlines("end"), LeafType.CIRCLE_END, null)); reallyCreateLeaf(quark, Display.getWithNewlines("end"), LeafType.CIRCLE_END, null);
return (Entity) quark.getData(); return quark.getData();
} }
@Override @Override
@ -106,7 +106,7 @@ public class ActivityDiagram extends CucaDiagram {
} }
public Entity createNote(Quark idNewLong, String code__, Display display) { public Entity createNote(Quark<Entity> idNewLong, String code__, Display display) {
return reallyCreateLeaf(Objects.requireNonNull(idNewLong), display, LeafType.NOTE, null); return reallyCreateLeaf(Objects.requireNonNull(idNewLong), display, LeafType.NOTE, null);
} }
@ -141,7 +141,7 @@ public class ActivityDiagram extends CucaDiagram {
final String idShort = "##" + this.getUniqueSequence(); final String idShort = "##" + this.getUniqueSequence();
final Quark quark = quarkInContext(idShort, false); final Quark<Entity> quark = quarkInContext(idShort, false);
gotoGroup(quark, Display.getWithNewlines(quark.getName()), GroupType.INNER_ACTIVITY); gotoGroup(quark, Display.getWithNewlines(quark.getName()), GroupType.INNER_ACTIVITY);
final Entity g = getCurrentGroup(); final Entity g = getCurrentGroup();
@ -160,7 +160,7 @@ public class ActivityDiagram extends CucaDiagram {
if (getCurrentGroup().getGroupType() != GroupType.INNER_ACTIVITY) if (getCurrentGroup().getGroupType() != GroupType.INNER_ACTIVITY)
throw new IllegalStateException("type=" + getCurrentGroup().getGroupType()); throw new IllegalStateException("type=" + getCurrentGroup().getGroupType());
final Quark idNewLong = quarkInContext(idShort, false); final Quark<Entity> idNewLong = quarkInContext(idShort, false);
gotoGroup(idNewLong, Display.getWithNewlines("code"), GroupType.CONCURRENT_ACTIVITY); gotoGroup(idNewLong, Display.getWithNewlines("code"), GroupType.CONCURRENT_ACTIVITY);
lastEntityConsulted = null; lastEntityConsulted = null;
lastEntityBrancheConsulted = null; lastEntityBrancheConsulted = null;

View File

@ -36,7 +36,6 @@
package net.sourceforge.plantuml.activitydiagram.command; package net.sourceforge.plantuml.activitydiagram.command;
import net.sourceforge.plantuml.activitydiagram.ActivityDiagram; import net.sourceforge.plantuml.activitydiagram.ActivityDiagram;
import net.sourceforge.plantuml.baraye.EntityUtils;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.regex.IRegex; import net.sourceforge.plantuml.regex.IRegex;

View File

@ -209,13 +209,13 @@ public class CommandLinkActivity extends SingleLineCommand2<ActivityDiagram> {
final String idShort = arg.get("CODE" + suf, 0); final String idShort = arg.get("CODE" + suf, 0);
if (idShort != null) { if (idShort != null) {
if (partition != null) { if (partition != null) {
final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(partition), false); final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(partition), false);
diagram.gotoGroup(quark, Display.getWithNewlines(quark), GroupType.PACKAGE); diagram.gotoGroup(quark, Display.getWithNewlines(quark), GroupType.PACKAGE);
} }
final Quark ident = diagram.quarkInContext(diagram.cleanIdForQuark(idShort), false); final Quark<Entity> ident = diagram.quarkInContext(diagram.cleanId(idShort), false);
final LeafType type = getTypeIfExisting(diagram, ident); final LeafType type = getTypeIfExisting(diagram, ident);
Entity result = (Entity) ident.getData(); Entity result = ident.getData();
if (result == null) if (result == null)
result = diagram.reallyCreateLeaf(ident, Display.getWithNewlines(idShort), type, null); result = diagram.reallyCreateLeaf(ident, Display.getWithNewlines(idShort), type, null);
@ -226,8 +226,8 @@ public class CommandLinkActivity extends SingleLineCommand2<ActivityDiagram> {
} }
final String bar = arg.get("BAR" + suf, 0); final String bar = arg.get("BAR" + suf, 0);
if (bar != null) { if (bar != null) {
final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(bar), false); final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(bar), false);
Entity result = (Entity) quark.getData(); Entity result = quark.getData();
if (result == null) if (result == null)
result = diagram.reallyCreateLeaf(quark, Display.getWithNewlines(bar), LeafType.SYNCHRO_BAR, null); result = diagram.reallyCreateLeaf(quark, Display.getWithNewlines(bar), LeafType.SYNCHRO_BAR, null);
return result; return result;
@ -236,14 +236,14 @@ public class CommandLinkActivity extends SingleLineCommand2<ActivityDiagram> {
if (quoted.get(0) != null) { if (quoted.get(0) != null) {
final String quotedString = quoted.get(1) == null ? quoted.get(0) : quoted.get(1); final String quotedString = quoted.get(1) == null ? quoted.get(0) : quoted.get(1);
if (partition != null) { if (partition != null) {
final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(partition), false); final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(partition), false);
diagram.gotoGroup(quark, Display.getWithNewlines(partition), GroupType.PACKAGE); diagram.gotoGroup(quark, Display.getWithNewlines(partition), GroupType.PACKAGE);
} }
final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(quotedString), false); final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(quotedString), false);
final LeafType type = getTypeIfExisting(diagram, quark); final LeafType type = getTypeIfExisting(diagram, quark);
Entity result = (Entity) quark.getData(); Entity result = quark.getData();
if (result == null) if (result == null)
result = diagram.reallyCreateLeaf(quark, Display.getWithNewlines(quoted.get(0)), type, null); result = diagram.reallyCreateLeaf(quark, Display.getWithNewlines(quoted.get(0)), type, null);
if (partition != null) if (partition != null)
@ -254,11 +254,11 @@ public class CommandLinkActivity extends SingleLineCommand2<ActivityDiagram> {
final String quoteInvisibleString = arg.get("QUOTED_INVISIBLE" + suf, 0); final String quoteInvisibleString = arg.get("QUOTED_INVISIBLE" + suf, 0);
if (quoteInvisibleString != null) { if (quoteInvisibleString != null) {
if (partition != null) { if (partition != null) {
final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(partition), false); final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(partition), false);
diagram.gotoGroup(quark, Display.getWithNewlines(quark), GroupType.PACKAGE); diagram.gotoGroup(quark, Display.getWithNewlines(quark), GroupType.PACKAGE);
} }
final Quark identInvisible = diagram.quarkInContext(diagram.cleanIdForQuark(quoteInvisibleString), false); final Quark<Entity> identInvisible = diagram.quarkInContext(diagram.cleanId(quoteInvisibleString), false);
Entity result = (Entity) identInvisible.getData(); Entity result = identInvisible.getData();
if (result == null) if (result == null)
result = diagram.reallyCreateLeaf(identInvisible, Display.getWithNewlines(identInvisible.getName()), result = diagram.reallyCreateLeaf(identInvisible, Display.getWithNewlines(identInvisible.getName()),
LeafType.ACTIVITY, null); LeafType.ACTIVITY, null);
@ -274,7 +274,7 @@ public class CommandLinkActivity extends SingleLineCommand2<ActivityDiagram> {
return null; return null;
} }
private static LeafType getTypeIfExisting(ActivityDiagram system, Quark code) { private static LeafType getTypeIfExisting(ActivityDiagram system, Quark<Entity> code) {
// if (code.getData() == null) { // if (code.getData() == null) {
// final Quark quark = system.getPlasma().getIfExistsFromName(code.getName()); // final Quark quark = system.getPlasma().getIfExistsFromName(code.getName());
// final IEntity ent = quark == null ? null : (ILeaf) quark.getData(); // final IEntity ent = quark == null ? null : (ILeaf) quark.getData();

View File

@ -176,12 +176,12 @@ public class CommandLinkLongActivity extends CommandMultilines2<ActivityDiagram>
partition = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(partition); partition = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(partition);
} }
if (partition != null) { if (partition != null) {
final Quark idNewLong = diagram.quarkInContext(diagram.cleanIdForQuark(partition), false); final Quark<Entity> idNewLong = diagram.quarkInContext(diagram.cleanId(partition), false);
diagram.gotoGroup(idNewLong, Display.getWithNewlines(partition), GroupType.PACKAGE); diagram.gotoGroup(idNewLong, Display.getWithNewlines(partition), GroupType.PACKAGE);
} }
final Quark ident = diagram.quarkInContext(diagram.cleanIdForQuark(idShort), false); final Quark<Entity> ident = diagram.quarkInContext(diagram.cleanId(idShort), false);
Entity entity2 = (Entity) ident.getData(); Entity entity2 = ident.getData();
if (entity2 == null) if (entity2 == null)
entity2 = diagram.reallyCreateLeaf(ident, Display.getWithNewlines(display), LeafType.ACTIVITY, null); entity2 = diagram.reallyCreateLeaf(ident, Display.getWithNewlines(display), LeafType.ACTIVITY, null);

View File

@ -83,10 +83,7 @@ public class CommandPartition extends SingleLineCommand2<ActivityDiagram> {
@Override @Override
protected CommandExecutionResult executeArg(ActivityDiagram diagram, LineLocation location, RegexResult arg) protected CommandExecutionResult executeArg(ActivityDiagram diagram, LineLocation location, RegexResult arg)
throws NoSuchColorException { throws NoSuchColorException {
final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(arg.get("NAME", 0)), false); final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(arg.get("NAME", 0)), false);
// final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("NAME", 0));
// final Quark ident = diagram.buildFromName(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(idShort));
// final Quark code = diagram.buildFromFullPath(idShort);
diagram.gotoGroup(quark, Display.getWithNewlines(quark.getName()), GroupType.PACKAGE); diagram.gotoGroup(quark, Display.getWithNewlines(quark.getName()), GroupType.PACKAGE);
final Entity p = diagram.getCurrentGroup(); final Entity p = diagram.getCurrentGroup();

View File

@ -36,7 +36,6 @@
package net.sourceforge.plantuml.activitydiagram3; package net.sourceforge.plantuml.activitydiagram3;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.sequencediagram.NotePosition; import net.sourceforge.plantuml.sequencediagram.NotePosition;

View File

@ -40,7 +40,6 @@ import static net.sourceforge.plantuml.utils.ObjectUtils.instanceOfAny;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import net.sourceforge.plantuml.awt.geom.XLine2D; import net.sourceforge.plantuml.awt.geom.XLine2D;
import net.sourceforge.plantuml.klimt.UBackground; import net.sourceforge.plantuml.klimt.UBackground;
import net.sourceforge.plantuml.klimt.UChange; import net.sourceforge.plantuml.klimt.UChange;

View File

@ -33,7 +33,6 @@ import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock; import java.util.concurrent.locks.ReentrantLock;
import java.util.prefs.Preferences; import java.util.prefs.Preferences;
import net.sourceforge.plantuml.log.Logme; import net.sourceforge.plantuml.log.Logme;
import net.sourceforge.plantuml.utils.Log; import net.sourceforge.plantuml.utils.Log;

View File

@ -32,7 +32,6 @@ import java.util.StringTokenizer;
import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicLong;
import java.util.prefs.Preferences; import java.util.prefs.Preferences;
import net.sourceforge.plantuml.log.Logme; import net.sourceforge.plantuml.log.Logme;
import net.sourceforge.plantuml.utils.Log; import net.sourceforge.plantuml.utils.Log;

View File

@ -32,7 +32,6 @@ import java.util.StringTokenizer;
import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicLong;
import java.util.prefs.Preferences; import java.util.prefs.Preferences;
import net.sourceforge.plantuml.log.Logme; import net.sourceforge.plantuml.log.Logme;
import net.sourceforge.plantuml.utils.Log; import net.sourceforge.plantuml.utils.Log;

View File

@ -0,0 +1,41 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2023, Arnaud Roques
*
* Project Info: http://plantuml.com
*
* If you like this project or if you find it useful, you can support us at:
*
* http://plantuml.com/patreon (only 1$ per month!)
* http://plantuml.com/paypal
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Arnaud Roques
* Contribution: Hisashi Miyashita
* Contribution: Miguel Esteves
*
*/
package net.sourceforge.plantuml.baraye;
public interface Bag {
}

View File

@ -59,7 +59,6 @@ import net.sourceforge.plantuml.core.UmlSource;
import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.EntityGender; import net.sourceforge.plantuml.cucadiagram.EntityGender;
import net.sourceforge.plantuml.cucadiagram.EntityPortion; import net.sourceforge.plantuml.cucadiagram.EntityPortion;
import net.sourceforge.plantuml.cucadiagram.EntityPosition;
import net.sourceforge.plantuml.cucadiagram.GroupHierarchy; import net.sourceforge.plantuml.cucadiagram.GroupHierarchy;
import net.sourceforge.plantuml.cucadiagram.GroupType; import net.sourceforge.plantuml.cucadiagram.GroupType;
import net.sourceforge.plantuml.cucadiagram.HideOrShow2; import net.sourceforge.plantuml.cucadiagram.HideOrShow2;
@ -75,7 +74,6 @@ import net.sourceforge.plantuml.cucadiagram.dot.CucaDiagramTxtMaker;
import net.sourceforge.plantuml.elk.CucaDiagramFileMakerElk; import net.sourceforge.plantuml.elk.CucaDiagramFileMakerElk;
import net.sourceforge.plantuml.graphic.USymbol; import net.sourceforge.plantuml.graphic.USymbol;
import net.sourceforge.plantuml.graphml.CucaDiagramGraphmlMaker; import net.sourceforge.plantuml.graphml.CucaDiagramGraphmlMaker;
import net.sourceforge.plantuml.plasma.Plasma;
import net.sourceforge.plantuml.plasma.Quark; import net.sourceforge.plantuml.plasma.Quark;
import net.sourceforge.plantuml.sdot.CucaDiagramFileMakerSmetana; import net.sourceforge.plantuml.sdot.CucaDiagramFileMakerSmetana;
import net.sourceforge.plantuml.security.SecurityUtils; import net.sourceforge.plantuml.security.SecurityUtils;
@ -94,26 +92,20 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
private String namespaceSeparator = null; private String namespaceSeparator = null;
private boolean namespaceSeparatorHasBeenSet = false; private boolean namespaceSeparatorHasBeenSet = false;
public final boolean mergeIntricated() {
return false;
}
private final List<HideOrShow2> hides2 = new ArrayList<>(); private final List<HideOrShow2> hides2 = new ArrayList<>();
private final List<HideOrShow2> removed = new ArrayList<>(); private final List<HideOrShow2> removed = new ArrayList<>();
protected final EntityFactory entityFactory = new EntityFactory(hides2, removed, this); protected final EntityFactory entityFactory = new EntityFactory(hides2, removed, this);
private List<Quark> stacks = new ArrayList<>(); private List<Bag> stacks = new ArrayList<>();
private boolean visibilityModifierPresent; private boolean visibilityModifierPresent;
private Together currentTogether;
public CucaDiagram(UmlSource source, UmlDiagramType type, Map<String, String> orig) { public CucaDiagram(UmlSource source, UmlDiagramType type, Map<String, String> orig) {
super(source, type, orig); super(source, type, orig);
this.stacks.add(entityFactory.getPlasma().root()); this.stacks.add(entityFactory.root().getData());
} }
public String getPortFor(String entString, Quark ident) { public String getPortFor(String entString, Quark<Entity> ident) {
final int x = entString.lastIndexOf("::"); final int x = entString.lastIndexOf("::");
if (x == -1) if (x == -1)
return null; return null;
@ -122,11 +114,26 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
return null; return null;
} }
public Quark currentQuark() { public final Entity getCurrentGroup() {
return this.stacks.get(stacks.size() - 1); int pos = stacks.size() - 1;
while (pos >= 0) {
final Bag tmp = this.stacks.get(pos);
if (tmp instanceof Entity)
return (Entity) tmp;
pos--;
}
throw new IllegalStateException();
} }
public String cleanIdForQuark(String id) { public final Together currentTogether() {
final int pos = stacks.size() - 1;
final Bag tmp = this.stacks.get(pos);
if (tmp instanceof Together)
return (Together) tmp;
return null;
}
public String cleanId(String id) {
if (id == null) if (id == null)
return null; return null;
return StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(id); return StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(id);
@ -135,7 +142,7 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
final public void setNamespaceSeparator(String namespaceSeparator) { final public void setNamespaceSeparator(String namespaceSeparator) {
this.namespaceSeparatorHasBeenSet = true; this.namespaceSeparatorHasBeenSet = true;
this.namespaceSeparator = namespaceSeparator; this.namespaceSeparator = namespaceSeparator;
getPlasma().setSeparator(namespaceSeparator); entityFactory.setSeparator(namespaceSeparator);
} }
final public String getNamespaceSeparator() { final public String getNamespaceSeparator() {
@ -147,8 +154,8 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
@Override @Override
public boolean hasUrl() { public boolean hasUrl() {
for (Quark quark : getPlasma().quarks()) { for (Quark<Entity> quark : entityFactory.quarks()) {
final Entity ent = (Entity) quark.getData(); final Entity ent = quark.getData();
if (ent != null && ent.hasUrl()) if (ent != null && ent.hasUrl())
return true; return true;
} }
@ -163,7 +170,7 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
protected void updateLasts(Entity result) { protected void updateLasts(Entity result) {
} }
final public Entity reallyCreateLeaf(Quark ident, Display display, LeafType type, USymbol symbol) { final public Entity reallyCreateLeaf(Quark<Entity> ident, Display display, LeafType type, USymbol symbol) {
Objects.requireNonNull(type); Objects.requireNonNull(type);
if (ident.getData() != null) if (ident.getData() != null)
throw new IllegalStateException(); throw new IllegalStateException();
@ -172,33 +179,38 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
final Entity result = entityFactory.createLeaf(ident, type, getHides()); final Entity result = entityFactory.createLeaf(ident, type, getHides());
result.setUSymbol(symbol); result.setUSymbol(symbol);
ident.setData(result);
this.lastEntity = result; this.lastEntity = result;
result.setTogether(currentTogether);
result.setTogether(currentTogether());
updateLasts(result); updateLasts(result);
// if (type == LeafType.OBJECT) // if (type == LeafType.OBJECT)
// ((EntityImp) parent.getData()).muteToType2(type); // ((EntityImp) parent.getData()).muteToType2(type);
result.setDisplay(display); result.setDisplay(display);
if (type.isLikeClass())
eventuallyBuildPhantomGroups();
return result; return result;
} }
final public Quark quarkInContext(String full, boolean specialForCreateClass) { final public Quark<Entity> quarkInContext(String full, boolean specialForCreateClass) {
final String sep = getNamespaceSeparator(); final String sep = getNamespaceSeparator();
if (sep == null) { if (sep == null) {
final Quark result = getPlasma().firstWithName(full); final Quark<Entity> result = entityFactory.firstWithName(full);
if (result != null) if (result != null)
return result; return result;
return currentQuark().child(full); return getCurrentGroup().getQuark().child(full);
} }
final Quark currentQuark = currentQuark(); final Quark<Entity> currentQuark = getCurrentGroup().getQuark();
if (full.startsWith(sep)) if (full.startsWith(sep))
return getPlasma().root().child(full.substring(sep.length())); return entityFactory.root().child(full.substring(sep.length()));
final int x = full.indexOf(sep); final int x = full.indexOf(sep);
if (x == -1) { if (x == -1) {
if (specialForCreateClass == false && getPlasma().countByName(full) == 1) { if (specialForCreateClass == false && entityFactory.countByName(full) == 1) {
final Quark byName = getPlasma().firstWithName(full); final Quark<Entity> byName = entityFactory.firstWithName(full);
assert byName != null; assert byName != null;
if (byName != currentQuark) if (byName != currentQuark)
return byName; return byName;
@ -207,10 +219,10 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
} }
final String first = full.substring(0, x); final String first = full.substring(0, x);
final boolean firstPackageDoesExist = getPlasma().root().childIfExists(first) != null; final boolean firstPackageDoesExist = entityFactory.root().childIfExists(first) != null;
if (firstPackageDoesExist) if (firstPackageDoesExist)
return getPlasma().root().child(full); return entityFactory.root().child(full);
return currentQuark.child(full); return currentQuark.child(full);
} }
@ -235,17 +247,17 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
return id.substring(x + 2); return id.substring(x + 2);
} }
// protected Plasma getPlasma() { public Quark<Entity> firstWithName(String name) {
public /* protected */ Plasma getPlasma() { return entityFactory.firstWithName(name);
return entityFactory.getPlasma();
} }
@Override
final public Collection<Entity> getChildrenGroups(Entity entity) { final public Collection<Entity> getChildrenGroups(Entity entity) {
return entity.groups(); return entity.groups();
} }
private void eventuallyBuildPhantomGroups() { private void eventuallyBuildPhantomGroups() {
for (Quark quark : getPlasma().quarks()) { for (Quark<Entity> quark : entityFactory.quarks()) {
if (quark.getData() != null) if (quark.getData() != null)
continue; continue;
int countChildren = quark.countChildren(); int countChildren = quark.countChildren();
@ -254,80 +266,63 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
final Display display = Display.getWithNewlines(quark.getName()); final Display display = Display.getWithNewlines(quark.getName());
final Entity result = entityFactory.createGroup(quark, GroupType.PACKAGE, getHides()); final Entity result = entityFactory.createGroup(quark, GroupType.PACKAGE, getHides());
result.setDisplay(display); result.setDisplay(display);
quark.setData(result);
} }
} }
} }
final public CommandExecutionResult gotoTogether() { final public CommandExecutionResult gotoTogether() {
if (currentTogether != null) this.stacks.add(new Together(currentTogether()));
return CommandExecutionResult.error("Cannot nest together");
this.currentTogether = new Together();
return CommandExecutionResult.ok(); return CommandExecutionResult.ok();
} }
final public CommandExecutionResult gotoGroup(Quark quark, Display display, GroupType type) { final public CommandExecutionResult gotoGroup(Quark<Entity> quark, Display display, GroupType type) {
if (currentTogether != null)
return CommandExecutionResult.error("Cannot be done inside 'together'");
if (quark.getData() == null) { if (quark.getData() == null) {
final Entity result = entityFactory.createGroup(quark, type, getHides()); final Entity result = entityFactory.createGroup(quark, type, getHides());
result.setTogether(currentTogether());
result.setDisplay(display); result.setDisplay(display);
quark.setData(result);
} }
final Entity ent = (Entity) quark.getData(); final Entity ent = quark.getData();
ent.muteToGroupType(type); ent.muteToGroupType(type);
this.stacks.add(quark); this.stacks.add(quark.getData());
return CommandExecutionResult.ok(); return CommandExecutionResult.ok();
} }
public boolean endGroup() { public boolean endGroup() {
if (this.currentTogether != null) {
this.currentTogether = null;
return true;
}
if (stacks.size() > 0) { if (stacks.size() > 0) {
stacks.remove(stacks.size() - 1); stacks.remove(stacks.size() - 1);
return true; return true;
} }
return false; return false;
} }
public final Entity getCurrentGroup() {
return (Entity) currentQuark().getData();
}
public final Entity getGroup(String code) { public final Entity getGroup(String code) {
final Quark quark = getPlasma().firstWithName(code); final Quark<Entity> quark = entityFactory.firstWithName(code);
if (quark == null) if (quark == null)
return null; return null;
return (Entity) quark.getData(); return quark.getData();
} }
public final boolean isGroup(String code) { public final boolean isGroup(String code) {
final Quark quark = getPlasma().firstWithName(code); final Quark<Entity> quark = entityFactory.firstWithName(code);
if (quark == null) if (quark == null)
return false; return false;
return isGroup(quark); return isGroup(quark);
} }
public final boolean isGroup(Quark quark) { public final boolean isGroup(Quark<Entity> quark) {
final Entity ent = (Entity) quark.getData(); final Entity ent = quark.getData();
if (ent == null) if (ent == null)
return false; return false;
return ent.isGroup(); return ent.isGroup();
} }
@Override
public Entity getRootGroup() { public Entity getRootGroup() {
return (Entity) getPlasma().root().getData(); return entityFactory.root().getData();
} }
final public void addLink(Link link) { final public void addLink(Link link) {
@ -462,33 +457,6 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
return generalWarningOrError + BackSlash.NEWLINE + warningOrError; return generalWarningOrError + BackSlash.NEWLINE + warningOrError;
} }
public boolean isAutarkic(Entity g) {
if (g.getGroupType() == GroupType.PACKAGE)
return false;
if (g.getGroupType() == GroupType.INNER_ACTIVITY)
return true;
if (g.getGroupType() == GroupType.CONCURRENT_ACTIVITY)
return true;
if (g.getGroupType() == GroupType.CONCURRENT_STATE)
return true;
if (getChildrenGroups(g).size() > 0)
return false;
for (Link link : getLinks())
if (EntityUtils.isPureInnerLink3(g, link) == false)
return false;
for (Entity leaf : g.leafs())
if (leaf.getEntityPosition() != EntityPosition.NORMAL)
return false;
return true;
}
private static boolean isNumber(String s) { private static boolean isNumber(String s) {
return s.matches("[+-]?(\\.?\\d+|\\d+\\.\\d*)"); return s.matches("[+-]?(\\.?\\d+|\\d+\\.\\d*)");
} }
@ -532,6 +500,7 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
return "25"; return "25";
} }
@Override
final public boolean isEmpty(Entity entity) { final public boolean isEmpty(Entity entity) {
return entity.isEmpty(); return entity.isEmpty();
} }

View File

@ -94,11 +94,11 @@ import net.sourceforge.plantuml.url.Url;
import net.sourceforge.plantuml.utils.Direction; import net.sourceforge.plantuml.utils.Direction;
import net.sourceforge.plantuml.utils.LineLocation; import net.sourceforge.plantuml.utils.LineLocation;
final public class Entity implements SpecificBackcolorable, Hideable, Removeable, LineConfigurable { final public class Entity implements SpecificBackcolorable, Hideable, Removeable, LineConfigurable, Bag {
private final EntityFactory entityFactory; private final EntityFactory entityFactory;
private Quark quark; private final Quark<Entity> quark;
private Url url; private Url url;
@ -157,7 +157,7 @@ final public class Entity implements SpecificBackcolorable, Hideable, Removeable
} }
// Back to Entity // Back to Entity
private Entity(Quark quark, EntityFactory entityFactory, Bodier bodier, int rawLayout) { private Entity(Quark<Entity> quark, EntityFactory entityFactory, Bodier bodier, int rawLayout) {
this.quark = Objects.requireNonNull(quark); this.quark = Objects.requireNonNull(quark);
if (quark.isRoot()) if (quark.isRoot())
this.uid = "clroot"; this.uid = "clroot";
@ -166,14 +166,15 @@ final public class Entity implements SpecificBackcolorable, Hideable, Removeable
this.entityFactory = entityFactory; this.entityFactory = entityFactory;
this.bodier = bodier; this.bodier = bodier;
this.rawLayout = rawLayout; this.rawLayout = rawLayout;
this.quark.setData(this);
} }
Entity(Quark quark, EntityFactory entityFactory, Bodier bodier, LeafType leafType, int rawLayout) { Entity(Quark<Entity> quark, EntityFactory entityFactory, Bodier bodier, LeafType leafType, int rawLayout) {
this(Objects.requireNonNull(quark), entityFactory, bodier, rawLayout); this(Objects.requireNonNull(quark), entityFactory, bodier, rawLayout);
this.leafType = leafType; this.leafType = leafType;
} }
Entity(Quark quark, EntityFactory entityFactory, Bodier bodier, GroupType groupType, int rawLayout) { Entity(Quark<Entity> quark, EntityFactory entityFactory, Bodier bodier, GroupType groupType, int rawLayout) {
this(Objects.requireNonNull(quark), entityFactory, bodier, rawLayout); this(Objects.requireNonNull(quark), entityFactory, bodier, rawLayout);
this.groupType = groupType; this.groupType = groupType;
} }
@ -220,7 +221,7 @@ final public class Entity implements SpecificBackcolorable, Hideable, Removeable
return true; return true;
} }
public Quark getQuark() { public Quark<Entity> getQuark() {
return quark; return quark;
} }
@ -652,24 +653,24 @@ final public class Entity implements SpecificBackcolorable, Hideable, Removeable
} }
public Together getTogether() {
return together;
}
public void setTogether(Together together) { public void setTogether(Together together) {
this.together = together; this.together = together;
} }
public Together getTogether() {
return this.together;
}
public Entity getParentContainer() { public Entity getParentContainer() {
if (quark.isRoot()) if (quark.isRoot())
return null; return null;
return (Entity) quark.getParent().getData(); return quark.getParent().getData();
} }
public Collection<Entity> leafs() { public Collection<Entity> leafs() {
final List<Entity> result = new ArrayList<>(); final List<Entity> result = new ArrayList<>();
for (Quark quark : quark.getChildren()) { for (Quark<Entity> child : quark.getChildren()) {
final Entity data = (Entity) quark.getData(); final Entity data = child.getData();
if (data != null && data.isGroup() == false) if (data != null && data.isGroup() == false)
result.add(data); result.add(data);
} }
@ -678,8 +679,8 @@ final public class Entity implements SpecificBackcolorable, Hideable, Removeable
public Collection<Entity> groups() { public Collection<Entity> groups() {
final List<Entity> result = new ArrayList<>(); final List<Entity> result = new ArrayList<>();
for (Quark quark : quark.getChildren()) { for (Quark<Entity> child : quark.getChildren()) {
final Entity data = (Entity) quark.getData(); final Entity data = child.getData();
if (data != null && data.isGroup()) if (data != null && data.isGroup())
result.add(data); result.add(data);
} }
@ -702,4 +703,31 @@ final public class Entity implements SpecificBackcolorable, Hideable, Removeable
return getQuark().getName(); return getQuark().getName();
} }
public boolean isAutarkic() {
if (getGroupType() == GroupType.PACKAGE)
return false;
if (getGroupType() == GroupType.INNER_ACTIVITY)
return true;
if (getGroupType() == GroupType.CONCURRENT_ACTIVITY)
return true;
if (getGroupType() == GroupType.CONCURRENT_STATE)
return true;
// if (diag.getChildrenGroups(this).size() > 0)
// return false;
for (Link link : entityFactory.getLinks())
if (EntityUtils.isPureInnerLink3(this, link) == false)
return false;
for (Entity leaf : leafs())
if (leaf.getEntityPosition() != EntityPosition.NORMAL)
return false;
return true;
}
} }

View File

@ -46,7 +46,6 @@ import net.sourceforge.plantuml.cucadiagram.Bodier;
import net.sourceforge.plantuml.cucadiagram.BodierJSon; import net.sourceforge.plantuml.cucadiagram.BodierJSon;
import net.sourceforge.plantuml.cucadiagram.BodierMap; import net.sourceforge.plantuml.cucadiagram.BodierMap;
import net.sourceforge.plantuml.cucadiagram.BodyFactory; import net.sourceforge.plantuml.cucadiagram.BodyFactory;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.GroupType; import net.sourceforge.plantuml.cucadiagram.GroupType;
import net.sourceforge.plantuml.cucadiagram.HideOrShow2; import net.sourceforge.plantuml.cucadiagram.HideOrShow2;
import net.sourceforge.plantuml.cucadiagram.ICucaDiagram; import net.sourceforge.plantuml.cucadiagram.ICucaDiagram;
@ -64,22 +63,24 @@ public final class EntityFactory implements IEntityFactory {
private int rawLayout; private int rawLayout;
private final Plasma plasma; private final Plasma<Entity> namespace;
private final Quark<Entity> root;
private final Entity rootGroup; private final Entity rootGroup;
private final List<HideOrShow2> hides2; private final List<HideOrShow2> hides2;
private final List<HideOrShow2> removed; private final List<HideOrShow2> removed;
final private ICucaDiagram namespaceSeparator; final private ICucaDiagram diagram;
// //
public EntityFactory(List<HideOrShow2> hides2, List<HideOrShow2> removed, ICucaDiagram namespaceSeparator) { public EntityFactory(List<HideOrShow2> hides2, List<HideOrShow2> removed, ICucaDiagram diagram) {
this.hides2 = hides2; this.hides2 = hides2;
this.removed = removed; this.removed = removed;
this.namespaceSeparator = namespaceSeparator; this.diagram = diagram;
this.plasma = new Plasma("."); this.namespace = new Plasma<Entity>(".");
this.rootGroup = new Entity(this.plasma.root(), this, null, GroupType.ROOT, 0); // this.printspace = new Plasma<Entity>(".");
this.plasma.root().setData(rootGroup); this.root = namespace.root();
this.rootGroup = new Entity(this.root, this, null, GroupType.ROOT, 0);
} }
public boolean isHidden(Entity leaf) { public boolean isHidden(Entity leaf) {
@ -144,7 +145,7 @@ public final class EntityFactory implements IEntityFactory {
return result; return result;
} }
final public Entity createLeaf(Quark quark, LeafType entityType, Set<VisibilityModifier> hides) { final public Entity createLeaf(Quark<Entity> quark, LeafType entityType, Set<VisibilityModifier> hides) {
final Bodier bodier; final Bodier bodier;
if (Objects.requireNonNull(entityType) == LeafType.MAP) if (Objects.requireNonNull(entityType) == LeafType.MAP)
bodier = new BodierMap(); bodier = new BodierMap();
@ -158,10 +159,10 @@ public final class EntityFactory implements IEntityFactory {
return result; return result;
} }
public Entity createGroup(Quark quark, GroupType groupType, Set<VisibilityModifier> hides) { public Entity createGroup(Quark<Entity> quark, GroupType groupType, Set<VisibilityModifier> hides) {
Objects.requireNonNull(groupType); Objects.requireNonNull(groupType);
if (quark.getData() != null) if (quark.getData() != null)
return (Entity) quark.getData(); return quark.getData();
final Bodier bodier = BodyFactory.createGroup(hides); final Bodier bodier = BodyFactory.createGroup(hides);
final Entity result = new Entity(quark, this, bodier, groupType, rawLayout); final Entity result = new Entity(quark, this, bodier, groupType, rawLayout);
@ -176,10 +177,10 @@ public final class EntityFactory implements IEntityFactory {
public final Collection<Entity> leafs() { public final Collection<Entity> leafs() {
final List<Entity> result = new ArrayList<>(); final List<Entity> result = new ArrayList<>();
for (Quark quark : getPlasma().quarks()) { for (Quark<Entity> quark : quarks()) {
if (quark.isRoot()) if (quark.isRoot())
continue; continue;
final Entity data = (Entity) quark.getData(); final Entity data = quark.getData();
if (data != null && data.isGroup() == false) if (data != null && data.isGroup() == false)
result.add(data); result.add(data);
} }
@ -189,11 +190,11 @@ public final class EntityFactory implements IEntityFactory {
public final Collection<Entity> groups() { public final Collection<Entity> groups() {
final List<Entity> result = new ArrayList<>(); final List<Entity> result = new ArrayList<>();
for (Quark quark : getPlasma().quarks()) { for (Quark<Entity> quark : quarks()) {
if (quark.isRoot()) if (quark.isRoot())
continue; continue;
final Entity data = (Entity) quark.getData(); final Entity data = quark.getData();
if (data != null && data.isGroup()) if (data != null && data.isGroup())
result.add(data); result.add(data);
} }
@ -202,8 +203,8 @@ public final class EntityFactory implements IEntityFactory {
public final Collection<Entity> groupsAndRoot() { public final Collection<Entity> groupsAndRoot() {
final List<Entity> result = new ArrayList<>(); final List<Entity> result = new ArrayList<>();
for (Quark quark : getPlasma().quarks()) { for (Quark<Entity> quark : quarks()) {
final Entity data = (Entity) quark.getData(); final Entity data = quark.getData();
if (data != null && data.isGroup()) if (data != null && data.isGroup())
result.add(data); result.add(data);
} }
@ -241,10 +242,35 @@ public final class EntityFactory implements IEntityFactory {
} }
public ICucaDiagram getDiagram() { public ICucaDiagram getDiagram() {
return namespaceSeparator; return diagram;
} }
public Plasma getPlasma() { // ----------
return plasma;
Collection<Quark<Entity>> quarks() {
final List<Quark<Entity>> result = new ArrayList<>();
for (Quark<Entity> quark : namespace.quarks()) {
result.add(quark);
}
return result;
} }
public Quark<Entity> root() {
return root;
}
public void setSeparator(String namespaceSeparator) {
namespace.setSeparator(namespaceSeparator);
// printspace.setSeparator(namespaceSeparator);
}
public Quark<Entity> firstWithName(String full) {
final Quark<Entity> tmp = namespace.firstWithName(full);
return tmp;
}
public int countByName(String full) {
return namespace.countByName(full);
}
} }

View File

@ -42,11 +42,13 @@ import java.util.Map;
import net.sourceforge.plantuml.FileFormatOption; import net.sourceforge.plantuml.FileFormatOption;
import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.baraye.Entity; import net.sourceforge.plantuml.baraye.Entity;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.core.ImageData;
import net.sourceforge.plantuml.core.UmlSource; import net.sourceforge.plantuml.core.UmlSource;
import net.sourceforge.plantuml.cucadiagram.Link; import net.sourceforge.plantuml.cucadiagram.Link;
import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.objectdiagram.AbstractClassOrObjectDiagram; import net.sourceforge.plantuml.objectdiagram.AbstractClassOrObjectDiagram;
import net.sourceforge.plantuml.plasma.Quark;
import net.sourceforge.plantuml.svek.image.EntityImageClass; import net.sourceforge.plantuml.svek.image.EntityImageClass;
public class ClassDiagram extends AbstractClassOrObjectDiagram { public class ClassDiagram extends AbstractClassOrObjectDiagram {
@ -55,50 +57,6 @@ public class ClassDiagram extends AbstractClassOrObjectDiagram {
super(source, UmlDiagramType.CLASS, skinParam); super(source, UmlDiagramType.CLASS, skinParam);
} }
// @Override
// protected ILeaf getOrCreateLeaf2(Quark ident, Quark code, LeafType type, USymbol symbol) {
// Objects.requireNonNull(ident);
// if (type == null) {
// code = code.eventuallyRemoveStartingAndEndingDoubleQuote("\"([:");
// if (code.getData() != null)
// return (ILeaf) code.getData();
// if (getNamespaceSeparator() == null)
// return reallyCreateLeaf(ident, Display.getWithNewlines(code.getName()), LeafType.CLASS, symbol);
// // return getOrCreateLeafDefault(ident, code.getName(), LeafType.CLASS, symbol);
//
// if (ident.getData() != null)
// return (ILeaf) ident.getData();
// final ILeaf result = reallyCreateLeaf(ident, Display.getWithNewlines(ident.getName()), LeafType.CLASS, symbol);
// this.lastEntity = (EntityImp) result;
// return result;
// }
// if (code.getData() != null)
// return (ILeaf) code.getData();
// if (getNamespaceSeparator() == null)
// return reallyCreateLeaf(ident, Display.getWithNewlines(code.getName()), type, symbol);
// // return getOrCreateLeafDefault(ident, code.getName(), type, symbol);
//
// final ILeaf result = reallyCreateLeaf(ident, Display.getWithNewlines(ident.getName()), type, symbol);
// this.lastEntity = (EntityImp) result;
// return result;
// }
// @Override
// public ILeaf createLeaf(Quark idNewLong, String displayString, Display display, LeafType type, USymbol symbol) {
// Objects.requireNonNull(idNewLong);
// if (type != LeafType.ABSTRACT_CLASS && type != LeafType.ANNOTATION && type != LeafType.CLASS
// && type != LeafType.INTERFACE && type != LeafType.ENUM && type != LeafType.LOLLIPOP_FULL
// && type != LeafType.LOLLIPOP_HALF && type != LeafType.NOTE)
// return super.createLeaf(idNewLong, displayString, display, type, symbol);
//
// if (getNamespaceSeparator() == null)
// return super.createLeaf(idNewLong, displayString, display, type, symbol);
//
// final ILeaf result = createLeafInternal(idNewLong, display, type, symbol);
// this.lastEntity = (EntityImp) result;
// return result;
// }
private boolean allowMixing; private boolean allowMixing;
public void setAllowMixing(boolean allowMixing) { public void setAllowMixing(boolean allowMixing) {
@ -164,4 +122,14 @@ public class ClassDiagram extends AbstractClassOrObjectDiagram {
return super.checkFinalError(); return super.checkFinalError();
} }
public CommandExecutionResult checkIfPackageHierarchyIfOk(Entity entity) {
Quark<Entity> current = entity.getQuark().getParent();
while (current.isRoot() == false) {
if (current.getData() != null && current.getData().isGroup() == false)
return CommandExecutionResult.error("Bad hierarchy for class " + entity.getQuark().getQualifiedName());
current = current.getParent();
}
return CommandExecutionResult.ok();
}
} }

View File

@ -70,13 +70,10 @@ public class CommandAddMethod extends SingleLineCommand2<ClassDiagram> {
protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg) protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg)
throws NoSuchColorException { throws NoSuchColorException {
final String idShort = arg.get("NAME", 0); final String idShort = arg.get("NAME", 0);
final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(idShort), false); final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(idShort), false);
Entity entity = (Entity) quark.getData(); Entity entity = quark.getData();
if (entity == null) if (entity == null)
entity = diagram.reallyCreateLeaf(quark, Display.getWithNewlines(quark), LeafType.CLASS, null); entity = diagram.reallyCreateLeaf(quark, Display.getWithNewlines(quark), LeafType.CLASS, null);
// final Quark ident = diagram.buildFromName(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(idShort));
// final Quark code = diagram.buildFromFullPath(idShort);
// final IEntity entity = diagram.getOrCreateLeaf(ident, code, null, null);
final String field = arg.get("DATA", 0); final String field = arg.get("DATA", 0);
if (field.length() > 0 && VisibilityModifier.isVisibilityCharacter(field)) if (field.length() > 0 && VisibilityModifier.isVisibilityCharacter(field))

View File

@ -132,16 +132,16 @@ public class CommandCreateClass extends SingleLineCommand2<ClassDiagram> {
throws NoSuchColorException { throws NoSuchColorException {
final String typeString = StringUtils.goUpperCase(arg.get("TYPE", 0)); final String typeString = StringUtils.goUpperCase(arg.get("TYPE", 0));
final LeafType type = LeafType.getLeafType(typeString); final LeafType type = LeafType.getLeafType(typeString);
final String idShort = diagram.cleanIdForQuark(arg.getLazzy("CODE", 0)); final String idShort = diagram.cleanId(arg.getLazzy("CODE", 0));
final String displayString = arg.getLazzy("DISPLAY", 0); final String displayString = arg.getLazzy("DISPLAY", 0);
final String genericOption = arg.getLazzy("DISPLAY", 1); final String genericOption = arg.getLazzy("DISPLAY", 1);
final String generic = genericOption != null ? genericOption : arg.get("GENERIC", 0); final String generic = genericOption != null ? genericOption : arg.get("GENERIC", 0);
final String stereo = arg.get("STEREO", 0); final String stereo = arg.get("STEREO", 0);
final Quark quark = diagram.quarkInContext(idShort, true); final Quark<Entity> quark = diagram.quarkInContext(idShort, true);
Entity entity = (Entity) quark.getData(); Entity entity = quark.getData();
if (entity == null) { if (entity == null) {
Display display = Display.getWithNewlines(displayString); Display display = Display.getWithNewlines(displayString);
@ -151,8 +151,12 @@ public class CommandCreateClass extends SingleLineCommand2<ClassDiagram> {
} else { } else {
if (entity.muteToType(type, null) == false) if (entity.muteToType(type, null) == false)
return CommandExecutionResult.error("Bad name"); return CommandExecutionResult.error("Bad name");
} }
final CommandExecutionResult check1 = diagram.checkIfPackageHierarchyIfOk(entity);
if (check1.isOk() == false)
return check1;
diagram.setLastEntity(entity); diagram.setLastEntity(entity);
if (stereo != null) { if (stereo != null) {
entity.setStereotype(Stereotype.build(stereo, diagram.getSkinParam().getCircledCharacterRadius(), entity.setStereotype(Stereotype.build(stereo, diagram.getSkinParam().getCircledCharacterRadius(),

View File

@ -159,7 +159,7 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
if (visibilityString != null) if (visibilityString != null)
visibilityModifier = VisibilityModifier.getVisibilityModifier(visibilityString + "FOO", false); visibilityModifier = VisibilityModifier.getVisibilityModifier(visibilityString + "FOO", false);
final String idShort = diagram.cleanIdForQuark(line0.getLazzy("CODE", 0)); final String idShort = diagram.cleanId(line0.getLazzy("CODE", 0));
final String displayString = line0.getLazzy("DISPLAY", 0); final String displayString = line0.getLazzy("DISPLAY", 0);
final String genericOption = line0.getLazzy("DISPLAY", 1); final String genericOption = line0.getLazzy("DISPLAY", 1);
@ -167,9 +167,9 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
final String stereotype = line0.get("STEREO", 0); final String stereotype = line0.get("STEREO", 0);
final Quark quark = diagram.quarkInContext(idShort, true); final Quark<Entity> quark = diagram.quarkInContext(idShort, true);
Entity entity = (Entity) quark.getData(); Entity entity = quark.getData();
Display display = Display.getWithNewlines(displayString); Display display = Display.getWithNewlines(displayString);
if (entity == null) { if (entity == null) {
@ -182,6 +182,9 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
if (Display.isNull(display) == false) if (Display.isNull(display) == false)
entity.setDisplay(display); entity.setDisplay(display);
} }
final CommandExecutionResult check1 = diagram.checkIfPackageHierarchyIfOk(entity);
if (check1.isOk() == false)
return check1;
diagram.setLastEntity(entity); diagram.setLastEntity(entity);
@ -274,13 +277,9 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
final String codes = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get(keyword, 1)); final String codes = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get(keyword, 1));
for (String s : codes.split(",")) { for (String s : codes.split(",")) {
final String idShort = StringUtils.trin(s); final String idShort = StringUtils.trin(s);
// final Quark ident = diagram
// .buildFromName(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(idShort));
// final Quark other = diagram.buildFromFullPath(idShort);
// final IEntity cl2 = diagram.getOrCreateLeaf(ident, other, type2, null);
final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(idShort), true); final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(idShort), true);
Entity cl2 = (Entity) quark.getData(); Entity cl2 = quark.getData();
if (cl2 == null) if (cl2 == null)
cl2 = diagram.reallyCreateLeaf(quark, Display.getWithNewlines(quark.getName()), type2, null); cl2 = diagram.reallyCreateLeaf(quark, Display.getWithNewlines(quark.getName()), type2, null);
@ -306,7 +305,7 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
if (visibilityString != null) if (visibilityString != null)
visibilityModifier = VisibilityModifier.getVisibilityModifier(visibilityString + "FOO", false); visibilityModifier = VisibilityModifier.getVisibilityModifier(visibilityString + "FOO", false);
final String idShort = diagram.cleanIdForQuark(line0.getLazzy("CODE", 0)); final String idShort = diagram.cleanId(line0.getLazzy("CODE", 0));
final String displayString = line0.getLazzy("DISPLAY", 0); final String displayString = line0.getLazzy("DISPLAY", 0);
final String genericOption = line0.getLazzy("DISPLAY", 1); final String genericOption = line0.getLazzy("DISPLAY", 1);
@ -314,13 +313,13 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
final String stereotype = line0.get("STEREO", 0); final String stereotype = line0.get("STEREO", 0);
final Quark quark = diagram.quarkInContext(idShort, true); final Quark<Entity> quark = diagram.quarkInContext(idShort, true);
Display display = Display.getWithNewlines(displayString); Display display = Display.getWithNewlines(displayString);
if (Display.isNull(display)) if (Display.isNull(display))
display = Display.getWithNewlines(quark.getName()).withCreoleMode(CreoleMode.SIMPLE_LINE); display = Display.getWithNewlines(quark.getName()).withCreoleMode(CreoleMode.SIMPLE_LINE);
Entity entity = (Entity) quark.getData(); Entity entity = quark.getData();
if (entity == null) { if (entity == null) {
entity = diagram.reallyCreateLeaf(quark, display, type, null); entity = diagram.reallyCreateLeaf(quark, display, type, null);

View File

@ -156,7 +156,7 @@ public class CommandCreateElementFull2 extends SingleLineCommand2<ClassDiagram>
return CommandExecutionResult.error("Use 'allowmixing' if you want to mix classes and other UML elements."); return CommandExecutionResult.error("Use 'allowmixing' if you want to mix classes and other UML elements.");
String codeRaw = arg.getLazzy("CODE", 0); String codeRaw = arg.getLazzy("CODE", 0);
final String displayRaw = arg.getLazzy("DISPLAY", 0); final String displayRaw = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.getLazzy("DISPLAY", 0));
final char codeChar = getCharEncoding(codeRaw); final char codeChar = getCharEncoding(codeRaw);
final char codeDisplay = getCharEncoding(displayRaw); final char codeDisplay = getCharEncoding(displayRaw);
final String symbol; final String symbol;
@ -206,20 +206,13 @@ public class CommandCreateElementFull2 extends SingleLineCommand2<ClassDiagram>
final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(codeRaw); final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(codeRaw);
final Display display = Display.getWithNewlines(displayRaw == null ? idShort : displayRaw); final Display display = Display.getWithNewlines(displayRaw == null ? idShort : displayRaw);
final Quark quark = diagram.quarkInContext(idShort, false); final Quark<Entity> quark = diagram.quarkInContext(idShort, false);
Entity entity = (Entity) quark.getData(); Entity entity = quark.getData();
if (entity == null) if (entity == null)
entity = diagram.reallyCreateLeaf(quark, display, type, usymbol); entity = diagram.reallyCreateLeaf(quark, display, type, usymbol);
// final Quark ident = diagram.buildFromName(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(idShort));
// final Quark code = diagram.buildFromFullPath(idShort);
// String display = displayRaw;
// if (display == null)
// display = code.getName();
//
// display = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(display);
final String stereotype = arg.getLazzy("STEREOTYPE", 0); final String stereotype = arg.getLazzy("STEREOTYPE", 0);
// final IEntity entity = diagram.getOrCreateLeaf(ident, code, type, usymbol);
entity.setDisplay(display); entity.setDisplay(display);
entity.setUSymbol(usymbol); entity.setUSymbol(usymbol);
if (stereotype != null) if (stereotype != null)

View File

@ -35,6 +35,7 @@
*/ */
package net.sourceforge.plantuml.classdiagram.command; package net.sourceforge.plantuml.classdiagram.command;
import net.sourceforge.plantuml.baraye.Entity;
import net.sourceforge.plantuml.classdiagram.ClassDiagram; import net.sourceforge.plantuml.classdiagram.ClassDiagram;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.SingleLineCommand2;
@ -64,10 +65,8 @@ public class CommandDiamondAssociation extends SingleLineCommand2<ClassDiagram>
@Override @Override
protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg) { protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg) {
final String idShort = arg.get("CODE", 0); final String idShort = arg.get("CODE", 0);
final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(idShort), false); final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(idShort), false);
// final Quark ident = diagram.buildFromName(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(idShort));
// final Quark code = diagram.buildFromFullPath(idShort);
// final boolean leafExist = diagram.leafExist(code);
if (quark.getData() != null) if (quark.getData() != null)
return CommandExecutionResult.error("Already existing : " + quark.getName()); return CommandExecutionResult.error("Already existing : " + quark.getName());

View File

@ -38,7 +38,6 @@ package net.sourceforge.plantuml.classdiagram.command;
import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.UmlDiagram; import net.sourceforge.plantuml.UmlDiagram;
import net.sourceforge.plantuml.baraye.Entity; import net.sourceforge.plantuml.baraye.Entity;
import net.sourceforge.plantuml.baraye.EntityUtils;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.cucadiagram.EntityGender; import net.sourceforge.plantuml.cucadiagram.EntityGender;
@ -145,12 +144,10 @@ public class CommandHideShowByGender extends SingleLineCommand2<UmlDiagram> {
} else if (arg1.startsWith("<<")) { } else if (arg1.startsWith("<<")) {
gender = EntityGenderUtils.byStereotype(arg1); gender = EntityGenderUtils.byStereotype(arg1);
} else { } else {
final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(arg1), false); final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(arg1), false);
if (quark.getData() == null) if (quark.getData() == null)
return CommandExecutionResult.error("No such element " + quark.getName()); return CommandExecutionResult.error("No such element " + quark.getName());
// final IEntity entity = diagram.getOrCreateLeaf(quark, final Entity entity = quark.getData();
// diagram.buildFromFullPath(arg1), null, null);
final Entity entity = (Entity) quark.getData();
gender = EntityGenderUtils.byEntityAlone(entity); gender = EntityGenderUtils.byEntityAlone(entity);
} }
@ -192,26 +189,20 @@ public class CommandHideShowByGender extends SingleLineCommand2<UmlDiagram> {
gender = EntityGenderUtils.byStereotype(arg1); gender = EntityGenderUtils.byStereotype(arg1);
} else { } else {
arg1 = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg1); arg1 = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg1);
final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(arg1), false); final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(arg1), false);
Entity entity = (Entity) quark.getData(); Entity entity = quark.getData();
if (entity == null) if (entity == null)
return CommandExecutionResult.error("No such element " + quark.getName()); return CommandExecutionResult.error("No such element " + quark.getName());
// entity = diagram.reallyCreateLeaf(quark,
// Display.getWithNewlines(quark.getParent()), LeafType.CLASS, null);
// final Quark ident = diagram.buildFromName(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg1));
// final Quark code = diagram.buildFromFullPath(arg1);
// final IEntity entity = diagram.getOrCreateLeaf(ident, code, null, null);
gender = EntityGenderUtils.byEntityAlone(entity); gender = EntityGenderUtils.byEntityAlone(entity);
} }
if (gender != null) { if (gender != null) {
final boolean empty = arg.get("EMPTY", 0) != null; final boolean empty = arg.get("EMPTY", 0) != null;
final boolean emptyMembers = empty && portion == EntityPortion.MEMBER; final boolean emptyMembers = empty && portion == EntityPortion.MEMBER;
if (empty == true && emptyMembers == false) { if (empty == true && emptyMembers == false)
gender = EntityGenderUtils.and(gender, emptyByGender(portion)); gender = EntityGenderUtils.and(gender, emptyByGender(portion));
}
if (diagram.getCurrentGroup().isRoot() == false) { if (diagram.getCurrentGroup().isRoot() == false)
gender = EntityGenderUtils.and(gender, EntityGenderUtils.byPackage(diagram.getCurrentGroup())); gender = EntityGenderUtils.and(gender, EntityGenderUtils.byPackage(diagram.getCurrentGroup()));
}
if (emptyMembers) { if (emptyMembers) {
diagram.hideOrShow(EntityGenderUtils.and(gender, emptyByGender(EntityPortion.FIELD)), diagram.hideOrShow(EntityGenderUtils.and(gender, emptyByGender(EntityPortion.FIELD)),
@ -227,21 +218,21 @@ public class CommandHideShowByGender extends SingleLineCommand2<UmlDiagram> {
private EntityPortion getEntityPortion(String s) { private EntityPortion getEntityPortion(String s) {
final String sub = StringUtils.goLowerCase(s.substring(0, 3)); final String sub = StringUtils.goLowerCase(s.substring(0, 3));
if (sub.equals("met")) { if (sub.equals("met"))
return EntityPortion.METHOD; return EntityPortion.METHOD;
}
if (sub.equals("mem")) { if (sub.equals("mem"))
return EntityPortion.MEMBER; return EntityPortion.MEMBER;
}
if (sub.equals("att") || sub.equals("fie")) { if (sub.equals("att") || sub.equals("fie"))
return EntityPortion.FIELD; return EntityPortion.FIELD;
}
if (sub.equals("cir")) { if (sub.equals("cir"))
return EntityPortion.CIRCLED_CHARACTER; return EntityPortion.CIRCLED_CHARACTER;
}
if (sub.equals("ste")) { if (sub.equals("ste"))
return EntityPortion.STEREOTYPE; return EntityPortion.STEREOTYPE;
}
throw new IllegalArgumentException(); throw new IllegalArgumentException();
} }

View File

@ -157,8 +157,8 @@ final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrOb
protected CommandExecutionResult executeArg(AbstractClassOrObjectDiagram diagram, LineLocation location, protected CommandExecutionResult executeArg(AbstractClassOrObjectDiagram diagram, LineLocation location,
RegexResult arg) throws NoSuchColorException { RegexResult arg) throws NoSuchColorException {
String ent1String = diagram.cleanIdForQuark(arg.get("ENT1", 0)); String ent1String = diagram.cleanId(arg.get("ENT1", 0));
String ent2String = diagram.cleanIdForQuark(arg.get("ENT2", 0)); String ent2String = diagram.cleanId(arg.get("ENT2", 0));
if (ent1String == null && ent2String == null) if (ent1String == null && ent2String == null)
return executeArgSpecial3(diagram, arg); return executeArgSpecial3(diagram, arg);
@ -175,23 +175,23 @@ final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrOb
String port1 = null; String port1 = null;
String port2 = null; String port2 = null;
final LinkType linkType = getLinkType(arg); final LinkType linkType = getLinkType(arg);
if (ent1String.contains("::") && diagram.getPlasma().firstWithName(ent1String) == null) { if (ent1String.contains("::") && diagram.firstWithName(ent1String) == null) {
port1 = diagram.getPortId(ent1String); port1 = diagram.getPortId(ent1String);
ent1String = diagram.removePortId(ent1String); ent1String = diagram.removePortId(ent1String);
} }
if (ent2String.contains("::") && diagram.getPlasma().firstWithName(ent2String) == null) { if (ent2String.contains("::") && diagram.firstWithName(ent2String) == null) {
port2 = diagram.getPortId(ent2String); port2 = diagram.getPortId(ent2String);
ent2String = diagram.removePortId(ent2String); ent2String = diagram.removePortId(ent2String);
} }
final Quark quark1 = diagram.quarkInContext(ent1String, false); final Quark<Entity> quark1 = diagram.quarkInContext(ent1String, false);
final Quark quark2 = diagram.quarkInContext(ent2String, false); final Quark<Entity> quark2 = diagram.quarkInContext(ent2String, false);
Entity cl1 = (Entity) quark1.getData(); Entity cl1 = quark1.getData();
if (cl1 == null) if (cl1 == null)
cl1 = diagram.reallyCreateLeaf(quark1, Display.getWithNewlines(quark1.getName()), LeafType.CLASS, null); cl1 = diagram.reallyCreateLeaf(quark1, Display.getWithNewlines(quark1.getName()), LeafType.CLASS, null);
Entity cl2 = (Entity) quark2.getData(); Entity cl2 = quark2.getData();
if (cl2 == null) if (cl2 == null)
cl2 = diagram.reallyCreateLeaf(quark2, Display.getWithNewlines(quark2.getName()), LeafType.CLASS, null); cl2 = diagram.reallyCreateLeaf(quark2, Display.getWithNewlines(quark2.getName()), LeafType.CLASS, null);
@ -241,7 +241,6 @@ final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrOb
// return diagram.isGroup(code); // return diagram.isGroup(code);
// } // }
private void addLink(AbstractClassOrObjectDiagram diagram, Link link, String weight) { private void addLink(AbstractClassOrObjectDiagram diagram, Link link, String weight) {
diagram.addLink(link); diagram.addLink(link);
if (weight == null) { if (weight == null) {
@ -300,8 +299,8 @@ final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrOb
final String name1A = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("COUPLE1", 0)); final String name1A = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("COUPLE1", 0));
final String name1B = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("COUPLE1", 1)); final String name1B = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("COUPLE1", 1));
Quark quark1A = diagram.quarkInContext(name1A, false); Quark<Entity> quark1A = diagram.quarkInContext(name1A, false);
Quark quark1B = diagram.quarkInContext(name1B, false); Quark<Entity> quark1B = diagram.quarkInContext(name1B, false);
if (quark1A.getData() != null == false) if (quark1A.getData() != null == false)
return CommandExecutionResult.error("No class " + name1A); return CommandExecutionResult.error("No class " + name1A);
@ -309,13 +308,13 @@ final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrOb
if (quark1B.getData() != null == false) if (quark1B.getData() != null == false)
return CommandExecutionResult.error("No class " + name1B); return CommandExecutionResult.error("No class " + name1B);
Entity cl1A = (Entity) quark1A.getData(); Entity cl1A = quark1A.getData();
Entity cl1B = (Entity) quark1B.getData(); Entity cl1B = quark1B.getData();
final String id2 = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("ENT2", 0), "\""); final String id2 = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("ENT2", 0), "\"");
final Quark ent2 = diagram.quarkInContext(id2, false); final Quark<Entity> ent2 = diagram.quarkInContext(id2, false);
Entity cl2 = (Entity) ent2.getData(); Entity cl2 = ent2.getData();
if (cl2 == null) if (cl2 == null)
cl2 = diagram.reallyCreateLeaf(ent2, Display.getWithNewlines(ent2.getName()), LeafType.CLASS, null); cl2 = diagram.reallyCreateLeaf(ent2, Display.getWithNewlines(ent2.getName()), LeafType.CLASS, null);
@ -333,8 +332,8 @@ final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrOb
final String name2A = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("COUPLE2", 0)); final String name2A = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("COUPLE2", 0));
final String name2B = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("COUPLE2", 1)); final String name2B = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("COUPLE2", 1));
final Quark quark2A = diagram.quarkInContext(name2A, false); final Quark<Entity> quark2A = diagram.quarkInContext(name2A, false);
final Quark quark2B = diagram.quarkInContext(name2B, false); final Quark<Entity> quark2B = diagram.quarkInContext(name2B, false);
if (quark2A.getData() != null == false) if (quark2A.getData() != null == false)
return CommandExecutionResult.error("No class " + name2A); return CommandExecutionResult.error("No class " + name2A);
@ -342,11 +341,11 @@ final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrOb
if (quark2B.getData() != null == false) if (quark2B.getData() != null == false)
return CommandExecutionResult.error("No class " + name2B); return CommandExecutionResult.error("No class " + name2B);
final Entity cl2A = (Entity) quark2A.getData(); final Entity cl2A = quark2A.getData();
final Entity cl2B = (Entity) quark2B.getData(); final Entity cl2B = quark2B.getData();
final String id1 = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("ENT1", 0), "\""); final String id1 = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("ENT1", 0), "\"");
final Quark ent1 = diagram.quarkInContext(id1, false); final Quark<Entity> ent1 = diagram.quarkInContext(id1, false);
Entity cl1 = (Entity) ent1.getData(); Entity cl1 = (Entity) ent1.getData();
if (cl1 == null) if (cl1 == null)
@ -369,10 +368,10 @@ final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrOb
final String name2A = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("COUPLE2", 0)); final String name2A = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("COUPLE2", 0));
final String name2B = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("COUPLE2", 1)); final String name2B = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("COUPLE2", 1));
final Quark quark1A = diagram.quarkInContext(name1A, false); final Quark<Entity> quark1A = diagram.quarkInContext(name1A, false);
final Quark quark1B = diagram.quarkInContext(name1B, false); final Quark<Entity> quark1B = diagram.quarkInContext(name1B, false);
final Quark quark2A = diagram.quarkInContext(name2A, false); final Quark<Entity> quark2A = diagram.quarkInContext(name2A, false);
final Quark quark2B = diagram.quarkInContext(name2B, false); final Quark<Entity> quark2B = diagram.quarkInContext(name2B, false);
if (quark1A.getData() != null == false) if (quark1A.getData() != null == false)
return CommandExecutionResult.error("No class " + name1A); return CommandExecutionResult.error("No class " + name1A);

View File

@ -125,12 +125,12 @@ final public class CommandLinkLollipop extends SingleLineCommand2<AbstractClassO
final String suffix = "lol" + diagram.getUniqueSequence(); final String suffix = "lol" + diagram.getUniqueSequence();
if (arg.get("LOL_THEN_ENT", 1) == null) { if (arg.get("LOL_THEN_ENT", 1) == null) {
final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(ent1), false); final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(ent1), false);
cl1 = (Entity) quark.getData(); cl1 = quark.getData();
if (cl1 == null) if (cl1 == null)
return CommandExecutionResult.error("No class " + quark.getName()); return CommandExecutionResult.error("No class " + quark.getName());
final Quark idNewLong = diagram.quarkInContext(diagram.cleanIdForQuark(ent1) + suffix, false); final Quark<Entity> idNewLong = diagram.quarkInContext(diagram.cleanId(ent1) + suffix, false);
final LeafType type = getType(arg.get("ENT_THEN_LOL", 1)); final LeafType type = getType(arg.get("ENT_THEN_LOL", 1));
cl2 = diagram.reallyCreateLeaf(idNewLong, Display.getWithNewlines(ent2), type, null); cl2 = diagram.reallyCreateLeaf(idNewLong, Display.getWithNewlines(ent2), type, null);
normalEntity = cl1; normalEntity = cl1;
@ -144,12 +144,12 @@ final public class CommandLinkLollipop extends SingleLineCommand2<AbstractClassO
// getType(arg.get("ENT_THEN_LOL", 1)), null); // getType(arg.get("ENT_THEN_LOL", 1)), null);
// normalEntity = cl1; // normalEntity = cl1;
} else { } else {
final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(ent2), false); final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(ent2), false);
cl2 = (Entity) quark.getData(); cl2 = quark.getData();
if (cl2 == null) if (cl2 == null)
return CommandExecutionResult.error("No class " + quark.getName()); return CommandExecutionResult.error("No class " + quark.getName());
final Quark idNewLong = diagram.quarkInContext(diagram.cleanIdForQuark(ent2) + suffix, false); final Quark<Entity> idNewLong = diagram.quarkInContext(diagram.cleanId(ent2) + suffix, false);
final LeafType type = getType(arg.get("LOL_THEN_ENT", 0)); final LeafType type = getType(arg.get("LOL_THEN_ENT", 0));
cl1 = diagram.reallyCreateLeaf(idNewLong, Display.getWithNewlines(ent1), type, null); cl1 = diagram.reallyCreateLeaf(idNewLong, Display.getWithNewlines(ent1), type, null);
normalEntity = cl2; normalEntity = cl2;

View File

@ -69,11 +69,8 @@ public class CommandStereotype extends SingleLineCommand2<ClassDiagram> {
final String name = arg.get("NAME", 0); final String name = arg.get("NAME", 0);
final String stereotype = arg.get("STEREO", 0); final String stereotype = arg.get("STEREO", 0);
// final Quark ident = diagram.buildFromName(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(name)); final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(name), false);
// final Quark code = diagram.buildFromFullPath(name); final Entity entity = quark.getData();
// final IEntity entity = diagram.getOrCreateLeaf(ident, code, null, null);
final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(name), false);
final Entity entity = (Entity) quark.getData();
if (entity == null) if (entity == null)
return CommandExecutionResult.error("No such class " + quark.getName()); return CommandExecutionResult.error("No such class " + quark.getName());

View File

@ -74,24 +74,14 @@ public class CommandUrl extends SingleLineCommand2<AbstractEntityDiagram> {
@Override @Override
protected CommandExecutionResult executeArg(AbstractEntityDiagram diagram, LineLocation location, RegexResult arg) { protected CommandExecutionResult executeArg(AbstractEntityDiagram diagram, LineLocation location, RegexResult arg) {
final String idShort = arg.get("CODE", 0); final String idShort = arg.get("CODE", 0);
// final Quark ident = diagram.buildFromName(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(idShort));
// final Quark code = diagram.buildFromFullPath(idShort);
final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(idShort), false); final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(idShort), false);
final Entity entity = (Entity) quark.getData(); final Entity entity = quark.getData();
if (entity == null) if (entity == null)
return CommandExecutionResult.error(quark.getName() + " does not exist"); return CommandExecutionResult.error(quark.getName() + " does not exist");
final String urlString = arg.get("URL", 0); final String urlString = arg.get("URL", 0);
// final boolean leafExist = code.getData() != null;
// if (leafExist)
// entity = diagram.getOrCreateLeaf(ident, code, null, null);
// else if (diagram.isGroup(idShort))
// entity = diagram.getGroup(idShort);
// else
// return CommandExecutionResult.error(code + " does not exist");
// final IEntity entity = diagram.getOrCreateLeaf(code, null);
final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), UrlMode.STRICT); final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), UrlMode.STRICT);
final Url url = urlBuilder.getUrl(urlString); final Url url = urlBuilder.getUrl(urlString);
entity.addUrl(url); entity.addUrl(url);

View File

@ -82,7 +82,7 @@ public class CommandNamespace extends SingleLineCommand2<ClassDiagram> {
protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg) protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg)
throws NoSuchColorException { throws NoSuchColorException {
final String idShort = arg.get("NAME", 0); final String idShort = arg.get("NAME", 0);
final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(idShort), true); final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(idShort), true);
final CommandExecutionResult status = diagram.gotoGroup(quark, Display.getWithNewlines(quark.getName()), final CommandExecutionResult status = diagram.gotoGroup(quark, Display.getWithNewlines(quark.getName()),
GroupType.PACKAGE); GroupType.PACKAGE);
if (status.isOk() == false) if (status.isOk() == false)

View File

@ -86,8 +86,7 @@ public class CommandNamespace2 extends SingleLineCommand2<ClassDiagram> {
protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg) protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg)
throws NoSuchColorException { throws NoSuchColorException {
final String idShort = arg.get("NAME", 0); final String idShort = arg.get("NAME", 0);
// final Quark ident = diagram.buildFromName(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(idShort)); final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(idShort), true);
final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(idShort), true);
final String disp = arg.getLazzy("DISPLAY", 0); final String disp = arg.getLazzy("DISPLAY", 0);
final Display display = Display.getWithNewlines(disp); final Display display = Display.getWithNewlines(disp);

View File

@ -82,14 +82,10 @@ public class CommandNamespaceEmpty extends SingleLineCommand2<ClassDiagram> {
throws NoSuchColorException { throws NoSuchColorException {
final String idShort = arg.get("NAME", 0); final String idShort = arg.get("NAME", 0);
final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(idShort), true); final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(idShort), true);
if (quark.getData() != null) if (quark.getData() != null)
return CommandExecutionResult.error("Already exists " + quark.getName()); return CommandExecutionResult.error("Already exists " + quark.getName());
// final Quark idNewLong = diagram
// .buildFromName(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(idShort));
// final Quark code = diagram.buildFromFullPath(idShort);
final Display display = Display.getWithNewlines(quark.getQualifiedName()); final Display display = Display.getWithNewlines(quark.getQualifiedName());
final CommandExecutionResult status = diagram.gotoGroup(quark, display, GroupType.PACKAGE); final CommandExecutionResult status = diagram.gotoGroup(quark, display, GroupType.PACKAGE);
if (status.isOk() == false) if (status.isOk() == false)

View File

@ -121,12 +121,12 @@ public class CommandPackage extends SingleLineCommand2<AbstractEntityDiagram> {
idShort = arg.get("AS", 0); idShort = arg.get("AS", 0);
} }
final Quark quark; final Quark<Entity> quark;
if (arg.get("AS", 0) == null) { if (arg.get("AS", 0) == null) {
quark = diagram.quarkInContext(diagram.cleanIdForQuark(name), true); quark = diagram.quarkInContext(diagram.cleanId(name), true);
display = quark.getName(); display = quark.getName();
} else { } else {
quark = diagram.quarkInContext(diagram.cleanIdForQuark(arg.get("AS", 0)), true); quark = diagram.quarkInContext(diagram.cleanId(arg.get("AS", 0)), true);
display = name; display = name;
} }

View File

@ -94,7 +94,7 @@ public class CommandPackageEmpty extends SingleLineCommand2<AbstractEntityDiagra
display = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("DISPLAY", 0)); display = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("DISPLAY", 0));
idShort = arg.get("CODE", 0); idShort = arg.get("CODE", 0);
} }
final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(idShort), true); final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(idShort), true);
final CommandExecutionResult status = diagram.gotoGroup(quark, Display.getWithNewlines(display), final CommandExecutionResult status = diagram.gotoGroup(quark, Display.getWithNewlines(display),
GroupType.PACKAGE); GroupType.PACKAGE);
if (status.isOk() == false) if (status.isOk() == false)

View File

@ -40,7 +40,6 @@ import java.util.Map;
import net.sourceforge.plantuml.AbstractPSystem; import net.sourceforge.plantuml.AbstractPSystem;
import net.sourceforge.plantuml.ErrorUml; import net.sourceforge.plantuml.ErrorUml;
import net.sourceforge.plantuml.ErrorUmlType; import net.sourceforge.plantuml.ErrorUmlType;
import net.sourceforge.plantuml.core.Diagram; import net.sourceforge.plantuml.core.Diagram;
import net.sourceforge.plantuml.core.DiagramType; import net.sourceforge.plantuml.core.DiagramType;
import net.sourceforge.plantuml.core.UmlSource; import net.sourceforge.plantuml.core.UmlSource;

View File

@ -43,7 +43,6 @@ import net.sourceforge.plantuml.AbstractPSystem;
import net.sourceforge.plantuml.EmbeddedDiagram; import net.sourceforge.plantuml.EmbeddedDiagram;
import net.sourceforge.plantuml.ErrorUml; import net.sourceforge.plantuml.ErrorUml;
import net.sourceforge.plantuml.ErrorUmlType; import net.sourceforge.plantuml.ErrorUmlType;
import net.sourceforge.plantuml.core.Diagram; import net.sourceforge.plantuml.core.Diagram;
import net.sourceforge.plantuml.core.DiagramType; import net.sourceforge.plantuml.core.DiagramType;
import net.sourceforge.plantuml.core.UmlSource; import net.sourceforge.plantuml.core.UmlSource;

View File

@ -135,19 +135,13 @@ public final class CommandFactoryNote implements SingleMultiFactoryCommand<Abstr
private CommandExecutionResult executeInternal(AbstractEntityDiagram diagram, RegexResult arg, BlocLines display) private CommandExecutionResult executeInternal(AbstractEntityDiagram diagram, RegexResult arg, BlocLines display)
throws NoSuchColorException { throws NoSuchColorException {
final String idShort = arg.get("CODE", 0); final String idShort = arg.get("CODE", 0);
final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(idShort), false); final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(idShort), false);
// final Quark ident = diagram.buildFromName(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(idShort));
// final Quark code = diagram.buildFromFullPath(idShort);
// final boolean leafExist = diagram.leafExist(code);
if (quark.getData() != null) if (quark.getData() != null)
return CommandExecutionResult.error("Note already created: " + quark.getName()); return CommandExecutionResult.error("Note already created: " + quark.getName());
final Entity entity = diagram.reallyCreateLeaf(quark, display.toDisplay(), LeafType.NOTE, null); final Entity entity = diagram.reallyCreateLeaf(quark, display.toDisplay(), LeafType.NOTE, null);
// final Quark quark = diagram.getPlasma().getIfExistsFromName(idShort);
// if (quark != null && quark.getData() != null)
// entity = diagram.getFromName(idShort);
// else
// entity = diagram.reallyCreateLeaf(ident, display.toDisplay(), LeafType.NOTE, null);
assert entity != null; assert entity != null;
final String s = arg.get("COLOR", 0); final String s = arg.get("COLOR", 0);
entity.setSpecificColorTOBEREMOVED(ColorType.BACK, entity.setSpecificColorTOBEREMOVED(ColorType.BACK,

View File

@ -114,15 +114,11 @@ public final class CommandFactoryNoteActivity implements SingleMultiFactoryComma
UrlMode.STRICT); UrlMode.STRICT);
url = urlBuilder.getUrl(strings.get(0).toString()); url = urlBuilder.getUrl(strings.get(0).toString());
} }
if (url != null) { if (url != null)
strings = strings.subList(1, strings.size()); strings = strings.subList(1, strings.size());
}
// final String s = StringUtils.getMergedLines(strings);
final String codeString = diagram.getUniqueSequence("GMN"); final String codeString = diagram.getUniqueSequence("GMN");
final Quark quark = diagram.quarkInContext(codeString, false); final Quark<Entity> quark = diagram.quarkInContext(codeString, false);
// final Quark code = diagram.buildCode(codeString);
final Entity note = diagram.reallyCreateLeaf(quark, strings, LeafType.NOTE, null); final Entity note = diagram.reallyCreateLeaf(quark, strings, LeafType.NOTE, null);
if (url != null) if (url != null)
note.addUrl(url); note.addUrl(url);
@ -139,10 +135,8 @@ public final class CommandFactoryNoteActivity implements SingleMultiFactoryComma
protected CommandExecutionResult executeArg(final ActivityDiagram diagram, LineLocation location, protected CommandExecutionResult executeArg(final ActivityDiagram diagram, LineLocation location,
RegexResult arg) throws NoSuchColorException { RegexResult arg) throws NoSuchColorException {
final String tmp = diagram.getUniqueSequence("GN"); final String tmp = diagram.getUniqueSequence("GN");
final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(tmp), false); final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(tmp), false);
// final Quark ident = diagram
// .buildFromName(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(tmp));
// final Quark code = diagram.buildCode(tmp);
final Entity note = diagram.createNote(quark, tmp, Display.getWithNewlines(arg.get("NOTE", 0))); final Entity note = diagram.createNote(quark, tmp, Display.getWithNewlines(arg.get("NOTE", 0)));
return executeInternal(diagram, arg, note); return executeInternal(diagram, arg, note);
} }

View File

@ -211,7 +211,7 @@ public final class CommandFactoryNoteOnEntity implements SingleMultiFactoryComma
private CommandExecutionResult executeInternal(RegexResult line0, AbstractEntityDiagram diagram, Url url, private CommandExecutionResult executeInternal(RegexResult line0, AbstractEntityDiagram diagram, Url url,
BlocLines strings) throws NoSuchColorException { BlocLines strings) throws NoSuchColorException {
final String pos = line0.get("POSITION", 0); final String pos = line0.get("POSITION", 0);
final String idShort = diagram.cleanIdForQuark(line0.get("ENTITY", 0)); final String idShort = diagram.cleanId(line0.get("ENTITY", 0));
final Entity cl1; final Entity cl1;
if (idShort == null) { if (idShort == null) {
cl1 = diagram.getLastEntity(); cl1 = diagram.getLastEntity();
@ -219,17 +219,10 @@ public final class CommandFactoryNoteOnEntity implements SingleMultiFactoryComma
return CommandExecutionResult.error("Nothing to note to"); return CommandExecutionResult.error("Nothing to note to");
} else { } else {
final Quark quark = diagram.quarkInContext(idShort, false); final Quark<Entity> quark = diagram.quarkInContext(idShort, false);
cl1 = (Entity) quark.getData(); cl1 = quark.getData();
if (cl1 == null) if (cl1 == null)
return CommandExecutionResult.error("Not known: " + idShort); return CommandExecutionResult.error("Not known: " + idShort);
// final Quark ident = diagram.buildFromName(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(idShort));
// final Quark code = diagram.buildFromFullPath(idShort);
// if (diagram.isGroup(idShort))
// cl1 = diagram.getGroup(idShort);
// else
// cl1 = diagram.getOrCreateLeaf(ident, code, null, null);
} }
final Position position = Position.valueOf(StringUtils.goUpperCase(pos)) final Position position = Position.valueOf(StringUtils.goUpperCase(pos))
@ -250,7 +243,7 @@ public final class CommandFactoryNoteOnEntity implements SingleMultiFactoryComma
} }
final String tmp = diagram.getUniqueSequence("GMN"); final String tmp = diagram.getUniqueSequence("GMN");
final Quark quark = diagram.quarkInContext(tmp, false); final Quark<Entity> quark = diagram.quarkInContext(tmp, false);
final Entity note = diagram.reallyCreateLeaf(quark, strings.toDisplay(), LeafType.NOTE, null); final Entity note = diagram.reallyCreateLeaf(quark, strings.toDisplay(), LeafType.NOTE, null);
if (stereotypeString != null) if (stereotypeString != null)

View File

@ -170,28 +170,19 @@ public final class CommandFactoryTipOnEntity implements SingleMultiFactoryComman
final String idShort = line0.get("ENTITY", 0); final String idShort = line0.get("ENTITY", 0);
final String member = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(line0.get("ENTITY", 1)); final String member = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(line0.get("ENTITY", 1));
final Quark quark = diagram.quarkInContext(idShort, false); final Quark<Entity> quark = diagram.quarkInContext(idShort, false);
final Entity cl1 = (Entity) quark.getData(); final Entity cl1 = quark.getData();
if (cl1 == null) if (cl1 == null)
return CommandExecutionResult.error("Nothing to note to"); return CommandExecutionResult.error("Nothing to note to");
// final Quark identShort = diagram.buildFromName(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(idShort));
// final Quark codeShort = diagram.buildFromFullPath(idShort);
// if (codeShort == null) {
// assert false;
// return CommandExecutionResult.error("Nothing to note to");
// }
// final IEntity cl1 = diagram.getOrCreateLeaf(identShort, codeShort, null, null);
final Position position = Position.valueOf(StringUtils.goUpperCase(pos)) final Position position = Position.valueOf(StringUtils.goUpperCase(pos))
.withRankdir(diagram.getSkinParam().getRankdir()); .withRankdir(diagram.getSkinParam().getRankdir());
final String tmp = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(idShort + "$$$" + position.name()); final String tmp = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(idShort + "$$$" + position.name());
final Quark identTip = diagram.quarkInContext(tmp, false); final Quark<Entity> identTip = diagram.quarkInContext(tmp, false);
Entity tips = (Entity) identTip.getData(); Entity tips = identTip.getData();
// final Quark identTip = diagram.buildFromName(tmp);
//IEntity tips = diagram.getLeafFromName(idShort + "$$$" + position.name());
if (tips == null) { if (tips == null) {
tips = diagram.reallyCreateLeaf(identTip, Display.getWithNewlines(""), LeafType.TIPS, null); tips = diagram.reallyCreateLeaf(identTip, Display.getWithNewlines(""), LeafType.TIPS, null);
final LinkType type = new LinkType(LinkDecor.NONE, LinkDecor.NONE).getInvisible(); final LinkType type = new LinkType(LinkDecor.NONE, LinkDecor.NONE).getInvisible();

View File

@ -73,7 +73,7 @@ public class CommandCreateBlock extends SingleLineCommand2<CompositeDiagram> {
protected CommandExecutionResult executeArg(CompositeDiagram diagram, LineLocation location, RegexResult arg) { protected CommandExecutionResult executeArg(CompositeDiagram diagram, LineLocation location, RegexResult arg) {
String display = arg.get("DISPLAY", 0); String display = arg.get("DISPLAY", 0);
final String idShort = arg.get("CODE", 0); final String idShort = arg.get("CODE", 0);
final Quark quark = diagram.quarkInContext(idShort, false); final Quark<Entity> quark = diagram.quarkInContext(idShort, false);
if (display == null) if (display == null)
display = quark.getName(); display = quark.getName();
@ -81,7 +81,7 @@ public class CommandCreateBlock extends SingleLineCommand2<CompositeDiagram> {
return CommandExecutionResult.error("Already exists " + quark.getName()); return CommandExecutionResult.error("Already exists " + quark.getName());
final Entity ent = diagram.reallyCreateLeaf(quark, Display.getWithNewlines(quark), LeafType.BLOCK, null); final Entity ent = diagram.reallyCreateLeaf(quark, Display.getWithNewlines(quark), LeafType.BLOCK, null);
// ent.setDisplay(Display.getWithNewlines(display));
return CommandExecutionResult.ok(); return CommandExecutionResult.ok();
} }

View File

@ -35,6 +35,7 @@
*/ */
package net.sourceforge.plantuml.compositediagram.command; package net.sourceforge.plantuml.compositediagram.command;
import net.sourceforge.plantuml.baraye.Entity;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.compositediagram.CompositeDiagram; import net.sourceforge.plantuml.compositediagram.CompositeDiagram;
@ -74,7 +75,7 @@ public class CommandCreatePackageBlock extends SingleLineCommand2<CompositeDiagr
String display = arg.get("DISPLAY", 0); String display = arg.get("DISPLAY", 0);
final String idShort = arg.get("CODE", 0); final String idShort = arg.get("CODE", 0);
final Quark quark = diagram.quarkInContext(idShort, false); final Quark<Entity> quark = diagram.quarkInContext(idShort, false);
if (display == null) if (display == null)
display = quark.getName(); display = quark.getName();

View File

@ -79,17 +79,15 @@ public class CommandLinkBlock extends SingleLineCommand2<CompositeDiagram> {
protected CommandExecutionResult executeArg(CompositeDiagram diagram, LineLocation location, RegexResult arg) { protected CommandExecutionResult executeArg(CompositeDiagram diagram, LineLocation location, RegexResult arg) {
final String ent1 = arg.get("ENT1", 0); final String ent1 = arg.get("ENT1", 0);
final String ent2 = arg.get("ENT2", 0); final String ent2 = arg.get("ENT2", 0);
final Quark quark1 = diagram.quarkInContext(diagram.cleanIdForQuark(ent1), false); final Quark<Entity> quark1 = diagram.quarkInContext(diagram.cleanId(ent1), false);
final Quark quark2 = diagram.quarkInContext(diagram.cleanIdForQuark(ent2), false); final Quark<Entity> quark2 = diagram.quarkInContext(diagram.cleanId(ent2), false);
final Entity cl1 = (Entity) quark1.getData(); final Entity cl1 = quark1.getData();
if (cl1 == null) if (cl1 == null)
return CommandExecutionResult.error("No such element " + quark1.getName()); return CommandExecutionResult.error("No such element " + quark1.getName());
final Entity cl2 = (Entity) quark2.getData(); final Entity cl2 = quark2.getData();
if (cl2 == null) if (cl2 == null)
return CommandExecutionResult.error("No such element " + quark2.getName()); return CommandExecutionResult.error("No such element " + quark2.getName());
// final IEntity cl1 = diagram.getOrCreateLeaf(quark1, diagram.buildFromFullPath(ent1), null, null);
// final IEntity cl2 = diagram.getOrCreateLeaf(quark2, diagram.buildFromFullPath(ent2), null, null);
final String deco1 = arg.get("DECO1", 0); final String deco1 = arg.get("DECO1", 0);
final String deco2 = arg.get("DECO2", 0); final String deco2 = arg.get("DECO2", 0);

View File

@ -42,7 +42,6 @@ import java.util.Map;
import java.util.Objects; import java.util.Objects;
import net.sourceforge.plantuml.LineBreakStrategy; import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.awt.geom.XDimension2D; import net.sourceforge.plantuml.awt.geom.XDimension2D;
import net.sourceforge.plantuml.awt.geom.XRectangle2D; import net.sourceforge.plantuml.awt.geom.XRectangle2D;
import net.sourceforge.plantuml.creole.atom.Atom; import net.sourceforge.plantuml.creole.atom.Atom;

View File

@ -47,6 +47,7 @@ import java.util.regex.Pattern;
import net.atmp.ISkinSimple; import net.atmp.ISkinSimple;
import net.sourceforge.plantuml.LineBreakStrategy; import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.baraye.Entity;
import net.sourceforge.plantuml.creole.CreoleMode; import net.sourceforge.plantuml.creole.CreoleMode;
import net.sourceforge.plantuml.creole.Sheet; import net.sourceforge.plantuml.creole.Sheet;
import net.sourceforge.plantuml.creole.SheetBlock1; import net.sourceforge.plantuml.creole.SheetBlock1;
@ -200,7 +201,7 @@ public class Display implements Iterable<CharSequence> {
return new Display(true, other, null, false, CreoleMode.FULL); return new Display(true, other, null, false, CreoleMode.FULL);
} }
public static Display getWithNewlines(Quark s) { public static Display getWithNewlines(Quark<Entity> s) {
return getWithNewlines(s.getName()); return getWithNewlines(s.getName());
} }

View File

@ -36,7 +36,6 @@
package net.sourceforge.plantuml.cucadiagram; package net.sourceforge.plantuml.cucadiagram;
import net.sourceforge.plantuml.baraye.Entity; import net.sourceforge.plantuml.baraye.Entity;
import net.sourceforge.plantuml.baraye.EntityUtils;
import net.sourceforge.plantuml.text.Guillemet; import net.sourceforge.plantuml.text.Guillemet;
public class EntityGenderUtils { public class EntityGenderUtils {

View File

@ -79,7 +79,7 @@ public interface ICucaDiagram extends GroupHierarchy, PortionShower, Annotated {
String[] getDotStringSkek(); String[] getDotStringSkek();
boolean isAutarkic(Entity g); // boolean isAutarkic(Entity g);
int getUniqueSequence(); int getUniqueSequence();

View File

@ -36,6 +36,18 @@
*/ */
package net.sourceforge.plantuml.cucadiagram; package net.sourceforge.plantuml.cucadiagram;
final public class Together { import net.sourceforge.plantuml.baraye.Bag;
final public class Together implements Bag {
private final Together parent;
public Together(Together parent) {
this.parent = parent;
}
public final Together getParent() {
return parent;
}
} }

View File

@ -44,7 +44,7 @@ import net.sourceforge.plantuml.baraye.Entity;
import net.sourceforge.plantuml.cucadiagram.ICucaDiagram; import net.sourceforge.plantuml.cucadiagram.ICucaDiagram;
import net.sourceforge.plantuml.cucadiagram.LeafType; import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.klimt.font.StringBounder; import net.sourceforge.plantuml.klimt.font.StringBounder;
import net.sourceforge.plantuml.svek.GroupPngMakerActivity; import net.sourceforge.plantuml.svek.GroupMakerActivity;
import net.sourceforge.plantuml.svek.IEntityImage; import net.sourceforge.plantuml.svek.IEntityImage;
public final class CucaDiagramSimplifierActivity { public final class CucaDiagramSimplifierActivity {
@ -60,35 +60,19 @@ public final class CucaDiagramSimplifierActivity {
do { do {
changed = false; changed = false;
final Collection<Entity> groups = new ArrayList<>(diagram.getEntityFactory().groups()); final Collection<Entity> groups = new ArrayList<>(diagram.getEntityFactory().groups());
for (Entity g : groups) { for (Entity g : groups)
if (diagram.isAutarkic(g)) { if (g.isAutarkic()) {
// final EntityType type;
// if (g.zgetGroupType() == GroupType.INNER_ACTIVITY) {
// type = EntityType.ACTIVITY;
// } else if (g.zgetGroupType() == GroupType.CONCURRENT_ACTIVITY) {
// type = EntityType.ACTIVITY_CONCURRENT;
// } else {
// throw new IllegalStateException();
// }
final IEntityImage img = computeImage(g); final IEntityImage img = computeImage(g);
g.overrideImage(img, LeafType.ACTIVITY); g.overrideImage(img, LeafType.ACTIVITY);
changed = true; changed = true;
} }
}
} while (changed); } while (changed);
} }
// private void computeImageGroup(EntityMutable g, EntityMutable proxy,
// List<String> dotStrings) throws IOException,
// InterruptedException {
// final GroupPngMakerActivity maker = new GroupPngMakerActivity(diagram, g);
// proxy.setSvekImage(maker.getImage());
// }
private IEntityImage computeImage(Entity g) throws IOException, InterruptedException { private IEntityImage computeImage(Entity g) throws IOException, InterruptedException {
final GroupPngMakerActivity maker = new GroupPngMakerActivity(diagram, g, stringBounder); final GroupMakerActivity maker = new GroupMakerActivity(diagram, g, stringBounder);
return maker.getImage(); return maker.getImage();
} }

View File

@ -46,7 +46,7 @@ import net.sourceforge.plantuml.cucadiagram.GroupType;
import net.sourceforge.plantuml.cucadiagram.ICucaDiagram; import net.sourceforge.plantuml.cucadiagram.ICucaDiagram;
import net.sourceforge.plantuml.cucadiagram.LeafType; import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.klimt.font.StringBounder; import net.sourceforge.plantuml.klimt.font.StringBounder;
import net.sourceforge.plantuml.svek.GroupPngMakerState; import net.sourceforge.plantuml.svek.GroupMakerState;
import net.sourceforge.plantuml.svek.IEntityImage; import net.sourceforge.plantuml.svek.IEntityImage;
public final class CucaDiagramSimplifierState { public final class CucaDiagramSimplifierState {
@ -63,7 +63,7 @@ public final class CucaDiagramSimplifierState {
changed = false; changed = false;
final Collection<Entity> groups = getOrdered(diagram.getRootGroup()); final Collection<Entity> groups = getOrdered(diagram.getRootGroup());
for (Entity g : groups) for (Entity g : groups)
if (diagram.isAutarkic(g)) { if (g.isAutarkic()) {
final IEntityImage img = computeImage(g); final IEntityImage img = computeImage(g);
g.overrideImage(img, g.getGroupType() == GroupType.CONCURRENT_STATE ? LeafType.STATE_CONCURRENT g.overrideImage(img, g.getGroupType() == GroupType.CONCURRENT_STATE ? LeafType.STATE_CONCURRENT
: LeafType.STATE); : LeafType.STATE);
@ -109,7 +109,7 @@ public final class CucaDiagramSimplifierState {
} }
private IEntityImage computeImage(Entity g) throws IOException, InterruptedException { private IEntityImage computeImage(Entity g) throws IOException, InterruptedException {
final GroupPngMakerState maker = new GroupPngMakerState(diagram, g, stringBounder); final GroupMakerState maker = new GroupMakerState(diagram, g, stringBounder);
return maker.getImage(); return maker.getImage();
} }

View File

@ -46,8 +46,8 @@ import java.util.Objects;
import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.Pragma; import net.sourceforge.plantuml.Pragma;
import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.baraye.EntityFactory;
import net.sourceforge.plantuml.baraye.Entity; import net.sourceforge.plantuml.baraye.Entity;
import net.sourceforge.plantuml.baraye.EntityFactory;
import net.sourceforge.plantuml.cucadiagram.EntityPortion; import net.sourceforge.plantuml.cucadiagram.EntityPortion;
import net.sourceforge.plantuml.cucadiagram.GroupHierarchy; import net.sourceforge.plantuml.cucadiagram.GroupHierarchy;
import net.sourceforge.plantuml.cucadiagram.Link; import net.sourceforge.plantuml.cucadiagram.Link;

View File

@ -90,18 +90,11 @@ public class CommandCreateDomain extends SingleLineCommand2<DescriptionDiagram>
if (codeString == null) if (codeString == null)
codeString = displayString; codeString = displayString;
// final String genericOption = arg.getLazzy("DISPLAY", 1);
// final String generic = genericOption != null ? genericOption :
// arg.get("GENERIC", 0);
final String stereotype = arg.get("STEREO", 0); final String stereotype = arg.get("STEREO", 0);
final GroupType type = typeString.equalsIgnoreCase("domain") ? GroupType.DOMAIN : GroupType.REQUIREMENT; final GroupType type = typeString.equalsIgnoreCase("domain") ? GroupType.DOMAIN : GroupType.REQUIREMENT;
final LeafType type2 = typeString.equalsIgnoreCase("domain") ? LeafType.DOMAIN : LeafType.REQUIREMENT; final LeafType type2 = typeString.equalsIgnoreCase("domain") ? LeafType.DOMAIN : LeafType.REQUIREMENT;
final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(codeString), false); final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(codeString), false);
// final Quark ident = diagram.buildFromName(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(codeString));
// final Quark code = diagram.buildFromFullPath(codeString);
if (quark.getData() != null) if (quark.getData() != null)
return CommandExecutionResult.error("Object already exists : " + codeString); return CommandExecutionResult.error("Object already exists : " + codeString);
@ -110,17 +103,17 @@ public class CommandCreateDomain extends SingleLineCommand2<DescriptionDiagram>
final String group = arg.get("GROUP", 0); final String group = arg.get("GROUP", 0);
Entity entity; Entity entity;
if (group != null) { if (group != null) {
final Entity currentGroup = diagram.getCurrentGroup(); // final Entity currentGroup = diagram.getCurrentGroup();
diagram.gotoGroup(quark, display, type); diagram.gotoGroup(quark, display, type);
entity = diagram.getCurrentGroup(); entity = diagram.getCurrentGroup();
} else { } else {
entity = diagram.reallyCreateLeaf(quark, display, type2, null); entity = diagram.reallyCreateLeaf(quark, display, type2, null);
} }
if (stereotype != null) { if (stereotype != null)
entity.setStereotype(Stereotype.build(stereotype, diagram.getSkinParam().getCircledCharacterRadius(), entity.setStereotype(Stereotype.build(stereotype, diagram.getSkinParam().getCircledCharacterRadius(),
diagram.getSkinParam().getFont(null, false, FontParam.CIRCLED_CHARACTER), diagram.getSkinParam().getFont(null, false, FontParam.CIRCLED_CHARACTER),
diagram.getSkinParam().getIHtmlColorSet())); diagram.getSkinParam().getIHtmlColorSet()));
}
if (urlString != null) { if (urlString != null) {
final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), UrlMode.STRICT); final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), UrlMode.STRICT);
final Url url = urlBuilder.getUrl(urlString); final Url url = urlBuilder.getUrl(urlString);

View File

@ -53,12 +53,12 @@ public class DescriptionDiagram extends AbstractEntityDiagram {
} }
@Override @Override
public String cleanIdForQuark(String id) { public String cleanId(String id) {
if (id == null) if (id == null)
return null; return null;
if (id.startsWith("()")) if (id.startsWith("()"))
id = StringUtils.trin(id.substring(2)); id = StringUtils.trin(id.substring(2));
return super.cleanIdForQuark(id); return super.cleanId(id);
} }
private boolean isUsecase() { private boolean isUsecase() {

View File

@ -123,10 +123,7 @@ public class CommandArchimate extends SingleLineCommand2<DescriptionDiagram> {
throws NoSuchColorException { throws NoSuchColorException {
final String codeRaw = arg.getLazzy("CODE", 0); final String codeRaw = arg.getLazzy("CODE", 0);
// final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(codeRaw); final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(codeRaw), false);
// final Quark ident = diagram.buildFromName(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(idShort));
// final Quark code = diagram.buildFromFullPath(idShort);
final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(codeRaw), false);
String display = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.getLazzy("DISPLAY", 0)); String display = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.getLazzy("DISPLAY", 0));
if (display == null) if (display == null)

View File

@ -104,18 +104,14 @@ public class CommandArchimateMultilines extends CommandMultilines2<AbstractEntit
final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString()); final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString());
final String codeRaw = line0.getLazzy("CODE", 0); final String codeRaw = line0.getLazzy("CODE", 0);
// final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(codeRaw); final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(codeRaw), true);
// final Quark ident = diagram.buildFromName(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(idShort));
// final Quark code = diagram.buildFromFullPath(idShort);
final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(codeRaw), true);
if (quark.getData() != null) if (quark.getData() != null)
return CommandExecutionResult.error("Already exists " + quark.getName()); return CommandExecutionResult.error("Already exists " + quark.getName());
final String icon = line0.getLazzy("STEREOTYPE", 0); final String icon = line0.getLazzy("STEREOTYPE", 0);
final Entity entity = diagram.reallyCreateLeaf(quark, final Entity entity = diagram.reallyCreateLeaf(quark, Display.getWithNewlines(quark), LeafType.DESCRIPTION,
Display.getWithNewlines(quark), LeafType.DESCRIPTION, USymbols.RECTANGLE); USymbols.RECTANGLE);
lines = lines.subExtract(1, 1); lines = lines.subExtract(1, 1);
Display display = lines.toDisplay(); Display display = lines.toDisplay();

View File

@ -38,7 +38,6 @@ package net.sourceforge.plantuml.descdiagram.command;
import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.baraye.Entity; import net.sourceforge.plantuml.baraye.Entity;
import net.sourceforge.plantuml.baraye.EntityUtils;
import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram; import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram;
import net.sourceforge.plantuml.classdiagram.command.CommandCreateClassMultilines; import net.sourceforge.plantuml.classdiagram.command.CommandCreateClassMultilines;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
@ -226,10 +225,7 @@ public class CommandCreateElementFull extends SingleLineCommand2<DescriptionDiag
} }
// final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(codeRaw); final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(codeRaw), false);
// final Quark ident = diagram.buildFromName(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(idShort));
// final Quark code = diagram.buildFromFullPath(idShort);
final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(codeRaw), false);
if (diagram.isGroup(quark)) if (diagram.isGroup(quark))
return CommandExecutionResult.error("This element (" + quark.getName() + ") is already defined"); return CommandExecutionResult.error("This element (" + quark.getName() + ") is already defined");
@ -246,7 +242,7 @@ public class CommandCreateElementFull extends SingleLineCommand2<DescriptionDiag
if ((type == LeafType.PORTIN || type == LeafType.PORTOUT) && diagram.getCurrentGroup().isRoot()) if ((type == LeafType.PORTIN || type == LeafType.PORTOUT) && diagram.getCurrentGroup().isRoot())
return CommandExecutionResult.error("Port can only be used inside an element and not at root level"); return CommandExecutionResult.error("Port can only be used inside an element and not at root level");
Entity entity = (Entity) quark.getData(); Entity entity = quark.getData();
if (entity == null) if (entity == null)
entity = diagram.reallyCreateLeaf(quark, Display.getWithNewlines(display), type, usymbol); entity = diagram.reallyCreateLeaf(quark, Display.getWithNewlines(display), type, usymbol);
@ -275,19 +271,14 @@ public class CommandCreateElementFull extends SingleLineCommand2<DescriptionDiag
entity.setColors(colors); entity.setColors(colors);
// entity.setSpecificColorTOBEREMOVED(ColorType.BACK,
// diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR",
// 0)));
return CommandExecutionResult.ok(); return CommandExecutionResult.ok();
} }
public static boolean existsWithBadType3(AbstractEntityDiagram diagram, Quark code, LeafType type, public static boolean existsWithBadType3(AbstractEntityDiagram diagram, Quark<Entity> code, LeafType type, USymbol usymbol) {
USymbol usymbol) {
if (code.getData() == null) if (code.getData() == null)
return false; return false;
// final ILeaf other = diagram.getLeafFromName(code.getName()); final Entity other = code.getData();
final Entity other = (Entity) code.getData();
if (other.getLeafType() != type) if (other.getLeafType() != type)
return true; return true;

View File

@ -162,13 +162,8 @@ public class CommandCreateElementMultilines extends CommandMultilines2<AbstractE
final String stereotype = line0.get("STEREO", 0); final String stereotype = line0.get("STEREO", 0);
// final Quark ident = diagram.buildFromName(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(idShort)); final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(idShort), false);
// final Quark code_ = diagram.buildFromFullPath(idShort); Entity result = quark.getData();
// if (CommandCreateElementFull.existsWithBadType3(diagram, code, type, usymbol))
// return CommandExecutionResult.error("This element (" + code.getName() + ") is already defined");
final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(idShort), false);
Entity result = (Entity) quark.getData();
if (quark.getData() == null) if (quark.getData() == null)
result = diagram.reallyCreateLeaf(quark, display, type, usymbol); result = diagram.reallyCreateLeaf(quark, display, type, usymbol);

View File

@ -149,17 +149,10 @@ public class CommandCreateElementParenthesis extends SingleLineCommand2<ClassDia
type = LeafType.DESCRIPTION; type = LeafType.DESCRIPTION;
usymbol = USymbols.fromString(symbol, diagram.getSkinParam()); usymbol = USymbols.fromString(symbol, diagram.getSkinParam());
// final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(codeRaw); final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(codeRaw), true);
// final Quark ident = diagram.buildFromName(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(idShort));
// final Quark code = diagram.buildFromFullPath(idShort);
final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(codeRaw), true);
if (quark.getData() != null) if (quark.getData() != null)
return CommandExecutionResult.error("This element (" + quark.getName() + ") is already defined"); return CommandExecutionResult.error("This element (" + quark.getName() + ") is already defined");
// if (diagram.isGroup(idShort))
// return CommandExecutionResult.error("This element (" + code.getName() + ") is already defined");
String display = displayRaw; String display = displayRaw;
if (display == null) if (display == null)
display = quark.getName(); display = quark.getName();
@ -172,11 +165,10 @@ public class CommandCreateElementParenthesis extends SingleLineCommand2<ClassDia
final Entity entity = diagram.reallyCreateLeaf(quark, Display.getWithNewlines(display), type, usymbol); final Entity entity = diagram.reallyCreateLeaf(quark, Display.getWithNewlines(display), type, usymbol);
entity.setDisplay(Display.getWithNewlines(display)); entity.setDisplay(Display.getWithNewlines(display));
entity.setUSymbol(usymbol); entity.setUSymbol(usymbol);
if (stereotype != null) { if (stereotype != null)
entity.setStereotype(Stereotype.build(stereotype, diagram.getSkinParam().getCircledCharacterRadius(), entity.setStereotype(Stereotype.build(stereotype, diagram.getSkinParam().getCircledCharacterRadius(),
diagram.getSkinParam().getFont(null, false, FontParam.CIRCLED_CHARACTER), diagram.getSkinParam().getFont(null, false, FontParam.CIRCLED_CHARACTER),
diagram.getSkinParam().getIHtmlColorSet())); diagram.getSkinParam().getIHtmlColorSet()));
}
final String urlString = arg.get("URL", 0); final String urlString = arg.get("URL", 0);
if (urlString != null) { if (urlString != null) {

View File

@ -242,8 +242,8 @@ public class CommandLinkElement extends SingleLineCommand2<DescriptionDiagram> {
throws NoSuchColorException { throws NoSuchColorException {
final String ent1 = arg.get("ENT1", 0); final String ent1 = arg.get("ENT1", 0);
final String ent2 = arg.get("ENT2", 0); final String ent2 = arg.get("ENT2", 0);
final String ent1clean = diagram.cleanIdForQuark(ent1); final String ent1clean = diagram.cleanId(ent1);
final String ent2clean = diagram.cleanIdForQuark(ent2); final String ent2clean = diagram.cleanId(ent2);
// final String ent1 = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(ent1String); // final String ent1 = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(ent1String);
// final String ent2 = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(ent2String); // final String ent2 = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(ent2String);
// final Quark ident1 = diagram.buildFullyQualified(ent1); // final Quark ident1 = diagram.buildFullyQualified(ent1);
@ -299,35 +299,35 @@ public class CommandLinkElement extends SingleLineCommand2<DescriptionDiagram> {
private Entity getDummy(DescriptionDiagram diagram, String ident) { private Entity getDummy(DescriptionDiagram diagram, String ident) {
if (ident.startsWith("()")) { if (ident.startsWith("()")) {
ident = diagram.cleanIdForQuark(ident); ident = diagram.cleanId(ident);
final Quark quark = diagram.quarkInContext(ident, false); final Quark<Entity> quark = diagram.quarkInContext(ident, false);
if (quark.getData() != null) if (quark.getData() != null)
return (Entity) quark.getData(); return quark.getData();
return diagram.reallyCreateLeaf(quark, Display.getWithNewlines(quark.getName()), LeafType.DESCRIPTION, return diagram.reallyCreateLeaf(quark, Display.getWithNewlines(quark.getName()), LeafType.DESCRIPTION,
USymbols.INTERFACE); USymbols.INTERFACE);
} }
final char codeChar = ident.length() > 2 ? ident.charAt(0) : 0; final char codeChar = ident.length() > 2 ? ident.charAt(0) : 0;
ident = diagram.cleanIdForQuark(ident); ident = diagram.cleanId(ident);
final Quark quark = diagram.quarkInContext(ident, false); final Quark<Entity> quark = diagram.quarkInContext(ident, false);
if (diagram.isGroup(quark)) if (diagram.isGroup(quark))
return (Entity) quark.getData(); return quark.getData();
if (quark.getData() != null) if (quark.getData() != null)
return (Entity) quark.getData(); return quark.getData();
final Display display = Display.getWithNewlines(quark.getName()); final Display display = Display.getWithNewlines(quark.getName());
if (codeChar == '(') { if (codeChar == '(') {
return (Entity) diagram.reallyCreateLeaf(quark, display, LeafType.USECASE, USymbols.USECASE); return diagram.reallyCreateLeaf(quark, display, LeafType.USECASE, USymbols.USECASE);
} else if (codeChar == ':') { } else if (codeChar == ':') {
return (Entity) diagram.reallyCreateLeaf(quark, display, LeafType.DESCRIPTION, return diagram.reallyCreateLeaf(quark, display, LeafType.DESCRIPTION,
diagram.getSkinParam().actorStyle().toUSymbol()); diagram.getSkinParam().actorStyle().toUSymbol());
} else if (codeChar == '[') { } else if (codeChar == '[') {
final USymbol sym = diagram.getSkinParam().componentStyle().toUSymbol(); final USymbol sym = diagram.getSkinParam().componentStyle().toUSymbol();
return (Entity) diagram.reallyCreateLeaf(quark, display, LeafType.DESCRIPTION, sym); return diagram.reallyCreateLeaf(quark, display, LeafType.DESCRIPTION, sym);
} }
return (Entity) diagram.reallyCreateLeaf(quark, display, LeafType.STILL_UNKNOWN, null); return diagram.reallyCreateLeaf(quark, display, LeafType.STILL_UNKNOWN, null);
} }
} }

View File

@ -150,9 +150,10 @@ public class CommandPackageWithUSymbol extends SingleLineCommand2<AbstractEntity
} }
final Quark ident = diagram.quarkInContext(diagram.cleanIdForQuark(idShort), true); final Quark<Entity> ident = diagram.quarkInContext(diagram.cleanId(idShort), true);
final CommandExecutionResult status = diagram.gotoGroup(ident, Display.getWithNewlines(display), GroupType.PACKAGE); final CommandExecutionResult status = diagram.gotoGroup(ident, Display.getWithNewlines(display),
GroupType.PACKAGE);
if (status.isOk() == false) if (status.isOk() == false)
return status; return status;
final Entity p = diagram.getCurrentGroup(); final Entity p = diagram.getCurrentGroup();

View File

@ -54,7 +54,6 @@ import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.api.ImageDataSimple; import net.sourceforge.plantuml.api.ImageDataSimple;
import net.sourceforge.plantuml.awt.geom.XDimension2D; import net.sourceforge.plantuml.awt.geom.XDimension2D;
import net.sourceforge.plantuml.awt.geom.XPoint2D; import net.sourceforge.plantuml.awt.geom.XPoint2D;
import net.sourceforge.plantuml.baraye.EntityFactory;
import net.sourceforge.plantuml.baraye.Entity; import net.sourceforge.plantuml.baraye.Entity;
import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.core.ImageData;
import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.Display;

View File

@ -51,6 +51,7 @@ import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.json.JsonArray; import net.sourceforge.plantuml.json.JsonArray;
import net.sourceforge.plantuml.json.JsonObject; import net.sourceforge.plantuml.json.JsonObject;
import net.sourceforge.plantuml.json.JsonObject.Member; import net.sourceforge.plantuml.json.JsonObject.Member;
import net.sourceforge.plantuml.json.JsonValue;
import net.sourceforge.plantuml.klimt.ULine; import net.sourceforge.plantuml.klimt.ULine;
import net.sourceforge.plantuml.klimt.URectangle; import net.sourceforge.plantuml.klimt.URectangle;
import net.sourceforge.plantuml.klimt.UTranslate; import net.sourceforge.plantuml.klimt.UTranslate;
@ -58,7 +59,6 @@ import net.sourceforge.plantuml.klimt.color.HColor;
import net.sourceforge.plantuml.klimt.font.FontConfiguration; import net.sourceforge.plantuml.klimt.font.FontConfiguration;
import net.sourceforge.plantuml.klimt.font.StringBounder; import net.sourceforge.plantuml.klimt.font.StringBounder;
import net.sourceforge.plantuml.klimt.geom.HorizontalAlignment; import net.sourceforge.plantuml.klimt.geom.HorizontalAlignment;
import net.sourceforge.plantuml.json.JsonValue;
import net.sourceforge.plantuml.style.PName; import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.style.Style;

View File

@ -39,7 +39,6 @@ import java.awt.Font;
import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.StyleSignatureBasic; import net.sourceforge.plantuml.style.StyleSignatureBasic;

View File

@ -44,8 +44,8 @@ import net.sourceforge.plantuml.BlockUml;
import net.sourceforge.plantuml.SourceStringReader; import net.sourceforge.plantuml.SourceStringReader;
import net.sourceforge.plantuml.api.mda.option2.MDADiagram; import net.sourceforge.plantuml.api.mda.option2.MDADiagram;
import net.sourceforge.plantuml.api.mda.option2.MDAPackage; import net.sourceforge.plantuml.api.mda.option2.MDAPackage;
import net.sourceforge.plantuml.baraye.EntityFactory;
import net.sourceforge.plantuml.baraye.Entity; import net.sourceforge.plantuml.baraye.Entity;
import net.sourceforge.plantuml.baraye.EntityFactory;
import net.sourceforge.plantuml.classdiagram.ClassDiagram; import net.sourceforge.plantuml.classdiagram.ClassDiagram;
import net.sourceforge.plantuml.core.Diagram; import net.sourceforge.plantuml.core.Diagram;

View File

@ -108,36 +108,19 @@ public abstract class AbstractClassOrObjectDiagram extends AbstractEntityDiagram
private final List<Association> associations = new ArrayList<>(); private final List<Association> associations = new ArrayList<>();
public CommandExecutionResult associationClass(Entity entity1A, Entity entity1B, Entity entity2A, public CommandExecutionResult associationClass(Entity entity1A, Entity entity1B, Entity entity2A, Entity entity2B,
Entity entity2B, LinkType linkType, Display label) { LinkType linkType, Display label) {
// final Quark ident1A = buildFromName(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(name1A));
// final Quark ident1B = buildFromName(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(name1B));
// final Quark ident2A = buildFromName(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(name2A));
// final Quark ident2B = buildFromName(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(name2B));
// final Quark code1A = buildFromFullPath(name1A);
// final Quark code1B = buildFromFullPath(name1B);
// final Quark code2A = buildFromFullPath(name2A);
// final Quark code2B = buildFromFullPath(name2B);
// final IEntity entity1A = getOrCreateLeaf(ident1A, code1A, null, null);
// final IEntity entity1B = getOrCreateLeaf(ident1B, code1B, null, null);
// final IEntity entity2A = getOrCreateLeaf(ident2A, code2A, null, null);
// final IEntity entity2B = getOrCreateLeaf(ident2B, code2B, null, null);
final List<Association> same1 = getExistingAssociatedPoints(entity1A, entity1B); final List<Association> same1 = getExistingAssociatedPoints(entity1A, entity1B);
final List<Association> same2 = getExistingAssociatedPoints(entity2A, entity2B); final List<Association> same2 = getExistingAssociatedPoints(entity2A, entity2B);
if (same1.size() == 0 && same2.size() == 0) { if (same1.size() == 0 && same2.size() == 0) {
final String tmp1 = this.getUniqueSequence("apoint"); final String tmp1 = this.getUniqueSequence("apoint");
final String tmp2 = this.getUniqueSequence("apoint"); final String tmp2 = this.getUniqueSequence("apoint");
// final Quark ident1 = buildFromName(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(tmp1));
// final Quark ident2 = buildFromName(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(tmp2));
// final Quark code1 = buildFromFullPath(tmp1);
// final Quark code2 = buildFromFullPath(tmp2);
// final IEntity point1 = getOrCreateLeaf(ident1, code1, LeafType.POINT_FOR_ASSOCIATION, null);
// final IEntity point2 = getOrCreateLeaf(ident2, code2, LeafType.POINT_FOR_ASSOCIATION, null);
final Quark code1 = currentQuark().child(tmp1); final Quark<Entity> code1 = getCurrentGroup().getQuark().child(tmp1);
final Entity point1 = reallyCreateLeaf(code1, Display.getWithNewlines(""), LeafType.POINT_FOR_ASSOCIATION, final Entity point1 = reallyCreateLeaf(code1, Display.getWithNewlines(""), LeafType.POINT_FOR_ASSOCIATION,
null); null);
final Quark code2 = currentQuark().child(tmp2); final Quark<Entity> code2 = getCurrentGroup().getQuark().child(tmp2);
final Entity point2 = reallyCreateLeaf(code2, Display.getWithNewlines(""), LeafType.POINT_FOR_ASSOCIATION, final Entity point2 = reallyCreateLeaf(code2, Display.getWithNewlines(""), LeafType.POINT_FOR_ASSOCIATION,
null); null);
@ -162,10 +145,8 @@ public abstract class AbstractClassOrObjectDiagram extends AbstractEntityDiagram
else else
removeLink(existingLink1); removeLink(existingLink1);
final Entity entity1real = existingLink1.isInverted() ? existingLink1.getEntity2() final Entity entity1real = existingLink1.isInverted() ? existingLink1.getEntity2() : existingLink1.getEntity1();
: existingLink1.getEntity1(); final Entity entity2real = existingLink1.isInverted() ? existingLink1.getEntity1() : existingLink1.getEntity2();
final Entity entity2real = existingLink1.isInverted() ? existingLink1.getEntity1()
: existingLink1.getEntity2();
final Link entity1ToPoint = new Link(getEntityFactory(), getSkinParam().getCurrentStyleBuilder(), entity1real, final Link entity1ToPoint = new Link(getEntityFactory(), getSkinParam().getCurrentStyleBuilder(), entity1real,
point1, existingLink1.getType().getPart2(), point1, existingLink1.getType().getPart2(),
@ -192,12 +173,6 @@ public abstract class AbstractClassOrObjectDiagram extends AbstractEntityDiagram
public boolean associationClass(int mode, Entity entity1, Entity entity2, Entity associed, LinkType linkType, public boolean associationClass(int mode, Entity entity1, Entity entity2, Entity associed, LinkType linkType,
Display label) { Display label) {
// final Quark ident1 = buildFromName(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(name1));
// final Quark ident2 = buildFromName(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(name2));
// final Quark code1 = buildFromFullPath(name1);
// final Quark code2 = buildFromFullPath(name2);
// final IEntity entity1 = getOrCreateLeaf(ident1, code1, null, null);
// final IEntity entity2 = getOrCreateLeaf(ident2, code2, null, null);
final List<Association> same = getExistingAssociatedPoints(entity1, entity2); final List<Association> same = getExistingAssociatedPoints(entity1, entity2);
if (same.size() > 1) { if (same.size() > 1) {
return false; return false;
@ -244,13 +219,9 @@ public abstract class AbstractClassOrObjectDiagram extends AbstractEntityDiagram
this.entity2 = entity2; this.entity2 = entity2;
this.associed = associed; this.associed = associed;
final String idShort = AbstractClassOrObjectDiagram.this.getUniqueSequence("apoint"); final String idShort = AbstractClassOrObjectDiagram.this.getUniqueSequence("apoint");
final Quark quark = quarkInContext(cleanIdForQuark(idShort), false); final Quark<Entity> quark = quarkInContext(cleanId(idShort), false);
point = reallyCreateLeaf(quark, Display.getWithNewlines(""), LeafType.POINT_FOR_ASSOCIATION, null); point = reallyCreateLeaf(quark, Display.getWithNewlines(""), LeafType.POINT_FOR_ASSOCIATION, null);
// final Quark ident = buildFromName(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(idShort));
// final Quark code = buildFromFullPath(idShort);
// point = getOrCreateLeaf(ident, code, LeafType.POINT_FOR_ASSOCIATION, null);
} }
public Association createSecondAssociation(int mode2, Entity associed2, Display label) { public Association createSecondAssociation(int mode2, Entity associed2, Display label) {

View File

@ -67,12 +67,10 @@ public class CommandAddData extends SingleLineCommand2<AbstractClassOrObjectDiag
protected CommandExecutionResult executeArg(AbstractClassOrObjectDiagram diagram, LineLocation location, protected CommandExecutionResult executeArg(AbstractClassOrObjectDiagram diagram, LineLocation location,
RegexResult arg) throws NoSuchColorException { RegexResult arg) throws NoSuchColorException {
final String name = arg.get("NAME", 0); final String name = arg.get("NAME", 0);
final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(name), false); final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(name), false);
final Entity entity = (Entity) quark.getData(); final Entity entity = quark.getData();
if (entity == null) if (entity == null)
return CommandExecutionResult.error("No such entity " + quark.getName()); return CommandExecutionResult.error("No such entity " + quark.getName());
// final IEntity entity = diagram.getOrCreateLeaf(quark,
// diagram.buildFromFullPath(name), null, null);
final String field = arg.get("DATA", 0); final String field = arg.get("DATA", 0);
if (field.length() > 0 && VisibilityModifier.isVisibilityCharacter(field)) if (field.length() > 0 && VisibilityModifier.isVisibilityCharacter(field))

View File

@ -80,12 +80,11 @@ public class CommandCreateEntityObject extends SingleLineCommand2<AbstractClassO
protected CommandExecutionResult executeArg(AbstractClassOrObjectDiagram diagram, LineLocation location, protected CommandExecutionResult executeArg(AbstractClassOrObjectDiagram diagram, LineLocation location,
RegexResult arg) throws NoSuchColorException { RegexResult arg) throws NoSuchColorException {
final String idShort = arg.get("NAME", 1); final String idShort = arg.get("NAME", 1);
// final Quark ident = diagram.buildFromName(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(idShort));
// final Quark code = diagram.buildFromFullPath(idShort); final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(idShort), false);
final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(idShort), false);
final String displayString = arg.get("NAME", 0); final String displayString = arg.get("NAME", 0);
final String stereotype = arg.get("STEREO", 0); final String stereotype = arg.get("STEREO", 0);
// final boolean leafExist = diagram.leafExist(code);
if (quark.getData() != null) if (quark.getData() != null)
return CommandExecutionResult.error("Object already exists : " + quark.getData()); return CommandExecutionResult.error("Object already exists : " + quark.getData());
@ -94,11 +93,11 @@ public class CommandCreateEntityObject extends SingleLineCommand2<AbstractClassO
display = Display.getWithNewlines(idShort).withCreoleMode(CreoleMode.SIMPLE_LINE); display = Display.getWithNewlines(idShort).withCreoleMode(CreoleMode.SIMPLE_LINE);
final Entity entity = diagram.reallyCreateLeaf(quark, display, LeafType.OBJECT, null); final Entity entity = diagram.reallyCreateLeaf(quark, display, LeafType.OBJECT, null);
if (stereotype != null) { if (stereotype != null)
entity.setStereotype(Stereotype.build(stereotype, diagram.getSkinParam().getCircledCharacterRadius(), entity.setStereotype(Stereotype.build(stereotype, diagram.getSkinParam().getCircledCharacterRadius(),
diagram.getSkinParam().getFont(null, false, FontParam.CIRCLED_CHARACTER), diagram.getSkinParam().getFont(null, false, FontParam.CIRCLED_CHARACTER),
diagram.getSkinParam().getIHtmlColorSet())); diagram.getSkinParam().getIHtmlColorSet()));
}
final String urlString = arg.get("URL", 0); final String urlString = arg.get("URL", 0);
if (urlString != null) { if (urlString != null) {
final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), UrlMode.STRICT); final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), UrlMode.STRICT);

View File

@ -108,26 +108,23 @@ public class CommandCreateEntityObjectMultilines extends CommandMultilines2<Abst
private Entity executeArg0(AbstractClassOrObjectDiagram diagram, RegexResult line0) throws NoSuchColorException { private Entity executeArg0(AbstractClassOrObjectDiagram diagram, RegexResult line0) throws NoSuchColorException {
final String name = line0.get("NAME", 1); final String name = line0.get("NAME", 1);
final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(name), false); final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(name), false);
// final Quark ident = diagram.buildFromName(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(name));
// final Quark code = diagram.buildFromFullPath(name);
final String displayString = line0.get("NAME", 0); final String displayString = line0.get("NAME", 0);
final String stereotype = line0.get("STEREO", 0); final String stereotype = line0.get("STEREO", 0);
// final boolean leafExist = diagram.leafExist(code);
// if (leafExist)
// return diagram.getOrCreateLeaf(diagram.buildFromName(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(name)), code, LeafType.OBJECT, null);
Display display = Display.getWithNewlines(displayString); Display display = Display.getWithNewlines(displayString);
if (Display.isNull(display)) if (Display.isNull(display))
display = Display.getWithNewlines(name).withCreoleMode(CreoleMode.SIMPLE_LINE); display = Display.getWithNewlines(name).withCreoleMode(CreoleMode.SIMPLE_LINE);
Entity entity = (Entity) quark.getData(); Entity entity = quark.getData();
if (entity == null) if (entity == null)
entity = diagram.reallyCreateLeaf(quark, display, LeafType.OBJECT, null); entity = diagram.reallyCreateLeaf(quark, display, LeafType.OBJECT, null);
if (stereotype != null) { if (stereotype != null)
entity.setStereotype(Stereotype.build(stereotype, diagram.getSkinParam().getCircledCharacterRadius(), entity.setStereotype(Stereotype.build(stereotype, diagram.getSkinParam().getCircledCharacterRadius(),
diagram.getSkinParam().getFont(null, false, FontParam.CIRCLED_CHARACTER), diagram.getSkinParam().getFont(null, false, FontParam.CIRCLED_CHARACTER),
diagram.getSkinParam().getIHtmlColorSet())); diagram.getSkinParam().getIHtmlColorSet()));
}
final String s = line0.get("COLOR", 0); final String s = line0.get("COLOR", 0);
entity.setSpecificColorTOBEREMOVED(ColorType.BACK, entity.setSpecificColorTOBEREMOVED(ColorType.BACK,
s == null ? null : diagram.getSkinParam().getIHtmlColorSet().getColor(s)); s == null ? null : diagram.getSkinParam().getIHtmlColorSet().getColor(s));

View File

@ -48,6 +48,8 @@ import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.LeafType; import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.json.Json.DefaultHandler; import net.sourceforge.plantuml.json.Json.DefaultHandler;
import net.sourceforge.plantuml.json.JsonParser;
import net.sourceforge.plantuml.json.JsonValue;
import net.sourceforge.plantuml.klimt.color.ColorParser; import net.sourceforge.plantuml.klimt.color.ColorParser;
import net.sourceforge.plantuml.klimt.color.ColorType; import net.sourceforge.plantuml.klimt.color.ColorType;
import net.sourceforge.plantuml.klimt.color.NoSuchColorException; import net.sourceforge.plantuml.klimt.color.NoSuchColorException;
@ -58,8 +60,6 @@ import net.sourceforge.plantuml.regex.RegexConcat;
import net.sourceforge.plantuml.regex.RegexLeaf; import net.sourceforge.plantuml.regex.RegexLeaf;
import net.sourceforge.plantuml.regex.RegexResult; import net.sourceforge.plantuml.regex.RegexResult;
import net.sourceforge.plantuml.text.StringLocated; import net.sourceforge.plantuml.text.StringLocated;
import net.sourceforge.plantuml.json.JsonParser;
import net.sourceforge.plantuml.json.JsonValue;
import net.sourceforge.plantuml.url.UrlBuilder; import net.sourceforge.plantuml.url.UrlBuilder;
import net.sourceforge.plantuml.utils.BlocLines; import net.sourceforge.plantuml.utils.BlocLines;
@ -143,16 +143,12 @@ public class CommandCreateJson extends CommandMultilines2<AbstractEntityDiagram>
private Entity executeArg0(AbstractEntityDiagram diagram, RegexResult line0) throws NoSuchColorException { private Entity executeArg0(AbstractEntityDiagram diagram, RegexResult line0) throws NoSuchColorException {
final String name = line0.get("NAME", 1); final String name = line0.get("NAME", 1);
// final Quark ident = diagram.buildFromName(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(name));
// final Quark code = diagram.buildFromFullPath(name); final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(name), false);
final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(name), false);
if (quark.getData() != null) if (quark.getData() != null)
return null; return null;
final String displayString = line0.get("NAME", 0); final String displayString = line0.get("NAME", 0);
final String stereotype = line0.get("STEREO", 0); final String stereotype = line0.get("STEREO", 0);
// final boolean leafExist = diagram.leafExist(code);
// if (leafExist)
// return diagram.getOrCreateLeaf(diagram.buildFromName(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(name)), code, LeafType.JSON, null);
Display display = Display.getWithNewlines(displayString); Display display = Display.getWithNewlines(displayString);
if (Display.isNull(display)) if (Display.isNull(display))

View File

@ -44,12 +44,12 @@ import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.LeafType; import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.json.Json.DefaultHandler; import net.sourceforge.plantuml.json.Json.DefaultHandler;
import net.sourceforge.plantuml.json.JsonParser;
import net.sourceforge.plantuml.json.JsonValue;
import net.sourceforge.plantuml.klimt.color.ColorParser; import net.sourceforge.plantuml.klimt.color.ColorParser;
import net.sourceforge.plantuml.klimt.color.ColorType; import net.sourceforge.plantuml.klimt.color.ColorType;
import net.sourceforge.plantuml.klimt.color.NoSuchColorException; import net.sourceforge.plantuml.klimt.color.NoSuchColorException;
import net.sourceforge.plantuml.klimt.font.FontParam; import net.sourceforge.plantuml.klimt.font.FontParam;
import net.sourceforge.plantuml.json.JsonParser;
import net.sourceforge.plantuml.json.JsonValue;
import net.sourceforge.plantuml.objectdiagram.AbstractClassOrObjectDiagram; import net.sourceforge.plantuml.objectdiagram.AbstractClassOrObjectDiagram;
import net.sourceforge.plantuml.plasma.Quark; import net.sourceforge.plantuml.plasma.Quark;
import net.sourceforge.plantuml.regex.IRegex; import net.sourceforge.plantuml.regex.IRegex;
@ -113,19 +113,12 @@ public class CommandCreateJsonSingleLine extends SingleLineCommand2<AbstractClas
private Entity executeArg0(AbstractClassOrObjectDiagram diagram, RegexResult line0) throws NoSuchColorException { private Entity executeArg0(AbstractClassOrObjectDiagram diagram, RegexResult line0) throws NoSuchColorException {
final String name = line0.get("NAME", 1); final String name = line0.get("NAME", 1);
final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(name), true); final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(name), true);
if (quark.getData() != null) if (quark.getData() != null)
return null; return null;
// final Quark ident = diagram.buildFromName(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(name));
// final Quark code = diagram.buildFromFullPath(name);
final String displayString = line0.get("NAME", 0); final String displayString = line0.get("NAME", 0);
final String stereotype = line0.get("STEREO", 0); final String stereotype = line0.get("STEREO", 0);
// final boolean leafExist = code.getData() != null;
// if (leafExist)
// return diagram.getOrCreateLeaf(
// diagram.buildFromName(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(name)), code,
// LeafType.JSON, null);
Display display = Display.getWithNewlines(displayString); Display display = Display.getWithNewlines(displayString);
if (Display.isNull(display)) if (Display.isNull(display))

View File

@ -122,8 +122,8 @@ public class CommandCreateMap extends CommandMultilines2<AbstractEntityDiagram>
final int x = line.indexOf(linkStr); final int x = line.indexOf(linkStr);
final String key = line.substring(0, x).trim(); final String key = line.substring(0, x).trim();
final String dest = line.substring(x + linkStr.length()).trim(); final String dest = line.substring(x + linkStr.length()).trim();
final Quark ident2 = diagram.quarkInContext(dest, false); final Quark<Entity> ident2 = diagram.quarkInContext(dest, false);
final Entity entity2 = (Entity) ident2.getData(); final Entity entity2 = ident2.getData();
if (entity2 == null) if (entity2 == null)
return CommandExecutionResult.error("No such entity " + ident2.getName()); return CommandExecutionResult.error("No such entity " + ident2.getName());
@ -140,16 +140,11 @@ public class CommandCreateMap extends CommandMultilines2<AbstractEntityDiagram>
private Entity executeArg0(AbstractEntityDiagram diagram, RegexResult line0) throws NoSuchColorException { private Entity executeArg0(AbstractEntityDiagram diagram, RegexResult line0) throws NoSuchColorException {
final String name = line0.get("NAME", 1); final String name = line0.get("NAME", 1);
// final Quark ident = diagram.buildFromName(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(name));
// final Quark code = diagram.buildFromFullPath(name); final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(name), false);
final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(name), false);
final String displayString = line0.get("NAME", 0); final String displayString = line0.get("NAME", 0);
final String stereotype = line0.get("STEREO", 0); final String stereotype = line0.get("STEREO", 0);
// final boolean leafExist = diagram.leafExist(code);
// if (leafExist)
// return diagram.getOrCreateLeaf(
// diagram.buildFromName(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(name)), code,
// LeafType.MAP, null);
if (quark.getData() != null) if (quark.getData() != null)
return null; return null;

View File

@ -0,0 +1,47 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2023, Arnaud Roques
*
* Project Info: http://plantuml.com
*
* If you like this project or if you find it useful, you can support us at:
*
* http://plantuml.com/patreon (only 1$ per month!)
* http://plantuml.com/paypal
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Arnaud Roques
*
*
*/
package net.sourceforge.plantuml.plasma;
class PEntry<DATA> {
final Quark<DATA> first;
int counter = 1;
PEntry(Quark<DATA> first) {
this.first = first;
}
}

View File

@ -38,21 +38,34 @@ package net.sourceforge.plantuml.plasma;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
public class Plasma { public class Plasma<DATA> {
private String separator; private String separator;
private final Quark root; private final Quark<DATA> root;
private final List<Quark> quarks = new ArrayList<>(); private final List<Quark<DATA>> quarks = new ArrayList<>();
private final Map<String, PEntry<DATA>> stats = new HashMap<String, PEntry<DATA>>();
public Plasma(String separator) { public Plasma(String separator) {
this.root = new Quark(this, null, "");
this.separator = separator; this.separator = separator;
this.quarks.add(root); this.root = new Quark<DATA>(this, null, "");
} }
public Quark root() { protected void register(Quark<DATA> quark) {
quarks.add(quark);
PEntry<DATA> ent = stats.get(quark.getName());
if (ent == null) {
ent = new PEntry<DATA>(quark);
stats.put(quark.getName(), ent);
} else {
ent.counter++;
}
}
public Quark<DATA> root() {
return root; return root;
} }
@ -70,100 +83,22 @@ public class Plasma {
return this.separator != null && this.separator != "\u0000"; return this.separator != null && this.separator != "\u0000";
} }
public Quark parse(Quark root, String full) { public Collection<Quark<DATA>> quarks() {
final List<String> result = root.getSignature();
while (true) {
int idx = full.indexOf(separator);
if (idx == -1) {
result.add(full);
return ensurePresent(result);
}
if (idx > 0) {
result.add(full.substring(0, idx));
ensurePresent(new ArrayList<>(result));
}
full = full.substring(idx + separator.length());
}
}
Quark ensurePresent(List<String> result) {
Quark quark = getIfExists(result);
if (quark == null) {
if (result.size() == 0) {
// quark = new Quark(this, null, result);
throw new UnsupportedOperationException();
} else {
final Quark parent = ensurePresent(result.subList(0, result.size() - 1));
quark = new Quark(this, parent, result.get(result.size() - 1));
}
// System.err.println("PUTTING " + quark);
quarks.add(quark);
}
return quark;
}
public Collection<Quark> quarks() {
return Collections.unmodifiableCollection(quarks); return Collections.unmodifiableCollection(quarks);
} }
public Quark firstWithName(String name) { public Quark<DATA> firstWithName(String name) {
for (Quark quark : quarks) final PEntry<DATA> ent = stats.get(name);
if (quark.getName().equals(name)) if (ent == null)
return quark; return null;
return ent.first;
return null;
} }
public int countByName(String name) { public int countByName(String name) {
int count = 0; final PEntry<DATA> ent = stats.get(name);
for (Quark quark : quarks) if (ent == null)
if (quark.getName().equals(name)) return 0;
count++; return ent.counter;
return count;
}
public Quark getIfExistsFromFullPath(String full) {
for (Quark quark : quarks)
if (quark.toString(separator).equals(full))
return quark;
return null;
}
public Quark getIfExists(List<String> signature) {
for (Quark quark : quarks)
if (quark.getSignature().equals(signature))
return quark;
return null;
}
public int countChildren(Quark parent) {
int count = 0;
for (Quark quark : quarks)
if (quark.getParent() == parent)
count++;
return count;
}
public List<Quark> getChildren(Quark parent) {
final List<Quark> result = new ArrayList<>();
for (Quark quark : quarks)
if (quark.getParent() == parent)
result.add(quark);
return Collections.unmodifiableList(result);
}
public void moveAllChildOfToAnewFather(Quark oldFather, Quark newFather) {
for (Quark quark : quarks) {
if (quark == newFather)
continue;
if (quark.getParent() == oldFather)
quark.setParent(newFather);
}
} }
} }

View File

@ -35,59 +35,45 @@
*/ */
package net.sourceforge.plantuml.plasma; package net.sourceforge.plantuml.plasma;
import java.util.ArrayList; import java.util.Collection;
import java.util.List; import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.Map;
public class Quark { public class Quark<DATA> {
private final Plasma plasma; private final Plasma<DATA> plasma;
private /* final */ Quark parent; private final Quark<DATA> parent;
private final String name; private final String name;
private Object data; private DATA data;
private final Map<String, Quark<DATA>> children = new LinkedHashMap<>();
private final String qualifiedName;
Quark(Plasma plasma, Quark parent, String name) { Quark(Plasma<DATA> plasma, Quark<DATA> parent, String name) {
this.name = name; this.name = name;
this.plasma = plasma; this.plasma = plasma;
this.parent = parent; this.parent = parent;
if (parent == null || parent.parent == null)
this.qualifiedName = name;
else
this.qualifiedName = parent.qualifiedName + plasma.getSeparator() + name;
this.plasma.register(this);
} }
public Quark getParent() { public Quark<DATA> getParent() {
return parent; return parent;
} }
@Override @Override
public String toString() { public String toString() {
// return parts.toString() + "(parent=" + parent + ")"; return qualifiedName;
return getSignature().toString();
} }
List<String> getSignature() { public String toStringPoint() {
final List<String> result = new ArrayList<>(); if (parent == null || parent.parent == null)
if (parent != null) return name;
result.addAll(parent.getSignature());
result.add(name);
return result;
}
public boolean containsLarge(Quark other) { return parent.toStringPoint() + "." + name;
final List<String> signature = this.getSignature();
final List<String> otherSignature = other.getSignature();
return otherSignature.size() > signature.size()
&& otherSignature.subList(0, signature.size()).equals(signature);
}
public String toString(String sep) {
if (sep == null)
sep = ".";
final StringBuilder sb = new StringBuilder();
for (String s : getSignature()) {
if (sb.length() > 0)
sb.append(sep);
sb.append(s);
}
return sb.toString();
} }
public String getName() { public String getName() {
@ -95,47 +81,76 @@ public class Quark {
} }
public String getQualifiedName() { public String getQualifiedName() {
if (plasma.hasSeparator()) return qualifiedName;
return toString(plasma.getSeparator());
return name;
} }
public boolean isRoot() { public boolean isRoot() {
return parent == null; return parent == null;
} }
public final Plasma getPlasma() { public final Plasma<DATA> getPlasma() {
return plasma; return plasma;
} }
public final Object getData() { public final DATA getData() {
return data; return data;
} }
public final void setData(Object data) { public final void setData(DATA data) {
if (this.data != null)
throw new IllegalStateException();
this.data = data; this.data = data;
} }
public Quark childIfExists(String name) { public Quark<DATA> childIfExists(String name) {
final List<String> sig = new ArrayList<>(getSignature()); if (plasma.hasSeparator() && name.contains(plasma.getSeparator()))
sig.add(name); throw new IllegalArgumentException();
return plasma.getIfExists(sig); return children.get(name);
} }
public Quark child(String full) { public Quark<DATA> child(String full) {
return plasma.parse(this, full); if (plasma.hasSeparator() == false)
return getDirectChild(full);
full = clean(full);
final String separator = plasma.getSeparator();
Quark<DATA> current = this;
while (true) {
int idx = full.indexOf(separator);
if (idx == -1)
return current.getDirectChild(full);
final String first = full.substring(0, idx);
current = current.getDirectChild(first);
full = clean(full.substring(idx + separator.length()));
}
}
private Quark<DATA> getDirectChild(String name) {
Quark<DATA> result = children.get(name);
if (result == null) {
result = new Quark<DATA>(plasma, this, name);
children.put(name, result);
}
return result;
}
private String clean(String full) {
final String separator = plasma.getSeparator();
while (full.startsWith(separator))
full = full.substring(separator.length());
while (full.endsWith(separator))
full = full.substring(0, full.length() - separator.length());
return full;
}
public Collection<Quark<DATA>> getChildren() {
return Collections.unmodifiableCollection(children.values());
} }
public int countChildren() { public int countChildren() {
return plasma.countChildren(this); return children.size();
}
public List<Quark> getChildren() {
return plasma.getChildren(this);
}
void setParent(Quark newFather) {
this.parent = newFather;
} }
} }

View File

@ -37,8 +37,8 @@ package net.sourceforge.plantuml.salt.factory;
import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.salt.DataSource; import net.sourceforge.plantuml.salt.DataSource;
import net.sourceforge.plantuml.salt.SaltDictionary;
import net.sourceforge.plantuml.salt.Positionner2; import net.sourceforge.plantuml.salt.Positionner2;
import net.sourceforge.plantuml.salt.SaltDictionary;
import net.sourceforge.plantuml.salt.Terminated; import net.sourceforge.plantuml.salt.Terminated;
import net.sourceforge.plantuml.salt.Terminator; import net.sourceforge.plantuml.salt.Terminator;
import net.sourceforge.plantuml.salt.element.Element; import net.sourceforge.plantuml.salt.element.Element;

View File

@ -36,8 +36,8 @@
package net.sourceforge.plantuml.salt.factory; package net.sourceforge.plantuml.salt.factory;
import net.sourceforge.plantuml.salt.DataSource; import net.sourceforge.plantuml.salt.DataSource;
import net.sourceforge.plantuml.salt.SaltDictionary;
import net.sourceforge.plantuml.salt.Positionner2; import net.sourceforge.plantuml.salt.Positionner2;
import net.sourceforge.plantuml.salt.SaltDictionary;
import net.sourceforge.plantuml.salt.Terminated; import net.sourceforge.plantuml.salt.Terminated;
import net.sourceforge.plantuml.salt.element.Element; import net.sourceforge.plantuml.salt.element.Element;
import net.sourceforge.plantuml.salt.element.ElementPyramidScrolled; import net.sourceforge.plantuml.salt.element.ElementPyramidScrolled;

View File

@ -69,7 +69,6 @@ import net.sourceforge.plantuml.api.ImageDataSimple;
import net.sourceforge.plantuml.awt.geom.XDimension2D; import net.sourceforge.plantuml.awt.geom.XDimension2D;
import net.sourceforge.plantuml.awt.geom.XPoint2D; import net.sourceforge.plantuml.awt.geom.XPoint2D;
import net.sourceforge.plantuml.baraye.Entity; import net.sourceforge.plantuml.baraye.Entity;
import net.sourceforge.plantuml.baraye.EntityFactory;
import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.core.ImageData;
import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.GroupType; import net.sourceforge.plantuml.cucadiagram.GroupType;

View File

@ -39,7 +39,6 @@ import java.util.Map;
import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.baraye.Entity; import net.sourceforge.plantuml.baraye.Entity;
import net.sourceforge.plantuml.baraye.EntityUtils;
import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram; import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram;
import net.sourceforge.plantuml.core.UmlSource; import net.sourceforge.plantuml.core.UmlSource;
import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.Display;
@ -57,86 +56,81 @@ public class StateDiagram extends AbstractEntityDiagram {
// setNamespaceSeparator(null); // setNamespaceSeparator(null);
} }
public boolean checkConcurrentStateOk(Quark code) { public boolean checkConcurrentStateOk(Quark<Entity> code) {
final boolean result = checkConcurrentStateOkInternal(code); final boolean result = checkConcurrentStateOkInternal(code);
// System.err.println("checkConcurrentStateOk " + code + " " + ident + " " +
// result);
return result; return result;
} }
private boolean checkConcurrentStateOkInternal(Quark code) { private boolean checkConcurrentStateOkInternal(Quark<Entity> code) {
if (code.getData() == null) { if (code.getData() == null)
return true; return true;
}
// final IEntity existing = this.getLeafFromName(code.getName()); final Entity existing = code.getData();
final Entity existing = (Entity) code.getData();
if (getCurrentGroup().getGroupType() == GroupType.CONCURRENT_STATE if (getCurrentGroup().getGroupType() == GroupType.CONCURRENT_STATE
&& getCurrentGroup() != existing.getParentContainer()) { && getCurrentGroup() != existing.getParentContainer())
return false; return false;
}
if (existing.getParentContainer().getGroupType() == GroupType.CONCURRENT_STATE if (existing.getParentContainer().getGroupType() == GroupType.CONCURRENT_STATE
&& getCurrentGroup() != existing.getParentContainer()) { && getCurrentGroup() != existing.getParentContainer())
return false; return false;
}
return true; return true;
} }
public Entity getStart() { public Entity getStart() {
final Entity g = getCurrentGroup(); final Entity g = getCurrentGroup();
if (g.isRoot()) { if (g.isRoot()) {
final String idShort = "*start*"; final String idShort = "*start*";
final Quark quark = quarkInContext(cleanIdForQuark(idShort), false); final Quark<Entity> quark = quarkInContext(cleanId(idShort), false);
if (quark.getData() == null) if (quark.getData() == null)
quark.setData(reallyCreateLeaf(quark, Display.getWithNewlines(""), LeafType.CIRCLE_START, null)); reallyCreateLeaf(quark, Display.getWithNewlines(""), LeafType.CIRCLE_START, null);
return (Entity) quark.getData(); return quark.getData();
} }
final String idShort = "*start*" + g.getName(); final String idShort = "*start*" + g.getName();
final Quark quark = quarkInContext(cleanIdForQuark(idShort), false); final Quark<Entity> quark = quarkInContext(cleanId(idShort), false);
if (quark.getData() == null) if (quark.getData() == null)
quark.setData(reallyCreateLeaf(quark, Display.getWithNewlines(""), LeafType.CIRCLE_START, null)); reallyCreateLeaf(quark, Display.getWithNewlines(""), LeafType.CIRCLE_START, null);
return (Entity) quark.getData(); return quark.getData();
} }
public Entity getEnd() { public Entity getEnd() {
final Entity p = getCurrentGroup(); final Entity p = getCurrentGroup();
if (p.isRoot()) { if (p.isRoot()) {
final String idShort = "*end*"; final String idShort = "*end*";
final Quark quark = quarkInContext(cleanIdForQuark(idShort), false); final Quark<Entity> quark = quarkInContext(cleanId(idShort), false);
if (quark.getData() == null) if (quark.getData() == null)
quark.setData(reallyCreateLeaf(quark, Display.getWithNewlines(""), LeafType.CIRCLE_END, null)); reallyCreateLeaf(quark, Display.getWithNewlines(""), LeafType.CIRCLE_END, null);
return (Entity) quark.getData(); return quark.getData();
} }
final String idShort = "*end*" + p.getName(); final String idShort = "*end*" + p.getName();
final Quark quark = quarkInContext(cleanIdForQuark(idShort), false); final Quark<Entity> quark = quarkInContext(cleanId(idShort), false);
if (quark.getData() == null) if (quark.getData() == null)
quark.setData(reallyCreateLeaf(quark, Display.getWithNewlines(""), LeafType.CIRCLE_END, null)); reallyCreateLeaf(quark, Display.getWithNewlines(""), LeafType.CIRCLE_END, null);
return (Entity) quark.getData(); return quark.getData();
} }
public Entity getHistorical() { public Entity getHistorical() {
final Entity g = getCurrentGroup(); final Entity g = getCurrentGroup();
if (g.isRoot()) { if (g.isRoot()) {
final String idShort = "*historical*"; final String idShort = "*historical*";
final Quark quark = quarkInContext(cleanIdForQuark(idShort), false); final Quark<Entity> quark = quarkInContext(cleanId(idShort), false);
if (quark.getData() == null) if (quark.getData() == null)
quark.setData(reallyCreateLeaf(quark, Display.getWithNewlines(""), LeafType.PSEUDO_STATE, null)); reallyCreateLeaf(quark, Display.getWithNewlines(""), LeafType.PSEUDO_STATE, null);
return (Entity) quark.getData(); return quark.getData();
} }
final String idShort = "*historical*" + g.getName(); final String idShort = "*historical*" + g.getName();
final Quark quark = quarkInContext(cleanIdForQuark(idShort), false); final Quark<Entity> quark = quarkInContext(cleanId(idShort), false);
if (quark.getData() == null) if (quark.getData() == null)
quark.setData(reallyCreateLeaf(quark, Display.getWithNewlines(""), LeafType.PSEUDO_STATE, null)); reallyCreateLeaf(quark, Display.getWithNewlines(""), LeafType.PSEUDO_STATE, null);
return (Entity) quark.getData(); return quark.getData();
} }
public Entity getHistorical(String idShort) { public Entity getHistorical(String idShort) {
final Quark quark = quarkInContext(cleanIdForQuark(idShort), false); final Quark<Entity> quark = quarkInContext(cleanId(idShort), false);
gotoGroup(quark, Display.getWithNewlines(quark), GroupType.STATE); gotoGroup(quark, Display.getWithNewlines(quark), GroupType.STATE);
final Entity g = getCurrentGroup(); final Entity g = getCurrentGroup();
final String tmp = "*historical*" + g.getName(); final String tmp = "*historical*" + g.getName();
final Quark ident = quarkInContext(tmp, false); final Quark<Entity> ident = quarkInContext(tmp, false);
final Entity result = reallyCreateLeaf(ident, Display.getWithNewlines(ident), LeafType.PSEUDO_STATE, null); final Entity result = reallyCreateLeaf(ident, Display.getWithNewlines(ident), LeafType.PSEUDO_STATE, null);
endGroup(); endGroup();
return result; return result;
@ -146,27 +140,27 @@ public class StateDiagram extends AbstractEntityDiagram {
final Entity g = getCurrentGroup(); final Entity g = getCurrentGroup();
if (g.isRoot()) { if (g.isRoot()) {
final String idShort = "*deephistory*"; final String idShort = "*deephistory*";
final Quark quark = quarkInContext(cleanIdForQuark(idShort), false); final Quark<Entity> quark = quarkInContext(cleanId(idShort), false);
if (quark.getData() == null) if (quark.getData() == null)
quark.setData(reallyCreateLeaf(quark, Display.getWithNewlines(""), LeafType.DEEP_HISTORY, null)); reallyCreateLeaf(quark, Display.getWithNewlines(""), LeafType.DEEP_HISTORY, null);
return (Entity) quark.getData(); return quark.getData();
} }
final String idShort = "*deephistory*" + g.getName(); final String idShort = "*deephistory*" + g.getName();
final Quark quark = quarkInContext(cleanIdForQuark(idShort), false); final Quark<Entity> quark = quarkInContext(cleanId(idShort), false);
if (quark.getData() == null) if (quark.getData() == null)
quark.setData(reallyCreateLeaf(quark, Display.getWithNewlines(""), LeafType.DEEP_HISTORY, null)); reallyCreateLeaf(quark, Display.getWithNewlines(""), LeafType.DEEP_HISTORY, null);
return (Entity) quark.getData(); return quark.getData();
} }
public Entity getDeepHistory(String idShort) { public Entity getDeepHistory(String idShort) {
final Quark quark = quarkInContext(cleanIdForQuark(idShort), false); final Quark<Entity> quark = quarkInContext(cleanId(idShort), false);
// final Quark codeGroup = buildFromFullPath(idShort);
gotoGroup(quark, Display.getWithNewlines(quark), GroupType.STATE); gotoGroup(quark, Display.getWithNewlines(quark), GroupType.STATE);
final Entity g = getCurrentGroup(); final Entity g = getCurrentGroup();
final String tmp = "*deephistory*" + g.getName(); final String tmp = "*deephistory*" + g.getName();
final Quark ident = quarkInContext(cleanIdForQuark(tmp), false); final Quark<Entity> ident = quarkInContext(cleanId(tmp), false);
final Entity result = reallyCreateLeaf(ident, Display.getWithNewlines(""), LeafType.DEEP_HISTORY, null); final Entity result = reallyCreateLeaf(ident, Display.getWithNewlines(""), LeafType.DEEP_HISTORY, null);
endGroup(); endGroup();
return result; return result;
@ -174,42 +168,34 @@ public class StateDiagram extends AbstractEntityDiagram {
public boolean concurrentState(char direction) { public boolean concurrentState(char direction) {
final Entity cur = getCurrentGroup(); final Entity cur = getCurrentGroup();
// printlink("BEFORE");
if (cur.isRoot() == false && cur.getGroupType() == GroupType.CONCURRENT_STATE) {
super.endGroup();
}
getCurrentGroup().setConcurrentSeparator(direction); getCurrentGroup().setConcurrentSeparator(direction);
if (cur.getGroupType() == GroupType.CONCURRENT_STATE)
super.endGroup();
final String tmp1 = this.getUniqueSequence(CONCURRENT_PREFIX); final String tmp1 = this.getUniqueSequence(CONCURRENT_PREFIX);
final Quark ident1 = quarkInContext(cleanIdForQuark(tmp1), false); final Quark<Entity> ident1 = quarkInContext(cleanId(tmp1), false);
gotoGroup(ident1, Display.create(""), GroupType.CONCURRENT_STATE); gotoGroup(ident1, Display.create(""), GroupType.CONCURRENT_STATE);
final Entity conc1 = getCurrentGroup(); getCurrentGroup().setConcurrentSeparator(direction);
if (cur.isRoot() == false && cur.getGroupType() == GroupType.STATE) { // // final Entity conc1 = getCurrentGroup();
// cur.moveEntitiesTo(conc1); // if (cur.getGroupType() == GroupType.STATE) {
getPlasma().moveAllChildOfToAnewFather(cur.getQuark(), conc1.getQuark()); //
super.endGroup(); //// moveAllChildOfToAnewFather(cur.getQuark(), conc1.getQuark());
//// super.endGroup();
//
// final String tmp2 = this.getUniqueSequence(CONCURRENT_PREFIX);
// final Quark<Entity> ident2 = quarkInContext(tmp2, false);
// gotoGroup(ident2, Display.create(""), GroupType.CONCURRENT_STATE);
// }
final String tmp2 = this.getUniqueSequence(CONCURRENT_PREFIX);
final Quark ident2 = quarkInContext(tmp2, false);
gotoGroup(ident2, Display.create(""), GroupType.CONCURRENT_STATE);
}
// printlink("AFTER");
return true; return true;
} }
// private void printlink(String comment) {
// Log.println("COMMENT="+comment);
// for (Link l : getLinks()) {
// Log.println(l);
// }
// }
@Override @Override
public boolean endGroup() { public boolean endGroup() {
final Entity cur = getCurrentGroup(); final Entity cur = getCurrentGroup();
if (cur.isRoot() == false && cur.getGroupType() == GroupType.CONCURRENT_STATE) if (cur.getGroupType() == GroupType.CONCURRENT_STATE)
super.endGroup(); super.endGroup();
return super.endGroup(); return super.endGroup();
@ -231,21 +217,21 @@ public class StateDiagram extends AbstractEntityDiagram {
for (Link link : this.getLinks()) { for (Link link : this.getLinks()) {
final Entity parent1 = getGroupParentIfItIsConcurrentState(link.getEntity1()); final Entity parent1 = getGroupParentIfItIsConcurrentState(link.getEntity1());
final Entity parent2 = getGroupParentIfItIsConcurrentState(link.getEntity2()); final Entity parent2 = getGroupParentIfItIsConcurrentState(link.getEntity2());
if (isCompatible(parent1, parent2) == false) { if (isCompatible(parent1, parent2) == false)
return "State within concurrent state cannot be linked out of this concurrent state (between " return "State within concurrent state cannot be linked out of this concurrent state (between "
+ link.getEntity1().getName() + " and " + link.getEntity2().getName() + ")"; + link.getEntity1().getName() + " and " + link.getEntity2().getName() + ")";
}
} }
return super.checkFinalError(); return super.checkFinalError();
} }
private static boolean isCompatible(Entity parent1, Entity parent2) { private static boolean isCompatible(Entity parent1, Entity parent2) {
if (parent1 == null && parent2 == null) { if (parent1 == null && parent2 == null)
return true; return true;
}
if (parent1 != null ^ parent2 != null) { if (parent1 != null ^ parent2 != null)
return false; return false;
}
assert parent1 != null && parent2 != null; assert parent1 != null && parent2 != null;
return parent1 == parent2; return parent1 == parent2;
} }
@ -253,9 +239,9 @@ public class StateDiagram extends AbstractEntityDiagram {
private static Entity getGroupParentIfItIsConcurrentState(Entity ent) { private static Entity getGroupParentIfItIsConcurrentState(Entity ent) {
Entity parent = ent.getParentContainer(); Entity parent = ent.getParentContainer();
while (parent != null) { while (parent != null) {
if (parent.getGroupType() == GroupType.CONCURRENT_STATE) { if (parent.getGroupType() == GroupType.CONCURRENT_STATE)
return parent; return parent;
}
parent = parent.getParentContainer(); parent = parent.getParentContainer();
} }
return null; return null;

View File

@ -72,13 +72,13 @@ public class CommandAddField extends SingleLineCommand2<StateDiagram> {
throws NoSuchColorException { throws NoSuchColorException {
final String codeString = arg.getLazzy("CODE", 0); final String codeString = arg.getLazzy("CODE", 0);
final Quark quark; final Quark<Entity> quark;
if (diagram.currentQuark().getName().equals(codeString) && diagram.currentQuark().getData() != null) if (diagram.getCurrentGroup().getName().equals(codeString))
quark = diagram.currentQuark(); quark = diagram.getCurrentGroup().getQuark();
else else
quark = diagram.quarkInContext(diagram.cleanIdForQuark(codeString), false); quark = diagram.quarkInContext(diagram.cleanId(codeString), false);
Entity entity = (Entity) quark.getData(); Entity entity = quark.getData();
if (entity == null) if (entity == null)
entity = diagram.reallyCreateLeaf(quark, Display.getWithNewlines(quark), LeafType.STATE, null); entity = diagram.reallyCreateLeaf(quark, Display.getWithNewlines(quark), LeafType.STATE, null);

View File

@ -58,9 +58,9 @@ public class CommandConcurrentState extends SingleLineCommand2<StateDiagram> {
@Override @Override
protected CommandExecutionResult executeArg(StateDiagram diagram, LineLocation location, RegexResult arg) { protected CommandExecutionResult executeArg(StateDiagram diagram, LineLocation location, RegexResult arg) {
if (diagram.concurrentState(arg.get("TYPE", 0).charAt(0))) { if (diagram.concurrentState(arg.get("TYPE", 0).charAt(0)))
return CommandExecutionResult.ok(); return CommandExecutionResult.ok();
}
return CommandExecutionResult.error("Error 42"); return CommandExecutionResult.error("Error 42");
} }

View File

@ -110,9 +110,7 @@ public class CommandCreatePackage2 extends SingleLineCommand2<StateDiagram> {
throws NoSuchColorException { throws NoSuchColorException {
final String idShort = getNotNull(arg, "CODE1", "CODE2"); final String idShort = getNotNull(arg, "CODE1", "CODE2");
// final Quark idNewLong = diagram.buildFullyQualified(idShort); final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(idShort), false);
// final Quark code = diagram.buildFromFullPath(idShort);
final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(idShort), false);
String display = getNotNull(arg, "DISPLAY1", "DISPLAY2"); String display = getNotNull(arg, "DISPLAY1", "DISPLAY2");
if (display == null) if (display == null)
display = quark.getName(); display = quark.getName();

View File

@ -115,16 +115,15 @@ public class CommandCreatePackageState extends SingleLineCommand2<StateDiagram>
throws NoSuchColorException { throws NoSuchColorException {
final String idShort = getNotNull(arg, "CODE1", "CODE2"); final String idShort = getNotNull(arg, "CODE1", "CODE2");
final Quark quark = diagram.quarkInContext(idShort, false); final Quark<Entity> quark = diagram.quarkInContext(idShort, false);
// final Quark idNewLong = diagram.buildFullyQualified(idShort);
// final Quark code = diagram.buildFromFullPath(idShort);
String display = getNotNull(arg, "DISPLAY1", "DISPLAY2");
if (display == null)
display = quark.getName();
diagram.gotoGroup(quark, Display.getWithNewlines(display), GroupType.STATE); final String display = getNotNull(arg, "DISPLAY1", "DISPLAY2");
diagram.gotoGroup(quark, Display.getWithNewlines(display == null ? quark.getName() : display), GroupType.STATE);
final Entity p = diagram.getCurrentGroup(); final Entity p = diagram.getCurrentGroup();
if (display != null)
p.setDisplay(Display.getWithNewlines(display));
final String stereotype = arg.get("STEREOTYPE", 0); final String stereotype = arg.get("STEREOTYPE", 0);
if (stereotype != null) if (stereotype != null)
p.setStereotype(Stereotype.build(stereotype)); p.setStereotype(Stereotype.build(stereotype));

View File

@ -113,10 +113,8 @@ public class CommandCreateState extends SingleLineCommand2<StateDiagram> {
throws NoSuchColorException { throws NoSuchColorException {
final String idShort = arg.getLazzy("CODE", 0); final String idShort = arg.getLazzy("CODE", 0);
final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(idShort), false); final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(idShort), false);
//
// final Quark ident = diagram.buildFromName(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(idShort));
// final Quark code = diagram.buildFromFullPath(idShort);
String display = arg.getLazzy("DISPLAY", 0); String display = arg.getLazzy("DISPLAY", 0);
if (display == null) if (display == null)
display = quark.getName(); display = quark.getName();
@ -129,7 +127,7 @@ public class CommandCreateState extends SingleLineCommand2<StateDiagram> {
return CommandExecutionResult.error("The state " + quark.getName() return CommandExecutionResult.error("The state " + quark.getName()
+ " has been created in a concurrent state : it cannot be used here."); + " has been created in a concurrent state : it cannot be used here.");
Entity ent = (Entity) quark.getData(); Entity ent = quark.getData();
if (ent == null) if (ent == null)
ent = diagram.reallyCreateLeaf(quark, Display.getWithNewlines(display), type, null); ent = diagram.reallyCreateLeaf(quark, Display.getWithNewlines(display), type, null);

View File

@ -166,21 +166,21 @@ abstract class CommandLinkStateCommon extends SingleLineCommand2<StateDiagram> {
if (code.startsWith("=") && code.endsWith("=")) { if (code.startsWith("=") && code.endsWith("=")) {
final String codeString1 = removeEquals(code); final String codeString1 = removeEquals(code);
final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(codeString1), false); final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(codeString1), false);
if (quark.getData() != null) if (quark.getData() != null)
return (Entity) quark.getData(); return quark.getData();
return diagram.reallyCreateLeaf(quark, Display.getWithNewlines(quark), LeafType.SYNCHRO_BAR, null); return diagram.reallyCreateLeaf(quark, Display.getWithNewlines(quark), LeafType.SYNCHRO_BAR, null);
} }
if (diagram.currentQuark().getName().equals(code) && diagram.currentQuark().getData() != null) if (diagram.getCurrentGroup().getName().equals(code))
return (Entity) diagram.currentQuark().getData(); return diagram.getCurrentGroup();
final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(code), false); final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(code), false);
if (diagram.checkConcurrentStateOk(quark) == false) if (diagram.checkConcurrentStateOk(quark) == false)
return null; return null;
if (quark.getData() != null) if (quark.getData() != null)
return (Entity) quark.getData(); return quark.getData();
return diagram.reallyCreateLeaf(quark, Display.getWithNewlines(quark.getName()), LeafType.STATE, null); return diagram.reallyCreateLeaf(quark, Display.getWithNewlines(quark.getName()), LeafType.STATE, null);
} }

View File

@ -44,6 +44,7 @@ import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects; import java.util.Objects;
@ -469,41 +470,52 @@ public class Cluster implements Moveable {
} }
private int togetherCounter = 0;
private void printTogether(Together together, StringBuilder sb, List<SvekNode> nodesOrderedWithoutTop,
StringBounder stringBounder, Collection<SvekLine> lines, DotMode dotMode, GraphvizVersion graphvizVersion,
UmlDiagramType type) {
sb.append("subgraph " + getClusterId() + "t" + togetherCounter + " {\n");
for (SvekNode node : nodesOrderedWithoutTop)
if (node.getTogether() == together)
node.appendShape(sb, stringBounder);
for (Cluster child : children)
if (child.group.getTogether() == together)
child.printInternal(sb, lines, stringBounder, dotMode, graphvizVersion, type);
sb.append("}\n");
togetherCounter++;
}
public SvekNode printCluster2(StringBuilder sb, Collection<SvekLine> lines, StringBounder stringBounder, public SvekNode printCluster2(StringBuilder sb, Collection<SvekLine> lines, StringBounder stringBounder,
DotMode dotMode, GraphvizVersion graphvizVersion, UmlDiagramType type) { DotMode dotMode, GraphvizVersion graphvizVersion, UmlDiagramType type) {
SvekNode added = null; SvekNode added = null;
final Map<Together, List<SvekNode>> togethers = new LinkedHashMap<>(); final Collection<Together> togethers = new LinkedHashSet<>();
for (SvekNode node : getNodesOrderedWithoutTop(lines)) { final List<SvekNode> nodesOrderedWithoutTop = getNodesOrderedWithoutTop(lines);
for (SvekNode node : nodesOrderedWithoutTop) {
final Together together = node.getTogether(); final Together together = node.getTogether();
if (together == null) { if (together == null) {
node.appendShape(sb, stringBounder); node.appendShape(sb, stringBounder);
} else { } else {
List<SvekNode> list = togethers.get(together); togethers.add(together);
if (list == null) {
list = new ArrayList<>();
togethers.put(together, list);
}
list.add(node);
} }
added = node; added = node;
} }
int t = 0; for (Together together : togethers)
for (List<SvekNode> list : togethers.values()) { printTogether(together, sb, nodesOrderedWithoutTop, stringBounder, lines, dotMode, graphvizVersion, type);
sb.append("subgraph " + getClusterId() + "t" + t + " {\n");
for (SvekNode node : list)
node.appendShape(sb, stringBounder);
sb.append("}\n");
t++;
}
if (skinParam.useRankSame() && dotMode != DotMode.NO_LEFT_RIGHT_AND_XLABEL if (skinParam.useRankSame() && dotMode != DotMode.NO_LEFT_RIGHT_AND_XLABEL
&& graphvizVersion.ignoreHorizontalLinks() == false) && graphvizVersion.ignoreHorizontalLinks() == false)
appendRankSame(sb, lines); appendRankSame(sb, lines);
for (Cluster child : getChildren()) for (Cluster child : children) {
child.printInternal(sb, lines, stringBounder, dotMode, graphvizVersion, type); if (child.group.getTogether() == null)
child.printInternal(sb, lines, stringBounder, dotMode, graphvizVersion, type);
}
return added; return added;
} }
@ -605,21 +617,7 @@ public class Cluster implements Moveable {
if (result != null) if (result != null)
return result; return result;
final Stereotype stereo = group.getStereotype();
return style.value(PName.BackGroundColor).asColor(skinParam.getIHtmlColorSet()); return style.value(PName.BackGroundColor).asColor(skinParam.getIHtmlColorSet());
// final USymbol sym = group.getUSymbol() == null ? USymbols.PACKAGE : group.getUSymbol();
// final ColorParam backparam = umlDiagramType == UmlDiagramType.ACTIVITY ? ColorParam.partitionBackground
// : sym.getColorParamBack();
// final HColor c1 = skinParam.getHtmlColor(backparam, stereo, false);
// if (c1 != null)
// return c1;
//
// if (parentCluster == null)
// return null;
//
// return parentCluster.getBackColor(umlDiagramType, style);
} }
boolean isClusterOf(Entity ent) { boolean isClusterOf(Entity ent) {

View File

@ -52,7 +52,7 @@ import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.style.StyleSignatureBasic; import net.sourceforge.plantuml.style.StyleSignatureBasic;
import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphic;
public final class CucaDiagramFileMakerSvek2InternalImage extends AbstractTextBlock implements IEntityImage { public final class ConcurrentStates extends AbstractTextBlock implements IEntityImage {
private final List<IEntityImage> inners; private final List<IEntityImage> inners;
private final Separator separator; private final Separator separator;
@ -100,7 +100,7 @@ public final class CucaDiagramFileMakerSvek2InternalImage extends AbstractTextBl
} }
} }
public CucaDiagramFileMakerSvek2InternalImage(List<IEntityImage> inners, char concurrentSeparator, public ConcurrentStates(List<IEntityImage> inners, char concurrentSeparator,
ISkinParam skinParam, Stereotype stereotype) { ISkinParam skinParam, Stereotype stereotype) {
this.separator = Separator.fromChar(concurrentSeparator); this.separator = Separator.fromChar(concurrentSeparator);
this.skinParam = skinParam; this.skinParam = skinParam;

View File

@ -50,8 +50,8 @@ import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.awt.geom.XPoint2D; import net.sourceforge.plantuml.awt.geom.XPoint2D;
import net.sourceforge.plantuml.baraye.EntityFactory;
import net.sourceforge.plantuml.baraye.Entity; import net.sourceforge.plantuml.baraye.Entity;
import net.sourceforge.plantuml.baraye.EntityFactory;
import net.sourceforge.plantuml.command.Position; import net.sourceforge.plantuml.command.Position;
import net.sourceforge.plantuml.cucadiagram.ICucaDiagram; import net.sourceforge.plantuml.cucadiagram.ICucaDiagram;
import net.sourceforge.plantuml.cucadiagram.dot.DotData; import net.sourceforge.plantuml.cucadiagram.dot.DotData;

View File

@ -43,7 +43,6 @@ import java.util.List;
import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.ColorParam;
import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.baraye.Entity; import net.sourceforge.plantuml.baraye.Entity;
import net.sourceforge.plantuml.baraye.EntityUtils;
import net.sourceforge.plantuml.cucadiagram.GroupHierarchy; import net.sourceforge.plantuml.cucadiagram.GroupHierarchy;
import net.sourceforge.plantuml.cucadiagram.GroupType; import net.sourceforge.plantuml.cucadiagram.GroupType;
import net.sourceforge.plantuml.cucadiagram.ICucaDiagram; import net.sourceforge.plantuml.cucadiagram.ICucaDiagram;
@ -60,7 +59,7 @@ import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.style.StyleSignatureBasic; import net.sourceforge.plantuml.style.StyleSignatureBasic;
import net.sourceforge.plantuml.svek.image.EntityImageState; import net.sourceforge.plantuml.svek.image.EntityImageState;
public final class GroupPngMakerActivity { public final class GroupMakerActivity {
private final ICucaDiagram diagram; private final ICucaDiagram diagram;
private final Entity group; private final Entity group;
@ -73,9 +72,9 @@ public final class GroupPngMakerActivity {
} }
public Collection<Entity> getChildrenGroups(Entity parent) { public Collection<Entity> getChildrenGroups(Entity parent) {
if (parent.isRoot()) if (parent.isRoot())
return diagram.getChildrenGroups(group); return diagram.getChildrenGroups(group);
return diagram.getChildrenGroups(parent); return diagram.getChildrenGroups(parent);
} }
@ -85,7 +84,7 @@ public final class GroupPngMakerActivity {
} }
public GroupPngMakerActivity(ICucaDiagram diagram, Entity group, StringBounder stringBounder) { public GroupMakerActivity(ICucaDiagram diagram, Entity group, StringBounder stringBounder) {
this.diagram = diagram; this.diagram = diagram;
this.group = group; this.group = group;
this.stringBounder = stringBounder; this.stringBounder = stringBounder;
@ -94,12 +93,12 @@ public final class GroupPngMakerActivity {
private List<Link> getPureInnerLinks() { private List<Link> getPureInnerLinks() {
final List<Link> result = new ArrayList<>(); final List<Link> result = new ArrayList<>();
for (Link link : diagram.getLinks()) { for (Link link : diagram.getLinks()) {
final Entity e1 = (Entity) link.getEntity1(); final Entity e1 = link.getEntity1();
final Entity e2 = (Entity) link.getEntity2(); final Entity e2 = link.getEntity2();
if (e1.getParentContainer() == group && e1.isGroup() == false && e2.getParentContainer() == group if (e1.getParentContainer() == group && e1.isGroup() == false && e2.getParentContainer() == group
&& e2.isGroup() == false) && e2.isGroup() == false)
result.add(link); result.add(link);
} }
return result; return result;
} }
@ -109,14 +108,14 @@ public final class GroupPngMakerActivity {
} }
public IEntityImage getImage() throws IOException, InterruptedException { public IEntityImage getImage() throws IOException, InterruptedException {
if (group.countChildren() == 0) { if (group.countChildren() == 0)
return new EntityImageState(group, diagram.getSkinParam()); return new EntityImageState(group, diagram.getSkinParam());
}
final List<Link> links = getPureInnerLinks(); final List<Link> links = getPureInnerLinks();
final ISkinParam skinParam = diagram.getSkinParam(); final ISkinParam skinParam = diagram.getSkinParam();
final DotData dotData = new DotData(group, links, group.leafs(), diagram.getUmlDiagramType(), final DotData dotData = new DotData(group, links, group.leafs(), diagram.getUmlDiagramType(), skinParam,
skinParam, new InnerGroupHierarchy(), diagram.getEntityFactory(), false, DotMode.NORMAL, new InnerGroupHierarchy(), diagram.getEntityFactory(), false, DotMode.NORMAL,
diagram.getNamespaceSeparator(), diagram.getPragma()); diagram.getNamespaceSeparator(), diagram.getPragma());
final GeneralImageBuilder svek2 = new GeneralImageBuilder(dotData, diagram.getEntityFactory(), final GeneralImageBuilder svek2 = new GeneralImageBuilder(dotData, diagram.getEntityFactory(),

View File

@ -48,7 +48,6 @@ import net.sourceforge.plantuml.cucadiagram.GroupType;
import net.sourceforge.plantuml.cucadiagram.ICucaDiagram; import net.sourceforge.plantuml.cucadiagram.ICucaDiagram;
import net.sourceforge.plantuml.cucadiagram.LeafType; import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.Link; import net.sourceforge.plantuml.cucadiagram.Link;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.cucadiagram.dot.DotData; import net.sourceforge.plantuml.cucadiagram.dot.DotData;
import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.klimt.UStroke; import net.sourceforge.plantuml.klimt.UStroke;
@ -63,7 +62,7 @@ import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.svek.image.EntityImageState; import net.sourceforge.plantuml.svek.image.EntityImageState;
import net.sourceforge.plantuml.svek.image.EntityImageStateCommon; import net.sourceforge.plantuml.svek.image.EntityImageStateCommon;
public final class GroupPngMakerState { public final class GroupMakerState {
private final ICucaDiagram diagram; private final ICucaDiagram diagram;
private final Entity group; private final Entity group;
@ -77,9 +76,18 @@ public final class GroupPngMakerState {
public Collection<Entity> getChildrenGroups(Entity parent) { public Collection<Entity> getChildrenGroups(Entity parent) {
if (parent.isRoot()) if (parent.isRoot())
return diagram.getChildrenGroups(group); return filter(diagram.getChildrenGroups(group));
return diagram.getChildrenGroups(parent); return filter(diagram.getChildrenGroups(parent));
}
private Collection<Entity> filter(Collection<Entity> groups) {
final List<Entity> result = new ArrayList<>();
for (Entity g : groups)
if (g.getGroupType() != GroupType.CONCURRENT_STATE)
result.add(g);
return result;
} }
public boolean isEmpty(Entity g) { public boolean isEmpty(Entity g) {
@ -88,7 +96,7 @@ public final class GroupPngMakerState {
} }
public GroupPngMakerState(ICucaDiagram diagram, Entity group, StringBounder stringBounder) { public GroupMakerState(ICucaDiagram diagram, Entity group, StringBounder stringBounder) {
this.diagram = diagram; this.diagram = diagram;
this.stringBounder = stringBounder; this.stringBounder = stringBounder;
this.group = group; this.group = group;
@ -111,8 +119,7 @@ public final class GroupPngMakerState {
final ISkinParam skinParam = diagram.getSkinParam(); final ISkinParam skinParam = diagram.getSkinParam();
final Style style = EntityImageStateCommon.getStyleState(group, skinParam); final Style style = EntityImageStateCommon.getStyleState(group, skinParam);
// final Style styleHeader = EntityImageStateCommon.getStyleStateHeader(group,
// skinParam);
final Style styleTitle = EntityImageStateCommon.getStyleStateTitle(group, skinParam); final Style styleTitle = EntityImageStateCommon.getStyleStateTitle(group, skinParam);
final Style styleBody = EntityImageStateCommon.getStyleStateBody(group, skinParam); final Style styleBody = EntityImageStateCommon.getStyleStateBody(group, skinParam);
@ -125,18 +132,8 @@ public final class GroupPngMakerState {
if (group.countChildren() == 0 && group.groups().size() == 0) if (group.countChildren() == 0 && group.groups().size() == 0)
return new EntityImageState(group, diagram.getSkinParam()); return new EntityImageState(group, diagram.getSkinParam());
final List<Link> links = getPureInnerLinks();
final DotData dotData = new DotData(group, links, group.leafs(), diagram.getUmlDiagramType(),
skinParam, new InnerGroupHierarchy(), diagram.getEntityFactory(),
diagram.isHideEmptyDescriptionForState(), DotMode.NORMAL, diagram.getNamespaceSeparator(),
diagram.getPragma());
final GeneralImageBuilder svek2 = new GeneralImageBuilder(dotData, diagram.getEntityFactory(),
diagram.getSource(), diagram.getPragma(), stringBounder, SName.stateDiagram);
if (group.getGroupType() == GroupType.CONCURRENT_STATE) if (group.getGroupType() == GroupType.CONCURRENT_STATE)
return svek2.buildImage(null, new String[0]); return createGeneralImageBuilder(group.leafs(), skinParam).buildImage(null, new String[0]);
if (group.getGroupType() != GroupType.STATE) if (group.getGroupType() != GroupType.STATE)
throw new UnsupportedOperationException(group.getGroupType().toString()); throw new UnsupportedOperationException(group.getGroupType().toString());
@ -145,7 +142,6 @@ public final class GroupPngMakerState {
if (borderColor == null) if (borderColor == null)
borderColor = style.value(PName.LineColor).asColor(skinParam.getIHtmlColorSet()); borderColor = style.value(PName.LineColor).asColor(skinParam.getIHtmlColorSet());
final Stereotype stereo = group.getStereotype();
HColor backColor = group.getColors().getColor(ColorType.BACK); HColor backColor = group.getColors().getColor(ColorType.BACK);
if (backColor == null) if (backColor == null)
backColor = style.value(PName.BackGroundColor).asColor(skinParam.getIHtmlColorSet()); backColor = style.value(PName.BackGroundColor).asColor(skinParam.getIHtmlColorSet());
@ -154,41 +150,49 @@ public final class GroupPngMakerState {
if (stroke == null) if (stroke == null)
stroke = style.getStroke(); stroke = style.getStroke();
final TextBlock attribute = ((Entity) group).getStateHeader(skinParam); final IEntityImage image;
if (containsSomeConcurrentStates()) {
final Stereotype stereotype = group.getStereotype(); final List<IEntityImage> inners = new ArrayList<>();
final boolean withSymbol = stereotype != null && stereotype.isWithOOSymbol(); inners.add(createGeneralImageBuilder(filter(group.leafs()), skinParam).buildImage(null, new String[0]));
for (Entity inner : group.leafs())
final boolean containsOnlyConcurrentStates = containsOnlyConcurrentStates(dotData); if (inner.getLeafType() == LeafType.STATE_CONCURRENT)
final IEntityImage image = containsOnlyConcurrentStates ? buildImageForConcurrentState(dotData) inners.add(inner.getSvekImage());
: svek2.buildImage(null, new String[0]); image = new ConcurrentStates(inners, group.getConcurrentSeparator(), skinParam, group.getStereotype());
} else {
image = createGeneralImageBuilder(filter(group.leafs()), skinParam).buildImage(null, new String[0]);
}
final HColor bodyColor = styleBody.value(PName.BackGroundColor).asColor(skinParam.getIHtmlColorSet()); final HColor bodyColor = styleBody.value(PName.BackGroundColor).asColor(skinParam.getIHtmlColorSet());
return new InnerStateAutonom(image, title, attribute, borderColor, backColor, group.getUrl99(), withSymbol, final boolean withSymbol = group.getStereotype() != null && group.getStereotype().isWithOOSymbol();
stroke, rounded, shadowing, bodyColor); return new InnerStateAutonom(image, title, group.getStateHeader(skinParam), borderColor, backColor,
group.getUrl99(), withSymbol, stroke, rounded, shadowing, bodyColor);
} }
private IEntityImage buildImageForConcurrentState(DotData dotData) { protected GeneralImageBuilder createGeneralImageBuilder(Collection<Entity> leafs, ISkinParam skinParam) {
final List<IEntityImage> inners = new ArrayList<>(); final DotData dotData = new DotData(group, getPureInnerLinks(), leafs, diagram.getUmlDiagramType(), skinParam,
for (Entity inner : dotData.getLeafs()) new InnerGroupHierarchy(), diagram.getEntityFactory(), diagram.isHideEmptyDescriptionForState(),
inners.add(inner.getSvekImage()); DotMode.NORMAL, diagram.getNamespaceSeparator(), diagram.getPragma());
return new CucaDiagramFileMakerSvek2InternalImage(inners, dotData.getTopParent().getConcurrentSeparator(),
dotData.getSkinParam(), group.getStereotype());
return new GeneralImageBuilder(dotData, diagram.getEntityFactory(), diagram.getSource(), diagram.getPragma(),
stringBounder, SName.stateDiagram);
} }
private boolean containsOnlyConcurrentStates(DotData dotData) { private Collection<Entity> filter(Collection<Entity> leafs) {
for (Entity leaf : dotData.getLeafs()) { final List<Entity> result = new ArrayList<>();
if (leaf instanceof Entity == false) for (Entity leaf : leafs)
return false; if (leaf.getLeafType() != LeafType.STATE_CONCURRENT)
result.add(leaf);
if (((Entity) leaf).getLeafType() != LeafType.STATE_CONCURRENT) return result;
return false; }
} private boolean containsSomeConcurrentStates() {
return true; for (Entity entity : group.leafs())
if (entity.getLeafType() == LeafType.STATE_CONCURRENT)
return true;
return false;
} }
} }

View File

@ -35,6 +35,8 @@
*/ */
package net.sourceforge.plantuml.svek; package net.sourceforge.plantuml.svek;
import java.util.Objects;
import net.sourceforge.plantuml.awt.geom.XDimension2D; import net.sourceforge.plantuml.awt.geom.XDimension2D;
import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.AbstractTextBlock;
import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlock;
@ -63,7 +65,7 @@ public final class InnerStateAutonom extends AbstractTextBlock implements IEntit
public InnerStateAutonom(IEntityImage im, TextBlock title, TextBlock attribute, HColor borderColor, public InnerStateAutonom(IEntityImage im, TextBlock title, TextBlock attribute, HColor borderColor,
HColor backColor, Url url, boolean withSymbol, UStroke stroke, double rounded, double shadowing, HColor backColor, Url url, boolean withSymbol, UStroke stroke, double rounded, double shadowing,
HColor bodyColor) { HColor bodyColor) {
this.im = im; this.im = Objects.requireNonNull(im);
this.withSymbol = withSymbol; this.withSymbol = withSymbol;
this.title = title; this.title = title;
this.borderColor = borderColor; this.borderColor = borderColor;
@ -83,7 +85,7 @@ public final class InnerStateAutonom extends AbstractTextBlock implements IEntit
final double marginForFields = attr.getHeight() > 0 ? IEntityImage.MARGIN : 0; final double marginForFields = attr.getHeight() > 0 ? IEntityImage.MARGIN : 0;
final double titreHeight = IEntityImage.MARGIN + text.getHeight() + IEntityImage.MARGIN_LINE; final double titreHeight = IEntityImage.MARGIN + text.getHeight() + IEntityImage.MARGIN_LINE;
// final HColor foo = im.getBackcolor();
final RoundedContainer r = new RoundedContainer(total, titreHeight, attr.getHeight() + marginForFields, final RoundedContainer r = new RoundedContainer(total, titreHeight, attr.getHeight() + marginForFields,
borderColor, backColor, bodyColor, stroke, rounded, shadowing); borderColor, backColor, bodyColor, stroke, rounded, shadowing);

View File

@ -85,7 +85,8 @@ public class EntityImageState extends EntityImageStateCommon {
} }
public XDimension2D calculateDimension(StringBounder stringBounder) { public XDimension2D calculateDimension(StringBounder stringBounder) {
final XDimension2D dim = title.calculateDimension(stringBounder).mergeTB(fields.calculateDimension(stringBounder)); final XDimension2D dim = title.calculateDimension(stringBounder)
.mergeTB(fields.calculateDimension(stringBounder));
double heightSymbol = 0; double heightSymbol = 0;
if (withSymbol) if (withSymbol)
heightSymbol += 2 * smallRadius + smallMarginY; heightSymbol += 2 * smallRadius + smallMarginY;
@ -95,7 +96,7 @@ public class EntityImageState extends EntityImageStateCommon {
} }
final public void drawU(UGraphic ug) { final public void drawU(UGraphic ug) {
ug.startGroup(Collections.singletonMap(UGroupType.ID, getEntity().getQuark().toString("."))); ug.startGroup(Collections.singletonMap(UGroupType.ID, getEntity().getQuark().toStringPoint()));
if (url != null) if (url != null)
ug.startUrl(url); ug.startUrl(url);

View File

@ -34,7 +34,6 @@
*/ */
package net.sourceforge.plantuml.version; package net.sourceforge.plantuml.version;
import java.io.IOException;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;

View File

@ -81,7 +81,7 @@ public class Version {
} }
public static int beta() { public static int beta() {
final int beta = 3; final int beta = 4;
return beta; return beta;
} }

View File

@ -139,7 +139,7 @@ abstract class XmiClassDiagramAbstract implements XmlDiagramTransformer {
cla.setAttribute("xmi.id", entity.getUid()); cla.setAttribute("xmi.id", entity.getUid());
cla.setAttribute("name", entity.getDisplay().get(0).toString()); cla.setAttribute("name", entity.getDisplay().get(0).toString());
final String parentCode = entity.getQuark().getParent().toString("."); final String parentCode = entity.getQuark().getParent().toStringPoint();
if (parentCode.length() == 0) if (parentCode.length() == 0)
cla.setAttribute("namespace", CucaDiagramXmiMaker.getModel(classDiagram)); cla.setAttribute("namespace", CucaDiagramXmiMaker.getModel(classDiagram));

View File

@ -58,7 +58,6 @@ import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.LeafType; import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.Link; import net.sourceforge.plantuml.cucadiagram.Link;
import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.plasma.Quark;
import net.sourceforge.plantuml.statediagram.StateDiagram; import net.sourceforge.plantuml.statediagram.StateDiagram;
import net.sourceforge.plantuml.text.Guillemet; import net.sourceforge.plantuml.text.Guillemet;
import net.sourceforge.plantuml.xml.XmlFactories; import net.sourceforge.plantuml.xml.XmlFactories;
@ -163,8 +162,7 @@ public class ScxmlStateDiagramStandard {
} }
private String getId(Entity entity) { private String getId(Entity entity) {
final Quark quark = entity.getQuark(); return entity.getName().replaceAll("\\*", "");
return quark.getName().replaceAll("\\*", "");
} }
public void transformerXml(OutputStream os) throws TransformerException, ParserConfigurationException { public void transformerXml(OutputStream os) throws TransformerException, ParserConfigurationException {