This commit is contained in:
Arnaud Roques 2023-01-11 22:47:15 +01:00
parent cc840383e3
commit 97c7f1ed34
69 changed files with 387 additions and 1138 deletions

View File

@ -76,7 +76,7 @@ public class ActivityDiagram extends CucaDiagram {
public IEntity getOrCreate(Ident idNewLong, Code code, Display display, LeafType type) {
final IEntity result;
final boolean leafExist = this.V1972() ? leafExistSmart(idNewLong) : leafExist(code);
final boolean leafExist = leafExist(code);
if (leafExist) {
result = getOrCreateLeafDefault(idNewLong, code, type, null);
if (result.getLeafType() != type) {
@ -88,19 +88,11 @@ public class ActivityDiagram extends CucaDiagram {
updateLasts(result);
return result;
}
@Override
public /*final*/ ILeaf getLeafVerySmart(Ident ident) {
final ILeaf result = super.getLeafVerySmart(ident);
updateLasts(result);
return result;
}
public void startIf(String optionalCodeString) {
final String idShort = optionalCodeString == null ? getAutoBranch() : optionalCodeString;
final Ident idNewLong = buildLeafIdent(idShort);
final Code code = this.V1972() ? idNewLong : buildCode(idShort);
final Code code = buildCode(idShort);
final IEntity br = createLeaf(idNewLong, code, Display.create(""), LeafType.BRANCH, null);
currentContext = new ConditionalContext(currentContext, br, Direction.DOWN);
}
@ -111,14 +103,14 @@ public class ActivityDiagram extends CucaDiagram {
public ILeaf getStart() {
final Ident ident = buildLeafIdent("start");
final Code code = this.V1972() ? ident : buildCode("start");
final Code code = buildCode("start");
return (ILeaf) getOrCreate(ident, code, Display.getWithNewlines("start"), LeafType.CIRCLE_START);
}
public ILeaf getEnd(String suppId) {
final String tmp = suppId == null ? "end" : "end$" + suppId;
final Ident ident = buildLeafIdent(tmp);
final Code code = this.V1972() ? ident : buildCode(tmp);
final Code code = buildCode(tmp);
return (ILeaf) getOrCreate(ident, code, Display.getWithNewlines("end"), LeafType.CIRCLE_END);
}
@ -173,7 +165,7 @@ public class ActivityDiagram extends CucaDiagram {
// Log.println("createInnerActivity A");
final String idShort = "##" + this.getUniqueSequence();
final Ident idNewLong = buildLeafIdent(idShort);
final Code code = this.V1972() ? idNewLong : buildCode(idShort);
final Code code = buildCode(idShort);
gotoGroup(idNewLong, code, Display.getWithNewlines(code), GroupType.INNER_ACTIVITY, getCurrentGroup(),
NamespaceStrategy.SINGLE);
final IEntity g = getCurrentGroup();

View File

@ -36,7 +36,6 @@
package net.sourceforge.plantuml.activitydiagram.command;
import net.sourceforge.plantuml.activitydiagram.ActivityDiagram;
import net.sourceforge.plantuml.baraye.IEntity;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
@ -65,11 +64,10 @@ public class CommandEndPartition extends SingleLineCommand2<ActivityDiagram> {
@Override
protected CommandExecutionResult executeArg(ActivityDiagram diagram, LineLocation location, RegexResult arg) {
final IEntity currentPackage = diagram.getCurrentGroup();
if (currentPackage == null) {
final boolean result = diagram.endGroup();
if (result == false)
return CommandExecutionResult.error("No partition defined");
}
diagram.endGroup();
return CommandExecutionResult.ok();
}

View File

@ -41,7 +41,6 @@ import net.sourceforge.plantuml.UrlBuilder;
import net.sourceforge.plantuml.UrlMode;
import net.sourceforge.plantuml.activitydiagram.ActivityDiagram;
import net.sourceforge.plantuml.baraye.IEntity;
import net.sourceforge.plantuml.baraye.ILeaf;
import net.sourceforge.plantuml.classdiagram.command.CommandLinkClass;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
@ -210,21 +209,14 @@ public class CommandLinkActivity extends SingleLineCommand2<ActivityDiagram> {
if (idShort != null) {
if (partition != null) {
final Ident idNewLong = diagram.buildLeafIdent(partition);
final Code codeP = diagram.V1972() ? idNewLong : diagram.buildCode(partition);
final Code codeP = diagram.buildCode(partition);
diagram.gotoGroup(idNewLong, codeP, Display.getWithNewlines(partition), GroupType.PACKAGE,
diagram.getRootGroup(), NamespaceStrategy.SINGLE);
}
final Ident ident = diagram.buildLeafIdent(idShort);
final Code code = diagram.V1972() ? ident : diagram.buildCode(idShort);
final LeafType type = diagram.V1972() ? getTypeIfExistingSmart(diagram, ident)
: getTypeIfExisting(diagram, code);
IEntity result;
if (diagram.V1972()) {
result = diagram.getLeafVerySmart(ident);
if (result == null)
result = diagram.getOrCreate(ident, code, Display.getWithNewlines(code), type);
} else
result = diagram.getOrCreate(ident, code, Display.getWithNewlines(code), type);
final Code code = diagram.buildCode(idShort);
final LeafType type = getTypeIfExisting(diagram, code);
final IEntity result = diagram.getOrCreate(ident, code, Display.getWithNewlines(code), type);
if (partition != null)
diagram.endGroup();
@ -233,13 +225,7 @@ public class CommandLinkActivity extends SingleLineCommand2<ActivityDiagram> {
final String bar = arg.get("BAR" + suf, 0);
if (bar != null) {
final Ident identBar = diagram.buildLeafIdent(bar);
final Code codeBar = diagram.V1972() ? identBar : diagram.buildCode(bar);
if (diagram.V1972()) {
final ILeaf result = diagram.getLeafVerySmart(identBar);
if (result != null)
return result;
}
final Code codeBar = diagram.buildCode(bar);
return diagram.getOrCreate(identBar, codeBar, Display.getWithNewlines(bar), LeafType.SYNCHRO_BAR);
}
final RegexPartialMatch quoted = arg.get("QUOTED" + suf);
@ -247,14 +233,13 @@ public class CommandLinkActivity extends SingleLineCommand2<ActivityDiagram> {
final String quotedString = quoted.get(1) == null ? quoted.get(0) : quoted.get(1);
if (partition != null) {
final Ident idNewLong = diagram.buildLeafIdent(partition);
final Code codeP = diagram.V1972() ? idNewLong : diagram.buildCode(partition);
final Code codeP = diagram.buildCode(partition);
diagram.gotoGroup(idNewLong, codeP, Display.getWithNewlines(partition), GroupType.PACKAGE,
diagram.getRootGroup(), NamespaceStrategy.SINGLE);
}
final Ident quotedIdent = diagram.buildLeafIdent(quotedString);
final Code quotedCode = diagram.V1972() ? quotedIdent : diagram.buildCode(quotedString);
final LeafType type = diagram.V1972() ? getTypeIfExistingSmart(diagram, quotedIdent)
: getTypeIfExisting(diagram, quotedCode);
final Code quotedCode = diagram.buildCode(quotedString);
final LeafType type = getTypeIfExisting(diagram, quotedCode);
final IEntity result = diagram.getOrCreate(quotedIdent, quotedCode, Display.getWithNewlines(quoted.get(0)),
type);
if (partition != null)
@ -266,12 +251,12 @@ public class CommandLinkActivity extends SingleLineCommand2<ActivityDiagram> {
if (quoteInvisibleString != null) {
if (partition != null) {
final Ident idNewLong = diagram.buildLeafIdent(partition);
final Code codeP = diagram.V1972() ? idNewLong : diagram.buildCode(partition);
final Code codeP = diagram.buildCode(partition);
diagram.gotoGroup(idNewLong, codeP, Display.getWithNewlines(partition), GroupType.PACKAGE,
diagram.getRootGroup(), NamespaceStrategy.SINGLE);
}
final Ident identInvisible = diagram.buildLeafIdent(quoteInvisibleString);
final Code quotedInvisible = diagram.V1972() ? identInvisible : diagram.buildCode(quoteInvisibleString);
final Code quotedInvisible = diagram.buildCode(quoteInvisibleString);
final IEntity result = diagram.getOrCreate(identInvisible, quotedInvisible,
Display.getWithNewlines(quotedInvisible), LeafType.ACTIVITY);
if (partition != null)
@ -286,15 +271,6 @@ public class CommandLinkActivity extends SingleLineCommand2<ActivityDiagram> {
return null;
}
private static LeafType getTypeIfExistingSmart(ActivityDiagram system, Ident ident) {
final IEntity ent = system.getLeafSmart(ident);
if (ent != null)
if (ent.getLeafType() == LeafType.BRANCH)
return LeafType.BRANCH;
return LeafType.ACTIVITY;
}
private static LeafType getTypeIfExisting(ActivityDiagram system, Code code) {
if (system.leafExist(code)) {
final IEntity ent = system.getLeaf(code);

View File

@ -183,7 +183,7 @@ public class CommandLinkLongActivity extends CommandMultilines2<ActivityDiagram>
GroupType.PACKAGE, null, NamespaceStrategy.SINGLE);
}
final Ident ident = diagram.buildLeafIdent(idShort);
final Code code = diagram.V1972() ? ident : diagram.buildCode(idShort);
final Code code = diagram.buildCode(idShort);
final IEntity entity2 = diagram.getOrCreate(ident, code, Display.getWithNewlines(display), LeafType.ACTIVITY);
if (entity2 == null)
return CommandExecutionResult.error("No such entity");

View File

@ -89,7 +89,7 @@ public class CommandPartition extends SingleLineCommand2<ActivityDiagram> {
throws NoSuchColorException {
final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("NAME", 0));
final Ident ident = diagram.buildLeafIdent(idShort);
final Code code = diagram.V1972() ? ident : diagram.buildCode(idShort);
final Code code = diagram.buildCode(idShort);
final IGroup currentPackage = diagram.getCurrentGroup();
diagram.gotoGroup(ident, code, Display.getWithNewlines(code), GroupType.PACKAGE, currentPackage,
NamespaceStrategy.SINGLE);

View File

@ -75,6 +75,7 @@ import net.sourceforge.plantuml.cucadiagram.Magma;
import net.sourceforge.plantuml.cucadiagram.MagmaList;
import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
import net.sourceforge.plantuml.cucadiagram.PortionShower;
import net.sourceforge.plantuml.cucadiagram.Together;
import net.sourceforge.plantuml.cucadiagram.dot.CucaDiagramTxtMaker;
import net.sourceforge.plantuml.cucadiagram.entity.IEntityFactory;
import net.sourceforge.plantuml.elk.CucaDiagramFileMakerElk;
@ -95,10 +96,6 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
static public final boolean QUARK = false;
static private final boolean G1972 = false;
// private String namespaceSeparator = ".";
// private String namespaceSeparator1 = GO1972 ? "::" : ".";
private String namespaceSeparator = null;
private boolean namespaceSeparatorHasBeenSet = false;
@ -110,25 +107,6 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
throw new UnsupportedOperationException();
}
public final boolean V1972() {
if (getPragma().backToLegacyPackage()) {
return false;
}
if (getPragma().useNewPackage()) {
return true;
}
if (G1972)
return true;
return false;
}
public final boolean mergeIntricated() {
if (getNamespaceSeparator() == null) {
return false;
}
return this.V1972() && this.getUmlDiagramType() == UmlDiagramType.CLASS;
}
private final List<HideOrShow2> hides2 = new ArrayList<>();
private final List<HideOrShow2> removed = new ArrayList<>();
protected final EntityFactory entityFactory = new EntityFactory(hides2, removed, this);
@ -169,7 +147,7 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
final public String getNamespaceSeparator() {
if (namespaceSeparatorHasBeenSet == false)
return V1972() ? "::" : ".";
return ".";
return namespaceSeparator;
}
@ -198,11 +176,7 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
final protected ILeaf getOrCreateLeafDefault(Ident idNewLong, Code code, LeafType type, USymbol symbol) {
Objects.requireNonNull(idNewLong);
Objects.requireNonNull(type);
ILeaf result;
if (this.V1972())
result = entityFactory.getLeafStrict(idNewLong);
else
result = entityFactory.getLeaf(code);
ILeaf result = entityFactory.getLeaf(code);
if (result == null) {
result = createLeafInternal(idNewLong, code, Display.getWithNewlines(code), type, symbol);
@ -266,28 +240,18 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
}
final public Code buildCode(String s) {
if (this.V1972())
throw new UnsupportedOperationException();
return CodeImpl.of(s);
}
public boolean leafExist(Code code) {
if (this.V1972())
throw new UnsupportedOperationException();
return entityFactory.getLeaf(code) != null;
}
public boolean leafExistSmart(Ident ident) {
return entityFactory.getLeafSmart(ident) != null;
}
public boolean leafExistStrict(Ident ident) {
return entityFactory.getLeafStrict(ident) != null;
}
final public Collection<IGroup> getChildrenGroups(IGroup parent) {
if (this.V1972())
return getChildrenGroupsIdent1972(parent);
final Collection<IGroup> result = new ArrayList<>();
for (IGroup gg : getGroups(false))
if (gg.getParentContainer() == parent)
@ -296,32 +260,22 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
return Collections.unmodifiableCollection(result);
}
private Collection<IGroup> getChildrenGroupsIdent1972(IGroup parent) {
final Collection<IGroup> result = new ArrayList<>();
for (IGroup gg : entityFactory.groups2())
if (gg.getIdent().parent().equals(parent.getIdent()))
result.add(gg);
return Collections.unmodifiableCollection(result);
}
private NamespaceStrategy lastNamespaceStrategy;
private Together currentTogether;
final public CommandExecutionResult gotoTogether(Ident ident, Code code, IGroup parent) {
IGroup result = entityFactory.createGroup(ident, code, Display.NULL, null, GroupType.TOGETHER, parent,
getHides(), getNamespaceSeparator());
if (currentTogether != null)
return CommandExecutionResult.error("Cannot nest together");
entityFactory.addGroup(result);
currentGroup = result;
return CommandExecutionResult.ok();
}
final public CommandExecutionResult gotoGroup(Ident ident, Code code, Display display, GroupType type,
IGroup parent, NamespaceStrategy strategy) {
if (type == GroupType.TOGETHER) {
IGroup result = entityFactory.createGroup(ident, code, display, null, type, parent, getHides(),
getNamespaceSeparator());
entityFactory.addGroup(result);
currentGroup = result;
return CommandExecutionResult.ok();
}
if (this.V1972()) {
gotoGroupInternalWithNamespace(ident, code, display, code, type, parent);
return CommandExecutionResult.ok();
}
if (this.lastNamespaceStrategy != null && strategy != this.lastNamespaceStrategy)
return CommandExecutionResult.error("Cannot mix packages and namespaces");
this.lastNamespaceStrategy = strategy;
@ -359,10 +313,6 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
this.stacks.add(currentGroup);
this.stacks2.add(idNewLong);
if (this.V1972()) {
gotoGroupInternal(idNewLong, code, display, namespaceNew, type, parent);
return;
}
if (getNamespaceSeparator() == null) {
gotoGroupInternal(idNewLong, code, display, namespaceNew, type, parent);
return;
@ -387,11 +337,15 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
}
public void endGroup() {
public boolean endGroup() {
if (this.currentTogether != null) {
this.currentTogether = null;
}
if (currentGroup.getGroupType() == GroupType.TOGETHER) {
currentGroup = currentGroup.getParentContainer();
return;
return true;
}
if (stacks2.size() > 0) {
@ -400,21 +354,17 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
}
if (EntityUtils.groupRoot(currentGroup)) {
Log.error("No parent group");
return;
return false;
}
if (stacks.size() > 0)
currentGroup = stacks.remove(stacks.size() - 1);
else
currentGroup = currentGroup.getParentContainer();
return true;
}
private void gotoGroupInternal(Ident idNewLong, final Code code, Display display, final Code namespace,
GroupType type, IGroup parent) {
if (this.V1972()) {
gotoGroupInternal1972(idNewLong, code, display, namespace, type, parent);
return;
}
IGroup result = entityFactory.getGroup(code);
if (result != null) {
currentGroup = result;
@ -431,30 +381,6 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
currentGroup = result;
}
private void gotoGroupInternal1972(Ident idNewLong, final Code code, Display display, final Code namespace,
GroupType type, IGroup parent) {
IGroup result = entityFactory.getGroupStrict(idNewLong);
if (result != null) {
currentGroup = result;
return;
}
final boolean mutation;
if (getNamespaceSeparator() == null)
mutation = entityFactory.getLeafVerySmart(idNewLong) != null;
else
mutation = entityFactory.getLeafStrict(idNewLong) != null;
if (mutation) {
result = entityFactory.muteToGroup1972(idNewLong, namespace, type, parent);
result.setDisplay(display);
} else {
result = entityFactory.createGroup(idNewLong, code, display, namespace, type, parent, getHides(),
getNamespaceSeparator());
}
entityFactory.addGroup(result);
currentGroup = result;
stacks2.set(stacks2.size() - 1, result.getIdent());
}
final protected void gotoGroupExternal(Ident newIdLong, final Code code, Display display, final Code namespace,
GroupType type, IGroup parent) {
IGroup result = entityFactory.getGroup(code);
@ -507,35 +433,23 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
}
public final IGroup getGroupStrict(Ident ident) {
if (!this.V1972())
throw new UnsupportedOperationException();
final IGroup p = entityFactory.getGroupStrict(ident);
return Objects.requireNonNull(p);
throw new UnsupportedOperationException();
}
public final IGroup getGroupVerySmart(Ident ident) {
if (!this.V1972())
throw new UnsupportedOperationException();
final IGroup p = entityFactory.getGroupVerySmart(ident);
return Objects.requireNonNull(p);
throw new UnsupportedOperationException();
}
public final boolean isGroup(Code code) {
if (this.V1972())
return isGroupStrict((Ident) code);
return leafExist(code) == false && entityFactory.getGroup(code) != null;
}
public final boolean isGroupStrict(Ident ident) {
if (!this.V1972())
throw new UnsupportedOperationException();
return leafExistStrict(ident) == false && entityFactory.getGroupStrict(ident) != null;
throw new UnsupportedOperationException();
}
public final boolean isGroupVerySmart(Ident ident) {
if (!this.V1972())
throw new UnsupportedOperationException();
return leafExistSmart(ident) == false && entityFactory.getGroupVerySmart(ident) != null;
throw new UnsupportedOperationException();
}
public final Collection<IGroup> getGroups(boolean withRootGroup) {
@ -568,14 +482,6 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
return entityFactory.getLeafStrict(ident);
}
public final ILeaf getLeafSmart(Ident ident) {
return entityFactory.getLeafSmart(ident);
}
public /* final */ ILeaf getLeafVerySmart(Ident ident) {
return entityFactory.getLeafVerySmart(ident);
}
final public void addLink(Link link) {
entityFactory.addLink(link);
}

View File

@ -39,7 +39,6 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@ -48,7 +47,6 @@ import java.util.Objects;
import java.util.Set;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.creole.CreoleMode;
import net.sourceforge.plantuml.cucadiagram.Bodier;
import net.sourceforge.plantuml.cucadiagram.BodierJSon;
import net.sourceforge.plantuml.cucadiagram.BodierMap;
@ -84,7 +82,6 @@ public final class EntityFactory implements IEntityFactory {
private final List<HideOrShow2> hides2;
private final List<HideOrShow2> removed;
/* private */ final public CucaDiagram namespaceSeparator;
// private final boolean mergeIntricated;
private Map<IGroup, ILeaf> emptyGroupsAsNode = new HashMap<IGroup, ILeaf>();
public ILeaf getLeafForEmptyGroup(IGroup g) {
@ -108,57 +105,12 @@ public final class EntityFactory implements IEntityFactory {
return folder;
}
public Display getIntricatedDisplay(Ident ident) {
final Set<Ident> known = new HashSet<>(groups2.keySet());
known.removeAll(hiddenBecauseOfIntrication);
String sep = namespaceSeparator.getNamespaceSeparator();
if (sep == null)
sep = ".";
for (int check = ident.size() - 1; check > 0; check--)
if (known.contains(ident.getPrefix(check)))
// if (hiddenBecauseOfIntrication.contains(ident.getPrefix(check)) == false)
return Display.getWithNewlines(ident.getSuffix(check).toString(sep))
.withCreoleMode(CreoleMode.SIMPLE_LINE);
return Display.getWithNewlines(ident.toString(sep)).withCreoleMode(CreoleMode.SIMPLE_LINE);
}
private final Collection<Ident> hiddenBecauseOfIntrication = new ArrayList<>();
public IGroup isIntricated(IGroup parent) {
final int leafs = parent.getLeafsDirect().size();
final Collection<IGroup> children = parent.getChildren();
if (leafs == 0 && children.size() == 1) {
final IGroup g = children.iterator().next();
if (g.getLeafsDirect().size() == 0 && g.getChildren().size() == 0
&& (g.getGroupType() == GroupType.PACKAGE || g.getGroupType() == GroupType.TOGETHER))
return null;
for (Link link : this.getLinks())
if (link.contains(parent))
return null;
((EntityImp) g).setIntricated(true);
hiddenBecauseOfIntrication.add(parent.getIdent());
return g;
}
return null;
}
public EntityFactory(List<HideOrShow2> hides2, List<HideOrShow2> removed, CucaDiagram namespaceSeparator) {
this.hides2 = hides2;
this.removed = removed;
this.namespaceSeparator = namespaceSeparator;
// this.mergeIntricated = namespaceSeparator.mergeIntricated();
// if (OptionFlags.V1972(namespaceSeparator)) {
// this.leafsByCode = null;
// this.groupsByCode = null;
// } else {
this.leafsByCode = new LinkedHashMap<String, ILeaf>();
this.groupsByCode = new LinkedHashMap<String, IGroup>();
// }
}
public boolean isHidden(ILeaf leaf) {
@ -257,19 +209,13 @@ public final class EntityFactory implements IEntityFactory {
}
public void addLeaf(ILeaf entity) {
if (namespaceSeparator.V1972() == false)
leafsByCode.put(entity.getCodeGetName(), entity);
leafsByCode.put(entity.getCodeGetName(), entity);
leafs2.put(entity.getIdent(), entity);
if (namespaceSeparator.V1972())
ensureParentIsCreated(entity.getIdent());
}
public void addGroup(IGroup group) {
if (namespaceSeparator.V1972() == false)
groupsByCode.put(group.getCodeGetName(), group);
groupsByCode.put(group.getCodeGetName(), group);
groups2.put(group.getIdent(), group);
if (namespaceSeparator.V1972())
ensureParentIsCreated(group.getIdent());
}
private void ensureParentIsCreated(Ident ident) {
@ -279,8 +225,6 @@ public final class EntityFactory implements IEntityFactory {
}
public /* private */ void removeGroup(String name) {
if (namespaceSeparator.V1972())
throw new UnsupportedOperationException();
final IEntity removed = Objects.requireNonNull(groupsByCode.remove(name));
final IEntity removed2 = groups2.remove(removed.getIdent());
if (removed != removed2) {
@ -299,8 +243,6 @@ public final class EntityFactory implements IEntityFactory {
}
public /* private */ void removeLeaf(String name) {
if (namespaceSeparator.V1972())
throw new UnsupportedOperationException();
final IEntity removed = Objects.requireNonNull(leafsByCode.remove(Objects.requireNonNull(name)));
final IEntity removed2 = leafs2.remove(removed.getIdent());
if (removed != removed2) {
@ -316,17 +258,7 @@ public final class EntityFactory implements IEntityFactory {
}
}
private void removeLeaf1972(ILeaf leaf) {
final boolean removed = leafs2.values().remove(leaf);
if (removed == false) {
System.err.println("leafs2=" + leafs2.keySet());
throw new IllegalArgumentException(leaf.toString());
}
}
public IGroup muteToGroup(String name, Code namespace, GroupType type, IGroup parent) {
if (namespaceSeparator.V1972())
throw new UnsupportedOperationException();
final ILeaf leaf = leafsByCode.get(name);
((EntityImp) leaf).muteToGroup(namespace, type, parent);
final IGroup result = (IGroup) leaf;
@ -334,20 +266,6 @@ public final class EntityFactory implements IEntityFactory {
return result;
}
public IGroup muteToGroup1972(Ident ident, Code namespace, GroupType type, IGroup parent) {
if (!namespaceSeparator.V1972())
throw new UnsupportedOperationException();
final ILeaf leaf;
if (namespaceSeparator.getNamespaceSeparator() == null)
leaf = getLeafVerySmart(ident);
else
leaf = leafs2.get(ident);
((EntityImp) leaf).muteToGroup(namespace, type, parent);
final IGroup result = (IGroup) leaf;
removeLeaf1972(leaf);
return result;
}
public IGroup getRootGroup() {
return rootGroup;
}
@ -356,30 +274,6 @@ public final class EntityFactory implements IEntityFactory {
return leafs2.get(ident);
}
public final ILeaf getLeafSmart(Ident ident) {
if (!namespaceSeparator.V1972())
throw new UnsupportedOperationException();
final ILeaf result = leafs2.get(ident);
if (result == null && ident.size() == 1)
for (Entry<Ident, ILeaf> ent : leafs2.entrySet())
if (ent.getKey().getLast().equals(ident.getLast()))
return ent.getValue();
return result;
}
public final ILeaf getLeafVerySmart(Ident ident) {
if (!namespaceSeparator.V1972())
throw new UnsupportedOperationException();
final ILeaf result = leafs2.get(ident);
if (result == null)
for (Entry<Ident, ILeaf> ent : leafs2.entrySet())
if (ent.getKey().getLast().equals(ident.getLast()))
return ent.getValue();
return result;
}
public Ident buildFullyQualified(Ident currentPath, Ident id) {
if (currentPath.equals(id) == false)
if (leafs2.containsKey(id) || groups2.containsKey(id))
@ -410,8 +304,6 @@ public final class EntityFactory implements IEntityFactory {
}
public final ILeaf getLeaf(Code code) {
if (namespaceSeparator.V1972())
throw new UnsupportedOperationException();
final ILeaf result = leafsByCode.get(code.getName());
if (result != null && result != leafs2.get(result.getIdent()))
bigError();
@ -420,8 +312,6 @@ public final class EntityFactory implements IEntityFactory {
}
public final IGroup getGroup(Code code) {
if (namespaceSeparator.V1972())
throw new UnsupportedOperationException();
final IGroup result = groupsByCode.get(code.getName());
if (result != null && result != groups2.get(result.getIdent()))
bigError();
@ -430,8 +320,6 @@ public final class EntityFactory implements IEntityFactory {
}
public final Collection<ILeaf> leafs() {
if (namespaceSeparator.V1972())
return leafs2();
final Collection<ILeaf> result = Collections.unmodifiableCollection(leafsByCode.values());
if (new ArrayList<>(result).equals(new ArrayList<>(leafs2())) == false)
bigError();
@ -440,8 +328,6 @@ public final class EntityFactory implements IEntityFactory {
}
public final Collection<IGroup> groups() {
if (namespaceSeparator.V1972())
return groups2();
final Collection<IGroup> result = Collections.unmodifiableCollection(groupsByCode.values());
if (new ArrayList<>(result).equals(new ArrayList<>(groups2())) == false)
bigError();
@ -490,21 +376,6 @@ public final class EntityFactory implements IEntityFactory {
}
public IGroup getParentContainer(Ident ident, IGroup parentContainer) {
if (namespaceSeparator.V1972()) {
final Ident parent = ident.parent();
if (parent.isRoot())
return this.rootGroup;
IGroup result = getGroupStrict(parent);
if (result != null)
return result;
final Display display = Display.getWithNewlines(parent.getName());
result = createGroup(parent, parent, display, null, GroupType.PACKAGE, null,
Collections.<VisibilityModifier>emptySet(), namespaceSeparator.getNamespaceSeparator());
addGroup(result);
return result;
}
return Objects.requireNonNull(parentContainer);
}

View File

@ -68,6 +68,7 @@ import net.sourceforge.plantuml.cucadiagram.Link;
import net.sourceforge.plantuml.cucadiagram.Stereostyles;
import net.sourceforge.plantuml.cucadiagram.Stereotag;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.cucadiagram.Together;
import net.sourceforge.plantuml.cucadiagram.dot.Neighborhood;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
@ -131,6 +132,8 @@ final public class EntityImp implements ILeaf, IGroup {
private final List<CucaNote> notesTop = new ArrayList<>();
private final List<CucaNote> notesBottom = new ArrayList<>();
private Together together;
@Override
public void addNote(Display note, Position position, Colors colors) {
if (position == Position.TOP)
@ -161,9 +164,6 @@ final public class EntityImp implements ILeaf, IGroup {
String namespaceSeparator, int rawLayout) {
this.ident = Objects.requireNonNull(ident);
this.uid = StringUtils.getUid("cl", entityFactory.getDiagram().getUniqueSequence());
if (entityFactory.namespaceSeparator.V1972())
code = ident;
this.code = Objects.requireNonNull(code);
this.entityFactory = entityFactory;
this.bodier = bodier;
@ -238,9 +238,6 @@ final public class EntityImp implements ILeaf, IGroup {
}
public Display getDisplay() {
if (intricated)
return entityFactory.getIntricatedDisplay(ident);
return display;
}
@ -271,8 +268,6 @@ final public class EntityImp implements ILeaf, IGroup {
// return super.toString() + code + " " + display + "(" + leafType + ")[" +
// groupType + "] " + xposition + " "
// + getUid();
if (entityFactory.namespaceSeparator.V1972())
return getUid() + " " + ident + " " + display + "(" + leafType + ")[" + groupType + "]";
return "EntityImpl " + code + ident + " " + display + "(" + leafType + ")[" + groupType + "] " + getUid();
}
@ -416,10 +411,6 @@ final public class EntityImp implements ILeaf, IGroup {
}
public void moveEntitiesTo(IGroup dest) {
if (entityFactory.namespaceSeparator.V1972()) {
moveEntitiesTo1972(dest);
return;
}
checkGroup();
if (dest.isGroup() == false)
throw new UnsupportedOperationException();
@ -552,18 +543,10 @@ final public class EntityImp implements ILeaf, IGroup {
if (EntityUtils.isPureInnerLink12(this, link))
entityFactory.removeLink(link);
if (entityFactory.namespaceSeparator.V1972()) {
entityFactory.removeGroup(getIdent());
for (ILeaf ent : new ArrayList<>(entityFactory.leafs()))
if (this != ent && getIdent().equals(ent.getIdent().parent()))
entityFactory.removeLeaf(ent.getIdent());
} else {
entityFactory.removeGroup(getCodeGetName());
for (ILeaf ent : new ArrayList<>(entityFactory.leafs()))
if (this != ent && this == ent.getParentContainer())
entityFactory.removeLeaf(ent.getCodeGetName());
}
entityFactory.removeGroup(getCodeGetName());
for (ILeaf ent : new ArrayList<>(entityFactory.leafs()))
if (this != ent && this == ent.getParentContainer())
entityFactory.removeLeaf(ent.getCodeGetName());
entityFactory.addLeaf(this);
this.groupType = null;
@ -760,13 +743,6 @@ final public class EntityImp implements ILeaf, IGroup {
return legend;
}
private boolean intricated;
public void setIntricated(boolean intricated) {
this.intricated = intricated;
}
private IGroup originalGroup;
public void setOriginalGroup(IGroup originalGroup) {
@ -778,13 +754,6 @@ final public class EntityImp implements ILeaf, IGroup {
return originalGroup;
}
private boolean together;
public void setThisIsTogether() {
this.together = true;
setUSymbol(USymbols.TOGETHER);
}
public String getCodeLine() {
if (this.codeLine == null)
return null;
@ -866,4 +835,14 @@ final public class EntityImp implements ILeaf, IGroup {
}
@Override
public Together getTogether() {
return together;
}
@Override
public void getTogether(Together together) {
this.together = together;
}
}

View File

@ -107,8 +107,6 @@ public interface IEntity extends SpecificBackcolorable, Hideable, Removeable, Li
public boolean isAloneAndUnlinked();
public void setThisIsTogether();
public String getCodeLine();
public void setCodeLine(LineLocation codeLine);

View File

@ -38,6 +38,7 @@ package net.sourceforge.plantuml.baraye;
import java.util.Collection;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.Together;
import net.sourceforge.plantuml.cucadiagram.dot.Neighborhood;
import net.sourceforge.plantuml.graphic.USymbol;
import net.sourceforge.plantuml.skin.VisibilityModifier;
@ -80,4 +81,8 @@ public interface ILeaf extends IEntity {
public boolean isStatic();
public Together getTogether();
public void getTogether(Together together);
}

View File

@ -78,12 +78,6 @@ public class ClassDiagram extends AbstractClassOrObjectDiagram {
@Override
public ILeaf getOrCreateLeaf(Ident ident, Code code, LeafType type, USymbol symbol) {
Objects.requireNonNull(ident);
if (this.V1972()) {
if (type == null) {
type = LeafType.CLASS;
}
return getOrCreateLeafDefault(ident, code, type, symbol);
}
if (type == null) {
code = code.eventuallyRemoveStartingAndEndingDoubleQuote("\"([:");
if (getNamespaceSeparator() == null) {
@ -114,23 +108,18 @@ public class ClassDiagram extends AbstractClassOrObjectDiagram {
&& type != LeafType.LOLLIPOP_HALF && type != LeafType.NOTE) {
return super.createLeaf(idNewLong, code, display, type, symbol);
}
if (this.V1972()) {
if (getNamespaceSeparator() == null)
return super.createLeaf(idNewLong, code, display, type, symbol);
}
if (getNamespaceSeparator() == null) {
return super.createLeaf(idNewLong, code, display, type, symbol);
}
code = getFullyQualifiedCode1972(code);
if (super.leafExist(code)) {
if (super.leafExist(code))
throw new IllegalArgumentException("Already known: " + code);
}
return createEntityWithNamespace1972(idNewLong, code, display, type, symbol);
}
private ILeaf createEntityWithNamespace1972(Ident id, Code fullyCode, Display display, LeafType type,
USymbol symbol) {
if (this.V1972())
throw new UnsupportedOperationException();
Objects.requireNonNull(id);
final IGroup backupCurrentGroup = getCurrentGroup();
final IGroup group = backupCurrentGroup;

View File

@ -70,21 +70,13 @@ public class CommandAddMethod extends SingleLineCommand2<ClassDiagram> {
throws NoSuchColorException {
final String idShort = arg.get("NAME", 0);
final Ident ident = diagram.buildLeafIdent(idShort);
final Code code = diagram.V1972() ? ident : diagram.buildCode(idShort);
/* final */IEntity entity;
if (diagram.V1972()) {
entity = diagram.getLeafVerySmart(diagram.cleanIdent(ident));
if (entity == null) {
entity = diagram.getOrCreateLeaf(ident, code, null, null);
}
} else {
entity = diagram.getOrCreateLeaf(ident, code, null, null);
}
final Code code = diagram.buildCode(idShort);
final IEntity entity = diagram.getOrCreateLeaf(ident, code, null, null);
final String field = arg.get("DATA", 0);
if (field.length() > 0 && VisibilityModifier.isVisibilityCharacter(field)) {
if (field.length() > 0 && VisibilityModifier.isVisibilityCharacter(field))
diagram.setVisibilityModifierPresent(true);
}
entity.getBodier().addFieldOrMethod(field);
return CommandExecutionResult.ok();
}

View File

@ -167,25 +167,14 @@ public class CommandCreateClass extends SingleLineCommand2<ClassDiagram> {
}
} else {
final Ident idNewLong = diagram.buildLeafIdent(idShort);
if (diagram.V1972()) {
if (diagram.leafExistSmart(idNewLong)) {
entity = diagram.getOrCreateLeaf(idNewLong, idNewLong, type, null);
if (entity.muteToType(type, null) == false)
return CommandExecutionResult.error("Bad name");
final Code code = diagram.buildCode(idShort);
if (diagram.leafExist(code)) {
entity = diagram.getOrCreateLeaf(idNewLong, code, type, null);
if (entity.muteToType(type, null) == false)
return CommandExecutionResult.error("Bad name");
} else {
entity = diagram.createLeaf(idNewLong, idNewLong, Display.getWithNewlines(display), type, null);
}
} else {
final Code code = diagram.buildCode(idShort);
if (diagram.leafExist(code)) {
entity = diagram.getOrCreateLeaf(idNewLong, code, type, null);
if (entity.muteToType(type, null) == false)
return CommandExecutionResult.error("Bad name");
} else {
entity = diagram.createLeaf(idNewLong, code, Display.getWithNewlines(display), type, null);
}
entity = diagram.createLeaf(idNewLong, code, Display.getWithNewlines(display), type, null);
}
}
if (stereo != null) {

View File

@ -217,7 +217,7 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
for (String s : codes.split(",")) {
final String idShort = StringUtils.trin(s);
final Ident ident = diagram.buildLeafIdent(idShort);
final Code other = diagram.V1972() ? ident : diagram.buildCode(idShort);
final Code other = diagram.buildCode(idShort);
final IEntity cl2 = diagram.getOrCreateLeaf(ident, other, type2, null);
LinkType typeLink = new LinkType(LinkDecor.NONE, LinkDecor.EXTENDS);
if (type2 == LeafType.INTERFACE && entity.getLeafType() != LeafType.INTERFACE)
@ -244,7 +244,7 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(line0.getLazzy("CODE", 0),
"\"([:");
final Ident ident = diagram.buildLeafIdent(idShort);
final Code code = diagram.V1972() ? ident : diagram.buildCode(idShort);
final Code code = diagram.buildCode(idShort);
final String display = line0.getLazzy("DISPLAY", 0);
final String genericOption = line0.getLazzy("DISPLAY", 1);
final String generic = genericOption != null ? genericOption : line0.get("GENERIC", 0);
@ -272,17 +272,6 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
if (result == null)
result = diagram.createLeaf(idNewLong, idNewLong, Display.getWithNewlines(display), type, null);
diagram.setLastEntity(result);
} else if (diagram.V1972()) {
result = diagram.getLeafSmart(ident);
if (result != null) {
// result = diagram.getOrCreateLeaf(ident, code, null, null);
diagram.setLastEntity(result);
if (result.muteToType(type, null) == false)
return null;
} else {
result = diagram.createLeaf(ident, code, Display.getWithNewlines(display), type, null);
}
} else {
if (diagram.leafExist(code)) {
result = diagram.getOrCreateLeaf(ident, code, null, null);
@ -299,6 +288,7 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
result.setStereotype(Stereotype.build(stereotype, diagram.getSkinParam().getCircledCharacterRadius(),
diagram.getSkinParam().getFont(null, false, FontParam.CIRCLED_CHARACTER),
diagram.getSkinParam().getIHtmlColorSet()));
result.setStereostyle(stereotype);
}
final String urlString = line0.get("URL", 0);

View File

@ -207,7 +207,7 @@ public class CommandCreateElementFull2 extends SingleLineCommand2<ClassDiagram>
final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(codeRaw);
final Ident ident = diagram.buildLeafIdent(idShort);
final Code code = diagram.V1972() ? ident : diagram.buildCode(idShort);
final Code code = diagram.buildCode(idShort);
String display = displayRaw;
if (display == null)
display = code.getName();

View File

@ -66,11 +66,11 @@ public class CommandDiamondAssociation extends SingleLineCommand2<ClassDiagram>
protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg) {
final String idShort = arg.get("CODE", 0);
final Ident ident = diagram.buildLeafIdent(idShort);
final Code code = diagram.V1972() ? ident : diagram.buildCode(idShort);
final boolean leafExist = diagram.V1972() ? diagram.leafExistSmart(ident) : diagram.leafExist(code);
if (leafExist) {
final Code code = diagram.buildCode(idShort);
final boolean leafExist = diagram.leafExist(code);
if (leafExist)
return CommandExecutionResult.error("Already existing : " + code.getName());
}
diagram.createLeaf(ident, code, Display.NULL, LeafType.ASSOCIATION, null);
return CommandExecutionResult.ok();

View File

@ -190,7 +190,7 @@ public class CommandHideShowByGender extends SingleLineCommand2<UmlDiagram> {
} else {
arg1 = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg1);
final Ident ident = diagram.buildLeafIdent(arg1);
final Code code = diagram.V1972() ? ident : diagram.buildCode(arg1);
final Code code = diagram.buildCode(arg1);
final IEntity entity = diagram.getOrCreateLeaf(ident, code, null, null);
gender = EntityGenderUtils.byEntityAlone(entity);
}

View File

@ -170,10 +170,10 @@ final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrOb
Ident ident1 = diagram.buildLeafIdentSpecial2(ent1String);
Ident ident2 = diagram.buildLeafIdentSpecial2(ent2String);
Ident ident1pure = Ident.empty().add(ent1String, diagram.getNamespaceSeparator());
Ident ident2pure = Ident.empty().add(ent2String, diagram.getNamespaceSeparator());
Code code1 = diagram.V1972() ? ident1 : diagram.buildCode(ent1String);
Code code2 = diagram.V1972() ? ident2 : diagram.buildCode(ent2String);
final Ident ident1pure = Ident.empty().add(ent1String, diagram.getNamespaceSeparator());
final Ident ident2pure = Ident.empty().add(ent2String, diagram.getNamespaceSeparator());
Code code1 = diagram.buildCode(ent1String);
Code code2 = diagram.buildCode(ent2String);
if (isGroupButNotTheCurrentGroup(diagram, code1, ident1)
&& isGroupButNotTheCurrentGroup(diagram, code2, ident2)) {
return executePackageLink(diagram, arg);
@ -182,41 +182,15 @@ final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrOb
String port1 = diagram.getPortFor(ent1String, ident1);
String port2 = diagram.getPortFor(ent2String, ident2);
if (diagram.V1972()) {
if ("::".equals(diagram.getNamespaceSeparator())) {
if (removeMemberPartIdentSpecial(diagram, ident1) != null) {
port1 = ident1.getLast();
ident1 = removeMemberPartIdentSpecial(diagram, ident1);
code1 = ident1;
}
if (removeMemberPartIdentSpecial(diagram, ident2) != null) {
port2 = ident2.getLast();
ident2 = removeMemberPartIdentSpecial(diagram, ident2);
code2 = ident1;
}
} else {
if (removeMemberPartIdent(diagram, ident1) != null) {
port1 = ident1.getPortMember();
ident1 = removeMemberPartIdent(diagram, ident1);
code1 = ident1;
}
if (removeMemberPartIdent(diagram, ident2) != null) {
port2 = ident2.getPortMember();
ident2 = removeMemberPartIdent(diagram, ident2);
code2 = ident2;
}
}
} else {
if (port1 == null && removeMemberPartLegacy1972(diagram, ident1) != null) {
port1 = ident1.getPortMember();
code1 = removeMemberPartLegacy1972(diagram, ident1);
ident1 = ident1.removeMemberPart();
}
if (port2 == null && removeMemberPartLegacy1972(diagram, ident2) != null) {
port2 = ident2.getPortMember();
code2 = removeMemberPartLegacy1972(diagram, ident2);
ident2 = ident2.removeMemberPart();
}
if (port1 == null && removeMemberPartLegacy1972(diagram, ident1) != null) {
port1 = ident1.getPortMember();
code1 = removeMemberPartLegacy1972(diagram, ident1);
ident1 = ident1.removeMemberPart();
}
if (port2 == null && removeMemberPartLegacy1972(diagram, ident2) != null) {
port2 = ident2.getPortMember();
code2 = removeMemberPartLegacy1972(diagram, ident2);
ident2 = ident2.removeMemberPart();
}
final IEntity cl1 = getFoo1(diagram, code1, ident1, ident1pure);
@ -263,62 +237,16 @@ final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrOb
}
private IEntity getFoo1(AbstractClassOrObjectDiagram diagram, Code code, Ident ident, Ident pure) {
if (isGroupButNotTheCurrentGroup(diagram, code, ident)) {
if (diagram.V1972())
return diagram.getGroupVerySmart(ident);
// final Code tap = ident.toCode(diagram);
if (isGroupButNotTheCurrentGroup(diagram, code, ident))
return diagram.getGroup(code);
}
if (diagram.V1972()) {
final IEntity result = pure.size() == 1 ? diagram.getLeafVerySmart(ident) : diagram.getLeafStrict(ident);
if (result != null)
return result;
}
return diagram.getOrCreateLeaf(ident, code, null, null);
}
private boolean isGroupButNotTheCurrentGroup(AbstractClassOrObjectDiagram diagram, Code code, Ident ident) {
if (diagram.V1972()) {
if (diagram.getCurrentGroup().getCodeGetName().equals(code.getName()))
return false;
if (diagram.getCurrentGroup().getCodeGetName().equals(code.getName()))
return false;
return diagram.isGroupVerySmart(ident);
} else {
if (diagram.getCurrentGroup().getCodeGetName().equals(code.getName()))
return false;
return diagram.isGroup(code);
}
}
private Ident removeMemberPartIdentSpecial(AbstractClassOrObjectDiagram diagram, Ident ident) {
if (diagram.leafExistSmart(ident))
return null;
final Ident before = ident.parent();
if (before == null)
return null;
if (diagram.leafExistSmart(before) == false)
return null;
return before;
}
private Ident removeMemberPartIdent(AbstractClassOrObjectDiagram diagram, Ident ident) {
if (diagram.leafExistSmart(ident))
return null;
final Ident before = ident.removeMemberPart();
if (before == null)
return null;
if (diagram.leafExistSmart(before) == false)
return null;
return before;
return diagram.isGroup(code);
}
private Code removeMemberPartLegacy1972(AbstractClassOrObjectDiagram diagram, Ident ident) {
@ -362,10 +290,8 @@ final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrOb
throws NoSuchColorException {
final String ent1String = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("ENT1", 0), "\"");
final String ent2String = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("ENT2", 0), "\"");
final IEntity cl1 = diagram.V1972() ? diagram.getGroupVerySmart(diagram.buildLeafIdent(ent1String))
: diagram.getGroup(diagram.buildCode(ent1String));
final IEntity cl2 = diagram.V1972() ? diagram.getGroupVerySmart(diagram.buildLeafIdent(ent2String))
: diagram.getGroup(diagram.buildCode(ent2String));
final IEntity cl1 = diagram.getGroup(diagram.buildCode(ent1String));
final IEntity cl2 = diagram.getGroup(diagram.buildCode(ent2String));
final LinkType linkType = getLinkType(arg);
final Direction dir = getDirection(arg);
@ -393,8 +319,6 @@ final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrOb
}
private CommandExecutionResult executeArgSpecial1(AbstractClassOrObjectDiagram diagram, RegexResult arg) {
if (diagram.V1972())
return executeArgSpecial1972Ident1(diagram, arg);
final String name1A = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("COUPLE1", 0));
final String name1B = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("COUPLE1", 1));
final Code clName1A = diagram.buildCode(name1A);
@ -419,86 +343,7 @@ final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrOb
return CommandExecutionResult.ok();
}
private CommandExecutionResult executeArgSpecial1972Ident1(AbstractClassOrObjectDiagram diagram, RegexResult arg) {
final String name1A = arg.get("COUPLE1", 0);
final String name1B = arg.get("COUPLE1", 1);
final Ident ident1A = diagram.buildLeafIdent(name1A);
final Ident ident1B = diagram.buildLeafIdent(name1B);
if (diagram.leafExistSmart(ident1A) == false)
return CommandExecutionResult.error("No class " + ident1A.getName());
if (diagram.leafExistSmart(ident1B) == false)
return CommandExecutionResult.error("No class " + ident1B.getName());
final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("ENT2", 0), "\"");
final Ident ident2 = diagram.buildLeafIdent(idShort);
final IEntity cl2 = diagram.getOrCreateLeaf(ident2, ident2, null, null);
final LinkType linkType = getLinkType(arg);
final Display label = Display.getWithNewlines(arg.get("LABEL_LINK", 0));
final boolean result = diagram.associationClass(1, name1A, name1B, cl2, linkType, label);
if (result == false)
return CommandExecutionResult.error("Cannot have more than 2 assocications");
return CommandExecutionResult.ok();
}
private CommandExecutionResult executeArgSpecial1972Ident2(AbstractClassOrObjectDiagram diagram, RegexResult arg) {
final String name2A = arg.get("COUPLE2", 0);
final String name2B = arg.get("COUPLE2", 1);
final Ident ident2A = diagram.buildLeafIdent(name2A);
final Ident ident2B = diagram.buildLeafIdent(name2B);
if (diagram.leafExistSmart(ident2A) == false)
return CommandExecutionResult.error("No class " + ident2A.getName());
if (diagram.leafExistSmart(ident2B) == false)
return CommandExecutionResult.error("No class " + ident2B.getName());
final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("ENT1", 0), "\"");
final Ident ident1 = diagram.buildLeafIdent(idShort);
final IEntity cl1 = diagram.getOrCreateLeaf(ident1, ident1, null, null);
final LinkType linkType = getLinkType(arg);
final Display label = Display.getWithNewlines(arg.get("LABEL_LINK", 0));
final boolean result = diagram.associationClass(2, name2A, name2B, cl1, linkType, label);
if (result == false)
return CommandExecutionResult.error("Cannot have more than 2 assocications");
return CommandExecutionResult.ok();
}
private CommandExecutionResult executeArgSpecial1972Ident3(AbstractClassOrObjectDiagram diagram, RegexResult arg) {
final String name1A = arg.get("COUPLE1", 0);
final String name1B = arg.get("COUPLE1", 1);
final String name2A = arg.get("COUPLE2", 0);
final String name2B = arg.get("COUPLE2", 1);
final Ident ident1A = diagram.buildLeafIdent(name1A);
final Ident ident1B = diagram.buildLeafIdent(name1B);
final Ident ident2A = diagram.buildLeafIdent(name2A);
final Ident ident2B = diagram.buildLeafIdent(name2B);
if (diagram.leafExistSmart(ident1A) == false)
return CommandExecutionResult.error("No class " + ident1A.getName());
if (diagram.leafExistSmart(ident1B) == false)
return CommandExecutionResult.error("No class " + ident1B.getName());
if (diagram.leafExistSmart(ident2A) == false)
return CommandExecutionResult.error("No class " + ident2A.getName());
if (diagram.leafExistSmart(ident2B) == false)
return CommandExecutionResult.error("No class " + ident2B.getName());
final LinkType linkType = getLinkType(arg);
final Display label = Display.getWithNewlines(arg.get("LABEL_LINK", 0));
return diagram.associationClass(name1A, name1B, name2A, name2B, linkType, label);
}
private CommandExecutionResult executeArgSpecial3(AbstractClassOrObjectDiagram diagram, RegexResult arg) {
if (diagram.V1972())
return executeArgSpecial1972Ident3(diagram, arg);
final String name1A = arg.get("COUPLE1", 0);
final String name1B = arg.get("COUPLE1", 1);
final String name2A = arg.get("COUPLE2", 0);
@ -526,8 +371,6 @@ final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrOb
}
private CommandExecutionResult executeArgSpecial2(AbstractClassOrObjectDiagram diagram, RegexResult arg) {
if (diagram.V1972())
return executeArgSpecial1972Ident2(diagram, arg);
final String name2A = arg.get("COUPLE2", 0);
final String name2B = arg.get("COUPLE2", 1);
final Code clName2A = diagram.buildCode(name2A);

View File

@ -172,8 +172,8 @@ final public class CommandLinkClass2 extends SingleLineCommand2<AbstractClassOrO
Ident ident2 = diagram.buildLeafIdentSpecial(ent2String);
Ident ident1pure = Ident.empty().add(ent1String, diagram.getNamespaceSeparator());
Ident ident2pure = Ident.empty().add(ent2String, diagram.getNamespaceSeparator());
Code code1 = diagram.V1972() ? ident1 : diagram.buildCode(ent1String);
Code code2 = diagram.V1972() ? ident2 : diagram.buildCode(ent2String);
Code code1 = diagram.buildCode(ent1String);
Code code2 = diagram.buildCode(ent2String);
if (isGroupButNotTheCurrentGroup(diagram, code1, ident1)
&& isGroupButNotTheCurrentGroup(diagram, code2, ident2)) {
return executePackageLink(diagram, arg);
@ -182,41 +182,15 @@ final public class CommandLinkClass2 extends SingleLineCommand2<AbstractClassOrO
String port1 = null;
String port2 = null;
if (diagram.V1972()) {
if ("::".equals(diagram.getNamespaceSeparator())) {
if (removeMemberPartIdentSpecial(diagram, ident1) != null) {
port1 = ident1.getLast();
ident1 = removeMemberPartIdentSpecial(diagram, ident1);
code1 = ident1;
}
if (removeMemberPartIdentSpecial(diagram, ident2) != null) {
port2 = ident2.getLast();
ident2 = removeMemberPartIdentSpecial(diagram, ident2);
code2 = ident1;
}
} else {
if (removeMemberPartIdent(diagram, ident1) != null) {
port1 = ident1.getPortMember();
ident1 = removeMemberPartIdent(diagram, ident1);
code1 = ident1;
}
if (removeMemberPartIdent(diagram, ident2) != null) {
port2 = ident2.getPortMember();
ident2 = removeMemberPartIdent(diagram, ident2);
code2 = ident2;
}
}
} else {
if (removeMemberPartLegacy1972(diagram, ident1) != null) {
port1 = ident1.getPortMember();
code1 = removeMemberPartLegacy1972(diagram, ident1);
ident1 = ident1.removeMemberPart();
}
if (removeMemberPartLegacy1972(diagram, ident2) != null) {
port2 = ident2.getPortMember();
code2 = removeMemberPartLegacy1972(diagram, ident2);
ident2 = ident2.removeMemberPart();
}
if (removeMemberPartLegacy1972(diagram, ident1) != null) {
port1 = ident1.getPortMember();
code1 = removeMemberPartLegacy1972(diagram, ident1);
ident1 = ident1.removeMemberPart();
}
if (removeMemberPartLegacy1972(diagram, ident2) != null) {
port2 = ident2.getPortMember();
code2 = removeMemberPartLegacy1972(diagram, ident2);
ident2 = ident2.removeMemberPart();
}
final IEntity cl1 = getFoo1(diagram, code1, ident1, ident1pure);
@ -263,66 +237,20 @@ final public class CommandLinkClass2 extends SingleLineCommand2<AbstractClassOrO
}
private IEntity getFoo1(AbstractClassOrObjectDiagram diagram, Code code, Ident ident, Ident pure) {
if (isGroupButNotTheCurrentGroup(diagram, code, ident)) {
if (diagram.V1972())
return diagram.getGroupVerySmart(ident);
// final Code tap = ident.toCode(diagram);
// return diagram.getGroupStrict(ident);
if (isGroupButNotTheCurrentGroup(diagram, code, ident))
return diagram.getGroupVerySmart(ident);
}
if (diagram.V1972()) {
final IEntity result = pure.size() == 1 ? diagram.getLeafVerySmart(ident) : diagram.getLeafStrict(ident);
if (result != null)
return result;
}
return diagram.getOrCreateLeaf(ident, code, null, null);
}
private boolean isGroupButNotTheCurrentGroup(AbstractClassOrObjectDiagram diagram, Code code, Ident ident) {
if (diagram.V1972()) {
if (diagram.getCurrentGroup().getCodeGetName().equals(code.getName()))
return false;
if (diagram.getCurrentGroup().getCodeGetName().equals(code.getName()))
return false;
return diagram.isGroupVerySmart(ident);
} else {
if (diagram.getCurrentGroup().getCodeGetName().equals(code.getName()))
return false;
if (diagram.isGroupStrict(ident))
return true;
if (diagram.isGroupStrict(ident))
return true;
return diagram.isGroup(code);
}
}
private Ident removeMemberPartIdentSpecial(AbstractClassOrObjectDiagram diagram, Ident ident) {
if (diagram.leafExistSmart(ident))
return null;
final Ident before = ident.parent();
if (before == null)
return null;
if (diagram.leafExistSmart(before) == false)
return null;
return before;
}
private Ident removeMemberPartIdent(AbstractClassOrObjectDiagram diagram, Ident ident) {
if (diagram.leafExistSmart(ident))
return null;
final Ident before = ident.removeMemberPart();
if (before == null)
return null;
if (diagram.leafExistSmart(before) == false)
return null;
return before;
return diagram.isGroup(code);
}
private Code removeMemberPartLegacy1972(AbstractClassOrObjectDiagram diagram, Ident ident) {
@ -369,32 +297,23 @@ final public class CommandLinkClass2 extends SingleLineCommand2<AbstractClassOrO
Ident ident1 = diagram.buildLeafIdentSpecial(ent1String);
Ident ident2 = diagram.buildLeafIdentSpecial(ent2String);
Ident ident1pure = Ident.empty().add(ent1String, diagram.getNamespaceSeparator());
Ident ident2pure = Ident.empty().add(ent2String, diagram.getNamespaceSeparator());
Code code1 = diagram.V1972() ? ident1 : diagram.buildCode(ent1String);
Code code2 = diagram.V1972() ? ident2 : diagram.buildCode(ent2String);
final Ident ident1pure = Ident.empty().add(ent1String, diagram.getNamespaceSeparator());
final Ident ident2pure = Ident.empty().add(ent2String, diagram.getNamespaceSeparator());
Code code1 = diagram.buildCode(ent1String);
Code code2 = diagram.buildCode(ent2String);
if (diagram.V1972()) {
throw new UnsupportedOperationException("to be finished...");
} else {
if (removeMemberPartLegacy1972(diagram, ident1) != null) {
code1 = removeMemberPartLegacy1972(diagram, ident1);
ident1 = ident1.removeMemberPart();
}
if (removeMemberPartLegacy1972(diagram, ident2) != null) {
code2 = removeMemberPartLegacy1972(diagram, ident2);
ident2 = ident2.removeMemberPart();
}
if (removeMemberPartLegacy1972(diagram, ident1) != null) {
code1 = removeMemberPartLegacy1972(diagram, ident1);
ident1 = ident1.removeMemberPart();
}
if (removeMemberPartLegacy1972(diagram, ident2) != null) {
code2 = removeMemberPartLegacy1972(diagram, ident2);
ident2 = ident2.removeMemberPart();
}
final IEntity cl1 = getFoo1(diagram, code1, ident1, ident1pure);
final IEntity cl2 = getFoo1(diagram, code2, ident2, ident2pure);
// final IEntity cl1 = diagram.V1972() ? diagram.getGroupVerySmart(diagram.buildLeafIdent(ent1String))
// : diagram.getGroup(diagram.buildCode(ent1String));
// final IEntity cl2 = diagram.V1972() ? diagram.getGroupVerySmart(diagram.buildLeafIdent(ent2String))
// : diagram.getGroup(diagram.buildCode(ent2String));
final LinkType linkType = getLinkType(arg);
final Direction dir = getDirection(arg);
final int queue;
@ -421,8 +340,6 @@ final public class CommandLinkClass2 extends SingleLineCommand2<AbstractClassOrO
}
private CommandExecutionResult executeArgSpecial1(AbstractClassOrObjectDiagram diagram, RegexResult arg) {
if (diagram.V1972())
return executeArgSpecial1972Ident1(diagram, arg);
final String name1A = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("COUPLE1", 0));
final String name1B = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("COUPLE1", 1));
final Code clName1A = diagram.buildCode(name1A);
@ -447,86 +364,7 @@ final public class CommandLinkClass2 extends SingleLineCommand2<AbstractClassOrO
return CommandExecutionResult.ok();
}
private CommandExecutionResult executeArgSpecial1972Ident1(AbstractClassOrObjectDiagram diagram, RegexResult arg) {
final String name1A = arg.get("COUPLE1", 0);
final String name1B = arg.get("COUPLE1", 1);
final Ident ident1A = diagram.buildLeafIdent(name1A);
final Ident ident1B = diagram.buildLeafIdent(name1B);
if (diagram.leafExistSmart(ident1A) == false)
return CommandExecutionResult.error("No class " + ident1A.getName());
if (diagram.leafExistSmart(ident1B) == false)
return CommandExecutionResult.error("No class " + ident1B.getName());
final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("ENT2", 0), "\"");
final Ident ident2 = diagram.buildLeafIdent(idShort);
final IEntity cl2 = diagram.getOrCreateLeaf(ident2, ident2, null, null);
final LinkType linkType = getLinkType(arg);
final Display label = Display.getWithNewlines(arg.get("LABEL_LINK", 0));
final boolean result = diagram.associationClass(1, name1A, name1B, cl2, linkType, label);
if (result == false)
return CommandExecutionResult.error("Cannot have more than 2 assocications");
return CommandExecutionResult.ok();
}
private CommandExecutionResult executeArgSpecial1972Ident2(AbstractClassOrObjectDiagram diagram, RegexResult arg) {
final String name2A = arg.get("COUPLE2", 0);
final String name2B = arg.get("COUPLE2", 1);
final Ident ident2A = diagram.buildLeafIdent(name2A);
final Ident ident2B = diagram.buildLeafIdent(name2B);
if (diagram.leafExistSmart(ident2A) == false)
return CommandExecutionResult.error("No class " + ident2A.getName());
if (diagram.leafExistSmart(ident2B) == false)
return CommandExecutionResult.error("No class " + ident2B.getName());
final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("ENT1", 0), "\"");
final Ident ident1 = diagram.buildLeafIdent(idShort);
final IEntity cl1 = diagram.getOrCreateLeaf(ident1, ident1, null, null);
final LinkType linkType = getLinkType(arg);
final Display label = Display.getWithNewlines(arg.get("LABEL_LINK", 0));
final boolean result = diagram.associationClass(2, name2A, name2B, cl1, linkType, label);
if (result == false)
return CommandExecutionResult.error("Cannot have more than 2 assocications");
return CommandExecutionResult.ok();
}
private CommandExecutionResult executeArgSpecial1972Ident3(AbstractClassOrObjectDiagram diagram, RegexResult arg) {
final String name1A = arg.get("COUPLE1", 0);
final String name1B = arg.get("COUPLE1", 1);
final String name2A = arg.get("COUPLE2", 0);
final String name2B = arg.get("COUPLE2", 1);
final Ident ident1A = diagram.buildLeafIdent(name1A);
final Ident ident1B = diagram.buildLeafIdent(name1B);
final Ident ident2A = diagram.buildLeafIdent(name2A);
final Ident ident2B = diagram.buildLeafIdent(name2B);
if (diagram.leafExistSmart(ident1A) == false)
return CommandExecutionResult.error("No class " + ident1A.getName());
if (diagram.leafExistSmart(ident1B) == false)
return CommandExecutionResult.error("No class " + ident1B.getName());
if (diagram.leafExistSmart(ident2A) == false)
return CommandExecutionResult.error("No class " + ident2A.getName());
if (diagram.leafExistSmart(ident2B) == false)
return CommandExecutionResult.error("No class " + ident2B.getName());
final LinkType linkType = getLinkType(arg);
final Display label = Display.getWithNewlines(arg.get("LABEL_LINK", 0));
return diagram.associationClass(name1A, name1B, name2A, name2B, linkType, label);
}
private CommandExecutionResult executeArgSpecial3(AbstractClassOrObjectDiagram diagram, RegexResult arg) {
if (diagram.V1972())
return executeArgSpecial1972Ident3(diagram, arg);
final String name1A = arg.get("COUPLE1", 0);
final String name1B = arg.get("COUPLE1", 1);
final String name2A = arg.get("COUPLE2", 0);
@ -554,8 +392,6 @@ final public class CommandLinkClass2 extends SingleLineCommand2<AbstractClassOrO
}
private CommandExecutionResult executeArgSpecial2(AbstractClassOrObjectDiagram diagram, RegexResult arg) {
if (diagram.V1972())
return executeArgSpecial1972Ident2(diagram, arg);
final String name2A = arg.get("COUPLE2", 0);
final String name2B = arg.get("COUPLE2", 1);
final Code clName2A = diagram.buildCode(name2A);

View File

@ -127,7 +127,7 @@ final public class CommandLinkLollipop extends SingleLineCommand2<AbstractClassO
if (arg.get("LOL_THEN_ENT", 1) == null) {
assert arg.get("ENT_THEN_LOL", 0) != null;
final Ident ident1 = diagram.buildLeafIdent(ent1);
final Code ent1code = diagram.V1972() ? ident1 : diagram.buildCode(ent1);
final Code ent1code = diagram.buildCode(ent1);
cl1 = getFoo1(diagram, ent1code, ident1);
final Ident idNewLong = diagram.buildLeafIdent(ent1 + suffix);
cl2 = diagram.createLeaf(idNewLong, idNewLong.toCode(diagram), Display.getWithNewlines(ent2),
@ -135,7 +135,7 @@ final public class CommandLinkLollipop extends SingleLineCommand2<AbstractClassO
normalEntity = cl1;
} else {
final Ident ident2 = diagram.buildLeafIdent(ent2);
final Code ent2code = diagram.V1972() ? ident2 : diagram.buildCode(ent2);
final Code ent2code = diagram.buildCode(ent2);
cl2 = getFoo1(diagram, ent2code, ident2);
final Ident idNewLong = diagram.buildLeafIdent(ent2 + suffix);
cl1 = diagram.createLeaf(idNewLong, idNewLong.toCode(diagram), Display.getWithNewlines(ent1),
@ -199,12 +199,6 @@ final public class CommandLinkLollipop extends SingleLineCommand2<AbstractClassO
}
private IEntity getFoo1(AbstractClassOrObjectDiagram diagram, final Code code, final Ident ident) {
if (diagram.V1972()) {
final IEntity result = ident.size() == 1 ? diagram.getLeafVerySmart(ident) : diagram.getLeafStrict(ident);
if (result != null)
return result;
}
return diagram.getOrCreateLeaf(ident, code, null, null);
}

View File

@ -69,7 +69,7 @@ public class CommandStereotype extends SingleLineCommand2<ClassDiagram> {
throws NoSuchColorException {
final String name = arg.get("NAME", 0);
final Ident ident = diagram.buildLeafIdent(name);
final Code code = diagram.V1972() ? ident : diagram.buildCode(name);
final Code code = diagram.buildCode(name);
final String stereotype = arg.get("STEREO", 0);
final IEntity entity = diagram.getOrCreateLeaf(ident, code, null, null);
entity.setStereotype(Stereotype.build(stereotype, diagram.getSkinParam().getCircledCharacterRadius(),

View File

@ -76,17 +76,17 @@ public class CommandUrl extends SingleLineCommand2<AbstractEntityDiagram> {
protected CommandExecutionResult executeArg(AbstractEntityDiagram diagram, LineLocation location, RegexResult arg) {
final String idShort = arg.get("CODE", 0);
final Ident ident = diagram.buildLeafIdent(idShort);
final Code code = diagram.V1972() ? ident : diagram.buildCode(idShort);
final Code code = diagram.buildCode(idShort);
final String urlString = arg.get("URL", 0);
final IEntity entity;
final boolean leafExist = diagram.V1972() ? diagram.leafExistSmart(ident) : diagram.leafExist(code);
if (leafExist) {
final boolean leafExist = diagram.leafExist(code);
if (leafExist)
entity = diagram.getOrCreateLeaf(ident, code, null, null);
} else if (diagram.V1972() ? diagram.isGroupStrict(ident) : diagram.isGroup(code)) {
entity = diagram.V1972() ? diagram.getGroupStrict(ident) : diagram.getGroup(code);
} else {
else if (diagram.isGroup(code))
entity = diagram.getGroup(code);
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);

View File

@ -35,8 +35,6 @@
*/
package net.sourceforge.plantuml.command;
import net.sourceforge.plantuml.baraye.EntityUtils;
import net.sourceforge.plantuml.baraye.IGroup;
import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
@ -58,11 +56,10 @@ public class CommandEndPackage extends SingleLineCommand2<AbstractEntityDiagram>
@Override
protected CommandExecutionResult executeArg(AbstractEntityDiagram diagram, LineLocation location, RegexResult arg) {
final IGroup currentPackage = diagram.getCurrentGroup();
if (EntityUtils.groupRoot(currentPackage)) {
final boolean result = diagram.endGroup();
if (result == false) {
return CommandExecutionResult.error("No package or namespace defined");
}
diagram.endGroup();
return CommandExecutionResult.ok();
}

View File

@ -97,11 +97,6 @@ public class CommandNamespace extends SingleLineCommand2<ClassDiagram> {
display = Display.getWithNewlines(idShort);
idNewLong = current.child(idShort);
currentPackage = (IGroup) current.getData();
} else if (diagram.V1972()) {
idNewLong = diagram.buildLeafIdent(idShort);
code = null;
currentPackage = null;
display = Display.getWithNewlines(idNewLong.getName());
} else {
idNewLong = diagram.buildLeafIdent(idShort);
code = diagram.buildCode(idShort);

View File

@ -90,12 +90,12 @@ public class CommandNamespace2 extends SingleLineCommand2<ClassDiagram> {
throws NoSuchColorException {
final String idShort = arg.get("NAME", 0);
final Ident ident = diagram.buildLeafIdent(idShort);
final Code code = diagram.V1972() ? ident : diagram.buildCode(idShort);
final Code code = diagram.buildCode(idShort);
final IGroup currentPackage = diagram.getCurrentGroup();
final String disp = arg.getLazzy("DISPLAY", 0);
final Display display = Display.getWithNewlines(disp);
final CommandExecutionResult status = diagram.gotoGroup(ident, code, display, GroupType.PACKAGE,
currentPackage, NamespaceStrategy.MULTIPLE);
final CommandExecutionResult status = diagram.gotoGroup(ident, code, display, GroupType.PACKAGE, currentPackage,
NamespaceStrategy.MULTIPLE);
if (status.isOk() == false)
return status;
final IEntity p = diagram.getCurrentGroup();

View File

@ -85,7 +85,7 @@ public class CommandNamespaceEmpty extends SingleLineCommand2<ClassDiagram> {
throws NoSuchColorException {
final String idShort = arg.get("NAME", 0);
final Ident idNewLong = diagram.buildLeafIdent(idShort);
final Code code = diagram.V1972() ? idNewLong : diagram.buildCode(idShort);
final Code code = diagram.buildCode(idShort);
final IGroup currentPackage = diagram.getCurrentGroup();
final Display display = Display.getWithNewlines(code);
final CommandExecutionResult status = diagram.gotoGroup(idNewLong, code, display, GroupType.PACKAGE,

View File

@ -135,9 +135,7 @@ public class CommandPackage extends SingleLineCommand2<AbstractEntityDiagram> {
ident = current.child(idShort);
} else {
ident = diagram.buildLeafIdent(idShort);
code = diagram.V1972() ? ident : diagram.buildCode(idShort);
if (diagram.V1972() && override1972)
display = ident.getLast();
code = diagram.buildCode(idShort);
}
final IGroup currentPackage = diagram.getCurrentGroup();
final CommandExecutionResult status = diagram.gotoGroup(ident, code, Display.getWithNewlines(display),

View File

@ -99,7 +99,7 @@ public class CommandPackageEmpty extends SingleLineCommand2<AbstractEntityDiagra
}
final IGroup currentPackage = diagram.getCurrentGroup();
final Ident ident = diagram.buildLeafIdent(idShort);
final Code code = diagram.V1972() ? ident : diagram.buildCode(idShort);
final Code code = diagram.buildCode(idShort);
final CommandExecutionResult status = diagram.gotoGroup(ident, code, Display.getWithNewlines(display),
GroupType.PACKAGE, currentPackage, NamespaceStrategy.SINGLE);
if (status.isOk() == false)

View File

@ -137,8 +137,8 @@ public final class CommandFactoryNote implements SingleMultiFactoryCommand<Abstr
throws NoSuchColorException {
final String idShort = arg.get("CODE", 0);
final Ident ident = diagram.buildLeafIdent(idShort);
final Code code = diagram.V1972() ? ident : diagram.buildCode(idShort);
final boolean leafExist = diagram.V1972() ? diagram.leafExistSmart(ident) : diagram.leafExist(code);
final Code code = diagram.buildCode(idShort);
final boolean leafExist = diagram.leafExist(code);
if (leafExist)
return CommandExecutionResult.error("Note already created: " + code.getName());

View File

@ -123,11 +123,11 @@ public final class CommandFactoryNoteActivity implements SingleMultiFactoryComma
final String codeString = diagram.getUniqueSequence("GMN");
final Ident ident = diagram.buildLeafIdent(codeString);
final Code code = diagram.V1972() ? ident : diagram.buildCode(codeString);
final Code code = diagram.buildCode(codeString);
final IEntity note = diagram.createLeaf(ident, code, strings, LeafType.NOTE, null);
if (url != null) {
if (url != null)
note.addUrl(url);
}
return executeInternal(diagram, arg, note);
}
};
@ -141,7 +141,7 @@ public final class CommandFactoryNoteActivity implements SingleMultiFactoryComma
RegexResult arg) throws NoSuchColorException {
final String tmp = diagram.getUniqueSequence("GN");
final Ident ident = diagram.buildLeafIdent(tmp);
final Code code = diagram.V1972() ? ident : diagram.buildCode(tmp);
final Code code = diagram.buildCode(tmp);
final IEntity note = diagram.createNote(ident, code, Display.getWithNewlines(arg.get("NOTE", 0)));
return executeInternal(diagram, arg, note);
}
@ -156,9 +156,8 @@ public final class CommandFactoryNoteActivity implements SingleMultiFactoryComma
s == null ? null : diagram.getSkinParam().getIHtmlColorSet().getColor(s));
IEntity activity = diagram.getLastEntityConsulted();
if (activity == null) {
if (activity == null)
activity = diagram.getStart();
}
final Link link;
@ -167,21 +166,21 @@ public final class CommandFactoryNoteActivity implements SingleMultiFactoryComma
final LinkType type = new LinkType(LinkDecor.NONE, LinkDecor.NONE).goDashed();
if (position == Position.RIGHT) {
link = new Link(diagram.getIEntityFactory(), diagram.getSkinParam().getCurrentStyleBuilder(), activity, note,
type, LinkArg.noDisplay(1));
} else if (position == Position.LEFT) {
link = new Link(diagram.getIEntityFactory(), diagram.getSkinParam().getCurrentStyleBuilder(), note, activity,
type, LinkArg.noDisplay(1));
} else if (position == Position.BOTTOM) {
link = new Link(diagram.getIEntityFactory(), diagram.getSkinParam().getCurrentStyleBuilder(), activity, note,
type, LinkArg.noDisplay(2));
} else if (position == Position.TOP) {
link = new Link(diagram.getIEntityFactory(), diagram.getSkinParam().getCurrentStyleBuilder(), note, activity,
type, LinkArg.noDisplay(2));
} else {
if (position == Position.RIGHT)
link = new Link(diagram.getIEntityFactory(), diagram.getSkinParam().getCurrentStyleBuilder(), activity,
note, type, LinkArg.noDisplay(1));
else if (position == Position.LEFT)
link = new Link(diagram.getIEntityFactory(), diagram.getSkinParam().getCurrentStyleBuilder(), note,
activity, type, LinkArg.noDisplay(1));
else if (position == Position.BOTTOM)
link = new Link(diagram.getIEntityFactory(), diagram.getSkinParam().getCurrentStyleBuilder(), activity,
note, type, LinkArg.noDisplay(2));
else if (position == Position.TOP)
link = new Link(diagram.getIEntityFactory(), diagram.getSkinParam().getCurrentStyleBuilder(), note,
activity, type, LinkArg.noDisplay(2));
else
throw new IllegalArgumentException();
}
diagram.addLink(link);
return CommandExecutionResult.ok();
}

View File

@ -223,15 +223,12 @@ public final class CommandFactoryNoteOnEntity implements SingleMultiFactoryComma
} else {
final Ident ident = diagram.buildLeafIdent(idShort);
final Code code = diagram.V1972() ? ident : diagram.buildCode(idShort);
if (diagram.isGroup(code)) {
cl1 = diagram.V1972() ? diagram.getGroupStrict(ident) : diagram.getGroup(code);
} else {
if (diagram.V1972() && diagram.leafExistSmart(diagram.cleanIdent(ident)))
cl1 = diagram.getLeafSmart(diagram.cleanIdent(ident));
else
cl1 = diagram.getOrCreateLeaf(ident, code, null, null);
}
final Code code = diagram.buildCode(idShort);
if (diagram.isGroup(code))
cl1 = diagram.getGroup(code);
else
cl1 = diagram.getOrCreateLeaf(ident, code, null, null);
}
final Position position = Position.valueOf(StringUtils.goUpperCase(pos))
@ -253,11 +250,8 @@ public final class CommandFactoryNoteOnEntity implements SingleMultiFactoryComma
final String tmp = diagram.getUniqueSequence("GMN");
final Ident idNewLong = diagram.buildLeafIdent(tmp);
final IEntity note;
if (diagram.V1972())
note = diagram.createLeaf(idNewLong, idNewLong, strings.toDisplay(), LeafType.NOTE, null);
else
note = diagram.createLeaf(idNewLong, diagram.buildCode(tmp), strings.toDisplay(), LeafType.NOTE, null);
final IEntity note = diagram.createLeaf(idNewLong, diagram.buildCode(tmp), strings.toDisplay(), LeafType.NOTE,
null);
if (stereotypeString != null)
note.setStereotype(stereotype);

View File

@ -170,7 +170,7 @@ public final class CommandFactoryTipOnEntity implements SingleMultiFactoryComman
final String idShort = line0.get("ENTITY", 0);
final Ident identShort = diagram.buildLeafIdent(idShort);
final Code codeShort = diagram.V1972() ? identShort : diagram.buildCode(idShort);
final Code codeShort = diagram.buildCode(idShort);
final String member = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(line0.get("ENTITY", 1));
if (codeShort == null) {
assert false;

View File

@ -35,7 +35,6 @@
*/
package net.sourceforge.plantuml.compositediagram.command;
import net.sourceforge.plantuml.baraye.IEntity;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
@ -59,11 +58,10 @@ public class CommandEndPackageBlock extends SingleLineCommand2<CompositeDiagram>
@Override
protected CommandExecutionResult executeArg(CompositeDiagram diagram, LineLocation location, RegexResult arg) {
final IEntity currentPackage = diagram.getCurrentGroup();
if (currentPackage == null) {
final boolean result = diagram.endGroup();
if (result == false)
return CommandExecutionResult.error("No inner block defined");
}
diagram.endGroup();
return CommandExecutionResult.ok();
}

View File

@ -158,15 +158,10 @@ public class GroupRoot implements IGroup {
@Override
public Collection<IGroup> getChildren() {
final List<IGroup> result = new ArrayList<>();
if (entityFactory.namespaceSeparator.V1972()) {
for (IGroup ent : entityFactory.groups())
if (ent.getIdent().size() == 1)
result.add(ent);
} else {
for (IGroup ent : entityFactory.groups())
if (ent.getParentContainer() == this)
result.add(ent);
}
for (IGroup ent : entityFactory.groups())
if (ent.getParentContainer() == this)
result.add(ent);
return Collections.unmodifiableCollection(result);
}
@ -313,11 +308,6 @@ public class GroupRoot implements IGroup {
throw new UnsupportedOperationException();
}
@Override
public void setThisIsTogether() {
throw new UnsupportedOperationException();
}
@Override
public String getCodeLine() {
throw new UnsupportedOperationException();

View File

@ -52,8 +52,6 @@ import net.sourceforge.plantuml.ugraphic.ImageBuilder;
public interface ICucaDiagram extends GroupHierarchy, PortionShower, Annotated {
boolean V1972();
ISkinParam getSkinParam();
UmlDiagramType getUmlDiagramType();
@ -80,8 +78,6 @@ public interface ICucaDiagram extends GroupHierarchy, PortionShower, Annotated {
String getNamespaceSeparator();
boolean mergeIntricated();
Collection<IGroup> getGroups(boolean b);
UmlSource getSource();

View File

@ -47,7 +47,7 @@ public class Ident implements Code {
final protected List<String> parts;
public /*private*/ Ident(List<String> parts) {
public /* private */ Ident(List<String> parts) {
this.parts = parts;
}
@ -96,8 +96,6 @@ public class Ident implements Code {
}
public Code toCode(CucaDiagram diagram) {
if (diagram.V1972())
return this;
return CodeImpl.of(getLast());
}
@ -228,9 +226,6 @@ public class Ident implements Code {
}
public void checkSameAs(Code code, String separator, CucaDiagram diagram) {
if (diagram.V1972()) {
return;
}
final String last = parts.get(parts.size() - 1);
if (separator == null) {
if (code.getName().equals(last) != true && code.getName().equals(toString(separator)) == false) {

View File

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

View File

@ -100,13 +100,10 @@ public class CommandCreateDomain extends SingleLineCommand2<DescriptionDiagram>
final String stereotype = arg.get("STEREO", 0);
final Ident ident = diagram.buildLeafIdent(codeString);
final Code code = diagram.V1972() ? ident : diagram.buildCode(codeString);
if (diagram.V1972() && diagram.leafExistSmart(ident)) {
final Code code = diagram.buildCode(codeString);
if (diagram.leafExist(code))
return CommandExecutionResult.error("Object already exists : " + codeString);
}
if (!diagram.V1972() && diagram.leafExist(code)) {
return CommandExecutionResult.error("Object already exists : " + codeString);
}
Display d = Display.getWithNewlines(display);
final String urlString = arg.get("URL", 0);
final String group = arg.get("GROUP", 0);

View File

@ -91,12 +91,12 @@ public class DescriptionDiagram extends AbstractEntityDiagram {
codeString = StringUtils.trin(codeString.substring(2));
codeString = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(codeString);
final Ident idNewLong = buildLeafIdent(codeString);
final Code code99 = this.V1972() ? idNewLong : buildCode(codeString);
final Code code99 = buildCode(codeString);
return getOrCreateLeafDefault(idNewLong, code99, LeafType.DESCRIPTION, USymbols.INTERFACE);
}
final String tmp4 = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(code.getName(), "\"([:");
final Ident idNewLong = ident.eventuallyRemoveStartingAndEndingDoubleQuote("\"([:");
code = this.V1972() ? idNewLong : buildCode(tmp4);
code = buildCode(tmp4);
return getOrCreateLeafDefault(idNewLong, code, LeafType.STILL_UNKNOWN, symbol);
}
return getOrCreateLeafDefault(ident, code, type, symbol);

View File

@ -126,7 +126,7 @@ public class CommandArchimate extends SingleLineCommand2<DescriptionDiagram> {
final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(codeRaw);
final Ident ident = diagram.buildLeafIdent(idShort);
final Code code = diagram.V1972() ? ident : diagram.buildCode(idShort);
final Code code = diagram.buildCode(idShort);
final String icon = arg.getLazzy("STEREOTYPE", 0);
final IEntity entity = diagram.getOrCreateLeaf(ident, code, LeafType.DESCRIPTION, USymbols.ARCHIMATE);

View File

@ -108,7 +108,7 @@ public class CommandArchimateMultilines extends CommandMultilines2<AbstractEntit
final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(codeRaw);
final Ident ident = diagram.buildLeafIdent(idShort);
final Code code = diagram.V1972() ? ident : diagram.buildCode(idShort);
final Code code = diagram.buildCode(idShort);
final String icon = line0.getLazzy("STEREOTYPE", 0);
final IEntity entity = diagram.getOrCreateLeaf(ident, code, LeafType.DESCRIPTION, USymbols.RECTANGLE);

View File

@ -230,13 +230,10 @@ public class CommandCreateElementFull extends SingleLineCommand2<DescriptionDiag
final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(codeRaw);
final Ident ident = diagram.buildLeafIdent(idShort);
final Code code = diagram.V1972() ? ident : diagram.buildCode(idShort);
if (!diagram.V1972() && diagram.isGroup(code))
final Code code = diagram.buildCode(idShort);
if (diagram.isGroup(code))
return CommandExecutionResult.error("This element (" + code.getName() + ") is already defined");
if (diagram.V1972() && diagram.isGroupStrict(ident))
return CommandExecutionResult.error("This element (" + ident.getName() + ") is already defined");
String display = displayRaw;
if (display == null)
display = code.getName();
@ -283,31 +280,17 @@ public class CommandCreateElementFull extends SingleLineCommand2<DescriptionDiag
public static boolean existsWithBadType3(AbstractEntityDiagram diagram, Code code, Ident ident, LeafType type,
USymbol usymbol) {
if (diagram.V1972()) {
if (diagram.leafExistSmart(ident) == false)
return false;
final ILeaf other = diagram.getLeafSmart(ident);
if (other.getLeafType() != type)
return true;
if (usymbol != null && other.getUSymbol() != usymbol)
return true;
if (diagram.leafExist(code) == false)
return false;
} else {
if (diagram.leafExist(code) == false)
return false;
final ILeaf other = diagram.getLeaf(code);
if (other.getLeafType() != type)
return true;
final ILeaf other = diagram.getLeaf(code);
if (other.getLeafType() != type)
return true;
if (usymbol != null && other.getUSymbol() != usymbol)
return true;
if (usymbol != null && other.getUSymbol() != usymbol)
return true;
return false;
}
return false;
}
private char getCharEncoding(final String codeRaw) {

View File

@ -164,7 +164,7 @@ public class CommandCreateElementMultilines extends CommandMultilines2<AbstractE
final String stereotype = line0.get("STEREO", 0);
final Ident ident = diagram.buildLeafIdent(idShort);
final Code code = diagram.V1972() ? ident : diagram.buildCode(idShort);
final Code code = diagram.buildCode(idShort);
if (CommandCreateElementFull.existsWithBadType3(diagram, code, ident, type, usymbol))
return CommandExecutionResult.error("This element (" + code.getName() + ") is already defined");

View File

@ -154,22 +154,19 @@ public class CommandCreateElementParenthesis extends SingleLineCommand2<ClassDia
final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(codeRaw);
final Ident ident = diagram.buildLeafIdent(idShort);
final Code code = diagram.V1972() ? ident : diagram.buildCode(idShort);
if (!diagram.V1972() && diagram.isGroup(code)) {
final Code code = diagram.buildCode(idShort);
if (diagram.isGroup(code))
return CommandExecutionResult.error("This element (" + code.getName() + ") is already defined");
}
if (diagram.V1972() && diagram.isGroupStrict(ident)) {
return CommandExecutionResult.error("This element (" + ident.getName() + ") is already defined");
}
String display = displayRaw;
if (display == null) {
if (display == null)
display = code.getName();
}
display = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(display);
final String stereotype = arg.getLazzy("STEREOTYPE", 0);
if (existsWithBadType3(diagram, code, ident, type, usymbol)) {
if (existsWithBadType3(diagram, code, ident, type, usymbol))
return CommandExecutionResult.error("This element (" + code.getName() + ") is already defined");
}
final IEntity entity = diagram.getOrCreateLeaf(ident, code, type, usymbol);
entity.setDisplay(Display.getWithNewlines(display));
entity.setUSymbol(usymbol);
@ -189,11 +186,10 @@ public class CommandCreateElementParenthesis extends SingleLineCommand2<ClassDia
Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet());
final String s = arg.get("LINECOLOR", 1);
final HColor lineColor = s == null ? null
: diagram.getSkinParam().getIHtmlColorSet().getColor(s);
if (lineColor != null) {
final HColor lineColor = s == null ? null : diagram.getSkinParam().getIHtmlColorSet().getColor(s);
if (lineColor != null)
colors = colors.add(ColorType.LINE, lineColor);
}
entity.setColors(colors);
// entity.setSpecificColorTOBEREMOVED(ColorType.BACK,
@ -204,31 +200,17 @@ public class CommandCreateElementParenthesis extends SingleLineCommand2<ClassDia
public static boolean existsWithBadType3(AbstractEntityDiagram diagram, Code code, Ident ident, LeafType type,
USymbol usymbol) {
if (diagram.V1972()) {
if (diagram.leafExistSmart(ident) == false) {
return false;
}
final ILeaf other = diagram.getLeafSmart(ident);
if (other.getLeafType() != type) {
return true;
}
if (usymbol != null && other.getUSymbol() != usymbol) {
return true;
}
if (diagram.leafExist(code) == false)
return false;
} else {
if (diagram.leafExist(code) == false) {
return false;
}
final ILeaf other = diagram.getLeaf(code);
if (other.getLeafType() != type) {
return true;
}
if (usymbol != null && other.getUSymbol() != usymbol) {
return true;
}
return false;
}
final ILeaf other = diagram.getLeaf(code);
if (other.getLeafType() != type)
return true;
if (usymbol != null && other.getUSymbol() != usymbol)
return true;
return false;
}
private char getCharEncoding(final String codeRaw) {

View File

@ -250,8 +250,8 @@ public class CommandLinkElement extends SingleLineCommand2<DescriptionDiagram> {
final Ident ident2 = diagram.buildLeafIdentSpecial(ent2);
Ident ident1pure = Ident.empty().add(ent1, diagram.getNamespaceSeparator());
Ident ident2pure = Ident.empty().add(ent2, diagram.getNamespaceSeparator());
final Code code1 = diagram.V1972() ? ident1 : diagram.buildCode(ent1String);
final Code code2 = diagram.V1972() ? ident2 : diagram.buildCode(ent2String);
final Code code1 = diagram.buildCode(ent1String);
final Code code2 = diagram.buildCode(ent2String);
final LinkType linkType = getLinkType(arg);
final Direction dir = getDirection(arg);
@ -266,10 +266,8 @@ public class CommandLinkElement extends SingleLineCommand2<DescriptionDiagram> {
final IEntity cl1;
final IEntity cl2;
if (diagram.isGroup(code1) && diagram.isGroup(code2)) {
cl1 = diagram.V1972() ? diagram.getGroupStrict(diagram.buildLeafIdent(ent1String))
: diagram.getGroup(diagram.buildCode(ent1String));
cl2 = diagram.V1972() ? diagram.getGroupStrict(diagram.buildLeafIdent(ent2String))
: diagram.getGroup(diagram.buildCode(ent2String));
cl1 = diagram.getGroup(diagram.buildCode(ent1String));
cl2 = diagram.getGroup(diagram.buildCode(ent2String));
} else {
cl1 = getFoo1(diagram, code1, ident1, ident1pure);
cl2 = getFoo1(diagram, code2, ident2, ident2pure);
@ -294,12 +292,9 @@ public class CommandLinkElement extends SingleLineCommand2<DescriptionDiagram> {
}
private IEntity getFoo1(DescriptionDiagram diagram, Code code, Ident ident, Ident pure) {
if (!diagram.V1972() && diagram.isGroup(code))
if (diagram.isGroup(code))
return diagram.getGroup(code);
if (diagram.V1972() && diagram.isGroupStrict(ident))
return diagram.getGroupStrict(ident);
final String codeString = code.getName();
if (ident.getLast().startsWith("()")) {
ident = ident.removeStartingParenthesis();
@ -309,7 +304,7 @@ public class CommandLinkElement extends SingleLineCommand2<DescriptionDiagram> {
final char codeChar = codeString.length() > 2 ? codeString.charAt(0) : 0;
final String tmp3 = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(codeString, "\"([:");
final Ident ident3 = diagram.buildFullyQualified(tmp3);
final Code code3 = diagram.V1972() ? ident3 : diagram.buildCode(tmp3);
final Code code3 = diagram.buildCode(tmp3);
if (codeChar == '(') {
return getOrCreateLeaf1972(diagram, ident, code3, LeafType.USECASE, USymbols.USECASE, pure);
} else if (codeChar == ':') {
@ -325,13 +320,6 @@ public class CommandLinkElement extends SingleLineCommand2<DescriptionDiagram> {
private ILeaf getOrCreateLeaf1972(DescriptionDiagram diagram, Ident ident, Code code, LeafType type, USymbol symbol,
Ident pure) {
if (diagram.V1972()) {
final ILeaf result = pure.size() == 1 ? diagram.getLeafVerySmart(ident) : diagram.getLeafStrict(ident);
// final ILeaf result = diagram.getLeafSmart(ident);
if (result != null)
return result;
}
return diagram.getOrCreateLeaf(ident, code, type, symbol);
}

View File

@ -154,7 +154,7 @@ public class CommandPackageWithUSymbol extends SingleLineCommand2<AbstractEntity
}
final Ident ident = diagram.buildLeafIdent(idShort);
final Code code = diagram.V1972() ? ident : diagram.buildCode(idShort);
final Code code = diagram.buildCode(idShort);
final IGroup currentPackage = diagram.getCurrentGroup();
final CommandExecutionResult status = diagram.gotoGroup(ident, code, Display.getWithNewlines(display),
GroupType.PACKAGE, currentPackage, NamespaceStrategy.SINGLE);

View File

@ -45,10 +45,8 @@ import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.GroupType;
import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
import net.sourceforge.plantuml.graphic.USymbols;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
import net.sourceforge.plantuml.utils.LineLocation;
@ -70,15 +68,14 @@ public class CommandTogether extends SingleLineCommand2<AbstractEntityDiagram> {
throws NoSuchColorException {
final String idShort = diagram.getUniqueSequence("##");
final Ident ident = diagram.buildLeafIdent(idShort);
final Code code = diagram.V1972() ? ident : diagram.buildCode(idShort);
final Code code = diagram.buildCode(idShort);
final IGroup currentPackage = diagram.getCurrentGroup();
final CommandExecutionResult status = diagram.gotoGroup(ident, code, Display.NULL, GroupType.TOGETHER,
currentPackage, NamespaceStrategy.SINGLE);
final CommandExecutionResult status = diagram.gotoTogether(ident, code, currentPackage);
if (status.isOk() == false)
return status;
final IEntity p = diagram.getCurrentGroup();
p.setThisIsTogether();
p.setUSymbol(USymbols.TOGETHER);
return CommandExecutionResult.ok();
}

View File

@ -113,7 +113,7 @@ public class StyleExtractor {
if (style.size() > 0) {
final StyleBuilder styleBuilder = skinParam.getCurrentStyleBuilder();
final BlocLines blocLines = BlocLines.from(style);
for (Style modifiedStyle : StyleParser.parse(blocLines.subExtract(1, 1), styleBuilder))
for (Style modifiedStyle : StyleParser.parse(blocLines, styleBuilder))
skinParam.muteStyle(modifiedStyle);
}
}

View File

@ -127,10 +127,10 @@ public abstract class AbstractClassOrObjectDiagram extends AbstractEntityDiagram
final Ident ident1B = buildLeafIdent(name1B);
final Ident ident2A = buildLeafIdent(name2A);
final Ident ident2B = buildLeafIdent(name2B);
final Code code1A = this.V1972() ? ident1A : buildCode(name1A);
final Code code1B = this.V1972() ? ident1B : buildCode(name1B);
final Code code2A = this.V1972() ? ident2A : buildCode(name2A);
final Code code2B = this.V1972() ? ident2B : buildCode(name2B);
final Code code1A = buildCode(name1A);
final Code code1B = buildCode(name1B);
final Code code2A = buildCode(name2A);
final Code code2B = buildCode(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);
@ -142,8 +142,8 @@ public abstract class AbstractClassOrObjectDiagram extends AbstractEntityDiagram
final String tmp2 = this.getUniqueSequence("apoint");
final Ident ident1 = buildLeafIdent(tmp1);
final Ident ident2 = buildLeafIdent(tmp2);
final Code code1 = this.V1972() ? ident1 : buildCode(tmp1);
final Code code2 = this.V1972() ? ident2 : buildCode(tmp2);
final Code code1 = buildCode(tmp1);
final Code code2 = buildCode(tmp2);
final IEntity point1 = getOrCreateLeaf(ident1, code1, LeafType.POINT_FOR_ASSOCIATION, null);
final IEntity point2 = getOrCreateLeaf(ident2, code2, LeafType.POINT_FOR_ASSOCIATION, null);
@ -201,8 +201,8 @@ public abstract class AbstractClassOrObjectDiagram extends AbstractEntityDiagram
Display label) {
final Ident ident1 = buildLeafIdent(name1);
final Ident ident2 = buildLeafIdent(name2);
final Code code1 = this.V1972() ? ident1 : buildCode(name1);
final Code code2 = this.V1972() ? ident2 : buildCode(name2);
final Code code1 = buildCode(name1);
final Code code2 = buildCode(name2);
final IEntity entity1 = getOrCreateLeaf(ident1, code1, null, null);
final IEntity entity2 = getOrCreateLeaf(ident2, code2, null, null);
final List<Association> same = getExistingAssociatedPoints(entity1, entity2);
@ -253,7 +253,7 @@ public abstract class AbstractClassOrObjectDiagram extends AbstractEntityDiagram
this.associed = associed;
final String idShort = AbstractClassOrObjectDiagram.this.getUniqueSequence("apoint");
final Ident ident = buildLeafIdent(idShort);
final Code code = AbstractClassOrObjectDiagram.this.V1972() ? ident : buildCode(idShort);
final Code code = buildCode(idShort);
point = getOrCreateLeaf(ident, code, LeafType.POINT_FOR_ASSOCIATION, null);
}
@ -313,11 +313,11 @@ public abstract class AbstractClassOrObjectDiagram extends AbstractEntityDiagram
addLink(pointToEntity2);
if (mode == 1) {
pointToAssocied = new Link(getIEntityFactory(), getSkinParam().getCurrentStyleBuilder(), point, associed,
linkType, LinkArg.build(label, length));
pointToAssocied = new Link(getIEntityFactory(), getSkinParam().getCurrentStyleBuilder(), point,
associed, linkType, LinkArg.build(label, length));
} else {
pointToAssocied = new Link(getIEntityFactory(), getSkinParam().getCurrentStyleBuilder(), associed, point,
linkType, LinkArg.build(label, length));
pointToAssocied = new Link(getIEntityFactory(), getSkinParam().getCurrentStyleBuilder(), associed,
point, linkType, LinkArg.build(label, length));
}
addLink(pointToAssocied);
}

View File

@ -81,13 +81,13 @@ public class CommandCreateEntityObject extends SingleLineCommand2<AbstractClassO
RegexResult arg) throws NoSuchColorException {
final String idShort = arg.get("NAME", 1);
final Ident ident = diagram.buildLeafIdent(idShort);
final Code code = diagram.V1972() ? ident : diagram.buildCode(idShort);
final Code code = diagram.buildCode(idShort);
final String display = arg.get("NAME", 0);
final String stereotype = arg.get("STEREO", 0);
final boolean leafExist = diagram.V1972() ? diagram.leafExistSmart(ident) : diagram.leafExist(code);
if (leafExist) {
final boolean leafExist = diagram.leafExist(code);
if (leafExist)
return CommandExecutionResult.error("Object already exists : " + code);
}
final IEntity entity = diagram.createLeaf(ident, code, Display.getWithNewlines(display), LeafType.OBJECT, null);
if (stereotype != null) {
entity.setStereotype(Stereotype.build(stereotype, diagram.getSkinParam().getCircledCharacterRadius(),
@ -101,8 +101,8 @@ public class CommandCreateEntityObject extends SingleLineCommand2<AbstractClassO
entity.addUrl(url);
}
final String s = arg.get("COLOR", 0);
entity.setSpecificColorTOBEREMOVED(ColorType.BACK, s == null ? null
: diagram.getSkinParam().getIHtmlColorSet().getColor(s));
entity.setSpecificColorTOBEREMOVED(ColorType.BACK,
s == null ? null : diagram.getSkinParam().getIHtmlColorSet().getColor(s));
return CommandExecutionResult.ok();
}
}

View File

@ -109,10 +109,10 @@ public class CommandCreateEntityObjectMultilines extends CommandMultilines2<Abst
private IEntity executeArg0(AbstractClassOrObjectDiagram diagram, RegexResult line0) throws NoSuchColorException {
final String name = line0.get("NAME", 1);
final Ident ident = diagram.buildLeafIdent(name);
final Code code = diagram.V1972() ? ident : diagram.buildCode(name);
final Code code = diagram.buildCode(name);
final String display = line0.get("NAME", 0);
final String stereotype = line0.get("STEREO", 0);
final boolean leafExist = diagram.V1972() ? diagram.leafExistSmart(ident) : diagram.leafExist(code);
final boolean leafExist = diagram.leafExist(code);
if (leafExist)
return diagram.getOrCreateLeaf(diagram.buildLeafIdent(name), code, LeafType.OBJECT, null);

View File

@ -144,10 +144,10 @@ public class CommandCreateJson extends CommandMultilines2<AbstractEntityDiagram>
private IEntity executeArg0(AbstractEntityDiagram diagram, RegexResult line0) throws NoSuchColorException {
final String name = line0.get("NAME", 1);
final Ident ident = diagram.buildLeafIdent(name);
final Code code = diagram.V1972() ? ident : diagram.buildCode(name);
final Code code = diagram.buildCode(name);
final String display = line0.get("NAME", 0);
final String stereotype = line0.get("STEREO", 0);
final boolean leafExist = diagram.V1972() ? diagram.leafExistSmart(ident) : diagram.leafExist(code);
final boolean leafExist = diagram.leafExist(code);
if (leafExist)
return diagram.getOrCreateLeaf(diagram.buildLeafIdent(name), code, LeafType.JSON, null);
@ -158,8 +158,8 @@ public class CommandCreateJson extends CommandMultilines2<AbstractEntityDiagram>
diagram.getSkinParam().getIHtmlColorSet()));
final String s = line0.get("COLOR", 0);
entity.setSpecificColorTOBEREMOVED(ColorType.BACK, s == null ? null
: diagram.getSkinParam().getIHtmlColorSet().getColor(s));
entity.setSpecificColorTOBEREMOVED(ColorType.BACK,
s == null ? null : diagram.getSkinParam().getIHtmlColorSet().getColor(s));
return entity;
}

View File

@ -113,10 +113,10 @@ public class CommandCreateJsonSingleLine extends SingleLineCommand2<AbstractClas
private IEntity executeArg0(AbstractClassOrObjectDiagram diagram, RegexResult line0) throws NoSuchColorException {
final String name = line0.get("NAME", 1);
final Ident ident = diagram.buildLeafIdent(name);
final Code code = diagram.V1972() ? ident : diagram.buildCode(name);
final Code code = diagram.buildCode(name);
final String display = line0.get("NAME", 0);
final String stereotype = line0.get("STEREO", 0);
final boolean leafExist = diagram.V1972() ? diagram.leafExistSmart(ident) : diagram.leafExist(code);
final boolean leafExist = diagram.leafExist(code);
if (leafExist)
return diagram.getOrCreateLeaf(diagram.buildLeafIdent(name), code, LeafType.JSON, null);
@ -127,8 +127,8 @@ public class CommandCreateJsonSingleLine extends SingleLineCommand2<AbstractClas
diagram.getSkinParam().getIHtmlColorSet()));
final String s = line0.get("COLOR", 0);
entity.setSpecificColorTOBEREMOVED(ColorType.BACK, s == null ? null
: diagram.getSkinParam().getIHtmlColorSet().getColor(s));
entity.setSpecificColorTOBEREMOVED(ColorType.BACK,
s == null ? null : diagram.getSkinParam().getIHtmlColorSet().getColor(s));
return entity;
}

View File

@ -142,10 +142,10 @@ public class CommandCreateMap extends CommandMultilines2<AbstractEntityDiagram>
private IEntity executeArg0(AbstractEntityDiagram diagram, RegexResult line0) throws NoSuchColorException {
final String name = line0.get("NAME", 1);
final Ident ident = diagram.buildLeafIdent(name);
final Code code = diagram.V1972() ? ident : diagram.buildCode(name);
final Code code = diagram.buildCode(name);
final String display = line0.get("NAME", 0);
final String stereotype = line0.get("STEREO", 0);
final boolean leafExist = diagram.V1972() ? diagram.leafExistSmart(ident) : diagram.leafExist(code);
final boolean leafExist = diagram.leafExist(code);
if (leafExist)
return diagram.getOrCreateLeaf(diagram.buildLeafIdent(name), code, LeafType.MAP, null);

View File

@ -42,7 +42,6 @@ import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.baraye.EntityUtils;
import net.sourceforge.plantuml.baraye.IEntity;
import net.sourceforge.plantuml.baraye.IGroup;
import net.sourceforge.plantuml.baraye.ILeaf;
import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram;
import net.sourceforge.plantuml.core.UmlSource;
import net.sourceforge.plantuml.cucadiagram.Code;
@ -64,9 +63,6 @@ public class StateDiagram extends AbstractEntityDiagram {
}
public boolean checkConcurrentStateOk(Ident ident, Code code) {
if (this.V1972()) {
return checkConcurrentStateOkInternal1972(ident);
}
final boolean result = checkConcurrentStateOkInternal(code);
// System.err.println("checkConcurrentStateOk " + code + " " + ident + " " +
// result);
@ -89,50 +85,18 @@ public class StateDiagram extends AbstractEntityDiagram {
return true;
}
private boolean checkConcurrentStateOkInternal1972(Ident ident) {
if (leafExistSmart(ident) == false) {
return true;
}
final IEntity existing = this.getLeafSmart(ident);
if (getCurrentGroup().getGroupType() == GroupType.CONCURRENT_STATE
&& getCurrentGroup() != existing.getParentContainer()) {
return false;
}
if (existing.getParentContainer().getGroupType() == GroupType.CONCURRENT_STATE
&& getCurrentGroup() != existing.getParentContainer()) {
return false;
}
return true;
}
@Override
public IEntity getOrCreateLeaf(Ident ident, Code code, LeafType type, USymbol symbol) {
if (checkConcurrentStateOk(Objects.requireNonNull(ident), code) == false) {
throw new IllegalStateException("Concurrent State " + code);
}
if (!this.V1972() && type == null) {
if (code.getName().startsWith("[*]")) {
if (type == null) {
if (code.getName().startsWith("[*]"))
throw new IllegalArgumentException();
}
if (isGroup(code)) {
return getGroup(code);
}
return getOrCreateLeafDefault(ident, code, LeafType.STATE, null);
}
if (this.V1972() && type == null) {
if (ident.getName().startsWith("[*]")) {
throw new IllegalArgumentException();
}
if (isGroupVerySmart(ident)) {
return getGroupVerySmart(ident);
}
if (getNamespaceSeparator() == null) {
final ILeaf result = getLeafVerySmart(ident);
if (result != null) {
return result;
}
}
if (isGroup(code))
return getGroup(code);
return getOrCreateLeafDefault(ident, code, LeafType.STATE, null);
}
return getOrCreateLeafDefault(ident, code, type, symbol);
@ -142,12 +106,12 @@ public class StateDiagram extends AbstractEntityDiagram {
final IGroup g = getCurrentGroup();
if (EntityUtils.groupRoot(g)) {
final Ident ident = buildLeafIdent("*start");
final Code code = this.V1972() ? ident : buildCode("*start");
final Code code = buildCode("*start");
return getOrCreateLeaf(ident, code, LeafType.CIRCLE_START, null);
}
final String idShort = "*start*" + g.getCodeGetName();
final Ident ident = buildLeafIdent(idShort);
final Code code = this.V1972() ? ident : buildCode(idShort);
final Code code = buildCode(idShort);
return getOrCreateLeaf(ident, code, LeafType.CIRCLE_START, null);
}
@ -155,12 +119,12 @@ public class StateDiagram extends AbstractEntityDiagram {
final IGroup p = getCurrentGroup();
if (EntityUtils.groupRoot(p)) {
final Ident ident = buildLeafIdent("*end");
final Code code = this.V1972() ? ident : buildCode("*end");
final Code code = buildCode("*end");
return getOrCreateLeaf(ident, code, LeafType.CIRCLE_END, null);
}
final String idShort = "*end*" + p.getCodeGetName();
final Ident ident = buildLeafIdent(idShort);
final Code code = this.V1972() ? ident : buildCode(idShort);
final Code code = buildCode(idShort);
return getOrCreateLeaf(ident, code, LeafType.CIRCLE_END, null);
}
@ -173,19 +137,19 @@ public class StateDiagram extends AbstractEntityDiagram {
}
final String idShort = "*historical*" + g.getCodeGetName();
final Ident ident = buildLeafIdent(idShort);
final Code code = this.V1972() ? ident : buildCode(idShort);
final Code code = buildCode(idShort);
return getOrCreateLeaf(ident, code, LeafType.PSEUDO_STATE, null);
}
public IEntity getHistorical(String idShort) {
final Ident idNewLong = buildLeafIdent(idShort);
final Code codeGroup = this.V1972() ? idNewLong : buildCode(idShort);
final Code codeGroup = buildCode(idShort);
gotoGroup(idNewLong, codeGroup, Display.getWithNewlines(codeGroup), GroupType.STATE, getRootGroup(),
NamespaceStrategy.SINGLE);
final IEntity g = getCurrentGroup();
final String tmp = "*historical*" + g.getCodeGetName();
final Ident ident = buildLeafIdent(tmp);
final Code code = this.V1972() ? ident : buildCode(tmp);
final Code code = buildCode(tmp);
final IEntity result = getOrCreateLeaf(ident, code, LeafType.PSEUDO_STATE, null);
endGroup();
return result;
@ -201,19 +165,19 @@ public class StateDiagram extends AbstractEntityDiagram {
final String idShort = "*deephistory*" + g.getCodeGetName();
final Ident ident = buildLeafIdent(idShort);
final Code code = this.V1972() ? ident : buildCode(idShort);
final Code code = buildCode(idShort);
return getOrCreateLeaf(ident, code, LeafType.DEEP_HISTORY, null);
}
public IEntity getDeepHistory(String idShort) {
final Ident idNewLong = buildLeafIdent(idShort);
final Code codeGroup = this.V1972() ? idNewLong : buildCode(idShort);
final Code codeGroup = buildCode(idShort);
gotoGroup(idNewLong, codeGroup, Display.getWithNewlines(codeGroup), GroupType.STATE, getRootGroup(),
NamespaceStrategy.SINGLE);
final IEntity g = getCurrentGroup();
final String tmp = "*deephistory*" + g.getCodeGetName();
final Ident ident = buildLeafIdent(tmp);
final Code code = this.V1972() ? ident : buildCode(tmp);
final Code code = buildCode(tmp);
final IEntity result = getOrCreateLeaf(ident, code, LeafType.DEEP_HISTORY, null);
endGroup();
return result;
@ -228,7 +192,7 @@ public class StateDiagram extends AbstractEntityDiagram {
getCurrentGroup().setConcurrentSeparator(direction);
final String tmp1 = this.getUniqueSequence(CONCURRENT_PREFIX);
final Ident ident1 = buildLeafIdent(tmp1);
final Code code1 = this.V1972() ? ident1 : buildCode(tmp1);
final Code code1 = buildCode(tmp1);
gotoGroup(ident1, code1, Display.create(""), GroupType.CONCURRENT_STATE, getCurrentGroup(),
NamespaceStrategy.SINGLE);
final IGroup conc1 = getCurrentGroup();
@ -237,7 +201,7 @@ public class StateDiagram extends AbstractEntityDiagram {
super.endGroup();
final String tmp2 = this.getUniqueSequence(CONCURRENT_PREFIX);
final Ident ident2 = buildLeafIdent(tmp2);
final Code code2 = this.V1972() ? ident2 : buildCode(tmp2);
final Code code2 = buildCode(tmp2);
gotoGroup(ident2, code2, Display.create(""), GroupType.CONCURRENT_STATE, getCurrentGroup(),
NamespaceStrategy.SINGLE);
}
@ -253,12 +217,12 @@ public class StateDiagram extends AbstractEntityDiagram {
// }
@Override
public void endGroup() {
public boolean endGroup() {
final IGroup cur = getCurrentGroup();
if (EntityUtils.groupRoot(cur) == false && cur.getGroupType() == GroupType.CONCURRENT_STATE) {
if (EntityUtils.groupRoot(cur) == false && cur.getGroupType() == GroupType.CONCURRENT_STATE)
super.endGroup();
}
super.endGroup();
return super.endGroup();
}
private boolean hideEmptyDescription = false;

View File

@ -97,13 +97,7 @@ public class CommandAddField extends SingleLineCommand2<StateDiagram> {
final String field = arg.get("FIELD", 0);
Ident ident = diagram.buildLeafIdent(codeString);
if (diagram.V1972()) {
// This is very bad. xi04 xc06
if (ident.parent().getLast().equals(codeString)) {
ident = ident.parent();
}
}
final Code code = diagram.V1972() ? ident : diagram.buildCode(codeString);
final Code code = diagram.buildCode(codeString);
final IEntity entity = diagram.getOrCreateLeaf(ident, code, null, null);
entity.getBodier().addFieldOrMethod(field);

View File

@ -114,7 +114,7 @@ public class CommandCreatePackage2 extends SingleLineCommand2<StateDiagram> {
final IGroup currentPackage = diagram.getCurrentGroup();
final String idShort = getNotNull(arg, "CODE1", "CODE2");
final Ident idNewLong = diagram.buildLeafIdentSpecial(idShort);
final Code code = diagram.V1972() ? idNewLong : diagram.buildCode(idShort);
final Code code = diagram.buildCode(idShort);
String display = getNotNull(arg, "DISPLAY1", "DISPLAY2");
if (display == null)
display = code.getName();
@ -137,8 +137,7 @@ public class CommandCreatePackage2 extends SingleLineCommand2<StateDiagram> {
Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet());
final String s = arg.get("LINECOLOR", 1);
final HColor lineColor = s == null ? null
: diagram.getSkinParam().getIHtmlColorSet().getColor(s);
final HColor lineColor = s == null ? null : diagram.getSkinParam().getIHtmlColorSet().getColor(s);
if (lineColor != null)
colors = colors.add(ColorType.LINE, lineColor);

View File

@ -119,7 +119,7 @@ public class CommandCreatePackageState extends SingleLineCommand2<StateDiagram>
final IGroup currentPackage = diagram.getCurrentGroup();
final String idShort = getNotNull(arg, "CODE1", "CODE2");
final Ident idNewLong = diagram.buildLeafIdentSpecial(idShort);
final Code code = diagram.V1972() ? idNewLong : diagram.buildCode(idShort);
final Code code = diagram.buildCode(idShort);
String display = getNotNull(arg, "DISPLAY1", "DISPLAY2");
if (display == null)
display = code.getName();

View File

@ -114,23 +114,23 @@ public class CommandCreateState extends SingleLineCommand2<StateDiagram> {
throws NoSuchColorException {
final String idShort = arg.getLazzy("CODE", 0);
final Ident ident = diagram.buildLeafIdent(idShort);
final Code code = diagram.V1972() ? ident : diagram.buildCode(idShort);
final Code code = diagram.buildCode(idShort);
String display = arg.getLazzy("DISPLAY", 0);
if (display == null)
if (display == null)
display = code.getName();
final String stereotype = arg.get("STEREOTYPE", 0);
final LeafType type = getTypeFromStereotype(stereotype);
if (diagram.checkConcurrentStateOk(ident, code) == false)
if (diagram.checkConcurrentStateOk(ident, code) == false)
return CommandExecutionResult.error("The state " + code.getName()
+ " has been created in a concurrent state : it cannot be used here.");
final IEntity ent = diagram.getOrCreateLeaf(diagram.buildLeafIdent(idShort), code, type, null);
ent.setDisplay(Display.getWithNewlines(display));
if (stereotype != null)
if (stereotype != null)
ent.setStereotype(Stereotype.build(stereotype));
final String urlString = arg.get("URL", 0);
if (urlString != null) {
final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), UrlMode.STRICT);
@ -141,14 +141,13 @@ public class CommandCreateState extends SingleLineCommand2<StateDiagram> {
Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet());
final String s = arg.get("LINECOLOR", 1);
final HColor lineColor = s == null ? null
: diagram.getSkinParam().getIHtmlColorSet().getColor(s);
if (lineColor != null)
final HColor lineColor = s == null ? null : diagram.getSkinParam().getIHtmlColorSet().getColor(s);
if (lineColor != null)
colors = colors.add(ColorType.LINE, lineColor);
if (arg.get("LINECOLOR", 0) != null)
if (arg.get("LINECOLOR", 0) != null)
colors = colors.addLegacyStroke(arg.get("LINECOLOR", 0));
ent.setColors(colors);
// ent.setSpecificColorTOBEREMOVED(ColorType.BACK,
@ -160,36 +159,36 @@ public class CommandCreateState extends SingleLineCommand2<StateDiagram> {
// ent.applyStroke(arg.get("LINECOLOR", 0));
final String addFields = arg.get("ADDFIELD", 0);
if (addFields != null)
if (addFields != null)
ent.getBodier().addFieldOrMethod(addFields);
CommandCreateClassMultilines.addTags(ent, arg.getLazzy("TAGS", 0));
return CommandExecutionResult.ok();
}
private LeafType getTypeFromStereotype(String stereotype) {
if ("<<choice>>".equalsIgnoreCase(stereotype))
if ("<<choice>>".equalsIgnoreCase(stereotype))
return LeafType.STATE_CHOICE;
if ("<<fork>>".equalsIgnoreCase(stereotype))
if ("<<fork>>".equalsIgnoreCase(stereotype))
return LeafType.STATE_FORK_JOIN;
if ("<<join>>".equalsIgnoreCase(stereotype))
if ("<<join>>".equalsIgnoreCase(stereotype))
return LeafType.STATE_FORK_JOIN;
if ("<<start>>".equalsIgnoreCase(stereotype))
if ("<<start>>".equalsIgnoreCase(stereotype))
return LeafType.CIRCLE_START;
if ("<<end>>".equalsIgnoreCase(stereotype))
if ("<<end>>".equalsIgnoreCase(stereotype))
return LeafType.CIRCLE_END;
if ("<<history>>".equalsIgnoreCase(stereotype))
if ("<<history>>".equalsIgnoreCase(stereotype))
return LeafType.PSEUDO_STATE;
if ("<<history*>>".equalsIgnoreCase(stereotype))
if ("<<history*>>".equalsIgnoreCase(stereotype))
return LeafType.DEEP_HISTORY;
return null;
}

View File

@ -168,11 +168,11 @@ abstract class CommandLinkStateCommon extends SingleLineCommand2<StateDiagram> {
if (codeString.startsWith("=") && codeString.endsWith("=")) {
final String codeString1 = removeEquals(codeString);
final Ident ident1 = diagram.buildLeafIdent(codeString1);
final Code code1 = diagram.V1972() ? ident1 : diagram.buildCode(codeString1);
final Code code1 = diagram.buildCode(codeString1);
return diagram.getOrCreateLeaf(ident1, code1, LeafType.SYNCHRO_BAR, null);
}
final Ident ident = diagram.buildLeafIdent(codeString);
final Code code = diagram.V1972() ? ident : diagram.buildCode(codeString);
final Code code = diagram.buildCode(codeString);
if (diagram.checkConcurrentStateOk(ident, code) == false)
return null;

View File

@ -79,6 +79,11 @@ public class StyleParser {
if (token.getType() == StyleTokenType.SEMICOLON)
continue;
if (token.getType() == StyleTokenType.STRING && token.getData().equalsIgnoreCase("<style>"))
continue;
if (token.getType() == StyleTokenType.STRING && token.getData().equalsIgnoreCase("</style>"))
continue;
if (ins.peek(0).getType() == StyleTokenType.COMMA) {
final String full = token.getData() + readWithComma(ins);
skipNewLines(ins);
@ -255,8 +260,6 @@ public class StyleParser {
result.add(new StyleToken(StyleTokenType.STRING, s));
} else {
final String s = readString(ins);
if (s.startsWith("<"))
throw new StyleParsingException("Cannot understand <");
result.add(new StyleToken(StyleTokenType.STRING, s));
}
}

View File

@ -78,9 +78,8 @@ public final class CucaDiagramFileMakerSvek implements CucaDiagramFileMaker {
diagram.getLeafsvalues(), diagram.getUmlDiagramType(), diagram.getSkinParam(), diagram, diagram,
diagram.getEntityFactory(), diagram.isHideEmptyDescriptionForState(), dotMode,
diagram.getNamespaceSeparator(), diagram.getPragma());
final boolean intricated = diagram.mergeIntricated();
return new GeneralImageBuilder(intricated, dotData, diagram.getEntityFactory(), diagram.getSource(),
diagram.getPragma(), stringBounder, diagram.getUmlDiagramType().getStyleName());
return new GeneralImageBuilder(dotData, diagram.getEntityFactory(), diagram.getSource(), diagram.getPragma(),
stringBounder, diagram.getUmlDiagramType().getStyleName());
}

View File

@ -349,8 +349,7 @@ public class DotStringFactory implements Moveable {
return graphviz.getDotExe();
}
public void solve(boolean mergeIntricated, EntityFactory entityFactory, final String svg)
throws IOException, InterruptedException {
public void solve(EntityFactory entityFactory, final String svg) throws IOException, InterruptedException {
if (svg.length() == 0)
throw new EmptySvgException();
@ -407,12 +406,6 @@ public class DotStringFactory implements Moveable {
}
for (Cluster cluster : bibliotekon.allCluster()) {
if (mergeIntricated) {
final IGroup group = cluster.getGroups().iterator().next();
if (entityFactory.isIntricated(group) != null)
continue;
}
int idx = getClusterIndex(svg, cluster.getColor());
final int starting = idx;
final List<XPoint2D> points = svgResult.substring(starting).extractList(SvgResult.POINTS_EQUALS);

View File

@ -296,11 +296,10 @@ public final class GeneralImageBuilder {
private Map<String, Double> maxX;
private final StringBounder stringBounder;
private final boolean mergeIntricated;
private final SName styleName;
public GeneralImageBuilder(boolean mergeIntricated, DotData dotData, EntityFactory entityFactory, UmlSource source,
Pragma pragma, StringBounder stringBounder, SName styleName) {
public GeneralImageBuilder(DotData dotData, EntityFactory entityFactory, UmlSource source, Pragma pragma,
StringBounder stringBounder, SName styleName) {
this.dotData = dotData;
this.styleName = styleName;
this.entityFactory = entityFactory;
@ -308,7 +307,6 @@ public final class GeneralImageBuilder {
this.pragma = pragma;
this.stringBounder = stringBounder;
this.strictUmlStyle = dotData.getSkinParam().strictUmlStyle();
this.mergeIntricated = mergeIntricated;
}
final public StyleSignature getDefaultStyleDefinitionArrow(Stereotype stereotype) {
@ -462,7 +460,7 @@ public final class GeneralImageBuilder {
final String graphvizVersion = extractGraphvizVersion(svg);
try {
dotStringFactory.solve(mergeIntricated, dotData.getEntityFactory(), svg);
dotStringFactory.solve(dotData.getEntityFactory(), svg);
final SvekResult result = new SvekResult(dotData, dotStringFactory);
this.maxX = dotStringFactory.getBibliotekon().getMaxX();
return result;
@ -608,14 +606,6 @@ public final class GeneralImageBuilder {
if (g.getGroupType() == GroupType.CONCURRENT_STATE)
return;
if (mergeIntricated) {
final IGroup intricated = dotData.getEntityFactory().isIntricated(g);
if (intricated != null) {
printGroup(dotStringFactory, intricated);
return;
}
}
final ClusterHeader clusterHeader = new ClusterHeader((EntityImp) g, dotData.getSkinParam(), dotData,
stringBounder);
dotStringFactory.openCluster(g, clusterHeader);

View File

@ -120,7 +120,7 @@ public final class GroupPngMakerActivity {
skinParam, new InnerGroupHierarchy(), diagram.getEntityFactory(), false, DotMode.NORMAL,
diagram.getNamespaceSeparator(), diagram.getPragma());
final GeneralImageBuilder svek2 = new GeneralImageBuilder(false, dotData, diagram.getEntityFactory(),
final GeneralImageBuilder svek2 = new GeneralImageBuilder(dotData, diagram.getEntityFactory(),
diagram.getSource(), diagram.getPragma(), stringBounder, SName.activityDiagram);
if (group.getGroupType() == GroupType.INNER_ACTIVITY) {

View File

@ -134,7 +134,7 @@ public final class GroupPngMakerState {
diagram.isHideEmptyDescriptionForState(), DotMode.NORMAL, diagram.getNamespaceSeparator(),
diagram.getPragma());
final GeneralImageBuilder svek2 = new GeneralImageBuilder(false, dotData, diagram.getEntityFactory(),
final GeneralImageBuilder svek2 = new GeneralImageBuilder(dotData, diagram.getEntityFactory(),
diagram.getSource(), diagram.getPragma(), stringBounder, SName.stateDiagram);
if (group.getGroupType() == GroupType.CONCURRENT_STATE)

View File

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

Binary file not shown.

Binary file not shown.