1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-11-22 13:05:09 +00:00

fix: improve port management

https://github.com/plantuml/plantuml/discussions/1325
This commit is contained in:
Arnaud Roques 2023-03-14 18:48:52 +01:00
parent 534fc27942
commit 4e0af3328c
48 changed files with 97 additions and 97 deletions

View File

@ -189,7 +189,7 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
}
final public Quark<Entity> quarkInContext(String full, boolean specialForCreateClass) {
final public Quark<Entity> quarkInContext(boolean reuseExistingChild, String full) {
final String sep = getNamespaceSeparator();
if (sep == null) {
final Quark<Entity> result = entityFactory.firstWithName(full);
@ -203,7 +203,7 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
return entityFactory.root().child(full.substring(sep.length()));
final int x = full.indexOf(sep);
if (x == -1) {
if (specialForCreateClass == false && entityFactory.countByName(full) == 1) {
if (reuseExistingChild && entityFactory.countByName(full) == 1) {
final Quark<Entity> byName = entityFactory.firstWithName(full);
assert byName != null;
if (byName != currentQuark)

View File

@ -68,7 +68,7 @@ public class ActivityDiagram extends CucaDiagram {
public void startIf(String optionalCodeString) {
final String idShort = optionalCodeString == null ? getAutoBranch() : optionalCodeString;
final Quark<Entity> quark = quarkInContext(cleanId(idShort), false);
final Quark<Entity> quark = quarkInContext(true, cleanId(idShort));
final Entity br = reallyCreateLeaf(quark, Display.create(""), LeafType.BRANCH, null);
currentContext = new ConditionalContext(currentContext, br, Direction.DOWN);
}
@ -78,7 +78,7 @@ public class ActivityDiagram extends CucaDiagram {
}
public Entity getStart() {
final Quark<Entity> quark = quarkInContext("start", false);
final Quark<Entity> quark = quarkInContext(true, "start");
if (quark.getData() == null)
reallyCreateLeaf(quark, Display.getWithNewlines("start"), LeafType.CIRCLE_START, null);
@ -87,7 +87,7 @@ public class ActivityDiagram extends CucaDiagram {
public Entity getEnd(String suppId) {
final String tmp = suppId == null ? "end" : "end$" + suppId;
final Quark<Entity> quark = quarkInContext(tmp, false);
final Quark<Entity> quark = quarkInContext(true, tmp);
if (quark.getData() == null)
reallyCreateLeaf(quark, Display.getWithNewlines("end"), LeafType.CIRCLE_END, null);
@ -141,7 +141,7 @@ public class ActivityDiagram extends CucaDiagram {
final String idShort = "##" + this.getUniqueSequence();
final Quark<Entity> quark = quarkInContext(idShort, false);
final Quark<Entity> quark = quarkInContext(true, idShort);
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<Entity> idNewLong = quarkInContext(idShort, false);
final Quark<Entity> idNewLong = quarkInContext(true, idShort);
gotoGroup(idNewLong, Display.getWithNewlines("code"), GroupType.CONCURRENT_ACTIVITY);
lastEntityConsulted = null;
lastEntityBrancheConsulted = null;

View File

@ -209,10 +209,10 @@ public class CommandLinkActivity extends SingleLineCommand2<ActivityDiagram> {
final String idShort = arg.get("CODE" + suf, 0);
if (idShort != null) {
if (partition != null) {
final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(partition), false);
final Quark<Entity> quark = diagram.quarkInContext(true, diagram.cleanId(partition));
diagram.gotoGroup(quark, Display.getWithNewlines(quark), GroupType.PACKAGE);
}
final Quark<Entity> ident = diagram.quarkInContext(diagram.cleanId(idShort), false);
final Quark<Entity> ident = diagram.quarkInContext(true, diagram.cleanId(idShort));
final LeafType type = getTypeIfExisting(diagram, ident);
Entity result = ident.getData();
@ -226,7 +226,7 @@ public class CommandLinkActivity extends SingleLineCommand2<ActivityDiagram> {
}
final String bar = arg.get("BAR" + suf, 0);
if (bar != null) {
final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(bar), false);
final Quark<Entity> quark = diagram.quarkInContext(true, diagram.cleanId(bar));
Entity result = quark.getData();
if (result == null)
result = diagram.reallyCreateLeaf(quark, Display.getWithNewlines(bar), LeafType.SYNCHRO_BAR, null);
@ -236,11 +236,11 @@ 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<Entity> quark = diagram.quarkInContext(diagram.cleanId(partition), false);
final Quark<Entity> quark = diagram.quarkInContext(true, diagram.cleanId(partition));
diagram.gotoGroup(quark, Display.getWithNewlines(partition), GroupType.PACKAGE);
}
final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(quotedString), false);
final Quark<Entity> quark = diagram.quarkInContext(true, diagram.cleanId(quotedString));
final LeafType type = getTypeIfExisting(diagram, quark);
Entity result = quark.getData();
@ -254,10 +254,10 @@ public class CommandLinkActivity extends SingleLineCommand2<ActivityDiagram> {
final String quoteInvisibleString = arg.get("QUOTED_INVISIBLE" + suf, 0);
if (quoteInvisibleString != null) {
if (partition != null) {
final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(partition), false);
final Quark<Entity> quark = diagram.quarkInContext(true, diagram.cleanId(partition));
diagram.gotoGroup(quark, Display.getWithNewlines(quark), GroupType.PACKAGE);
}
final Quark<Entity> identInvisible = diagram.quarkInContext(diagram.cleanId(quoteInvisibleString), false);
final Quark<Entity> identInvisible = diagram.quarkInContext(true, diagram.cleanId(quoteInvisibleString));
Entity result = identInvisible.getData();
if (result == null)
result = diagram.reallyCreateLeaf(identInvisible, Display.getWithNewlines(identInvisible.getName()),

View File

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

View File

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

View File

@ -70,7 +70,7 @@ 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<Entity> quark = diagram.quarkInContext(diagram.cleanId(idShort), false);
final Quark<Entity> quark = diagram.quarkInContext(true, diagram.cleanId(idShort));
Entity entity = quark.getData();
if (entity == null)
entity = diagram.reallyCreateLeaf(quark, Display.getWithNewlines(quark), LeafType.CLASS, null);

View File

@ -139,7 +139,7 @@ public class CommandCreateClass extends SingleLineCommand2<ClassDiagram> {
final String stereo = arg.get("STEREO", 0);
final Quark<Entity> quark = diagram.quarkInContext(idShort, true);
final Quark<Entity> quark = diagram.quarkInContext(false, idShort);
Entity entity = quark.getData();

View File

@ -167,7 +167,7 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
final String stereotype = line0.get("STEREO", 0);
final Quark<Entity> quark = diagram.quarkInContext(idShort, true);
final Quark<Entity> quark = diagram.quarkInContext(false, idShort);
Entity entity = quark.getData();
@ -278,7 +278,7 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
for (String s : codes.split(",")) {
final String idShort = StringUtils.trin(s);
final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(idShort), true);
final Quark<Entity> quark = diagram.quarkInContext(false, diagram.cleanId(idShort));
Entity cl2 = quark.getData();
if (cl2 == null)
cl2 = diagram.reallyCreateLeaf(quark, Display.getWithNewlines(quark.getName()), type2, null);
@ -313,7 +313,7 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
final String stereotype = line0.get("STEREO", 0);
final Quark<Entity> quark = diagram.quarkInContext(idShort, true);
final Quark<Entity> quark = diagram.quarkInContext(false, idShort);
Display display = Display.getWithNewlines(displayString);
if (Display.isNull(display))

View File

@ -206,7 +206,7 @@ public class CommandCreateElementFull2 extends SingleLineCommand2<ClassDiagram>
final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(codeRaw);
final Display display = Display.getWithNewlines(displayRaw == null ? idShort : displayRaw);
final Quark<Entity> quark = diagram.quarkInContext(idShort, false);
final Quark<Entity> quark = diagram.quarkInContext(true, idShort);
Entity entity = quark.getData();
if (entity == null)
entity = diagram.reallyCreateLeaf(quark, display, type, usymbol);

View File

@ -65,7 +65,7 @@ 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<Entity> quark = diagram.quarkInContext(diagram.cleanId(idShort), false);
final Quark<Entity> quark = diagram.quarkInContext(true, diagram.cleanId(idShort));
if (quark.getData() != null)
return CommandExecutionResult.error("Already existing : " + quark.getName());

View File

@ -144,7 +144,7 @@ public class CommandHideShowByGender extends SingleLineCommand2<UmlDiagram> {
} else if (arg1.startsWith("<<")) {
gender = EntityGenderUtils.byStereotype(arg1);
} else {
final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(arg1), false);
final Quark<Entity> quark = diagram.quarkInContext(true, diagram.cleanId(arg1));
if (quark.getData() == null)
return CommandExecutionResult.error("No such element " + quark.getName());
final Entity entity = quark.getData();
@ -189,7 +189,7 @@ public class CommandHideShowByGender extends SingleLineCommand2<UmlDiagram> {
gender = EntityGenderUtils.byStereotype(arg1);
} else {
arg1 = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg1);
final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(arg1), false);
final Quark<Entity> quark = diagram.quarkInContext(true, diagram.cleanId(arg1));
Entity entity = quark.getData();
if (entity == null)
return CommandExecutionResult.error("No such element " + quark.getName());

View File

@ -197,8 +197,8 @@ final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrOb
ent2String = diagram.removePortId(ent2String);
}
final Quark<Entity> quark1 = diagram.quarkInContext(ent1String, false);
final Quark<Entity> quark2 = diagram.quarkInContext(ent2String, false);
final Quark<Entity> quark1 = diagram.quarkInContext(true, ent1String);
final Quark<Entity> quark2 = diagram.quarkInContext(true, ent2String);
Entity cl1 = quark1.getData();
if (cl1 == null)
@ -311,8 +311,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));
final Quark<Entity> quark1A = diagram.quarkInContext(name1A, false);
final Quark<Entity> quark1B = diagram.quarkInContext(name1B, false);
final Quark<Entity> quark1A = diagram.quarkInContext(true, name1A);
final Quark<Entity> quark1B = diagram.quarkInContext(true, name1B);
if (quark1A.getData() != null == false)
return CommandExecutionResult.error("No class " + name1A);
@ -324,7 +324,7 @@ final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrOb
final Entity cl1B = quark1B.getData();
final String id2 = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("ENT2", 0), "\"");
final Quark<Entity> ent2 = diagram.quarkInContext(id2, false);
final Quark<Entity> ent2 = diagram.quarkInContext(true, id2);
Entity cl2 = ent2.getData();
if (cl2 == null)
@ -344,8 +344,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<Entity> quark2A = diagram.quarkInContext(name2A, false);
final Quark<Entity> quark2B = diagram.quarkInContext(name2B, false);
final Quark<Entity> quark2A = diagram.quarkInContext(true, name2A);
final Quark<Entity> quark2B = diagram.quarkInContext(true, name2B);
if (quark2A.getData() != null == false)
return CommandExecutionResult.error("No class " + name2A);
@ -357,7 +357,7 @@ final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrOb
final Entity cl2B = quark2B.getData();
final String id1 = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("ENT1", 0), "\"");
final Quark<Entity> ent1 = diagram.quarkInContext(id1, false);
final Quark<Entity> ent1 = diagram.quarkInContext(true, id1);
Entity cl1 = (Entity) ent1.getData();
if (cl1 == null)
@ -380,10 +380,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<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);
final Quark<Entity> quark1A = diagram.quarkInContext(true, name1A);
final Quark<Entity> quark1B = diagram.quarkInContext(true, name1B);
final Quark<Entity> quark2A = diagram.quarkInContext(true, name2A);
final Quark<Entity> quark2B = diagram.quarkInContext(true, name2B);
if (quark1A.getData() != null == false)
return CommandExecutionResult.error("No class " + name1A);

View File

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

View File

@ -69,7 +69,7 @@ public class CommandStereotype extends SingleLineCommand2<ClassDiagram> {
final String name = arg.get("NAME", 0);
final String stereotype = arg.get("STEREO", 0);
final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(name), false);
final Quark<Entity> quark = diagram.quarkInContext(true, diagram.cleanId(name));
final Entity entity = quark.getData();
if (entity == null)
return CommandExecutionResult.error("No such class " + quark.getName());

View File

@ -75,7 +75,7 @@ public class CommandUrl extends SingleLineCommand2<AbstractEntityDiagram> {
protected CommandExecutionResult executeArg(AbstractEntityDiagram diagram, LineLocation location, RegexResult arg) {
final String idShort = arg.get("CODE", 0);
final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(idShort), false);
final Quark<Entity> quark = diagram.quarkInContext(true, diagram.cleanId(idShort));
final Entity entity = quark.getData();
if (entity == null)
return CommandExecutionResult.error(quark.getName() + " does not exist");

View File

@ -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<Entity> quark = diagram.quarkInContext(diagram.cleanId(idShort), true);
final Quark<Entity> quark = diagram.quarkInContext(false, diagram.cleanId(idShort));
final CommandExecutionResult status = diagram.gotoGroup(quark, Display.getWithNewlines(quark.getName()),
GroupType.PACKAGE);
if (status.isOk() == false)

View File

@ -86,7 +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<Entity> quark = diagram.quarkInContext(diagram.cleanId(idShort), true);
final Quark<Entity> quark = diagram.quarkInContext(false, diagram.cleanId(idShort));
final String disp = arg.getLazzy("DISPLAY", 0);
final Display display = Display.getWithNewlines(disp);

View File

@ -82,7 +82,7 @@ public class CommandNamespaceEmpty extends SingleLineCommand2<ClassDiagram> {
throws NoSuchColorException {
final String idShort = arg.get("NAME", 0);
final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(idShort), true);
final Quark<Entity> quark = diagram.quarkInContext(false, diagram.cleanId(idShort));
if (quark.getData() != null)
return CommandExecutionResult.error("Already exists " + quark.getName());

View File

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

View File

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

View File

@ -136,7 +136,7 @@ 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<Entity> quark = diagram.quarkInContext(diagram.cleanId(idShort), false);
final Quark<Entity> quark = diagram.quarkInContext(true, diagram.cleanId(idShort));
if (quark.getData() != null)
return CommandExecutionResult.error("Note already created: " + quark.getName());

View File

@ -118,7 +118,7 @@ public final class CommandFactoryNoteActivity implements SingleMultiFactoryComma
strings = strings.subList(1, strings.size());
final String codeString = diagram.getUniqueSequence("GMN");
final Quark<Entity> quark = diagram.quarkInContext(codeString, false);
final Quark<Entity> quark = diagram.quarkInContext(true, codeString);
final Entity note = diagram.reallyCreateLeaf(quark, strings, LeafType.NOTE, null);
if (url != null)
note.addUrl(url);
@ -135,7 +135,7 @@ 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<Entity> quark = diagram.quarkInContext(diagram.cleanId(tmp), false);
final Quark<Entity> quark = diagram.quarkInContext(true, diagram.cleanId(tmp));
final Entity note = diagram.createNote(quark, tmp, Display.getWithNewlines(arg.get("NOTE", 0)));
return executeInternal(diagram, arg, note);

View File

@ -219,7 +219,7 @@ public final class CommandFactoryNoteOnEntity implements SingleMultiFactoryComma
return CommandExecutionResult.error("Nothing to note to");
} else {
final Quark<Entity> quark = diagram.quarkInContext(idShort, false);
final Quark<Entity> quark = diagram.quarkInContext(true, idShort);
cl1 = quark.getData();
if (cl1 == null)
return CommandExecutionResult.error("Not known: " + idShort);
@ -243,7 +243,7 @@ public final class CommandFactoryNoteOnEntity implements SingleMultiFactoryComma
}
final String tmp = diagram.getUniqueSequence("GMN");
final Quark<Entity> quark = diagram.quarkInContext(tmp, false);
final Quark<Entity> quark = diagram.quarkInContext(true, tmp);
final Entity note = diagram.reallyCreateLeaf(quark, strings.toDisplay(), LeafType.NOTE, null);
if (stereotypeString != null)

View File

@ -171,7 +171,7 @@ public final class CommandFactoryTipOnEntity implements SingleMultiFactoryComman
final String idShort = line0.get("ENTITY", 0);
final String member = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(line0.get("ENTITY", 1));
final Quark<Entity> quark = diagram.quarkInContext(idShort, false);
final Quark<Entity> quark = diagram.quarkInContext(true, idShort);
final Entity cl1 = quark.getData();
if (cl1 == null)
return CommandExecutionResult.error("Nothing to note to");
@ -180,7 +180,7 @@ public final class CommandFactoryTipOnEntity implements SingleMultiFactoryComman
.withRankdir(diagram.getSkinParam().getRankdir());
final String tmp = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(idShort + "$$$" + position.name());
final Quark<Entity> identTip = diagram.quarkInContext(tmp, false);
final Quark<Entity> identTip = diagram.quarkInContext(true, tmp);
Entity tips = identTip.getData();
if (tips == null) {

View File

@ -74,7 +74,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<Entity> quark = diagram.quarkInContext(idShort, false);
final Quark<Entity> quark = diagram.quarkInContext(true, idShort);
if (display == null)
display = quark.getName();

View File

@ -75,7 +75,7 @@ public class CommandCreatePackageBlock extends SingleLineCommand2<CompositeDiagr
String display = arg.get("DISPLAY", 0);
final String idShort = arg.get("CODE", 0);
final Quark<Entity> quark = diagram.quarkInContext(idShort, false);
final Quark<Entity> quark = diagram.quarkInContext(true, idShort);
if (display == null)
display = quark.getName();

View File

@ -79,8 +79,8 @@ 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<Entity> quark1 = diagram.quarkInContext(diagram.cleanId(ent1), false);
final Quark<Entity> quark2 = diagram.quarkInContext(diagram.cleanId(ent2), false);
final Quark<Entity> quark1 = diagram.quarkInContext(true, diagram.cleanId(ent1));
final Quark<Entity> quark2 = diagram.quarkInContext(true, diagram.cleanId(ent2));
final Entity cl1 = quark1.getData();
if (cl1 == null)
return CommandExecutionResult.error("No such element " + quark1.getName());

View File

@ -94,7 +94,7 @@ public class CommandCreateDomain extends SingleLineCommand2<DescriptionDiagram>
final GroupType type = typeString.equalsIgnoreCase("domain") ? GroupType.DOMAIN : GroupType.REQUIREMENT;
final LeafType type2 = typeString.equalsIgnoreCase("domain") ? LeafType.DOMAIN : LeafType.REQUIREMENT;
final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(codeString), false);
final Quark<Entity> quark = diagram.quarkInContext(true, diagram.cleanId(codeString));
if (quark.getData() != null)
return CommandExecutionResult.error("Object already exists : " + codeString);

View File

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

View File

@ -104,7 +104,7 @@ public class CommandArchimateMultilines extends CommandMultilines2<AbstractEntit
final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString());
final String codeRaw = line0.getLazzy("CODE", 0);
final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(codeRaw), true);
final Quark<Entity> quark = diagram.quarkInContext(false, diagram.cleanId(codeRaw));
if (quark.getData() != null)
return CommandExecutionResult.error("Already exists " + quark.getName());

View File

@ -225,7 +225,7 @@ public class CommandCreateElementFull extends SingleLineCommand2<DescriptionDiag
}
final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(codeRaw), false);
final Quark<Entity> quark = diagram.quarkInContext(false, diagram.cleanId(codeRaw));
if (diagram.isGroup(quark))
return CommandExecutionResult.error("This element (" + quark.getName() + ") is already defined");

View File

@ -162,7 +162,7 @@ public class CommandCreateElementMultilines extends CommandMultilines2<AbstractE
final String stereotype = line0.get("STEREO", 0);
final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(idShort), false);
final Quark<Entity> quark = diagram.quarkInContext(true, diagram.cleanId(idShort));
Entity result = quark.getData();
if (quark.getData() == null)
result = diagram.reallyCreateLeaf(quark, display, type, usymbol);

View File

@ -149,7 +149,7 @@ public class CommandCreateElementParenthesis extends SingleLineCommand2<ClassDia
type = LeafType.DESCRIPTION;
usymbol = USymbols.fromString(symbol, diagram.getSkinParam());
final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(codeRaw), true);
final Quark<Entity> quark = diagram.quarkInContext(false, diagram.cleanId(codeRaw));
if (quark.getData() != null)
return CommandExecutionResult.error("This element (" + quark.getName() + ") is already defined");

View File

@ -302,7 +302,7 @@ public class CommandLinkElement extends SingleLineCommand2<DescriptionDiagram> {
private Entity getDummy(DescriptionDiagram diagram, String ident) {
if (ident.startsWith("()")) {
ident = diagram.cleanId(ident);
final Quark<Entity> quark = diagram.quarkInContext(ident, false);
final Quark<Entity> quark = diagram.quarkInContext(true, ident);
if (quark.getData() != null)
return quark.getData();
return diagram.reallyCreateLeaf(quark, Display.getWithNewlines(quark.getName()), LeafType.DESCRIPTION,
@ -312,7 +312,7 @@ public class CommandLinkElement extends SingleLineCommand2<DescriptionDiagram> {
final char codeChar = ident.length() > 2 ? ident.charAt(0) : 0;
final boolean endWithSlash = ident.endsWith("/");
ident = diagram.cleanId(ident);
final Quark<Entity> quark = diagram.quarkInContext(ident, false);
final Quark<Entity> quark = diagram.quarkInContext(true, ident);
if (diagram.isGroup(quark))
return quark.getData();

View File

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

View File

@ -225,7 +225,7 @@ public abstract class AbstractClassOrObjectDiagram extends AbstractEntityDiagram
if (entity1.getQuark().getParent() == entity2.getQuark().getParent())
quark = entity1.getQuark().getParent().child(idShort);
else
quark = quarkInContext(cleanId(idShort), false);
quark = quarkInContext(true, cleanId(idShort));
point = reallyCreateLeaf(quark, Display.getWithNewlines(""), LeafType.POINT_FOR_ASSOCIATION, null);
}

View File

@ -68,7 +68,7 @@ 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<Entity> quark = diagram.quarkInContext(diagram.cleanId(name), false);
final Quark<Entity> quark = diagram.quarkInContext(true, diagram.cleanId(name));
final Entity entity = quark.getData();
if (entity == null)
return CommandExecutionResult.error("No such entity " + quark.getName());

View File

@ -81,7 +81,7 @@ public class CommandCreateEntityObject extends SingleLineCommand2<AbstractClassO
RegexResult arg) throws NoSuchColorException {
final String idShort = arg.get("NAME", 1);
final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(idShort), false);
final Quark<Entity> quark = diagram.quarkInContext(true, diagram.cleanId(idShort));
final String displayString = arg.get("NAME", 0);
final String stereotype = arg.get("STEREO", 0);

View File

@ -108,7 +108,7 @@ public class CommandCreateEntityObjectMultilines extends CommandMultilines2<Abst
private Entity executeArg0(AbstractClassOrObjectDiagram diagram, RegexResult line0) throws NoSuchColorException {
final String name = line0.get("NAME", 1);
final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(name), false);
final Quark<Entity> quark = diagram.quarkInContext(true, diagram.cleanId(name));
final String displayString = line0.get("NAME", 0);
final String stereotype = line0.get("STEREO", 0);

View File

@ -144,7 +144,7 @@ public class CommandCreateJson extends CommandMultilines2<AbstractEntityDiagram>
private Entity executeArg0(AbstractEntityDiagram diagram, RegexResult line0) throws NoSuchColorException {
final String name = line0.get("NAME", 1);
final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(name), false);
final Quark<Entity> quark = diagram.quarkInContext(true, diagram.cleanId(name));
if (quark.getData() != null)
return null;
final String displayString = line0.get("NAME", 0);

View File

@ -113,7 +113,7 @@ public class CommandCreateJsonSingleLine extends SingleLineCommand2<AbstractClas
private Entity executeArg0(AbstractClassOrObjectDiagram diagram, RegexResult line0) throws NoSuchColorException {
final String name = line0.get("NAME", 1);
final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(name), true);
final Quark<Entity> quark = diagram.quarkInContext(false, diagram.cleanId(name));
if (quark.getData() != null)
return null;

View File

@ -122,7 +122,7 @@ 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<Entity> ident2 = diagram.quarkInContext(dest, false);
final Quark<Entity> ident2 = diagram.quarkInContext(true, dest);
final Entity entity2 = ident2.getData();
if (entity2 == null)
return CommandExecutionResult.error("No such entity " + ident2.getName());
@ -141,7 +141,7 @@ public class CommandCreateMap extends CommandMultilines2<AbstractEntityDiagram>
private Entity executeArg0(AbstractEntityDiagram diagram, RegexResult line0) throws NoSuchColorException {
final String name = line0.get("NAME", 1);
final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(name), false);
final Quark<Entity> quark = diagram.quarkInContext(true, diagram.cleanId(name));
final String displayString = line0.get("NAME", 0);
final String stereotype = line0.get("STEREO", 0);

View File

@ -82,13 +82,13 @@ public class StateDiagram extends AbstractEntityDiagram {
final Entity g = getCurrentGroup();
if (g.isRoot()) {
final String idShort = "*start*";
final Quark<Entity> quark = quarkInContext(cleanId(idShort), false);
final Quark<Entity> quark = quarkInContext(true, cleanId(idShort));
if (quark.getData() == null)
reallyCreateLeaf(quark, Display.getWithNewlines(""), LeafType.CIRCLE_START, null);
return quark.getData();
}
final String idShort = "*start*" + g.getName();
final Quark<Entity> quark = quarkInContext(cleanId(idShort), false);
final Quark<Entity> quark = quarkInContext(true, cleanId(idShort));
if (quark.getData() == null)
reallyCreateLeaf(quark, Display.getWithNewlines(""), LeafType.CIRCLE_START, null);
return quark.getData();
@ -98,13 +98,13 @@ public class StateDiagram extends AbstractEntityDiagram {
final Entity p = getCurrentGroup();
if (p.isRoot()) {
final String idShort = "*end*";
final Quark<Entity> quark = quarkInContext(cleanId(idShort), false);
final Quark<Entity> quark = quarkInContext(true, cleanId(idShort));
if (quark.getData() == null)
reallyCreateLeaf(quark, Display.getWithNewlines(""), LeafType.CIRCLE_END, null);
return quark.getData();
}
final String idShort = "*end*" + p.getName();
final Quark<Entity> quark = quarkInContext(cleanId(idShort), false);
final Quark<Entity> quark = quarkInContext(true, cleanId(idShort));
if (quark.getData() == null)
reallyCreateLeaf(quark, Display.getWithNewlines(""), LeafType.CIRCLE_END, null);
return quark.getData();
@ -114,24 +114,24 @@ public class StateDiagram extends AbstractEntityDiagram {
final Entity g = getCurrentGroup();
if (g.isRoot()) {
final String idShort = "*historical*";
final Quark<Entity> quark = quarkInContext(cleanId(idShort), false);
final Quark<Entity> quark = quarkInContext(true, cleanId(idShort));
if (quark.getData() == null)
reallyCreateLeaf(quark, Display.getWithNewlines(""), LeafType.PSEUDO_STATE, null);
return quark.getData();
}
final String idShort = "*historical*" + g.getName();
final Quark<Entity> quark = quarkInContext(cleanId(idShort), false);
final Quark<Entity> quark = quarkInContext(true, cleanId(idShort));
if (quark.getData() == null)
reallyCreateLeaf(quark, Display.getWithNewlines(""), LeafType.PSEUDO_STATE, null);
return quark.getData();
}
public Entity getHistorical(String idShort) {
final Quark<Entity> quark = quarkInContext(cleanId(idShort), false);
final Quark<Entity> quark = quarkInContext(true, cleanId(idShort));
gotoGroup(quark, Display.getWithNewlines(quark), GroupType.STATE);
final Entity g = getCurrentGroup();
final String tmp = "*historical*" + g.getName();
final Quark<Entity> ident = quarkInContext(tmp, false);
final Quark<Entity> ident = quarkInContext(true, tmp);
final Entity result = reallyCreateLeaf(ident, Display.getWithNewlines(ident), LeafType.PSEUDO_STATE, null);
endGroup();
return result;
@ -141,14 +141,14 @@ public class StateDiagram extends AbstractEntityDiagram {
final Entity g = getCurrentGroup();
if (g.isRoot()) {
final String idShort = "*deephistory*";
final Quark<Entity> quark = quarkInContext(cleanId(idShort), false);
final Quark<Entity> quark = quarkInContext(true, cleanId(idShort));
if (quark.getData() == null)
reallyCreateLeaf(quark, Display.getWithNewlines(""), LeafType.DEEP_HISTORY, null);
return quark.getData();
}
final String idShort = "*deephistory*" + g.getName();
final Quark<Entity> quark = quarkInContext(cleanId(idShort), false);
final Quark<Entity> quark = quarkInContext(true, cleanId(idShort));
if (quark.getData() == null)
reallyCreateLeaf(quark, Display.getWithNewlines(""), LeafType.DEEP_HISTORY, null);
return quark.getData();
@ -156,12 +156,12 @@ public class StateDiagram extends AbstractEntityDiagram {
}
public Entity getDeepHistory(String idShort) {
final Quark<Entity> quark = quarkInContext(cleanId(idShort), false);
final Quark<Entity> quark = quarkInContext(true, cleanId(idShort));
gotoGroup(quark, Display.getWithNewlines(quark), GroupType.STATE);
final Entity g = getCurrentGroup();
final String tmp = "*deephistory*" + g.getName();
final Quark<Entity> ident = quarkInContext(cleanId(tmp), false);
final Quark<Entity> ident = quarkInContext(true, cleanId(tmp));
final Entity result = reallyCreateLeaf(ident, Display.getWithNewlines(""), LeafType.DEEP_HISTORY, null);
endGroup();
return result;
@ -175,7 +175,7 @@ public class StateDiagram extends AbstractEntityDiagram {
super.endGroup();
final String tmp1 = this.getUniqueSequence(CONCURRENT_PREFIX);
final Quark<Entity> ident1 = quarkInContext(cleanId(tmp1), false);
final Quark<Entity> ident1 = quarkInContext(true, cleanId(tmp1));
gotoGroup(ident1, Display.create(""), GroupType.CONCURRENT_STATE);
getCurrentGroup().setConcurrentSeparator(direction);

View File

@ -76,7 +76,7 @@ public class CommandAddField extends SingleLineCommand2<StateDiagram> {
if (diagram.getCurrentGroup().getName().equals(codeString))
quark = diagram.getCurrentGroup().getQuark();
else
quark = diagram.quarkInContext(diagram.cleanId(codeString), false);
quark = diagram.quarkInContext(true, diagram.cleanId(codeString));
Entity entity = quark.getData();
if (entity == null)

View File

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

View File

@ -115,7 +115,7 @@ public class CommandCreatePackageState extends SingleLineCommand2<StateDiagram>
throws NoSuchColorException {
final String idShort = getNotNull(arg, "CODE1", "CODE2");
final Quark<Entity> quark = diagram.quarkInContext(idShort, false);
final Quark<Entity> quark = diagram.quarkInContext(true, idShort);
final String display = getNotNull(arg, "DISPLAY1", "DISPLAY2");

View File

@ -113,7 +113,7 @@ public class CommandCreateState extends SingleLineCommand2<StateDiagram> {
throws NoSuchColorException {
final String idShort = arg.getLazzy("CODE", 0);
final Quark<Entity> quark = diagram.quarkInContext(diagram.cleanId(idShort), false);
final Quark<Entity> quark = diagram.quarkInContext(true, diagram.cleanId(idShort));
String display = arg.getLazzy("DISPLAY", 0);
if (display == null)

View File

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