mirror of
https://github.com/octoleo/plantuml.git
synced 2024-12-22 10:59:01 +00:00
wip
This commit is contained in:
parent
62d819dae4
commit
58cc4e096b
@ -46,7 +46,6 @@ import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
import net.sourceforge.plantuml.api.ApiWarning;
|
||||
import net.sourceforge.plantuml.cucadiagram.dot.GraphvizUtils;
|
||||
import net.sourceforge.plantuml.klimt.color.ColorMapper;
|
||||
|
@ -38,7 +38,6 @@ package net.sourceforge.plantuml;
|
||||
import java.util.EnumMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
||||
import net.sourceforge.plantuml.klimt.color.HColor;
|
||||
|
||||
|
@ -41,7 +41,6 @@ import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
import net.sourceforge.plantuml.preproc.Defines;
|
||||
import net.sourceforge.plantuml.security.SFile;
|
||||
import net.sourceforge.plantuml.utils.Log;
|
||||
|
@ -47,7 +47,6 @@ import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
import net.sourceforge.plantuml.core.Diagram;
|
||||
import net.sourceforge.plantuml.core.DiagramDescription;
|
||||
import net.sourceforge.plantuml.core.ImageData;
|
||||
|
@ -68,7 +68,7 @@ public class ActivityDiagram extends CucaDiagram {
|
||||
|
||||
public void startIf(String 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);
|
||||
currentContext = new ConditionalContext(currentContext, br, Direction.DOWN);
|
||||
}
|
||||
@ -78,20 +78,20 @@ public class ActivityDiagram extends CucaDiagram {
|
||||
}
|
||||
|
||||
public Entity getStart() {
|
||||
final Quark quark = quarkInContext("start", false);
|
||||
final Quark<Entity> quark = quarkInContext("start", false);
|
||||
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) {
|
||||
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)
|
||||
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
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -141,7 +141,7 @@ public class ActivityDiagram extends CucaDiagram {
|
||||
|
||||
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);
|
||||
final Entity g = getCurrentGroup();
|
||||
|
||||
@ -160,7 +160,7 @@ public class ActivityDiagram extends CucaDiagram {
|
||||
if (getCurrentGroup().getGroupType() != GroupType.INNER_ACTIVITY)
|
||||
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);
|
||||
lastEntityConsulted = null;
|
||||
lastEntityBrancheConsulted = null;
|
||||
|
@ -36,7 +36,6 @@
|
||||
package net.sourceforge.plantuml.activitydiagram.command;
|
||||
|
||||
import net.sourceforge.plantuml.activitydiagram.ActivityDiagram;
|
||||
import net.sourceforge.plantuml.baraye.EntityUtils;
|
||||
import net.sourceforge.plantuml.command.CommandExecutionResult;
|
||||
import net.sourceforge.plantuml.command.SingleLineCommand2;
|
||||
import net.sourceforge.plantuml.regex.IRegex;
|
||||
|
@ -209,13 +209,13 @@ public class CommandLinkActivity extends SingleLineCommand2<ActivityDiagram> {
|
||||
final String idShort = arg.get("CODE" + suf, 0);
|
||||
if (idShort != 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);
|
||||
}
|
||||
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);
|
||||
Entity result = (Entity) ident.getData();
|
||||
Entity result = ident.getData();
|
||||
if (result == 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);
|
||||
if (bar != null) {
|
||||
final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(bar), false);
|
||||
Entity result = (Entity) quark.getData();
|
||||
final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(bar), false);
|
||||
Entity result = quark.getData();
|
||||
if (result == null)
|
||||
result = diagram.reallyCreateLeaf(quark, Display.getWithNewlines(bar), LeafType.SYNCHRO_BAR, null);
|
||||
return result;
|
||||
@ -236,14 +236,14 @@ public class CommandLinkActivity extends SingleLineCommand2<ActivityDiagram> {
|
||||
if (quoted.get(0) != null) {
|
||||
final String quotedString = quoted.get(1) == null ? quoted.get(0) : quoted.get(1);
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
Entity result = (Entity) quark.getData();
|
||||
Entity result = quark.getData();
|
||||
if (result == null)
|
||||
result = diagram.reallyCreateLeaf(quark, Display.getWithNewlines(quoted.get(0)), type, null);
|
||||
if (partition != null)
|
||||
@ -254,11 +254,11 @@ public class CommandLinkActivity extends SingleLineCommand2<ActivityDiagram> {
|
||||
final String quoteInvisibleString = arg.get("QUOTED_INVISIBLE" + suf, 0);
|
||||
if (quoteInvisibleString != 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);
|
||||
}
|
||||
final Quark identInvisible = diagram.quarkInContext(diagram.cleanIdForQuark(quoteInvisibleString), false);
|
||||
Entity result = (Entity) identInvisible.getData();
|
||||
final Quark<Entity> identInvisible = diagram.quarkInContext(diagram.cleanId(quoteInvisibleString), false);
|
||||
Entity result = identInvisible.getData();
|
||||
if (result == null)
|
||||
result = diagram.reallyCreateLeaf(identInvisible, Display.getWithNewlines(identInvisible.getName()),
|
||||
LeafType.ACTIVITY, null);
|
||||
@ -274,7 +274,7 @@ public class CommandLinkActivity extends SingleLineCommand2<ActivityDiagram> {
|
||||
return null;
|
||||
}
|
||||
|
||||
private static LeafType getTypeIfExisting(ActivityDiagram system, Quark code) {
|
||||
private static LeafType getTypeIfExisting(ActivityDiagram system, Quark<Entity> code) {
|
||||
// if (code.getData() == null) {
|
||||
// final Quark quark = system.getPlasma().getIfExistsFromName(code.getName());
|
||||
// final IEntity ent = quark == null ? null : (ILeaf) quark.getData();
|
||||
|
@ -176,12 +176,12 @@ public class CommandLinkLongActivity extends CommandMultilines2<ActivityDiagram>
|
||||
partition = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(partition);
|
||||
}
|
||||
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);
|
||||
}
|
||||
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)
|
||||
entity2 = diagram.reallyCreateLeaf(ident, Display.getWithNewlines(display), LeafType.ACTIVITY, null);
|
||||
|
||||
|
@ -83,10 +83,7 @@ public class CommandPartition extends SingleLineCommand2<ActivityDiagram> {
|
||||
@Override
|
||||
protected CommandExecutionResult executeArg(ActivityDiagram diagram, LineLocation location, RegexResult arg)
|
||||
throws NoSuchColorException {
|
||||
final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(arg.get("NAME", 0)), false);
|
||||
// final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("NAME", 0));
|
||||
// final Quark ident = diagram.buildFromName(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(idShort));
|
||||
// final Quark code = diagram.buildFromFullPath(idShort);
|
||||
final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(arg.get("NAME", 0)), false);
|
||||
|
||||
diagram.gotoGroup(quark, Display.getWithNewlines(quark.getName()), GroupType.PACKAGE);
|
||||
final Entity p = diagram.getCurrentGroup();
|
||||
|
@ -36,7 +36,6 @@
|
||||
package net.sourceforge.plantuml.activitydiagram3;
|
||||
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.color.Colors;
|
||||
import net.sourceforge.plantuml.sequencediagram.NotePosition;
|
||||
|
@ -40,7 +40,6 @@ import static net.sourceforge.plantuml.utils.ObjectUtils.instanceOfAny;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
import net.sourceforge.plantuml.awt.geom.XLine2D;
|
||||
import net.sourceforge.plantuml.klimt.UBackground;
|
||||
import net.sourceforge.plantuml.klimt.UChange;
|
||||
|
@ -33,7 +33,6 @@ import java.util.concurrent.locks.Lock;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.util.prefs.Preferences;
|
||||
|
||||
|
||||
import net.sourceforge.plantuml.log.Logme;
|
||||
import net.sourceforge.plantuml.utils.Log;
|
||||
|
||||
|
@ -32,7 +32,6 @@ import java.util.StringTokenizer;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
import java.util.prefs.Preferences;
|
||||
|
||||
|
||||
import net.sourceforge.plantuml.log.Logme;
|
||||
import net.sourceforge.plantuml.utils.Log;
|
||||
|
||||
|
@ -32,7 +32,6 @@ import java.util.StringTokenizer;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
import java.util.prefs.Preferences;
|
||||
|
||||
|
||||
import net.sourceforge.plantuml.log.Logme;
|
||||
import net.sourceforge.plantuml.utils.Log;
|
||||
|
||||
|
41
src/net/sourceforge/plantuml/baraye/Bag.java
Normal file
41
src/net/sourceforge/plantuml/baraye/Bag.java
Normal 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 {
|
||||
|
||||
}
|
@ -59,7 +59,6 @@ import net.sourceforge.plantuml.core.UmlSource;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.cucadiagram.EntityGender;
|
||||
import net.sourceforge.plantuml.cucadiagram.EntityPortion;
|
||||
import net.sourceforge.plantuml.cucadiagram.EntityPosition;
|
||||
import net.sourceforge.plantuml.cucadiagram.GroupHierarchy;
|
||||
import net.sourceforge.plantuml.cucadiagram.GroupType;
|
||||
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.graphic.USymbol;
|
||||
import net.sourceforge.plantuml.graphml.CucaDiagramGraphmlMaker;
|
||||
import net.sourceforge.plantuml.plasma.Plasma;
|
||||
import net.sourceforge.plantuml.plasma.Quark;
|
||||
import net.sourceforge.plantuml.sdot.CucaDiagramFileMakerSmetana;
|
||||
import net.sourceforge.plantuml.security.SecurityUtils;
|
||||
@ -94,26 +92,20 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
|
||||
private String namespaceSeparator = null;
|
||||
private boolean namespaceSeparatorHasBeenSet = false;
|
||||
|
||||
public final boolean mergeIntricated() {
|
||||
return false;
|
||||
}
|
||||
|
||||
private final List<HideOrShow2> hides2 = new ArrayList<>();
|
||||
private final List<HideOrShow2> removed = new ArrayList<>();
|
||||
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 Together currentTogether;
|
||||
|
||||
public CucaDiagram(UmlSource source, UmlDiagramType type, Map<String, String> 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("::");
|
||||
if (x == -1)
|
||||
return null;
|
||||
@ -122,11 +114,26 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
|
||||
return null;
|
||||
}
|
||||
|
||||
public Quark currentQuark() {
|
||||
return this.stacks.get(stacks.size() - 1);
|
||||
public final Entity getCurrentGroup() {
|
||||
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)
|
||||
return null;
|
||||
return StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(id);
|
||||
@ -135,7 +142,7 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
|
||||
final public void setNamespaceSeparator(String namespaceSeparator) {
|
||||
this.namespaceSeparatorHasBeenSet = true;
|
||||
this.namespaceSeparator = namespaceSeparator;
|
||||
getPlasma().setSeparator(namespaceSeparator);
|
||||
entityFactory.setSeparator(namespaceSeparator);
|
||||
}
|
||||
|
||||
final public String getNamespaceSeparator() {
|
||||
@ -147,8 +154,8 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
|
||||
|
||||
@Override
|
||||
public boolean hasUrl() {
|
||||
for (Quark quark : getPlasma().quarks()) {
|
||||
final Entity ent = (Entity) quark.getData();
|
||||
for (Quark<Entity> quark : entityFactory.quarks()) {
|
||||
final Entity ent = quark.getData();
|
||||
if (ent != null && ent.hasUrl())
|
||||
return true;
|
||||
}
|
||||
@ -163,7 +170,7 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
|
||||
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);
|
||||
if (ident.getData() != null)
|
||||
throw new IllegalStateException();
|
||||
@ -172,33 +179,38 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
|
||||
|
||||
final Entity result = entityFactory.createLeaf(ident, type, getHides());
|
||||
result.setUSymbol(symbol);
|
||||
ident.setData(result);
|
||||
this.lastEntity = result;
|
||||
result.setTogether(currentTogether);
|
||||
|
||||
result.setTogether(currentTogether());
|
||||
|
||||
updateLasts(result);
|
||||
// if (type == LeafType.OBJECT)
|
||||
// ((EntityImp) parent.getData()).muteToType2(type);
|
||||
result.setDisplay(display);
|
||||
|
||||
if (type.isLikeClass())
|
||||
eventuallyBuildPhantomGroups();
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
final public Quark quarkInContext(String full, boolean specialForCreateClass) {
|
||||
final public Quark<Entity> quarkInContext(String full, boolean specialForCreateClass) {
|
||||
final String sep = getNamespaceSeparator();
|
||||
if (sep == null) {
|
||||
final Quark result = getPlasma().firstWithName(full);
|
||||
final Quark<Entity> result = entityFactory.firstWithName(full);
|
||||
if (result != null)
|
||||
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))
|
||||
return getPlasma().root().child(full.substring(sep.length()));
|
||||
return entityFactory.root().child(full.substring(sep.length()));
|
||||
final int x = full.indexOf(sep);
|
||||
if (x == -1) {
|
||||
if (specialForCreateClass == false && getPlasma().countByName(full) == 1) {
|
||||
final Quark byName = getPlasma().firstWithName(full);
|
||||
if (specialForCreateClass == false && entityFactory.countByName(full) == 1) {
|
||||
final Quark<Entity> byName = entityFactory.firstWithName(full);
|
||||
assert byName != null;
|
||||
if (byName != currentQuark)
|
||||
return byName;
|
||||
@ -207,10 +219,10 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
|
||||
}
|
||||
|
||||
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)
|
||||
return getPlasma().root().child(full);
|
||||
return entityFactory.root().child(full);
|
||||
return currentQuark.child(full);
|
||||
|
||||
}
|
||||
@ -235,17 +247,17 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
|
||||
return id.substring(x + 2);
|
||||
}
|
||||
|
||||
// protected Plasma getPlasma() {
|
||||
public /* protected */ Plasma getPlasma() {
|
||||
return entityFactory.getPlasma();
|
||||
public Quark<Entity> firstWithName(String name) {
|
||||
return entityFactory.firstWithName(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
final public Collection<Entity> getChildrenGroups(Entity entity) {
|
||||
return entity.groups();
|
||||
}
|
||||
|
||||
private void eventuallyBuildPhantomGroups() {
|
||||
for (Quark quark : getPlasma().quarks()) {
|
||||
for (Quark<Entity> quark : entityFactory.quarks()) {
|
||||
if (quark.getData() != null)
|
||||
continue;
|
||||
int countChildren = quark.countChildren();
|
||||
@ -254,80 +266,63 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
|
||||
final Display display = Display.getWithNewlines(quark.getName());
|
||||
final Entity result = entityFactory.createGroup(quark, GroupType.PACKAGE, getHides());
|
||||
result.setDisplay(display);
|
||||
quark.setData(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final public CommandExecutionResult gotoTogether() {
|
||||
if (currentTogether != null)
|
||||
return CommandExecutionResult.error("Cannot nest together");
|
||||
|
||||
this.currentTogether = new Together();
|
||||
this.stacks.add(new Together(currentTogether()));
|
||||
return CommandExecutionResult.ok();
|
||||
}
|
||||
|
||||
final public CommandExecutionResult gotoGroup(Quark quark, Display display, GroupType type) {
|
||||
if (currentTogether != null)
|
||||
return CommandExecutionResult.error("Cannot be done inside 'together'");
|
||||
|
||||
final public CommandExecutionResult gotoGroup(Quark<Entity> quark, Display display, GroupType type) {
|
||||
if (quark.getData() == null) {
|
||||
final Entity result = entityFactory.createGroup(quark, type, getHides());
|
||||
result.setTogether(currentTogether());
|
||||
result.setDisplay(display);
|
||||
quark.setData(result);
|
||||
}
|
||||
final Entity ent = (Entity) quark.getData();
|
||||
final Entity ent = quark.getData();
|
||||
ent.muteToGroupType(type);
|
||||
|
||||
this.stacks.add(quark);
|
||||
this.stacks.add(quark.getData());
|
||||
|
||||
return CommandExecutionResult.ok();
|
||||
|
||||
}
|
||||
|
||||
public boolean endGroup() {
|
||||
|
||||
if (this.currentTogether != null) {
|
||||
this.currentTogether = null;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (stacks.size() > 0) {
|
||||
stacks.remove(stacks.size() - 1);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
public final Entity getCurrentGroup() {
|
||||
return (Entity) currentQuark().getData();
|
||||
}
|
||||
|
||||
public final Entity getGroup(String code) {
|
||||
final Quark quark = getPlasma().firstWithName(code);
|
||||
final Quark<Entity> quark = entityFactory.firstWithName(code);
|
||||
if (quark == null)
|
||||
return null;
|
||||
return (Entity) quark.getData();
|
||||
return quark.getData();
|
||||
}
|
||||
|
||||
public final boolean isGroup(String code) {
|
||||
final Quark quark = getPlasma().firstWithName(code);
|
||||
final Quark<Entity> quark = entityFactory.firstWithName(code);
|
||||
if (quark == null)
|
||||
return false;
|
||||
return isGroup(quark);
|
||||
}
|
||||
|
||||
public final boolean isGroup(Quark quark) {
|
||||
final Entity ent = (Entity) quark.getData();
|
||||
public final boolean isGroup(Quark<Entity> quark) {
|
||||
final Entity ent = quark.getData();
|
||||
if (ent == null)
|
||||
return false;
|
||||
return ent.isGroup();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Entity getRootGroup() {
|
||||
return (Entity) getPlasma().root().getData();
|
||||
return entityFactory.root().getData();
|
||||
}
|
||||
|
||||
final public void addLink(Link link) {
|
||||
@ -462,33 +457,6 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
|
||||
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) {
|
||||
return s.matches("[+-]?(\\.?\\d+|\\d+\\.\\d*)");
|
||||
}
|
||||
@ -532,6 +500,7 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
|
||||
return "25";
|
||||
}
|
||||
|
||||
@Override
|
||||
final public boolean isEmpty(Entity entity) {
|
||||
return entity.isEmpty();
|
||||
}
|
||||
|
@ -94,11 +94,11 @@ import net.sourceforge.plantuml.url.Url;
|
||||
import net.sourceforge.plantuml.utils.Direction;
|
||||
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 Quark quark;
|
||||
private final Quark<Entity> quark;
|
||||
|
||||
private Url url;
|
||||
|
||||
@ -157,7 +157,7 @@ final public class Entity implements SpecificBackcolorable, Hideable, Removeable
|
||||
}
|
||||
|
||||
// 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);
|
||||
if (quark.isRoot())
|
||||
this.uid = "clroot";
|
||||
@ -166,14 +166,15 @@ final public class Entity implements SpecificBackcolorable, Hideable, Removeable
|
||||
this.entityFactory = entityFactory;
|
||||
this.bodier = bodier;
|
||||
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.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.groupType = groupType;
|
||||
}
|
||||
@ -220,7 +221,7 @@ final public class Entity implements SpecificBackcolorable, Hideable, Removeable
|
||||
return true;
|
||||
}
|
||||
|
||||
public Quark getQuark() {
|
||||
public Quark<Entity> getQuark() {
|
||||
return quark;
|
||||
}
|
||||
|
||||
@ -652,24 +653,24 @@ final public class Entity implements SpecificBackcolorable, Hideable, Removeable
|
||||
|
||||
}
|
||||
|
||||
public Together getTogether() {
|
||||
return together;
|
||||
}
|
||||
|
||||
public void setTogether(Together together) {
|
||||
this.together = together;
|
||||
}
|
||||
|
||||
public Together getTogether() {
|
||||
return this.together;
|
||||
}
|
||||
|
||||
public Entity getParentContainer() {
|
||||
if (quark.isRoot())
|
||||
return null;
|
||||
return (Entity) quark.getParent().getData();
|
||||
return quark.getParent().getData();
|
||||
}
|
||||
|
||||
public Collection<Entity> leafs() {
|
||||
final List<Entity> result = new ArrayList<>();
|
||||
for (Quark quark : quark.getChildren()) {
|
||||
final Entity data = (Entity) quark.getData();
|
||||
for (Quark<Entity> child : quark.getChildren()) {
|
||||
final Entity data = child.getData();
|
||||
if (data != null && data.isGroup() == false)
|
||||
result.add(data);
|
||||
}
|
||||
@ -678,8 +679,8 @@ final public class Entity implements SpecificBackcolorable, Hideable, Removeable
|
||||
|
||||
public Collection<Entity> groups() {
|
||||
final List<Entity> result = new ArrayList<>();
|
||||
for (Quark quark : quark.getChildren()) {
|
||||
final Entity data = (Entity) quark.getData();
|
||||
for (Quark<Entity> child : quark.getChildren()) {
|
||||
final Entity data = child.getData();
|
||||
if (data != null && data.isGroup())
|
||||
result.add(data);
|
||||
}
|
||||
@ -702,4 +703,31 @@ final public class Entity implements SpecificBackcolorable, Hideable, Removeable
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -46,7 +46,6 @@ import net.sourceforge.plantuml.cucadiagram.Bodier;
|
||||
import net.sourceforge.plantuml.cucadiagram.BodierJSon;
|
||||
import net.sourceforge.plantuml.cucadiagram.BodierMap;
|
||||
import net.sourceforge.plantuml.cucadiagram.BodyFactory;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.cucadiagram.GroupType;
|
||||
import net.sourceforge.plantuml.cucadiagram.HideOrShow2;
|
||||
import net.sourceforge.plantuml.cucadiagram.ICucaDiagram;
|
||||
@ -64,22 +63,24 @@ public final class EntityFactory implements IEntityFactory {
|
||||
|
||||
private int rawLayout;
|
||||
|
||||
private final Plasma plasma;
|
||||
private final Plasma<Entity> namespace;
|
||||
private final Quark<Entity> root;
|
||||
|
||||
private final Entity rootGroup;
|
||||
|
||||
private final List<HideOrShow2> hides2;
|
||||
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.removed = removed;
|
||||
this.namespaceSeparator = namespaceSeparator;
|
||||
this.plasma = new Plasma(".");
|
||||
this.rootGroup = new Entity(this.plasma.root(), this, null, GroupType.ROOT, 0);
|
||||
this.plasma.root().setData(rootGroup);
|
||||
this.diagram = diagram;
|
||||
this.namespace = new Plasma<Entity>(".");
|
||||
// this.printspace = new Plasma<Entity>(".");
|
||||
this.root = namespace.root();
|
||||
this.rootGroup = new Entity(this.root, this, null, GroupType.ROOT, 0);
|
||||
}
|
||||
|
||||
public boolean isHidden(Entity leaf) {
|
||||
@ -144,7 +145,7 @@ public final class EntityFactory implements IEntityFactory {
|
||||
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;
|
||||
if (Objects.requireNonNull(entityType) == LeafType.MAP)
|
||||
bodier = new BodierMap();
|
||||
@ -158,10 +159,10 @@ public final class EntityFactory implements IEntityFactory {
|
||||
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);
|
||||
if (quark.getData() != null)
|
||||
return (Entity) quark.getData();
|
||||
return quark.getData();
|
||||
|
||||
final Bodier bodier = BodyFactory.createGroup(hides);
|
||||
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() {
|
||||
|
||||
final List<Entity> result = new ArrayList<>();
|
||||
for (Quark quark : getPlasma().quarks()) {
|
||||
for (Quark<Entity> quark : quarks()) {
|
||||
if (quark.isRoot())
|
||||
continue;
|
||||
final Entity data = (Entity) quark.getData();
|
||||
final Entity data = quark.getData();
|
||||
if (data != null && data.isGroup() == false)
|
||||
result.add(data);
|
||||
}
|
||||
@ -189,11 +190,11 @@ public final class EntityFactory implements IEntityFactory {
|
||||
|
||||
public final Collection<Entity> groups() {
|
||||
final List<Entity> result = new ArrayList<>();
|
||||
for (Quark quark : getPlasma().quarks()) {
|
||||
for (Quark<Entity> quark : quarks()) {
|
||||
if (quark.isRoot())
|
||||
continue;
|
||||
|
||||
final Entity data = (Entity) quark.getData();
|
||||
final Entity data = quark.getData();
|
||||
if (data != null && data.isGroup())
|
||||
result.add(data);
|
||||
}
|
||||
@ -202,8 +203,8 @@ public final class EntityFactory implements IEntityFactory {
|
||||
|
||||
public final Collection<Entity> groupsAndRoot() {
|
||||
final List<Entity> result = new ArrayList<>();
|
||||
for (Quark quark : getPlasma().quarks()) {
|
||||
final Entity data = (Entity) quark.getData();
|
||||
for (Quark<Entity> quark : quarks()) {
|
||||
final Entity data = quark.getData();
|
||||
if (data != null && data.isGroup())
|
||||
result.add(data);
|
||||
}
|
||||
@ -241,10 +242,35 @@ public final class EntityFactory implements IEntityFactory {
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -42,11 +42,13 @@ import java.util.Map;
|
||||
import net.sourceforge.plantuml.FileFormatOption;
|
||||
import net.sourceforge.plantuml.UmlDiagramType;
|
||||
import net.sourceforge.plantuml.baraye.Entity;
|
||||
import net.sourceforge.plantuml.command.CommandExecutionResult;
|
||||
import net.sourceforge.plantuml.core.ImageData;
|
||||
import net.sourceforge.plantuml.core.UmlSource;
|
||||
import net.sourceforge.plantuml.cucadiagram.Link;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.objectdiagram.AbstractClassOrObjectDiagram;
|
||||
import net.sourceforge.plantuml.plasma.Quark;
|
||||
import net.sourceforge.plantuml.svek.image.EntityImageClass;
|
||||
|
||||
public class ClassDiagram extends AbstractClassOrObjectDiagram {
|
||||
@ -55,50 +57,6 @@ public class ClassDiagram extends AbstractClassOrObjectDiagram {
|
||||
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;
|
||||
|
||||
public void setAllowMixing(boolean allowMixing) {
|
||||
@ -164,4 +122,14 @@ public class ClassDiagram extends AbstractClassOrObjectDiagram {
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -70,13 +70,10 @@ public class CommandAddMethod extends SingleLineCommand2<ClassDiagram> {
|
||||
protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg)
|
||||
throws NoSuchColorException {
|
||||
final String idShort = arg.get("NAME", 0);
|
||||
final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(idShort), false);
|
||||
Entity entity = (Entity) quark.getData();
|
||||
final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(idShort), false);
|
||||
Entity entity = quark.getData();
|
||||
if (entity == null)
|
||||
entity = diagram.reallyCreateLeaf(quark, Display.getWithNewlines(quark), LeafType.CLASS, null);
|
||||
// final Quark ident = diagram.buildFromName(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(idShort));
|
||||
// final Quark code = diagram.buildFromFullPath(idShort);
|
||||
// final IEntity entity = diagram.getOrCreateLeaf(ident, code, null, null);
|
||||
|
||||
final String field = arg.get("DATA", 0);
|
||||
if (field.length() > 0 && VisibilityModifier.isVisibilityCharacter(field))
|
||||
|
@ -132,16 +132,16 @@ public class CommandCreateClass extends SingleLineCommand2<ClassDiagram> {
|
||||
throws NoSuchColorException {
|
||||
final String typeString = StringUtils.goUpperCase(arg.get("TYPE", 0));
|
||||
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 genericOption = arg.getLazzy("DISPLAY", 1);
|
||||
final String generic = genericOption != null ? genericOption : arg.get("GENERIC", 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) {
|
||||
Display display = Display.getWithNewlines(displayString);
|
||||
@ -151,8 +151,12 @@ public class CommandCreateClass extends SingleLineCommand2<ClassDiagram> {
|
||||
} else {
|
||||
if (entity.muteToType(type, null) == false)
|
||||
return CommandExecutionResult.error("Bad name");
|
||||
|
||||
}
|
||||
|
||||
final CommandExecutionResult check1 = diagram.checkIfPackageHierarchyIfOk(entity);
|
||||
if (check1.isOk() == false)
|
||||
return check1;
|
||||
|
||||
diagram.setLastEntity(entity);
|
||||
if (stereo != null) {
|
||||
entity.setStereotype(Stereotype.build(stereo, diagram.getSkinParam().getCircledCharacterRadius(),
|
||||
|
@ -159,7 +159,7 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
|
||||
if (visibilityString != null)
|
||||
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 genericOption = line0.getLazzy("DISPLAY", 1);
|
||||
@ -167,9 +167,9 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
|
||||
|
||||
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);
|
||||
if (entity == null) {
|
||||
@ -182,6 +182,9 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
|
||||
if (Display.isNull(display) == false)
|
||||
entity.setDisplay(display);
|
||||
}
|
||||
final CommandExecutionResult check1 = diagram.checkIfPackageHierarchyIfOk(entity);
|
||||
if (check1.isOk() == false)
|
||||
return check1;
|
||||
|
||||
diagram.setLastEntity(entity);
|
||||
|
||||
@ -274,13 +277,9 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
|
||||
final String codes = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get(keyword, 1));
|
||||
for (String s : codes.split(",")) {
|
||||
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);
|
||||
Entity cl2 = (Entity) quark.getData();
|
||||
final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(idShort), true);
|
||||
Entity cl2 = quark.getData();
|
||||
if (cl2 == null)
|
||||
cl2 = diagram.reallyCreateLeaf(quark, Display.getWithNewlines(quark.getName()), type2, null);
|
||||
|
||||
@ -306,7 +305,7 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
|
||||
if (visibilityString != null)
|
||||
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 genericOption = line0.getLazzy("DISPLAY", 1);
|
||||
@ -314,13 +313,13 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
|
||||
|
||||
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);
|
||||
if (Display.isNull(display))
|
||||
display = Display.getWithNewlines(quark.getName()).withCreoleMode(CreoleMode.SIMPLE_LINE);
|
||||
|
||||
Entity entity = (Entity) quark.getData();
|
||||
Entity entity = quark.getData();
|
||||
|
||||
if (entity == null) {
|
||||
entity = diagram.reallyCreateLeaf(quark, display, type, null);
|
||||
|
@ -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.");
|
||||
|
||||
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 codeDisplay = getCharEncoding(displayRaw);
|
||||
final String symbol;
|
||||
@ -206,20 +206,13 @@ public class CommandCreateElementFull2 extends SingleLineCommand2<ClassDiagram>
|
||||
|
||||
final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(codeRaw);
|
||||
final Display display = Display.getWithNewlines(displayRaw == null ? idShort : displayRaw);
|
||||
final Quark quark = diagram.quarkInContext(idShort, false);
|
||||
Entity entity = (Entity) quark.getData();
|
||||
final Quark<Entity> quark = diagram.quarkInContext(idShort, false);
|
||||
Entity entity = quark.getData();
|
||||
if (entity == null)
|
||||
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 IEntity entity = diagram.getOrCreateLeaf(ident, code, type, usymbol);
|
||||
|
||||
entity.setDisplay(display);
|
||||
entity.setUSymbol(usymbol);
|
||||
if (stereotype != null)
|
||||
|
@ -35,6 +35,7 @@
|
||||
*/
|
||||
package net.sourceforge.plantuml.classdiagram.command;
|
||||
|
||||
import net.sourceforge.plantuml.baraye.Entity;
|
||||
import net.sourceforge.plantuml.classdiagram.ClassDiagram;
|
||||
import net.sourceforge.plantuml.command.CommandExecutionResult;
|
||||
import net.sourceforge.plantuml.command.SingleLineCommand2;
|
||||
@ -64,10 +65,8 @@ public class CommandDiamondAssociation extends SingleLineCommand2<ClassDiagram>
|
||||
@Override
|
||||
protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg) {
|
||||
final String idShort = arg.get("CODE", 0);
|
||||
final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(idShort), false);
|
||||
// final Quark ident = diagram.buildFromName(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(idShort));
|
||||
// final Quark code = diagram.buildFromFullPath(idShort);
|
||||
// final boolean leafExist = diagram.leafExist(code);
|
||||
final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(idShort), false);
|
||||
|
||||
if (quark.getData() != null)
|
||||
return CommandExecutionResult.error("Already existing : " + quark.getName());
|
||||
|
||||
|
@ -38,7 +38,6 @@ package net.sourceforge.plantuml.classdiagram.command;
|
||||
import net.sourceforge.plantuml.StringUtils;
|
||||
import net.sourceforge.plantuml.UmlDiagram;
|
||||
import net.sourceforge.plantuml.baraye.Entity;
|
||||
import net.sourceforge.plantuml.baraye.EntityUtils;
|
||||
import net.sourceforge.plantuml.command.CommandExecutionResult;
|
||||
import net.sourceforge.plantuml.command.SingleLineCommand2;
|
||||
import net.sourceforge.plantuml.cucadiagram.EntityGender;
|
||||
@ -145,12 +144,10 @@ public class CommandHideShowByGender extends SingleLineCommand2<UmlDiagram> {
|
||||
} else if (arg1.startsWith("<<")) {
|
||||
gender = EntityGenderUtils.byStereotype(arg1);
|
||||
} else {
|
||||
final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(arg1), false);
|
||||
final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(arg1), false);
|
||||
if (quark.getData() == null)
|
||||
return CommandExecutionResult.error("No such element " + quark.getName());
|
||||
// final IEntity entity = diagram.getOrCreateLeaf(quark,
|
||||
// diagram.buildFromFullPath(arg1), null, null);
|
||||
final Entity entity = (Entity) quark.getData();
|
||||
final Entity entity = quark.getData();
|
||||
gender = EntityGenderUtils.byEntityAlone(entity);
|
||||
}
|
||||
|
||||
@ -192,26 +189,20 @@ public class CommandHideShowByGender extends SingleLineCommand2<UmlDiagram> {
|
||||
gender = EntityGenderUtils.byStereotype(arg1);
|
||||
} else {
|
||||
arg1 = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg1);
|
||||
final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(arg1), false);
|
||||
Entity entity = (Entity) quark.getData();
|
||||
final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(arg1), false);
|
||||
Entity entity = quark.getData();
|
||||
if (entity == null)
|
||||
return CommandExecutionResult.error("No such element " + quark.getName());
|
||||
// entity = diagram.reallyCreateLeaf(quark,
|
||||
// Display.getWithNewlines(quark.getParent()), LeafType.CLASS, null);
|
||||
// final Quark ident = diagram.buildFromName(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg1));
|
||||
// final Quark code = diagram.buildFromFullPath(arg1);
|
||||
// final IEntity entity = diagram.getOrCreateLeaf(ident, code, null, null);
|
||||
gender = EntityGenderUtils.byEntityAlone(entity);
|
||||
}
|
||||
if (gender != null) {
|
||||
final boolean empty = arg.get("EMPTY", 0) != null;
|
||||
final boolean emptyMembers = empty && portion == EntityPortion.MEMBER;
|
||||
if (empty == true && emptyMembers == false) {
|
||||
if (empty == true && emptyMembers == false)
|
||||
gender = EntityGenderUtils.and(gender, emptyByGender(portion));
|
||||
}
|
||||
if (diagram.getCurrentGroup().isRoot() == false) {
|
||||
|
||||
if (diagram.getCurrentGroup().isRoot() == false)
|
||||
gender = EntityGenderUtils.and(gender, EntityGenderUtils.byPackage(diagram.getCurrentGroup()));
|
||||
}
|
||||
|
||||
if (emptyMembers) {
|
||||
diagram.hideOrShow(EntityGenderUtils.and(gender, emptyByGender(EntityPortion.FIELD)),
|
||||
@ -227,21 +218,21 @@ public class CommandHideShowByGender extends SingleLineCommand2<UmlDiagram> {
|
||||
|
||||
private EntityPortion getEntityPortion(String s) {
|
||||
final String sub = StringUtils.goLowerCase(s.substring(0, 3));
|
||||
if (sub.equals("met")) {
|
||||
if (sub.equals("met"))
|
||||
return EntityPortion.METHOD;
|
||||
}
|
||||
if (sub.equals("mem")) {
|
||||
|
||||
if (sub.equals("mem"))
|
||||
return EntityPortion.MEMBER;
|
||||
}
|
||||
if (sub.equals("att") || sub.equals("fie")) {
|
||||
|
||||
if (sub.equals("att") || sub.equals("fie"))
|
||||
return EntityPortion.FIELD;
|
||||
}
|
||||
if (sub.equals("cir")) {
|
||||
|
||||
if (sub.equals("cir"))
|
||||
return EntityPortion.CIRCLED_CHARACTER;
|
||||
}
|
||||
if (sub.equals("ste")) {
|
||||
|
||||
if (sub.equals("ste"))
|
||||
return EntityPortion.STEREOTYPE;
|
||||
}
|
||||
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
|
@ -157,8 +157,8 @@ final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrOb
|
||||
protected CommandExecutionResult executeArg(AbstractClassOrObjectDiagram diagram, LineLocation location,
|
||||
RegexResult arg) throws NoSuchColorException {
|
||||
|
||||
String ent1String = diagram.cleanIdForQuark(arg.get("ENT1", 0));
|
||||
String ent2String = diagram.cleanIdForQuark(arg.get("ENT2", 0));
|
||||
String ent1String = diagram.cleanId(arg.get("ENT1", 0));
|
||||
String ent2String = diagram.cleanId(arg.get("ENT2", 0));
|
||||
if (ent1String == null && ent2String == null)
|
||||
return executeArgSpecial3(diagram, arg);
|
||||
|
||||
@ -175,23 +175,23 @@ final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrOb
|
||||
String port1 = null;
|
||||
String port2 = null;
|
||||
final LinkType linkType = getLinkType(arg);
|
||||
if (ent1String.contains("::") && diagram.getPlasma().firstWithName(ent1String) == null) {
|
||||
if (ent1String.contains("::") && diagram.firstWithName(ent1String) == null) {
|
||||
port1 = diagram.getPortId(ent1String);
|
||||
ent1String = diagram.removePortId(ent1String);
|
||||
}
|
||||
|
||||
if (ent2String.contains("::") && diagram.getPlasma().firstWithName(ent2String) == null) {
|
||||
if (ent2String.contains("::") && diagram.firstWithName(ent2String) == null) {
|
||||
port2 = diagram.getPortId(ent2String);
|
||||
ent2String = diagram.removePortId(ent2String);
|
||||
}
|
||||
|
||||
final Quark quark1 = diagram.quarkInContext(ent1String, false);
|
||||
final Quark quark2 = diagram.quarkInContext(ent2String, false);
|
||||
final Quark<Entity> quark1 = diagram.quarkInContext(ent1String, false);
|
||||
final Quark<Entity> quark2 = diagram.quarkInContext(ent2String, false);
|
||||
|
||||
Entity cl1 = (Entity) quark1.getData();
|
||||
Entity cl1 = quark1.getData();
|
||||
if (cl1 == null)
|
||||
cl1 = diagram.reallyCreateLeaf(quark1, Display.getWithNewlines(quark1.getName()), LeafType.CLASS, null);
|
||||
Entity cl2 = (Entity) quark2.getData();
|
||||
Entity cl2 = quark2.getData();
|
||||
if (cl2 == 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);
|
||||
// }
|
||||
|
||||
|
||||
private void addLink(AbstractClassOrObjectDiagram diagram, Link link, String weight) {
|
||||
diagram.addLink(link);
|
||||
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 name1B = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("COUPLE1", 1));
|
||||
|
||||
Quark quark1A = diagram.quarkInContext(name1A, false);
|
||||
Quark quark1B = diagram.quarkInContext(name1B, false);
|
||||
Quark<Entity> quark1A = diagram.quarkInContext(name1A, false);
|
||||
Quark<Entity> quark1B = diagram.quarkInContext(name1B, false);
|
||||
|
||||
if (quark1A.getData() != null == false)
|
||||
return CommandExecutionResult.error("No class " + name1A);
|
||||
@ -309,13 +308,13 @@ final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrOb
|
||||
if (quark1B.getData() != null == false)
|
||||
return CommandExecutionResult.error("No class " + name1B);
|
||||
|
||||
Entity cl1A = (Entity) quark1A.getData();
|
||||
Entity cl1B = (Entity) quark1B.getData();
|
||||
Entity cl1A = quark1A.getData();
|
||||
Entity cl1B = quark1B.getData();
|
||||
|
||||
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)
|
||||
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 name2B = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("COUPLE2", 1));
|
||||
|
||||
final Quark quark2A = diagram.quarkInContext(name2A, false);
|
||||
final Quark quark2B = diagram.quarkInContext(name2B, false);
|
||||
final Quark<Entity> quark2A = diagram.quarkInContext(name2A, false);
|
||||
final Quark<Entity> quark2B = diagram.quarkInContext(name2B, false);
|
||||
|
||||
if (quark2A.getData() != null == false)
|
||||
return CommandExecutionResult.error("No class " + name2A);
|
||||
@ -342,11 +341,11 @@ final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrOb
|
||||
if (quark2B.getData() != null == false)
|
||||
return CommandExecutionResult.error("No class " + name2B);
|
||||
|
||||
final Entity cl2A = (Entity) quark2A.getData();
|
||||
final Entity cl2B = (Entity) quark2B.getData();
|
||||
final Entity cl2A = quark2A.getData();
|
||||
final Entity cl2B = quark2B.getData();
|
||||
|
||||
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();
|
||||
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 name2B = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("COUPLE2", 1));
|
||||
|
||||
final Quark quark1A = diagram.quarkInContext(name1A, false);
|
||||
final Quark quark1B = diagram.quarkInContext(name1B, false);
|
||||
final Quark quark2A = diagram.quarkInContext(name2A, false);
|
||||
final Quark quark2B = diagram.quarkInContext(name2B, false);
|
||||
final Quark<Entity> quark1A = diagram.quarkInContext(name1A, false);
|
||||
final Quark<Entity> quark1B = diagram.quarkInContext(name1B, false);
|
||||
final Quark<Entity> quark2A = diagram.quarkInContext(name2A, false);
|
||||
final Quark<Entity> quark2B = diagram.quarkInContext(name2B, false);
|
||||
|
||||
if (quark1A.getData() != null == false)
|
||||
return CommandExecutionResult.error("No class " + name1A);
|
||||
|
@ -125,12 +125,12 @@ final public class CommandLinkLollipop extends SingleLineCommand2<AbstractClassO
|
||||
final String suffix = "lol" + diagram.getUniqueSequence();
|
||||
if (arg.get("LOL_THEN_ENT", 1) == null) {
|
||||
|
||||
final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(ent1), false);
|
||||
cl1 = (Entity) quark.getData();
|
||||
final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(ent1), false);
|
||||
cl1 = quark.getData();
|
||||
if (cl1 == null)
|
||||
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));
|
||||
cl2 = diagram.reallyCreateLeaf(idNewLong, Display.getWithNewlines(ent2), type, null);
|
||||
normalEntity = cl1;
|
||||
@ -144,12 +144,12 @@ final public class CommandLinkLollipop extends SingleLineCommand2<AbstractClassO
|
||||
// getType(arg.get("ENT_THEN_LOL", 1)), null);
|
||||
// normalEntity = cl1;
|
||||
} else {
|
||||
final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(ent2), false);
|
||||
cl2 = (Entity) quark.getData();
|
||||
final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(ent2), false);
|
||||
cl2 = quark.getData();
|
||||
if (cl2 == null)
|
||||
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));
|
||||
cl1 = diagram.reallyCreateLeaf(idNewLong, Display.getWithNewlines(ent1), type, null);
|
||||
normalEntity = cl2;
|
||||
|
@ -69,11 +69,8 @@ public class CommandStereotype extends SingleLineCommand2<ClassDiagram> {
|
||||
final String name = arg.get("NAME", 0);
|
||||
final String stereotype = arg.get("STEREO", 0);
|
||||
|
||||
// final Quark ident = diagram.buildFromName(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(name));
|
||||
// final Quark code = diagram.buildFromFullPath(name);
|
||||
// final IEntity entity = diagram.getOrCreateLeaf(ident, code, null, null);
|
||||
final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(name), false);
|
||||
final Entity entity = (Entity) quark.getData();
|
||||
final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(name), false);
|
||||
final Entity entity = quark.getData();
|
||||
if (entity == null)
|
||||
return CommandExecutionResult.error("No such class " + quark.getName());
|
||||
|
||||
|
@ -74,24 +74,14 @@ public class CommandUrl extends SingleLineCommand2<AbstractEntityDiagram> {
|
||||
@Override
|
||||
protected CommandExecutionResult executeArg(AbstractEntityDiagram diagram, LineLocation location, RegexResult arg) {
|
||||
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 Entity entity = (Entity) quark.getData();
|
||||
final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(idShort), false);
|
||||
final Entity entity = quark.getData();
|
||||
if (entity == null)
|
||||
return CommandExecutionResult.error(quark.getName() + " does not exist");
|
||||
|
||||
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 Url url = urlBuilder.getUrl(urlString);
|
||||
entity.addUrl(url);
|
||||
|
@ -82,7 +82,7 @@ public class CommandNamespace extends SingleLineCommand2<ClassDiagram> {
|
||||
protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg)
|
||||
throws NoSuchColorException {
|
||||
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()),
|
||||
GroupType.PACKAGE);
|
||||
if (status.isOk() == false)
|
||||
|
@ -86,8 +86,7 @@ public class CommandNamespace2 extends SingleLineCommand2<ClassDiagram> {
|
||||
protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg)
|
||||
throws NoSuchColorException {
|
||||
final String idShort = arg.get("NAME", 0);
|
||||
// final Quark ident = diagram.buildFromName(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(idShort));
|
||||
final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(idShort), true);
|
||||
final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(idShort), true);
|
||||
|
||||
final String disp = arg.getLazzy("DISPLAY", 0);
|
||||
final Display display = Display.getWithNewlines(disp);
|
||||
|
@ -82,14 +82,10 @@ public class CommandNamespaceEmpty extends SingleLineCommand2<ClassDiagram> {
|
||||
throws NoSuchColorException {
|
||||
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)
|
||||
return CommandExecutionResult.error("Already exists " + quark.getName());
|
||||
|
||||
// final Quark idNewLong = diagram
|
||||
// .buildFromName(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(idShort));
|
||||
// final Quark code = diagram.buildFromFullPath(idShort);
|
||||
|
||||
final Display display = Display.getWithNewlines(quark.getQualifiedName());
|
||||
final CommandExecutionResult status = diagram.gotoGroup(quark, display, GroupType.PACKAGE);
|
||||
if (status.isOk() == false)
|
||||
|
@ -121,12 +121,12 @@ public class CommandPackage extends SingleLineCommand2<AbstractEntityDiagram> {
|
||||
idShort = arg.get("AS", 0);
|
||||
}
|
||||
|
||||
final Quark quark;
|
||||
final Quark<Entity> quark;
|
||||
if (arg.get("AS", 0) == null) {
|
||||
quark = diagram.quarkInContext(diagram.cleanIdForQuark(name), true);
|
||||
quark = diagram.quarkInContext(diagram.cleanId(name), true);
|
||||
display = quark.getName();
|
||||
} else {
|
||||
quark = diagram.quarkInContext(diagram.cleanIdForQuark(arg.get("AS", 0)), true);
|
||||
quark = diagram.quarkInContext(diagram.cleanId(arg.get("AS", 0)), true);
|
||||
display = name;
|
||||
}
|
||||
|
||||
|
@ -94,7 +94,7 @@ public class CommandPackageEmpty extends SingleLineCommand2<AbstractEntityDiagra
|
||||
display = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("DISPLAY", 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),
|
||||
GroupType.PACKAGE);
|
||||
if (status.isOk() == false)
|
||||
|
@ -40,7 +40,6 @@ import java.util.Map;
|
||||
import net.sourceforge.plantuml.AbstractPSystem;
|
||||
import net.sourceforge.plantuml.ErrorUml;
|
||||
import net.sourceforge.plantuml.ErrorUmlType;
|
||||
|
||||
import net.sourceforge.plantuml.core.Diagram;
|
||||
import net.sourceforge.plantuml.core.DiagramType;
|
||||
import net.sourceforge.plantuml.core.UmlSource;
|
||||
|
@ -43,7 +43,6 @@ import net.sourceforge.plantuml.AbstractPSystem;
|
||||
import net.sourceforge.plantuml.EmbeddedDiagram;
|
||||
import net.sourceforge.plantuml.ErrorUml;
|
||||
import net.sourceforge.plantuml.ErrorUmlType;
|
||||
|
||||
import net.sourceforge.plantuml.core.Diagram;
|
||||
import net.sourceforge.plantuml.core.DiagramType;
|
||||
import net.sourceforge.plantuml.core.UmlSource;
|
||||
|
@ -135,19 +135,13 @@ public final class CommandFactoryNote implements SingleMultiFactoryCommand<Abstr
|
||||
private CommandExecutionResult executeInternal(AbstractEntityDiagram diagram, RegexResult arg, BlocLines display)
|
||||
throws NoSuchColorException {
|
||||
final String idShort = arg.get("CODE", 0);
|
||||
final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(idShort), false);
|
||||
// final Quark ident = diagram.buildFromName(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(idShort));
|
||||
// final Quark code = diagram.buildFromFullPath(idShort);
|
||||
// final boolean leafExist = diagram.leafExist(code);
|
||||
final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(idShort), false);
|
||||
|
||||
if (quark.getData() != null)
|
||||
return CommandExecutionResult.error("Note already created: " + quark.getName());
|
||||
|
||||
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;
|
||||
final String s = arg.get("COLOR", 0);
|
||||
entity.setSpecificColorTOBEREMOVED(ColorType.BACK,
|
||||
|
@ -114,15 +114,11 @@ public final class CommandFactoryNoteActivity implements SingleMultiFactoryComma
|
||||
UrlMode.STRICT);
|
||||
url = urlBuilder.getUrl(strings.get(0).toString());
|
||||
}
|
||||
if (url != null) {
|
||||
if (url != null)
|
||||
strings = strings.subList(1, strings.size());
|
||||
}
|
||||
|
||||
// final String s = StringUtils.getMergedLines(strings);
|
||||
|
||||
final String codeString = diagram.getUniqueSequence("GMN");
|
||||
final Quark quark = diagram.quarkInContext(codeString, false);
|
||||
// final Quark code = diagram.buildCode(codeString);
|
||||
final Quark<Entity> quark = diagram.quarkInContext(codeString, false);
|
||||
final Entity note = diagram.reallyCreateLeaf(quark, strings, LeafType.NOTE, null);
|
||||
if (url != null)
|
||||
note.addUrl(url);
|
||||
@ -139,10 +135,8 @@ public final class CommandFactoryNoteActivity implements SingleMultiFactoryComma
|
||||
protected CommandExecutionResult executeArg(final ActivityDiagram diagram, LineLocation location,
|
||||
RegexResult arg) throws NoSuchColorException {
|
||||
final String tmp = diagram.getUniqueSequence("GN");
|
||||
final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(tmp), false);
|
||||
// final Quark ident = diagram
|
||||
// .buildFromName(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(tmp));
|
||||
// final Quark code = diagram.buildCode(tmp);
|
||||
final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(tmp), false);
|
||||
|
||||
final Entity note = diagram.createNote(quark, tmp, Display.getWithNewlines(arg.get("NOTE", 0)));
|
||||
return executeInternal(diagram, arg, note);
|
||||
}
|
||||
|
@ -211,7 +211,7 @@ public final class CommandFactoryNoteOnEntity implements SingleMultiFactoryComma
|
||||
private CommandExecutionResult executeInternal(RegexResult line0, AbstractEntityDiagram diagram, Url url,
|
||||
BlocLines strings) throws NoSuchColorException {
|
||||
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;
|
||||
if (idShort == null) {
|
||||
cl1 = diagram.getLastEntity();
|
||||
@ -219,17 +219,10 @@ public final class CommandFactoryNoteOnEntity implements SingleMultiFactoryComma
|
||||
return CommandExecutionResult.error("Nothing to note to");
|
||||
|
||||
} else {
|
||||
final Quark quark = diagram.quarkInContext(idShort, false);
|
||||
cl1 = (Entity) quark.getData();
|
||||
final Quark<Entity> quark = diagram.quarkInContext(idShort, false);
|
||||
cl1 = quark.getData();
|
||||
if (cl1 == null)
|
||||
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))
|
||||
@ -250,7 +243,7 @@ public final class CommandFactoryNoteOnEntity implements SingleMultiFactoryComma
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
if (stereotypeString != null)
|
||||
|
@ -170,28 +170,19 @@ public final class CommandFactoryTipOnEntity implements SingleMultiFactoryComman
|
||||
|
||||
final String idShort = line0.get("ENTITY", 0);
|
||||
final String member = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(line0.get("ENTITY", 1));
|
||||
|
||||
final Quark quark = diagram.quarkInContext(idShort, false);
|
||||
final Entity cl1 = (Entity) quark.getData();
|
||||
if (cl1 == null)
|
||||
|
||||
final Quark<Entity> quark = diagram.quarkInContext(idShort, false);
|
||||
final Entity cl1 = quark.getData();
|
||||
if (cl1 == null)
|
||||
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))
|
||||
.withRankdir(diagram.getSkinParam().getRankdir());
|
||||
|
||||
final String tmp = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(idShort + "$$$" + position.name());
|
||||
final Quark identTip = diagram.quarkInContext(tmp, false);
|
||||
Entity tips = (Entity) identTip.getData();
|
||||
// final Quark identTip = diagram.buildFromName(tmp);
|
||||
//IEntity tips = diagram.getLeafFromName(idShort + "$$$" + position.name());
|
||||
final Quark<Entity> identTip = diagram.quarkInContext(tmp, false);
|
||||
Entity tips = identTip.getData();
|
||||
|
||||
if (tips == null) {
|
||||
tips = diagram.reallyCreateLeaf(identTip, Display.getWithNewlines(""), LeafType.TIPS, null);
|
||||
final LinkType type = new LinkType(LinkDecor.NONE, LinkDecor.NONE).getInvisible();
|
||||
|
@ -73,7 +73,7 @@ public class CommandCreateBlock extends SingleLineCommand2<CompositeDiagram> {
|
||||
protected CommandExecutionResult executeArg(CompositeDiagram diagram, LineLocation location, RegexResult arg) {
|
||||
String display = arg.get("DISPLAY", 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)
|
||||
display = quark.getName();
|
||||
|
||||
@ -81,7 +81,7 @@ public class CommandCreateBlock extends SingleLineCommand2<CompositeDiagram> {
|
||||
return CommandExecutionResult.error("Already exists " + quark.getName());
|
||||
|
||||
final Entity ent = diagram.reallyCreateLeaf(quark, Display.getWithNewlines(quark), LeafType.BLOCK, null);
|
||||
// ent.setDisplay(Display.getWithNewlines(display));
|
||||
|
||||
return CommandExecutionResult.ok();
|
||||
}
|
||||
|
||||
|
@ -35,6 +35,7 @@
|
||||
*/
|
||||
package net.sourceforge.plantuml.compositediagram.command;
|
||||
|
||||
import net.sourceforge.plantuml.baraye.Entity;
|
||||
import net.sourceforge.plantuml.command.CommandExecutionResult;
|
||||
import net.sourceforge.plantuml.command.SingleLineCommand2;
|
||||
import net.sourceforge.plantuml.compositediagram.CompositeDiagram;
|
||||
@ -74,7 +75,7 @@ public class CommandCreatePackageBlock extends SingleLineCommand2<CompositeDiagr
|
||||
|
||||
String display = arg.get("DISPLAY", 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)
|
||||
display = quark.getName();
|
||||
|
||||
|
@ -79,17 +79,15 @@ public class CommandLinkBlock extends SingleLineCommand2<CompositeDiagram> {
|
||||
protected CommandExecutionResult executeArg(CompositeDiagram diagram, LineLocation location, RegexResult arg) {
|
||||
final String ent1 = arg.get("ENT1", 0);
|
||||
final String ent2 = arg.get("ENT2", 0);
|
||||
final Quark quark1 = diagram.quarkInContext(diagram.cleanIdForQuark(ent1), false);
|
||||
final Quark quark2 = diagram.quarkInContext(diagram.cleanIdForQuark(ent2), false);
|
||||
final Entity cl1 = (Entity) quark1.getData();
|
||||
final Quark<Entity> quark1 = diagram.quarkInContext(diagram.cleanId(ent1), false);
|
||||
final Quark<Entity> quark2 = diagram.quarkInContext(diagram.cleanId(ent2), false);
|
||||
final Entity cl1 = quark1.getData();
|
||||
if (cl1 == null)
|
||||
return CommandExecutionResult.error("No such element " + quark1.getName());
|
||||
|
||||
final Entity cl2 = (Entity) quark2.getData();
|
||||
final Entity cl2 = quark2.getData();
|
||||
if (cl2 == null)
|
||||
return CommandExecutionResult.error("No such element " + quark2.getName());
|
||||
// final IEntity cl1 = diagram.getOrCreateLeaf(quark1, diagram.buildFromFullPath(ent1), null, null);
|
||||
// final IEntity cl2 = diagram.getOrCreateLeaf(quark2, diagram.buildFromFullPath(ent2), null, null);
|
||||
|
||||
final String deco1 = arg.get("DECO1", 0);
|
||||
final String deco2 = arg.get("DECO2", 0);
|
||||
|
@ -42,7 +42,6 @@ import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
import net.sourceforge.plantuml.LineBreakStrategy;
|
||||
|
||||
import net.sourceforge.plantuml.awt.geom.XDimension2D;
|
||||
import net.sourceforge.plantuml.awt.geom.XRectangle2D;
|
||||
import net.sourceforge.plantuml.creole.atom.Atom;
|
||||
|
@ -47,6 +47,7 @@ import java.util.regex.Pattern;
|
||||
|
||||
import net.atmp.ISkinSimple;
|
||||
import net.sourceforge.plantuml.LineBreakStrategy;
|
||||
import net.sourceforge.plantuml.baraye.Entity;
|
||||
import net.sourceforge.plantuml.creole.CreoleMode;
|
||||
import net.sourceforge.plantuml.creole.Sheet;
|
||||
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);
|
||||
}
|
||||
|
||||
public static Display getWithNewlines(Quark s) {
|
||||
public static Display getWithNewlines(Quark<Entity> s) {
|
||||
return getWithNewlines(s.getName());
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,6 @@
|
||||
package net.sourceforge.plantuml.cucadiagram;
|
||||
|
||||
import net.sourceforge.plantuml.baraye.Entity;
|
||||
import net.sourceforge.plantuml.baraye.EntityUtils;
|
||||
import net.sourceforge.plantuml.text.Guillemet;
|
||||
|
||||
public class EntityGenderUtils {
|
||||
|
@ -79,7 +79,7 @@ public interface ICucaDiagram extends GroupHierarchy, PortionShower, Annotated {
|
||||
|
||||
String[] getDotStringSkek();
|
||||
|
||||
boolean isAutarkic(Entity g);
|
||||
// boolean isAutarkic(Entity g);
|
||||
|
||||
int getUniqueSequence();
|
||||
|
||||
|
@ -36,6 +36,18 @@
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ import net.sourceforge.plantuml.baraye.Entity;
|
||||
import net.sourceforge.plantuml.cucadiagram.ICucaDiagram;
|
||||
import net.sourceforge.plantuml.cucadiagram.LeafType;
|
||||
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;
|
||||
|
||||
public final class CucaDiagramSimplifierActivity {
|
||||
@ -60,35 +60,19 @@ public final class CucaDiagramSimplifierActivity {
|
||||
do {
|
||||
changed = false;
|
||||
final Collection<Entity> groups = new ArrayList<>(diagram.getEntityFactory().groups());
|
||||
for (Entity g : groups) {
|
||||
if (diagram.isAutarkic(g)) {
|
||||
// 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();
|
||||
// }
|
||||
|
||||
for (Entity g : groups)
|
||||
if (g.isAutarkic()) {
|
||||
final IEntityImage img = computeImage(g);
|
||||
g.overrideImage(img, LeafType.ACTIVITY);
|
||||
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
} 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 {
|
||||
final GroupPngMakerActivity maker = new GroupPngMakerActivity(diagram, g, stringBounder);
|
||||
final GroupMakerActivity maker = new GroupMakerActivity(diagram, g, stringBounder);
|
||||
return maker.getImage();
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ import net.sourceforge.plantuml.cucadiagram.GroupType;
|
||||
import net.sourceforge.plantuml.cucadiagram.ICucaDiagram;
|
||||
import net.sourceforge.plantuml.cucadiagram.LeafType;
|
||||
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;
|
||||
|
||||
public final class CucaDiagramSimplifierState {
|
||||
@ -63,7 +63,7 @@ public final class CucaDiagramSimplifierState {
|
||||
changed = false;
|
||||
final Collection<Entity> groups = getOrdered(diagram.getRootGroup());
|
||||
for (Entity g : groups)
|
||||
if (diagram.isAutarkic(g)) {
|
||||
if (g.isAutarkic()) {
|
||||
final IEntityImage img = computeImage(g);
|
||||
g.overrideImage(img, g.getGroupType() == GroupType.CONCURRENT_STATE ? LeafType.STATE_CONCURRENT
|
||||
: LeafType.STATE);
|
||||
@ -109,7 +109,7 @@ public final class CucaDiagramSimplifierState {
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
|
@ -46,8 +46,8 @@ import java.util.Objects;
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.Pragma;
|
||||
import net.sourceforge.plantuml.UmlDiagramType;
|
||||
import net.sourceforge.plantuml.baraye.EntityFactory;
|
||||
import net.sourceforge.plantuml.baraye.Entity;
|
||||
import net.sourceforge.plantuml.baraye.EntityFactory;
|
||||
import net.sourceforge.plantuml.cucadiagram.EntityPortion;
|
||||
import net.sourceforge.plantuml.cucadiagram.GroupHierarchy;
|
||||
import net.sourceforge.plantuml.cucadiagram.Link;
|
||||
|
@ -90,18 +90,11 @@ public class CommandCreateDomain extends SingleLineCommand2<DescriptionDiagram>
|
||||
if (codeString == null)
|
||||
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 GroupType type = typeString.equalsIgnoreCase("domain") ? GroupType.DOMAIN : GroupType.REQUIREMENT;
|
||||
final LeafType type2 = typeString.equalsIgnoreCase("domain") ? LeafType.DOMAIN : LeafType.REQUIREMENT;
|
||||
|
||||
final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(codeString), false);
|
||||
|
||||
// final Quark ident = diagram.buildFromName(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(codeString));
|
||||
// final Quark code = diagram.buildFromFullPath(codeString);
|
||||
final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(codeString), false);
|
||||
if (quark.getData() != null)
|
||||
return CommandExecutionResult.error("Object already exists : " + codeString);
|
||||
|
||||
@ -110,17 +103,17 @@ public class CommandCreateDomain extends SingleLineCommand2<DescriptionDiagram>
|
||||
final String group = arg.get("GROUP", 0);
|
||||
Entity entity;
|
||||
if (group != null) {
|
||||
final Entity currentGroup = diagram.getCurrentGroup();
|
||||
// final Entity currentGroup = diagram.getCurrentGroup();
|
||||
diagram.gotoGroup(quark, display, type);
|
||||
entity = diagram.getCurrentGroup();
|
||||
} else {
|
||||
entity = diagram.reallyCreateLeaf(quark, display, type2, null);
|
||||
}
|
||||
if (stereotype != null) {
|
||||
if (stereotype != null)
|
||||
entity.setStereotype(Stereotype.build(stereotype, diagram.getSkinParam().getCircledCharacterRadius(),
|
||||
diagram.getSkinParam().getFont(null, false, FontParam.CIRCLED_CHARACTER),
|
||||
diagram.getSkinParam().getIHtmlColorSet()));
|
||||
}
|
||||
|
||||
if (urlString != null) {
|
||||
final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), UrlMode.STRICT);
|
||||
final Url url = urlBuilder.getUrl(urlString);
|
||||
|
@ -53,12 +53,12 @@ public class DescriptionDiagram extends AbstractEntityDiagram {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String cleanIdForQuark(String id) {
|
||||
public String cleanId(String id) {
|
||||
if (id == null)
|
||||
return null;
|
||||
if (id.startsWith("()"))
|
||||
id = StringUtils.trin(id.substring(2));
|
||||
return super.cleanIdForQuark(id);
|
||||
return super.cleanId(id);
|
||||
}
|
||||
|
||||
private boolean isUsecase() {
|
||||
|
@ -123,10 +123,7 @@ public class CommandArchimate extends SingleLineCommand2<DescriptionDiagram> {
|
||||
throws NoSuchColorException {
|
||||
final String codeRaw = arg.getLazzy("CODE", 0);
|
||||
|
||||
// final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(codeRaw);
|
||||
// final Quark ident = diagram.buildFromName(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(idShort));
|
||||
// final Quark code = diagram.buildFromFullPath(idShort);
|
||||
final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(codeRaw), false);
|
||||
final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(codeRaw), false);
|
||||
|
||||
String display = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.getLazzy("DISPLAY", 0));
|
||||
if (display == null)
|
||||
|
@ -104,18 +104,14 @@ public class CommandArchimateMultilines extends CommandMultilines2<AbstractEntit
|
||||
final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString());
|
||||
final String codeRaw = line0.getLazzy("CODE", 0);
|
||||
|
||||
// final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(codeRaw);
|
||||
// final Quark ident = diagram.buildFromName(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(idShort));
|
||||
// final Quark code = diagram.buildFromFullPath(idShort);
|
||||
|
||||
final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(codeRaw), true);
|
||||
final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(codeRaw), true);
|
||||
if (quark.getData() != null)
|
||||
return CommandExecutionResult.error("Already exists " + quark.getName());
|
||||
|
||||
final String icon = line0.getLazzy("STEREOTYPE", 0);
|
||||
|
||||
final Entity entity = diagram.reallyCreateLeaf(quark,
|
||||
Display.getWithNewlines(quark), LeafType.DESCRIPTION, USymbols.RECTANGLE);
|
||||
final Entity entity = diagram.reallyCreateLeaf(quark, Display.getWithNewlines(quark), LeafType.DESCRIPTION,
|
||||
USymbols.RECTANGLE);
|
||||
|
||||
lines = lines.subExtract(1, 1);
|
||||
Display display = lines.toDisplay();
|
||||
|
@ -38,7 +38,6 @@ package net.sourceforge.plantuml.descdiagram.command;
|
||||
|
||||
import net.sourceforge.plantuml.StringUtils;
|
||||
import net.sourceforge.plantuml.baraye.Entity;
|
||||
import net.sourceforge.plantuml.baraye.EntityUtils;
|
||||
import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram;
|
||||
import net.sourceforge.plantuml.classdiagram.command.CommandCreateClassMultilines;
|
||||
import net.sourceforge.plantuml.command.CommandExecutionResult;
|
||||
@ -226,10 +225,7 @@ public class CommandCreateElementFull extends SingleLineCommand2<DescriptionDiag
|
||||
|
||||
}
|
||||
|
||||
// final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(codeRaw);
|
||||
// final Quark ident = diagram.buildFromName(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(idShort));
|
||||
// final Quark code = diagram.buildFromFullPath(idShort);
|
||||
final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(codeRaw), false);
|
||||
final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(codeRaw), false);
|
||||
|
||||
if (diagram.isGroup(quark))
|
||||
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())
|
||||
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)
|
||||
entity = diagram.reallyCreateLeaf(quark, Display.getWithNewlines(display), type, usymbol);
|
||||
|
||||
@ -275,19 +271,14 @@ public class CommandCreateElementFull extends SingleLineCommand2<DescriptionDiag
|
||||
|
||||
entity.setColors(colors);
|
||||
|
||||
// entity.setSpecificColorTOBEREMOVED(ColorType.BACK,
|
||||
// diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR",
|
||||
// 0)));
|
||||
return CommandExecutionResult.ok();
|
||||
}
|
||||
|
||||
public static boolean existsWithBadType3(AbstractEntityDiagram diagram, Quark code, LeafType type,
|
||||
USymbol usymbol) {
|
||||
public static boolean existsWithBadType3(AbstractEntityDiagram diagram, Quark<Entity> code, LeafType type, USymbol usymbol) {
|
||||
if (code.getData() == null)
|
||||
return false;
|
||||
|
||||
// final ILeaf other = diagram.getLeafFromName(code.getName());
|
||||
final Entity other = (Entity) code.getData();
|
||||
final Entity other = code.getData();
|
||||
if (other.getLeafType() != type)
|
||||
return true;
|
||||
|
||||
|
@ -162,13 +162,8 @@ public class CommandCreateElementMultilines extends CommandMultilines2<AbstractE
|
||||
|
||||
final String stereotype = line0.get("STEREO", 0);
|
||||
|
||||
// final Quark ident = diagram.buildFromName(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(idShort));
|
||||
// final Quark code_ = diagram.buildFromFullPath(idShort);
|
||||
// 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();
|
||||
final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(idShort), false);
|
||||
Entity result = quark.getData();
|
||||
if (quark.getData() == null)
|
||||
result = diagram.reallyCreateLeaf(quark, display, type, usymbol);
|
||||
|
||||
|
@ -149,17 +149,10 @@ public class CommandCreateElementParenthesis extends SingleLineCommand2<ClassDia
|
||||
type = LeafType.DESCRIPTION;
|
||||
usymbol = USymbols.fromString(symbol, diagram.getSkinParam());
|
||||
|
||||
// final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(codeRaw);
|
||||
// final Quark ident = diagram.buildFromName(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(idShort));
|
||||
// final Quark code = diagram.buildFromFullPath(idShort);
|
||||
|
||||
final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(codeRaw), true);
|
||||
final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(codeRaw), true);
|
||||
if (quark.getData() != null)
|
||||
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;
|
||||
if (display == null)
|
||||
display = quark.getName();
|
||||
@ -172,11 +165,10 @@ public class CommandCreateElementParenthesis extends SingleLineCommand2<ClassDia
|
||||
final Entity entity = diagram.reallyCreateLeaf(quark, Display.getWithNewlines(display), type, usymbol);
|
||||
entity.setDisplay(Display.getWithNewlines(display));
|
||||
entity.setUSymbol(usymbol);
|
||||
if (stereotype != null) {
|
||||
if (stereotype != null)
|
||||
entity.setStereotype(Stereotype.build(stereotype, diagram.getSkinParam().getCircledCharacterRadius(),
|
||||
diagram.getSkinParam().getFont(null, false, FontParam.CIRCLED_CHARACTER),
|
||||
diagram.getSkinParam().getIHtmlColorSet()));
|
||||
}
|
||||
|
||||
final String urlString = arg.get("URL", 0);
|
||||
if (urlString != null) {
|
||||
|
@ -242,8 +242,8 @@ public class CommandLinkElement extends SingleLineCommand2<DescriptionDiagram> {
|
||||
throws NoSuchColorException {
|
||||
final String ent1 = arg.get("ENT1", 0);
|
||||
final String ent2 = arg.get("ENT2", 0);
|
||||
final String ent1clean = diagram.cleanIdForQuark(ent1);
|
||||
final String ent2clean = diagram.cleanIdForQuark(ent2);
|
||||
final String ent1clean = diagram.cleanId(ent1);
|
||||
final String ent2clean = diagram.cleanId(ent2);
|
||||
// final String ent1 = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(ent1String);
|
||||
// final String ent2 = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(ent2String);
|
||||
// final Quark ident1 = diagram.buildFullyQualified(ent1);
|
||||
@ -299,35 +299,35 @@ public class CommandLinkElement extends SingleLineCommand2<DescriptionDiagram> {
|
||||
|
||||
private Entity getDummy(DescriptionDiagram diagram, String ident) {
|
||||
if (ident.startsWith("()")) {
|
||||
ident = diagram.cleanIdForQuark(ident);
|
||||
final Quark quark = diagram.quarkInContext(ident, false);
|
||||
ident = diagram.cleanId(ident);
|
||||
final Quark<Entity> quark = diagram.quarkInContext(ident, false);
|
||||
if (quark.getData() != null)
|
||||
return (Entity) quark.getData();
|
||||
return quark.getData();
|
||||
return diagram.reallyCreateLeaf(quark, Display.getWithNewlines(quark.getName()), LeafType.DESCRIPTION,
|
||||
USymbols.INTERFACE);
|
||||
}
|
||||
|
||||
final char codeChar = ident.length() > 2 ? ident.charAt(0) : 0;
|
||||
ident = diagram.cleanIdForQuark(ident);
|
||||
final Quark quark = diagram.quarkInContext(ident, false);
|
||||
ident = diagram.cleanId(ident);
|
||||
final Quark<Entity> quark = diagram.quarkInContext(ident, false);
|
||||
|
||||
if (diagram.isGroup(quark))
|
||||
return (Entity) quark.getData();
|
||||
return quark.getData();
|
||||
if (quark.getData() != null)
|
||||
return (Entity) quark.getData();
|
||||
return quark.getData();
|
||||
final Display display = Display.getWithNewlines(quark.getName());
|
||||
|
||||
if (codeChar == '(') {
|
||||
return (Entity) diagram.reallyCreateLeaf(quark, display, LeafType.USECASE, USymbols.USECASE);
|
||||
return diagram.reallyCreateLeaf(quark, display, LeafType.USECASE, USymbols.USECASE);
|
||||
} else if (codeChar == ':') {
|
||||
return (Entity) diagram.reallyCreateLeaf(quark, display, LeafType.DESCRIPTION,
|
||||
return diagram.reallyCreateLeaf(quark, display, LeafType.DESCRIPTION,
|
||||
diagram.getSkinParam().actorStyle().toUSymbol());
|
||||
} else if (codeChar == '[') {
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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)
|
||||
return status;
|
||||
final Entity p = diagram.getCurrentGroup();
|
||||
|
@ -54,7 +54,6 @@ import net.sourceforge.plantuml.UmlDiagramType;
|
||||
import net.sourceforge.plantuml.api.ImageDataSimple;
|
||||
import net.sourceforge.plantuml.awt.geom.XDimension2D;
|
||||
import net.sourceforge.plantuml.awt.geom.XPoint2D;
|
||||
import net.sourceforge.plantuml.baraye.EntityFactory;
|
||||
import net.sourceforge.plantuml.baraye.Entity;
|
||||
import net.sourceforge.plantuml.core.ImageData;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
|
@ -51,6 +51,7 @@ import net.sourceforge.plantuml.graphic.TextBlockUtils;
|
||||
import net.sourceforge.plantuml.json.JsonArray;
|
||||
import net.sourceforge.plantuml.json.JsonObject;
|
||||
import net.sourceforge.plantuml.json.JsonObject.Member;
|
||||
import net.sourceforge.plantuml.json.JsonValue;
|
||||
import net.sourceforge.plantuml.klimt.ULine;
|
||||
import net.sourceforge.plantuml.klimt.URectangle;
|
||||
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.StringBounder;
|
||||
import net.sourceforge.plantuml.klimt.geom.HorizontalAlignment;
|
||||
import net.sourceforge.plantuml.json.JsonValue;
|
||||
import net.sourceforge.plantuml.style.PName;
|
||||
import net.sourceforge.plantuml.style.SName;
|
||||
import net.sourceforge.plantuml.style.Style;
|
||||
|
@ -39,7 +39,6 @@ import java.awt.Font;
|
||||
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.UmlDiagramType;
|
||||
|
||||
import net.sourceforge.plantuml.style.SName;
|
||||
import net.sourceforge.plantuml.style.StyleSignatureBasic;
|
||||
|
||||
|
@ -44,8 +44,8 @@ import net.sourceforge.plantuml.BlockUml;
|
||||
import net.sourceforge.plantuml.SourceStringReader;
|
||||
import net.sourceforge.plantuml.api.mda.option2.MDADiagram;
|
||||
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.EntityFactory;
|
||||
import net.sourceforge.plantuml.classdiagram.ClassDiagram;
|
||||
import net.sourceforge.plantuml.core.Diagram;
|
||||
|
||||
|
@ -108,36 +108,19 @@ public abstract class AbstractClassOrObjectDiagram extends AbstractEntityDiagram
|
||||
|
||||
private final List<Association> associations = new ArrayList<>();
|
||||
|
||||
public CommandExecutionResult associationClass(Entity entity1A, Entity entity1B, Entity entity2A,
|
||||
Entity entity2B, 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);
|
||||
public CommandExecutionResult associationClass(Entity entity1A, Entity entity1B, Entity entity2A, Entity entity2B,
|
||||
LinkType linkType, Display label) {
|
||||
|
||||
final List<Association> same1 = getExistingAssociatedPoints(entity1A, entity1B);
|
||||
final List<Association> same2 = getExistingAssociatedPoints(entity2A, entity2B);
|
||||
if (same1.size() == 0 && same2.size() == 0) {
|
||||
final String tmp1 = 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,
|
||||
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,
|
||||
null);
|
||||
|
||||
@ -162,10 +145,8 @@ public abstract class AbstractClassOrObjectDiagram extends AbstractEntityDiagram
|
||||
else
|
||||
removeLink(existingLink1);
|
||||
|
||||
final Entity entity1real = existingLink1.isInverted() ? existingLink1.getEntity2()
|
||||
: existingLink1.getEntity1();
|
||||
final Entity entity2real = existingLink1.isInverted() ? existingLink1.getEntity1()
|
||||
: existingLink1.getEntity2();
|
||||
final Entity entity1real = existingLink1.isInverted() ? existingLink1.getEntity2() : existingLink1.getEntity1();
|
||||
final Entity entity2real = existingLink1.isInverted() ? existingLink1.getEntity1() : existingLink1.getEntity2();
|
||||
|
||||
final Link entity1ToPoint = new Link(getEntityFactory(), getSkinParam().getCurrentStyleBuilder(), entity1real,
|
||||
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,
|
||||
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);
|
||||
if (same.size() > 1) {
|
||||
return false;
|
||||
@ -244,13 +219,9 @@ public abstract class AbstractClassOrObjectDiagram extends AbstractEntityDiagram
|
||||
this.entity2 = entity2;
|
||||
this.associed = associed;
|
||||
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);
|
||||
|
||||
// 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) {
|
||||
|
@ -67,12 +67,10 @@ public class CommandAddData extends SingleLineCommand2<AbstractClassOrObjectDiag
|
||||
protected CommandExecutionResult executeArg(AbstractClassOrObjectDiagram diagram, LineLocation location,
|
||||
RegexResult arg) throws NoSuchColorException {
|
||||
final String name = arg.get("NAME", 0);
|
||||
final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(name), false);
|
||||
final Entity entity = (Entity) quark.getData();
|
||||
final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(name), false);
|
||||
final Entity entity = quark.getData();
|
||||
if (entity == null)
|
||||
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);
|
||||
if (field.length() > 0 && VisibilityModifier.isVisibilityCharacter(field))
|
||||
|
@ -80,12 +80,11 @@ public class CommandCreateEntityObject extends SingleLineCommand2<AbstractClassO
|
||||
protected CommandExecutionResult executeArg(AbstractClassOrObjectDiagram diagram, LineLocation location,
|
||||
RegexResult arg) throws NoSuchColorException {
|
||||
final String idShort = arg.get("NAME", 1);
|
||||
// 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 String displayString = arg.get("NAME", 0);
|
||||
final String stereotype = arg.get("STEREO", 0);
|
||||
// final boolean leafExist = diagram.leafExist(code);
|
||||
|
||||
if (quark.getData() != null)
|
||||
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);
|
||||
|
||||
final Entity entity = diagram.reallyCreateLeaf(quark, display, LeafType.OBJECT, null);
|
||||
if (stereotype != null) {
|
||||
if (stereotype != null)
|
||||
entity.setStereotype(Stereotype.build(stereotype, diagram.getSkinParam().getCircledCharacterRadius(),
|
||||
diagram.getSkinParam().getFont(null, false, FontParam.CIRCLED_CHARACTER),
|
||||
diagram.getSkinParam().getIHtmlColorSet()));
|
||||
}
|
||||
|
||||
final String urlString = arg.get("URL", 0);
|
||||
if (urlString != null) {
|
||||
final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), UrlMode.STRICT);
|
||||
|
@ -108,26 +108,23 @@ public class CommandCreateEntityObjectMultilines extends CommandMultilines2<Abst
|
||||
|
||||
private Entity executeArg0(AbstractClassOrObjectDiagram diagram, RegexResult line0) throws NoSuchColorException {
|
||||
final String name = line0.get("NAME", 1);
|
||||
final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(name), false);
|
||||
// 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 String displayString = line0.get("NAME", 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);
|
||||
if (Display.isNull(display))
|
||||
display = Display.getWithNewlines(name).withCreoleMode(CreoleMode.SIMPLE_LINE);
|
||||
Entity entity = (Entity) quark.getData();
|
||||
Entity entity = quark.getData();
|
||||
if (entity == null)
|
||||
entity = diagram.reallyCreateLeaf(quark, display, LeafType.OBJECT, null);
|
||||
|
||||
if (stereotype != null) {
|
||||
if (stereotype != null)
|
||||
entity.setStereotype(Stereotype.build(stereotype, diagram.getSkinParam().getCircledCharacterRadius(),
|
||||
diagram.getSkinParam().getFont(null, false, FontParam.CIRCLED_CHARACTER),
|
||||
diagram.getSkinParam().getIHtmlColorSet()));
|
||||
}
|
||||
|
||||
final String s = line0.get("COLOR", 0);
|
||||
entity.setSpecificColorTOBEREMOVED(ColorType.BACK,
|
||||
s == null ? null : diagram.getSkinParam().getIHtmlColorSet().getColor(s));
|
||||
|
@ -48,6 +48,8 @@ import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.cucadiagram.LeafType;
|
||||
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
||||
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.ColorType;
|
||||
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.RegexResult;
|
||||
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.utils.BlocLines;
|
||||
|
||||
@ -143,16 +143,12 @@ public class CommandCreateJson extends CommandMultilines2<AbstractEntityDiagram>
|
||||
|
||||
private Entity executeArg0(AbstractEntityDiagram diagram, RegexResult line0) throws NoSuchColorException {
|
||||
final String name = line0.get("NAME", 1);
|
||||
// final Quark ident = diagram.buildFromName(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(name));
|
||||
// final Quark code = diagram.buildFromFullPath(name);
|
||||
final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(name), false);
|
||||
|
||||
final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(name), false);
|
||||
if (quark.getData() != null)
|
||||
return null;
|
||||
final String displayString = line0.get("NAME", 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);
|
||||
if (Display.isNull(display))
|
||||
|
@ -44,12 +44,12 @@ import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.cucadiagram.LeafType;
|
||||
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
||||
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.ColorType;
|
||||
import net.sourceforge.plantuml.klimt.color.NoSuchColorException;
|
||||
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.plasma.Quark;
|
||||
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 {
|
||||
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)
|
||||
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 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);
|
||||
if (Display.isNull(display))
|
||||
|
@ -122,8 +122,8 @@ public class CommandCreateMap extends CommandMultilines2<AbstractEntityDiagram>
|
||||
final int x = line.indexOf(linkStr);
|
||||
final String key = line.substring(0, x).trim();
|
||||
final String dest = line.substring(x + linkStr.length()).trim();
|
||||
final Quark ident2 = diagram.quarkInContext(dest, false);
|
||||
final Entity entity2 = (Entity) ident2.getData();
|
||||
final Quark<Entity> ident2 = diagram.quarkInContext(dest, false);
|
||||
final Entity entity2 = ident2.getData();
|
||||
if (entity2 == null)
|
||||
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 {
|
||||
final String name = line0.get("NAME", 1);
|
||||
// final Quark ident = diagram.buildFromName(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(name));
|
||||
// final Quark code = diagram.buildFromFullPath(name);
|
||||
final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(name), false);
|
||||
|
||||
final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(name), false);
|
||||
final String displayString = line0.get("NAME", 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)
|
||||
return null;
|
||||
|
||||
|
47
src/net/sourceforge/plantuml/plasma/PEntry.java
Normal file
47
src/net/sourceforge/plantuml/plasma/PEntry.java
Normal 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;
|
||||
}
|
||||
|
||||
}
|
@ -38,21 +38,34 @@ package net.sourceforge.plantuml.plasma;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class Plasma {
|
||||
public class Plasma<DATA> {
|
||||
|
||||
private String separator;
|
||||
private final Quark root;
|
||||
private final List<Quark> quarks = new ArrayList<>();
|
||||
private final Quark<DATA> root;
|
||||
private final List<Quark<DATA>> quarks = new ArrayList<>();
|
||||
private final Map<String, PEntry<DATA>> stats = new HashMap<String, PEntry<DATA>>();
|
||||
|
||||
public Plasma(String separator) {
|
||||
this.root = new Quark(this, null, "");
|
||||
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;
|
||||
}
|
||||
|
||||
@ -70,100 +83,22 @@ public class Plasma {
|
||||
return this.separator != null && this.separator != "\u0000";
|
||||
}
|
||||
|
||||
public Quark parse(Quark root, String full) {
|
||||
|
||||
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() {
|
||||
public Collection<Quark<DATA>> quarks() {
|
||||
return Collections.unmodifiableCollection(quarks);
|
||||
}
|
||||
|
||||
public Quark firstWithName(String name) {
|
||||
for (Quark quark : quarks)
|
||||
if (quark.getName().equals(name))
|
||||
return quark;
|
||||
|
||||
return null;
|
||||
public Quark<DATA> firstWithName(String name) {
|
||||
final PEntry<DATA> ent = stats.get(name);
|
||||
if (ent == null)
|
||||
return null;
|
||||
return ent.first;
|
||||
}
|
||||
|
||||
public int countByName(String name) {
|
||||
int count = 0;
|
||||
for (Quark quark : quarks)
|
||||
if (quark.getName().equals(name))
|
||||
count++;
|
||||
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);
|
||||
}
|
||||
|
||||
final PEntry<DATA> ent = stats.get(name);
|
||||
if (ent == null)
|
||||
return 0;
|
||||
return ent.counter;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -35,59 +35,45 @@
|
||||
*/
|
||||
package net.sourceforge.plantuml.plasma;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
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 */ Quark parent;
|
||||
private final Plasma<DATA> plasma;
|
||||
private final Quark<DATA> parent;
|
||||
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.plasma = plasma;
|
||||
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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
// return parts.toString() + "(parent=" + parent + ")";
|
||||
return getSignature().toString();
|
||||
return qualifiedName;
|
||||
}
|
||||
|
||||
List<String> getSignature() {
|
||||
final List<String> result = new ArrayList<>();
|
||||
if (parent != null)
|
||||
result.addAll(parent.getSignature());
|
||||
result.add(name);
|
||||
return result;
|
||||
}
|
||||
public String toStringPoint() {
|
||||
if (parent == null || parent.parent == null)
|
||||
return name;
|
||||
|
||||
public boolean containsLarge(Quark other) {
|
||||
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();
|
||||
return parent.toStringPoint() + "." + name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
@ -95,47 +81,76 @@ public class Quark {
|
||||
}
|
||||
|
||||
public String getQualifiedName() {
|
||||
if (plasma.hasSeparator())
|
||||
return toString(plasma.getSeparator());
|
||||
return name;
|
||||
return qualifiedName;
|
||||
}
|
||||
|
||||
public boolean isRoot() {
|
||||
return parent == null;
|
||||
}
|
||||
|
||||
public final Plasma getPlasma() {
|
||||
public final Plasma<DATA> getPlasma() {
|
||||
return plasma;
|
||||
}
|
||||
|
||||
public final Object getData() {
|
||||
public final DATA getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public final void setData(Object data) {
|
||||
public final void setData(DATA data) {
|
||||
if (this.data != null)
|
||||
throw new IllegalStateException();
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public Quark childIfExists(String name) {
|
||||
final List<String> sig = new ArrayList<>(getSignature());
|
||||
sig.add(name);
|
||||
return plasma.getIfExists(sig);
|
||||
public Quark<DATA> childIfExists(String name) {
|
||||
if (plasma.hasSeparator() && name.contains(plasma.getSeparator()))
|
||||
throw new IllegalArgumentException();
|
||||
return children.get(name);
|
||||
}
|
||||
|
||||
public Quark child(String full) {
|
||||
return plasma.parse(this, full);
|
||||
public Quark<DATA> child(String 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() {
|
||||
return plasma.countChildren(this);
|
||||
}
|
||||
|
||||
public List<Quark> getChildren() {
|
||||
return plasma.getChildren(this);
|
||||
}
|
||||
|
||||
void setParent(Quark newFather) {
|
||||
this.parent = newFather;
|
||||
return children.size();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -37,8 +37,8 @@ package net.sourceforge.plantuml.salt.factory;
|
||||
|
||||
import net.sourceforge.plantuml.StringUtils;
|
||||
import net.sourceforge.plantuml.salt.DataSource;
|
||||
import net.sourceforge.plantuml.salt.SaltDictionary;
|
||||
import net.sourceforge.plantuml.salt.Positionner2;
|
||||
import net.sourceforge.plantuml.salt.SaltDictionary;
|
||||
import net.sourceforge.plantuml.salt.Terminated;
|
||||
import net.sourceforge.plantuml.salt.Terminator;
|
||||
import net.sourceforge.plantuml.salt.element.Element;
|
||||
|
@ -36,8 +36,8 @@
|
||||
package net.sourceforge.plantuml.salt.factory;
|
||||
|
||||
import net.sourceforge.plantuml.salt.DataSource;
|
||||
import net.sourceforge.plantuml.salt.SaltDictionary;
|
||||
import net.sourceforge.plantuml.salt.Positionner2;
|
||||
import net.sourceforge.plantuml.salt.SaltDictionary;
|
||||
import net.sourceforge.plantuml.salt.Terminated;
|
||||
import net.sourceforge.plantuml.salt.element.Element;
|
||||
import net.sourceforge.plantuml.salt.element.ElementPyramidScrolled;
|
||||
|
@ -69,7 +69,6 @@ import net.sourceforge.plantuml.api.ImageDataSimple;
|
||||
import net.sourceforge.plantuml.awt.geom.XDimension2D;
|
||||
import net.sourceforge.plantuml.awt.geom.XPoint2D;
|
||||
import net.sourceforge.plantuml.baraye.Entity;
|
||||
import net.sourceforge.plantuml.baraye.EntityFactory;
|
||||
import net.sourceforge.plantuml.core.ImageData;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.cucadiagram.GroupType;
|
||||
|
@ -39,7 +39,6 @@ import java.util.Map;
|
||||
|
||||
import net.sourceforge.plantuml.UmlDiagramType;
|
||||
import net.sourceforge.plantuml.baraye.Entity;
|
||||
import net.sourceforge.plantuml.baraye.EntityUtils;
|
||||
import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram;
|
||||
import net.sourceforge.plantuml.core.UmlSource;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
@ -57,86 +56,81 @@ public class StateDiagram extends AbstractEntityDiagram {
|
||||
// setNamespaceSeparator(null);
|
||||
}
|
||||
|
||||
public boolean checkConcurrentStateOk(Quark code) {
|
||||
public boolean checkConcurrentStateOk(Quark<Entity> code) {
|
||||
final boolean result = checkConcurrentStateOkInternal(code);
|
||||
// System.err.println("checkConcurrentStateOk " + code + " " + ident + " " +
|
||||
// result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private boolean checkConcurrentStateOkInternal(Quark code) {
|
||||
if (code.getData() == null) {
|
||||
private boolean checkConcurrentStateOkInternal(Quark<Entity> code) {
|
||||
if (code.getData() == null)
|
||||
return true;
|
||||
}
|
||||
// final IEntity existing = this.getLeafFromName(code.getName());
|
||||
final Entity existing = (Entity) code.getData();
|
||||
|
||||
final Entity existing = code.getData();
|
||||
if (getCurrentGroup().getGroupType() == GroupType.CONCURRENT_STATE
|
||||
&& getCurrentGroup() != existing.getParentContainer()) {
|
||||
&& getCurrentGroup() != existing.getParentContainer())
|
||||
return false;
|
||||
}
|
||||
|
||||
if (existing.getParentContainer().getGroupType() == GroupType.CONCURRENT_STATE
|
||||
&& getCurrentGroup() != existing.getParentContainer()) {
|
||||
&& getCurrentGroup() != existing.getParentContainer())
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public Entity getStart() {
|
||||
final Entity g = getCurrentGroup();
|
||||
if (g.isRoot()) {
|
||||
final String idShort = "*start*";
|
||||
final Quark quark = quarkInContext(cleanIdForQuark(idShort), false);
|
||||
final Quark<Entity> quark = quarkInContext(cleanId(idShort), false);
|
||||
if (quark.getData() == null)
|
||||
quark.setData(reallyCreateLeaf(quark, Display.getWithNewlines(""), LeafType.CIRCLE_START, null));
|
||||
return (Entity) quark.getData();
|
||||
reallyCreateLeaf(quark, Display.getWithNewlines(""), LeafType.CIRCLE_START, null);
|
||||
return quark.getData();
|
||||
}
|
||||
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)
|
||||
quark.setData(reallyCreateLeaf(quark, Display.getWithNewlines(""), LeafType.CIRCLE_START, null));
|
||||
return (Entity) quark.getData();
|
||||
reallyCreateLeaf(quark, Display.getWithNewlines(""), LeafType.CIRCLE_START, null);
|
||||
return quark.getData();
|
||||
}
|
||||
|
||||
public Entity getEnd() {
|
||||
final Entity p = getCurrentGroup();
|
||||
if (p.isRoot()) {
|
||||
final String idShort = "*end*";
|
||||
final Quark quark = quarkInContext(cleanIdForQuark(idShort), false);
|
||||
final Quark<Entity> quark = quarkInContext(cleanId(idShort), false);
|
||||
if (quark.getData() == null)
|
||||
quark.setData(reallyCreateLeaf(quark, Display.getWithNewlines(""), LeafType.CIRCLE_END, null));
|
||||
return (Entity) quark.getData();
|
||||
reallyCreateLeaf(quark, Display.getWithNewlines(""), LeafType.CIRCLE_END, null);
|
||||
return quark.getData();
|
||||
}
|
||||
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)
|
||||
quark.setData(reallyCreateLeaf(quark, Display.getWithNewlines(""), LeafType.CIRCLE_END, null));
|
||||
return (Entity) quark.getData();
|
||||
reallyCreateLeaf(quark, Display.getWithNewlines(""), LeafType.CIRCLE_END, null);
|
||||
return quark.getData();
|
||||
}
|
||||
|
||||
public Entity getHistorical() {
|
||||
final Entity g = getCurrentGroup();
|
||||
if (g.isRoot()) {
|
||||
final String idShort = "*historical*";
|
||||
final Quark quark = quarkInContext(cleanIdForQuark(idShort), false);
|
||||
final Quark<Entity> quark = quarkInContext(cleanId(idShort), false);
|
||||
if (quark.getData() == null)
|
||||
quark.setData(reallyCreateLeaf(quark, Display.getWithNewlines(""), LeafType.PSEUDO_STATE, null));
|
||||
return (Entity) quark.getData();
|
||||
reallyCreateLeaf(quark, Display.getWithNewlines(""), LeafType.PSEUDO_STATE, null);
|
||||
return quark.getData();
|
||||
}
|
||||
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)
|
||||
quark.setData(reallyCreateLeaf(quark, Display.getWithNewlines(""), LeafType.PSEUDO_STATE, null));
|
||||
return (Entity) quark.getData();
|
||||
reallyCreateLeaf(quark, Display.getWithNewlines(""), LeafType.PSEUDO_STATE, null);
|
||||
return quark.getData();
|
||||
}
|
||||
|
||||
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);
|
||||
final Entity g = getCurrentGroup();
|
||||
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);
|
||||
endGroup();
|
||||
return result;
|
||||
@ -146,27 +140,27 @@ public class StateDiagram extends AbstractEntityDiagram {
|
||||
final Entity g = getCurrentGroup();
|
||||
if (g.isRoot()) {
|
||||
final String idShort = "*deephistory*";
|
||||
final Quark quark = quarkInContext(cleanIdForQuark(idShort), false);
|
||||
final Quark<Entity> quark = quarkInContext(cleanId(idShort), false);
|
||||
if (quark.getData() == null)
|
||||
quark.setData(reallyCreateLeaf(quark, Display.getWithNewlines(""), LeafType.DEEP_HISTORY, null));
|
||||
return (Entity) quark.getData();
|
||||
reallyCreateLeaf(quark, Display.getWithNewlines(""), LeafType.DEEP_HISTORY, null);
|
||||
return quark.getData();
|
||||
}
|
||||
|
||||
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)
|
||||
quark.setData(reallyCreateLeaf(quark, Display.getWithNewlines(""), LeafType.DEEP_HISTORY, null));
|
||||
return (Entity) quark.getData();
|
||||
reallyCreateLeaf(quark, Display.getWithNewlines(""), LeafType.DEEP_HISTORY, null);
|
||||
return quark.getData();
|
||||
|
||||
}
|
||||
|
||||
public Entity getDeepHistory(String idShort) {
|
||||
final Quark quark = quarkInContext(cleanIdForQuark(idShort), false);
|
||||
// final Quark codeGroup = buildFromFullPath(idShort);
|
||||
final Quark<Entity> quark = quarkInContext(cleanId(idShort), false);
|
||||
|
||||
gotoGroup(quark, Display.getWithNewlines(quark), GroupType.STATE);
|
||||
final Entity g = getCurrentGroup();
|
||||
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);
|
||||
endGroup();
|
||||
return result;
|
||||
@ -174,42 +168,34 @@ public class StateDiagram extends AbstractEntityDiagram {
|
||||
|
||||
public boolean concurrentState(char direction) {
|
||||
final Entity cur = getCurrentGroup();
|
||||
// printlink("BEFORE");
|
||||
if (cur.isRoot() == false && cur.getGroupType() == GroupType.CONCURRENT_STATE) {
|
||||
super.endGroup();
|
||||
}
|
||||
getCurrentGroup().setConcurrentSeparator(direction);
|
||||
|
||||
if (cur.getGroupType() == GroupType.CONCURRENT_STATE)
|
||||
super.endGroup();
|
||||
|
||||
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);
|
||||
final Entity conc1 = getCurrentGroup();
|
||||
if (cur.isRoot() == false && cur.getGroupType() == GroupType.STATE) {
|
||||
// cur.moveEntitiesTo(conc1);
|
||||
getPlasma().moveAllChildOfToAnewFather(cur.getQuark(), conc1.getQuark());
|
||||
super.endGroup();
|
||||
getCurrentGroup().setConcurrentSeparator(direction);
|
||||
// // final Entity conc1 = getCurrentGroup();
|
||||
// if (cur.getGroupType() == GroupType.STATE) {
|
||||
//
|
||||
//// 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;
|
||||
}
|
||||
|
||||
// private void printlink(String comment) {
|
||||
// Log.println("COMMENT="+comment);
|
||||
// for (Link l : getLinks()) {
|
||||
// Log.println(l);
|
||||
// }
|
||||
// }
|
||||
|
||||
@Override
|
||||
public boolean endGroup() {
|
||||
final Entity cur = getCurrentGroup();
|
||||
if (cur.isRoot() == false && cur.getGroupType() == GroupType.CONCURRENT_STATE)
|
||||
if (cur.getGroupType() == GroupType.CONCURRENT_STATE)
|
||||
super.endGroup();
|
||||
|
||||
return super.endGroup();
|
||||
@ -231,21 +217,21 @@ public class StateDiagram extends AbstractEntityDiagram {
|
||||
for (Link link : this.getLinks()) {
|
||||
final Entity parent1 = getGroupParentIfItIsConcurrentState(link.getEntity1());
|
||||
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 "
|
||||
+ link.getEntity1().getName() + " and " + link.getEntity2().getName() + ")";
|
||||
}
|
||||
|
||||
}
|
||||
return super.checkFinalError();
|
||||
}
|
||||
|
||||
private static boolean isCompatible(Entity parent1, Entity parent2) {
|
||||
if (parent1 == null && parent2 == null) {
|
||||
if (parent1 == null && parent2 == null)
|
||||
return true;
|
||||
}
|
||||
if (parent1 != null ^ parent2 != null) {
|
||||
|
||||
if (parent1 != null ^ parent2 != null)
|
||||
return false;
|
||||
}
|
||||
|
||||
assert parent1 != null && parent2 != null;
|
||||
return parent1 == parent2;
|
||||
}
|
||||
@ -253,9 +239,9 @@ public class StateDiagram extends AbstractEntityDiagram {
|
||||
private static Entity getGroupParentIfItIsConcurrentState(Entity ent) {
|
||||
Entity parent = ent.getParentContainer();
|
||||
while (parent != null) {
|
||||
if (parent.getGroupType() == GroupType.CONCURRENT_STATE) {
|
||||
if (parent.getGroupType() == GroupType.CONCURRENT_STATE)
|
||||
return parent;
|
||||
}
|
||||
|
||||
parent = parent.getParentContainer();
|
||||
}
|
||||
return null;
|
||||
|
@ -72,13 +72,13 @@ public class CommandAddField extends SingleLineCommand2<StateDiagram> {
|
||||
throws NoSuchColorException {
|
||||
final String codeString = arg.getLazzy("CODE", 0);
|
||||
|
||||
final Quark quark;
|
||||
if (diagram.currentQuark().getName().equals(codeString) && diagram.currentQuark().getData() != null)
|
||||
quark = diagram.currentQuark();
|
||||
final Quark<Entity> quark;
|
||||
if (diagram.getCurrentGroup().getName().equals(codeString))
|
||||
quark = diagram.getCurrentGroup().getQuark();
|
||||
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)
|
||||
entity = diagram.reallyCreateLeaf(quark, Display.getWithNewlines(quark), LeafType.STATE, null);
|
||||
|
||||
|
@ -58,9 +58,9 @@ public class CommandConcurrentState extends SingleLineCommand2<StateDiagram> {
|
||||
|
||||
@Override
|
||||
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.error("Error 42");
|
||||
}
|
||||
|
||||
|
@ -110,9 +110,7 @@ public class CommandCreatePackage2 extends SingleLineCommand2<StateDiagram> {
|
||||
throws NoSuchColorException {
|
||||
|
||||
final String idShort = getNotNull(arg, "CODE1", "CODE2");
|
||||
// final Quark idNewLong = diagram.buildFullyQualified(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);
|
||||
String display = getNotNull(arg, "DISPLAY1", "DISPLAY2");
|
||||
if (display == null)
|
||||
display = quark.getName();
|
||||
|
@ -115,16 +115,15 @@ public class CommandCreatePackageState extends SingleLineCommand2<StateDiagram>
|
||||
throws NoSuchColorException {
|
||||
|
||||
final String idShort = getNotNull(arg, "CODE1", "CODE2");
|
||||
final Quark 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();
|
||||
final Quark<Entity> quark = diagram.quarkInContext(idShort, false);
|
||||
|
||||
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();
|
||||
if (display != null)
|
||||
p.setDisplay(Display.getWithNewlines(display));
|
||||
|
||||
final String stereotype = arg.get("STEREOTYPE", 0);
|
||||
if (stereotype != null)
|
||||
p.setStereotype(Stereotype.build(stereotype));
|
||||
|
@ -113,10 +113,8 @@ public class CommandCreateState extends SingleLineCommand2<StateDiagram> {
|
||||
throws NoSuchColorException {
|
||||
final String idShort = arg.getLazzy("CODE", 0);
|
||||
|
||||
final Quark quark = diagram.quarkInContext(diagram.cleanIdForQuark(idShort), false);
|
||||
//
|
||||
// final Quark ident = diagram.buildFromName(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(idShort));
|
||||
// final Quark code = diagram.buildFromFullPath(idShort);
|
||||
final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(idShort), false);
|
||||
|
||||
String display = arg.getLazzy("DISPLAY", 0);
|
||||
if (display == null)
|
||||
display = quark.getName();
|
||||
@ -129,7 +127,7 @@ public class CommandCreateState extends SingleLineCommand2<StateDiagram> {
|
||||
return CommandExecutionResult.error("The state " + quark.getName()
|
||||
+ " has been created in a concurrent state : it cannot be used here.");
|
||||
|
||||
Entity ent = (Entity) quark.getData();
|
||||
Entity ent = quark.getData();
|
||||
if (ent == null)
|
||||
ent = diagram.reallyCreateLeaf(quark, Display.getWithNewlines(display), type, null);
|
||||
|
||||
|
@ -166,21 +166,21 @@ abstract class CommandLinkStateCommon extends SingleLineCommand2<StateDiagram> {
|
||||
|
||||
if (code.startsWith("=") && code.endsWith("=")) {
|
||||
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)
|
||||
return (Entity) quark.getData();
|
||||
return quark.getData();
|
||||
return diagram.reallyCreateLeaf(quark, Display.getWithNewlines(quark), LeafType.SYNCHRO_BAR, null);
|
||||
}
|
||||
|
||||
if (diagram.currentQuark().getName().equals(code) && diagram.currentQuark().getData() != null)
|
||||
return (Entity) diagram.currentQuark().getData();
|
||||
if (diagram.getCurrentGroup().getName().equals(code))
|
||||
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)
|
||||
return null;
|
||||
|
||||
if (quark.getData() != null)
|
||||
return (Entity) quark.getData();
|
||||
return quark.getData();
|
||||
return diagram.reallyCreateLeaf(quark, Display.getWithNewlines(quark.getName()), LeafType.STATE, null);
|
||||
}
|
||||
|
||||
|
@ -44,6 +44,7 @@ import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
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,
|
||||
DotMode dotMode, GraphvizVersion graphvizVersion, UmlDiagramType type) {
|
||||
|
||||
SvekNode added = null;
|
||||
final Map<Together, List<SvekNode>> togethers = new LinkedHashMap<>();
|
||||
for (SvekNode node : getNodesOrderedWithoutTop(lines)) {
|
||||
final Collection<Together> togethers = new LinkedHashSet<>();
|
||||
final List<SvekNode> nodesOrderedWithoutTop = getNodesOrderedWithoutTop(lines);
|
||||
for (SvekNode node : nodesOrderedWithoutTop) {
|
||||
final Together together = node.getTogether();
|
||||
if (together == null) {
|
||||
node.appendShape(sb, stringBounder);
|
||||
} else {
|
||||
List<SvekNode> list = togethers.get(together);
|
||||
if (list == null) {
|
||||
list = new ArrayList<>();
|
||||
togethers.put(together, list);
|
||||
}
|
||||
list.add(node);
|
||||
togethers.add(together);
|
||||
}
|
||||
added = node;
|
||||
}
|
||||
|
||||
int t = 0;
|
||||
for (List<SvekNode> list : togethers.values()) {
|
||||
sb.append("subgraph " + getClusterId() + "t" + t + " {\n");
|
||||
for (SvekNode node : list)
|
||||
node.appendShape(sb, stringBounder);
|
||||
sb.append("}\n");
|
||||
t++;
|
||||
}
|
||||
for (Together together : togethers)
|
||||
printTogether(together, sb, nodesOrderedWithoutTop, stringBounder, lines, dotMode, graphvizVersion, type);
|
||||
|
||||
if (skinParam.useRankSame() && dotMode != DotMode.NO_LEFT_RIGHT_AND_XLABEL
|
||||
&& graphvizVersion.ignoreHorizontalLinks() == false)
|
||||
appendRankSame(sb, lines);
|
||||
|
||||
for (Cluster child : getChildren())
|
||||
child.printInternal(sb, lines, stringBounder, dotMode, graphvizVersion, type);
|
||||
for (Cluster child : children) {
|
||||
if (child.group.getTogether() == null)
|
||||
child.printInternal(sb, lines, stringBounder, dotMode, graphvizVersion, type);
|
||||
}
|
||||
|
||||
return added;
|
||||
}
|
||||
@ -605,21 +617,7 @@ public class Cluster implements Moveable {
|
||||
if (result != null)
|
||||
return result;
|
||||
|
||||
final Stereotype stereo = group.getStereotype();
|
||||
|
||||
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) {
|
||||
|
@ -52,7 +52,7 @@ import net.sourceforge.plantuml.style.Style;
|
||||
import net.sourceforge.plantuml.style.StyleSignatureBasic;
|
||||
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 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) {
|
||||
this.separator = Separator.fromChar(concurrentSeparator);
|
||||
this.skinParam = skinParam;
|
@ -50,8 +50,8 @@ import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.StringUtils;
|
||||
import net.sourceforge.plantuml.UmlDiagramType;
|
||||
import net.sourceforge.plantuml.awt.geom.XPoint2D;
|
||||
import net.sourceforge.plantuml.baraye.EntityFactory;
|
||||
import net.sourceforge.plantuml.baraye.Entity;
|
||||
import net.sourceforge.plantuml.baraye.EntityFactory;
|
||||
import net.sourceforge.plantuml.command.Position;
|
||||
import net.sourceforge.plantuml.cucadiagram.ICucaDiagram;
|
||||
import net.sourceforge.plantuml.cucadiagram.dot.DotData;
|
||||
|
@ -43,7 +43,6 @@ import java.util.List;
|
||||
import net.sourceforge.plantuml.ColorParam;
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.baraye.Entity;
|
||||
import net.sourceforge.plantuml.baraye.EntityUtils;
|
||||
import net.sourceforge.plantuml.cucadiagram.GroupHierarchy;
|
||||
import net.sourceforge.plantuml.cucadiagram.GroupType;
|
||||
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.svek.image.EntityImageState;
|
||||
|
||||
public final class GroupPngMakerActivity {
|
||||
public final class GroupMakerActivity {
|
||||
|
||||
private final ICucaDiagram diagram;
|
||||
private final Entity group;
|
||||
@ -73,9 +72,9 @@ public final class GroupPngMakerActivity {
|
||||
}
|
||||
|
||||
public Collection<Entity> getChildrenGroups(Entity parent) {
|
||||
if (parent.isRoot())
|
||||
if (parent.isRoot())
|
||||
return diagram.getChildrenGroups(group);
|
||||
|
||||
|
||||
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.group = group;
|
||||
this.stringBounder = stringBounder;
|
||||
@ -94,12 +93,12 @@ public final class GroupPngMakerActivity {
|
||||
private List<Link> getPureInnerLinks() {
|
||||
final List<Link> result = new ArrayList<>();
|
||||
for (Link link : diagram.getLinks()) {
|
||||
final Entity e1 = (Entity) link.getEntity1();
|
||||
final Entity e2 = (Entity) link.getEntity2();
|
||||
final Entity e1 = link.getEntity1();
|
||||
final Entity e2 = link.getEntity2();
|
||||
if (e1.getParentContainer() == group && e1.isGroup() == false && e2.getParentContainer() == group
|
||||
&& e2.isGroup() == false)
|
||||
&& e2.isGroup() == false)
|
||||
result.add(link);
|
||||
|
||||
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -109,14 +108,14 @@ public final class GroupPngMakerActivity {
|
||||
}
|
||||
|
||||
public IEntityImage getImage() throws IOException, InterruptedException {
|
||||
if (group.countChildren() == 0) {
|
||||
if (group.countChildren() == 0)
|
||||
return new EntityImageState(group, diagram.getSkinParam());
|
||||
}
|
||||
|
||||
final List<Link> links = getPureInnerLinks();
|
||||
final ISkinParam skinParam = diagram.getSkinParam();
|
||||
|
||||
final DotData dotData = new DotData(group, links, group.leafs(), diagram.getUmlDiagramType(),
|
||||
skinParam, new InnerGroupHierarchy(), diagram.getEntityFactory(), false, DotMode.NORMAL,
|
||||
final DotData dotData = new DotData(group, links, group.leafs(), diagram.getUmlDiagramType(), skinParam,
|
||||
new InnerGroupHierarchy(), diagram.getEntityFactory(), false, DotMode.NORMAL,
|
||||
diagram.getNamespaceSeparator(), diagram.getPragma());
|
||||
|
||||
final GeneralImageBuilder svek2 = new GeneralImageBuilder(dotData, diagram.getEntityFactory(),
|
@ -48,7 +48,6 @@ import net.sourceforge.plantuml.cucadiagram.GroupType;
|
||||
import net.sourceforge.plantuml.cucadiagram.ICucaDiagram;
|
||||
import net.sourceforge.plantuml.cucadiagram.LeafType;
|
||||
import net.sourceforge.plantuml.cucadiagram.Link;
|
||||
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
||||
import net.sourceforge.plantuml.cucadiagram.dot.DotData;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
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.EntityImageStateCommon;
|
||||
|
||||
public final class GroupPngMakerState {
|
||||
public final class GroupMakerState {
|
||||
|
||||
private final ICucaDiagram diagram;
|
||||
private final Entity group;
|
||||
@ -77,9 +76,18 @@ public final class GroupPngMakerState {
|
||||
|
||||
public Collection<Entity> getChildrenGroups(Entity parent) {
|
||||
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) {
|
||||
@ -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.stringBounder = stringBounder;
|
||||
this.group = group;
|
||||
@ -111,8 +119,7 @@ public final class GroupPngMakerState {
|
||||
final ISkinParam skinParam = diagram.getSkinParam();
|
||||
|
||||
final Style style = EntityImageStateCommon.getStyleState(group, skinParam);
|
||||
// final Style styleHeader = EntityImageStateCommon.getStyleStateHeader(group,
|
||||
// skinParam);
|
||||
|
||||
final Style styleTitle = EntityImageStateCommon.getStyleStateTitle(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)
|
||||
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)
|
||||
return svek2.buildImage(null, new String[0]);
|
||||
return createGeneralImageBuilder(group.leafs(), skinParam).buildImage(null, new String[0]);
|
||||
|
||||
if (group.getGroupType() != GroupType.STATE)
|
||||
throw new UnsupportedOperationException(group.getGroupType().toString());
|
||||
@ -145,7 +142,6 @@ public final class GroupPngMakerState {
|
||||
if (borderColor == null)
|
||||
borderColor = style.value(PName.LineColor).asColor(skinParam.getIHtmlColorSet());
|
||||
|
||||
final Stereotype stereo = group.getStereotype();
|
||||
HColor backColor = group.getColors().getColor(ColorType.BACK);
|
||||
if (backColor == null)
|
||||
backColor = style.value(PName.BackGroundColor).asColor(skinParam.getIHtmlColorSet());
|
||||
@ -154,41 +150,49 @@ public final class GroupPngMakerState {
|
||||
if (stroke == null)
|
||||
stroke = style.getStroke();
|
||||
|
||||
final TextBlock attribute = ((Entity) group).getStateHeader(skinParam);
|
||||
|
||||
final Stereotype stereotype = group.getStereotype();
|
||||
final boolean withSymbol = stereotype != null && stereotype.isWithOOSymbol();
|
||||
|
||||
final boolean containsOnlyConcurrentStates = containsOnlyConcurrentStates(dotData);
|
||||
final IEntityImage image = containsOnlyConcurrentStates ? buildImageForConcurrentState(dotData)
|
||||
: svek2.buildImage(null, new String[0]);
|
||||
final IEntityImage image;
|
||||
if (containsSomeConcurrentStates()) {
|
||||
final List<IEntityImage> inners = new ArrayList<>();
|
||||
inners.add(createGeneralImageBuilder(filter(group.leafs()), skinParam).buildImage(null, new String[0]));
|
||||
for (Entity inner : group.leafs())
|
||||
if (inner.getLeafType() == LeafType.STATE_CONCURRENT)
|
||||
inners.add(inner.getSvekImage());
|
||||
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());
|
||||
return new InnerStateAutonom(image, title, attribute, borderColor, backColor, group.getUrl99(), withSymbol,
|
||||
stroke, rounded, shadowing, bodyColor);
|
||||
final boolean withSymbol = group.getStereotype() != null && group.getStereotype().isWithOOSymbol();
|
||||
return new InnerStateAutonom(image, title, group.getStateHeader(skinParam), borderColor, backColor,
|
||||
group.getUrl99(), withSymbol, stroke, rounded, shadowing, bodyColor);
|
||||
|
||||
}
|
||||
|
||||
private IEntityImage buildImageForConcurrentState(DotData dotData) {
|
||||
final List<IEntityImage> inners = new ArrayList<>();
|
||||
for (Entity inner : dotData.getLeafs())
|
||||
inners.add(inner.getSvekImage());
|
||||
|
||||
return new CucaDiagramFileMakerSvek2InternalImage(inners, dotData.getTopParent().getConcurrentSeparator(),
|
||||
dotData.getSkinParam(), group.getStereotype());
|
||||
protected GeneralImageBuilder createGeneralImageBuilder(Collection<Entity> leafs, ISkinParam skinParam) {
|
||||
final DotData dotData = new DotData(group, getPureInnerLinks(), leafs, diagram.getUmlDiagramType(), skinParam,
|
||||
new InnerGroupHierarchy(), diagram.getEntityFactory(), diagram.isHideEmptyDescriptionForState(),
|
||||
DotMode.NORMAL, diagram.getNamespaceSeparator(), diagram.getPragma());
|
||||
|
||||
return new GeneralImageBuilder(dotData, diagram.getEntityFactory(), diagram.getSource(), diagram.getPragma(),
|
||||
stringBounder, SName.stateDiagram);
|
||||
}
|
||||
|
||||
private boolean containsOnlyConcurrentStates(DotData dotData) {
|
||||
for (Entity leaf : dotData.getLeafs()) {
|
||||
if (leaf instanceof Entity == false)
|
||||
return false;
|
||||
private Collection<Entity> filter(Collection<Entity> leafs) {
|
||||
final List<Entity> result = new ArrayList<>();
|
||||
for (Entity leaf : leafs)
|
||||
if (leaf.getLeafType() != LeafType.STATE_CONCURRENT)
|
||||
result.add(leaf);
|
||||
|
||||
if (((Entity) leaf).getLeafType() != LeafType.STATE_CONCURRENT)
|
||||
return false;
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
return true;
|
||||
private boolean containsSomeConcurrentStates() {
|
||||
for (Entity entity : group.leafs())
|
||||
if (entity.getLeafType() == LeafType.STATE_CONCURRENT)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
@ -35,6 +35,8 @@
|
||||
*/
|
||||
package net.sourceforge.plantuml.svek;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import net.sourceforge.plantuml.awt.geom.XDimension2D;
|
||||
import net.sourceforge.plantuml.graphic.AbstractTextBlock;
|
||||
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,
|
||||
HColor backColor, Url url, boolean withSymbol, UStroke stroke, double rounded, double shadowing,
|
||||
HColor bodyColor) {
|
||||
this.im = im;
|
||||
this.im = Objects.requireNonNull(im);
|
||||
this.withSymbol = withSymbol;
|
||||
this.title = title;
|
||||
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 titreHeight = IEntityImage.MARGIN + text.getHeight() + IEntityImage.MARGIN_LINE;
|
||||
// final HColor foo = im.getBackcolor();
|
||||
|
||||
final RoundedContainer r = new RoundedContainer(total, titreHeight, attr.getHeight() + marginForFields,
|
||||
borderColor, backColor, bodyColor, stroke, rounded, shadowing);
|
||||
|
||||
|
@ -85,7 +85,8 @@ public class EntityImageState extends EntityImageStateCommon {
|
||||
}
|
||||
|
||||
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;
|
||||
if (withSymbol)
|
||||
heightSymbol += 2 * smallRadius + smallMarginY;
|
||||
@ -95,7 +96,7 @@ public class EntityImageState extends EntityImageStateCommon {
|
||||
}
|
||||
|
||||
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)
|
||||
ug.startUrl(url);
|
||||
|
||||
|
@ -34,7 +34,6 @@
|
||||
*/
|
||||
package net.sourceforge.plantuml.version;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
|
@ -81,7 +81,7 @@ public class Version {
|
||||
}
|
||||
|
||||
public static int beta() {
|
||||
final int beta = 3;
|
||||
final int beta = 4;
|
||||
return beta;
|
||||
}
|
||||
|
||||
|
@ -139,7 +139,7 @@ abstract class XmiClassDiagramAbstract implements XmlDiagramTransformer {
|
||||
|
||||
cla.setAttribute("xmi.id", entity.getUid());
|
||||
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)
|
||||
cla.setAttribute("namespace", CucaDiagramXmiMaker.getModel(classDiagram));
|
||||
|
@ -58,7 +58,6 @@ import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.cucadiagram.LeafType;
|
||||
import net.sourceforge.plantuml.cucadiagram.Link;
|
||||
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
||||
import net.sourceforge.plantuml.plasma.Quark;
|
||||
import net.sourceforge.plantuml.statediagram.StateDiagram;
|
||||
import net.sourceforge.plantuml.text.Guillemet;
|
||||
import net.sourceforge.plantuml.xml.XmlFactories;
|
||||
@ -163,8 +162,7 @@ public class ScxmlStateDiagramStandard {
|
||||
}
|
||||
|
||||
private String getId(Entity entity) {
|
||||
final Quark quark = entity.getQuark();
|
||||
return quark.getName().replaceAll("\\*", "");
|
||||
return entity.getName().replaceAll("\\*", "");
|
||||
}
|
||||
|
||||
public void transformerXml(OutputStream os) throws TransformerException, ParserConfigurationException {
|
||||
|
Loading…
Reference in New Issue
Block a user