diff --git a/dumpAst.base/src/main/jastadd/DumpAst.relast b/dumpAst.base/src/main/jastadd/DumpAst.relast index 5abf5872ff94270d670b9d1acd747019560d025f..e6b8d57aeeea46eb6fc6018c082911b1a52ca07e 100644 --- a/dumpAst.base/src/main/jastadd/DumpAst.relast +++ b/dumpAst.base/src/main/jastadd/DumpAst.relast @@ -13,18 +13,18 @@ rel InnerRelationDumpNode.DumpNode <-> DumpNode.ContainerOfRelationInner* ; abstract DumpChildNode ::= <Label> <Computed:boolean> ; DumpNormalChildNode : DumpChildNode ::= <LineColor> <TextColor> ; rel DumpNormalChildNode.DumpNode <-> DumpNode.ContainerOfNormalChild? ; -DumpListChildNode : DumpChildNode ::= InnerDumpNode* ; +DumpListChildNode : DumpChildNode ::= InnerDumpNode* <Name> ; abstract DumpToken ::= <Label> <Computed:boolean> ; DumpReferenceToken : DumpToken ; rel DumpReferenceToken.Value -> DumpNode ; -DumpReferenceListToken : DumpToken ::= InnerRelationDumpNode* ; +DumpReferenceListToken : DumpToken ::= InnerRelationDumpNode* <Name> ; DumpValueToken : DumpToken ::= <Value:Object> ; abstract DumpRelation ::= <Label> <Bidirectional:boolean> ; DumpNormalRelation : DumpRelation ::= <LineColor> <TextColor> ; rel DumpNormalRelation.DumpNode -> DumpNode ; -DumpListRelation : DumpRelation ::= InnerRelationDumpNode* ; +DumpListRelation : DumpRelation ::= InnerRelationDumpNode* <Name> ; // type of NTA InvisiblePath ::= InnerRelationDumpNode* ; diff --git a/dumpAst.base/src/main/jastadd/Frontend.jrag b/dumpAst.base/src/main/jastadd/Frontend.jrag index 41319aa812239c1a3e8b273e7aaf6740065912ec..eaaf02de2cef1576494e311800f539f2e5cc541e 100644 --- a/dumpAst.base/src/main/jastadd/Frontend.jrag +++ b/dumpAst.base/src/main/jastadd/Frontend.jrag @@ -12,7 +12,7 @@ aspect Frontend { @FunctionalInterface public interface RelationStyleDefinition<ASTNODE> { - void style(ASTNODE source, ASTNODE target, RelationStyle style); + void style(ASTNODE source, ASTNODE target, boolean isComputed, boolean isContainment, RelationStyle style); } public void NodeStyle.useSimpleLabel() { diff --git a/dumpAst.base/src/main/jastadd/Navigation.jrag b/dumpAst.base/src/main/jastadd/Navigation.jrag index 5935de96b99892d9b0b2c31d85ba4f65d65ca3c2..2c420a761e10747fc1c61a48ed97db9632c30d0b 100644 --- a/dumpAst.base/src/main/jastadd/Navigation.jrag +++ b/dumpAst.base/src/main/jastadd/Navigation.jrag @@ -10,6 +10,10 @@ aspect Navigation { // --- buildConfig --- inh BuildConfig DumpNode.buildConfig(); inh BuildConfig PrintConfig.buildConfig(); + inh BuildConfig InnerDumpNode.buildConfig(); + inh BuildConfig InnerRelationDumpNode.buildConfig(); + inh BuildConfig DumpChildNode.buildConfig(); + inh BuildConfig DumpRelation.buildConfig(); eq DumpAst.getChild().buildConfig() = getBuildConfig(); // --- printConfig --- diff --git a/dumpAst.base/src/main/jastadd/Printing.jrag b/dumpAst.base/src/main/jastadd/Printing.jrag index 6325c9da6411abefd31a5b8df62631c4d18ff8bd..5b0c51589e911873d9b87ff45bc763a829b61773 100644 --- a/dumpAst.base/src/main/jastadd/Printing.jrag +++ b/dumpAst.base/src/main/jastadd/Printing.jrag @@ -1,54 +1,6 @@ aspect Printing { - // --- outerNodeName --- - inh String InnerDumpNode.outerNodeName(); - inh String InnerRelationDumpNode.outerNodeName(); - inh String DumpChildNode.outerNodeName(); - inh String DumpRelation.outerNodeName(); - inh String DumpToken.outerNodeName(); - inh String DumpReferenceToken.outerNodeName(); - eq DumpNode.getChild().outerNodeName() = name(); - - // --- innerNodeName --- - syn String InnerDumpNode.innerNodeName() = getDumpNode() != null ? getDumpNode().name() : null; - syn String InnerRelationDumpNode.innerNodeName() = getDumpNode() != null ? getDumpNode().name() : null; - syn String DumpNormalChildNode.innerNodeName() = getDumpNode() != null ? getDumpNode().name() : null; - syn String DumpNormalRelation.innerNodeName() = getDumpNode() != null ? getDumpNode().name() : null; - syn String DumpReferenceToken.innerNodeName() = getValue().name(); - // --- name --- syn String DumpNode.name() = getName(); // might change in the future - - // --- label --- - syn String DumpChildNode.label() = getLabel() + (getComputed() ? "()" : ""); - syn String DumpRelation.label() = getLabel(); - syn String DumpToken.label() = getLabel() + (getComputed() ? "()" : ""); - syn String DumpNode.label() = getLabel(); - inh String InnerDumpNode.label(); - inh String InnerRelationDumpNode.label(); - eq DumpListChildNode.getInnerDumpNode(int index).label() { - InnerDumpNode inner = getInnerDumpNode(index); - return inner.getLabel() + - (inner.getDumpNode().isEmpty() ? "" : "[" + chooseIndex(inner.getOriginalIndex(), index) + "]"); - } - eq DumpListRelation.getInnerRelationDumpNode(int index).label() { - InnerRelationDumpNode inner = getInnerRelationDumpNode(index); - return inner.getLabel() + - (inner.getDumpNode().isEmpty() ? "" : "[" + chooseIndex(inner.getOriginalIndex(), index) + "]"); - } - eq DumpReferenceListToken.getInnerRelationDumpNode(int index).label() = label() + "[" + index + "]"; - eq InvisiblePath.getInnerRelationDumpNode(int index).label() = null; - protected int ASTNode.chooseIndex(int originalIndex, int inheritedIndex) { - return originalIndex != 0 ? originalIndex : inheritedIndex; - } - - // --- bothVisible --- - boolean ASTNode.bothVisible(DumpNode one, DumpNode two) { - return one != null && two != null && !one.getInvisible() && !two.getInvisible(); - } - syn boolean InnerDumpNode.bothVisible() = bothVisible(containingDumpNode(), getDumpNode()); - syn boolean InnerRelationDumpNode.bothVisible() = bothVisible(containingDumpNode(), getDumpNode()); - syn boolean DumpNormalChildNode.bothVisible() = bothVisible(containingDumpNode(), getDumpNode()); - syn boolean DumpNormalRelation.bothVisible() = bothVisible(containingDumpNode(), getDumpNode()); } aspect Debugging { diff --git a/dumpAst.base/src/main/jastadd/TemplateContext.jrag b/dumpAst.base/src/main/jastadd/TemplateContext.jrag index 0f313732f5d521d08a2b8b29d1f5331137638bb3..db8fb1d2e4f247c690d57099f845026a9c5361c4 100644 --- a/dumpAst.base/src/main/jastadd/TemplateContext.jrag +++ b/dumpAst.base/src/main/jastadd/TemplateContext.jrag @@ -27,6 +27,54 @@ aspect TemplateContext { return false; } + // --- outerNodeName --- + inh String InnerDumpNode.outerNodeName(); + inh String InnerRelationDumpNode.outerNodeName(); + inh String DumpChildNode.outerNodeName(); + inh String DumpRelation.outerNodeName(); + inh String DumpToken.outerNodeName(); + inh String DumpReferenceToken.outerNodeName(); + eq DumpNode.getChild().outerNodeName() = name(); + + // --- innerNodeName --- + syn String InnerDumpNode.innerNodeName() = getDumpNode() != null ? getDumpNode().name() : null; + syn String InnerRelationDumpNode.innerNodeName() = getDumpNode() != null ? getDumpNode().name() : null; + syn String DumpNormalChildNode.innerNodeName() = getDumpNode() != null ? getDumpNode().name() : null; + syn String DumpNormalRelation.innerNodeName() = getDumpNode() != null ? getDumpNode().name() : null; + syn String DumpReferenceToken.innerNodeName() = getValue().name(); + + // --- label --- + syn String DumpChildNode.label() = getLabel() + (getComputed() ? "()" : ""); + syn String DumpRelation.label() = getLabel(); + syn String DumpToken.label() = getLabel() + (getComputed() ? "()" : ""); + syn String DumpNode.label() = getLabel(); + inh String InnerDumpNode.label(); + inh String InnerRelationDumpNode.label(); + eq DumpListChildNode.getInnerDumpNode(int index).label() { + InnerDumpNode inner = getInnerDumpNode(index); + return + (inner.getDumpNode().isEmpty() ? "" : "[" + chooseIndex(inner.getOriginalIndex(), index) + "]"); + } + eq DumpListRelation.getInnerRelationDumpNode(int index).label() { + InnerRelationDumpNode inner = getInnerRelationDumpNode(index); + return (inner.isComputed() ? " " : inner.getLabel()) + + (inner.getDumpNode().isEmpty() ? "" : "[" + chooseIndex(inner.getOriginalIndex(), index) + "]"); + } + eq DumpReferenceListToken.getInnerRelationDumpNode(int index).label() = "[" + index + "]"; + eq InvisiblePath.getInnerRelationDumpNode(int index).label() = null; + protected int ASTNode.chooseIndex(int originalIndex, int inheritedIndex) { + return originalIndex != 0 ? originalIndex : inheritedIndex; + } + + // --- bothVisible --- + boolean ASTNode.bothVisible(DumpNode one, DumpNode two) { + return one != null && two != null && !one.getInvisible() && !two.getInvisible(); + } + syn boolean InnerDumpNode.bothVisible() = bothVisible(containingDumpNode(), getDumpNode()); + syn boolean InnerRelationDumpNode.bothVisible() = bothVisible(containingDumpNode(), getDumpNode()); + syn boolean DumpNormalChildNode.bothVisible() = bothVisible(containingDumpNode(), getDumpNode()); + syn boolean DumpNormalRelation.bothVisible() = bothVisible(containingDumpNode(), getDumpNode()); + // --- NTA: InvisiblePath --- syn InvisiblePath DumpNode.getInvisiblePath() { InvisiblePath result = new InvisiblePath(); diff --git a/dumpAst.base/src/main/jastadd/ToYaml.jrag b/dumpAst.base/src/main/jastadd/ToYaml.jrag index 51f5eee938fd792a6b1d027b8c4bd307dfe8acc2..7f1cf01066c5cb043c23bc22e0842d96f9c690be 100644 --- a/dumpAst.base/src/main/jastadd/ToYaml.jrag +++ b/dumpAst.base/src/main/jastadd/ToYaml.jrag @@ -62,7 +62,6 @@ aspect ToYaml { result.put("Name", getName()); if (!fromRelation) { result.put("Computed", getComputed()); - result.put("Label", getLabel()); result.put("BackgroundColor", getBackgroundColor()); result.put("TextColor", getTextColor()); result.put("Invisible", getInvisible()); @@ -73,6 +72,7 @@ aspect ToYaml { result.put("isNull", isNull()); result.put("isEmpty", isEmpty()); result.put("isAstNode", isAstNode()); + result.put("label", label()); result.put("labelAndTextColor", labelAndTextColor()); result.put("stereotypeList", stereotypeList()); addYamledList(result, "myChildren", myChildren(), true); @@ -89,9 +89,10 @@ aspect ToYaml { syn MappingElement DumpChildNode.toYaml(boolean fromRelation) { MappingElement result = new MappingElement(); + // tokens - result.put("Label", getLabel()); result.put("Computed", getComputed()); + // attributes result.put("label", label()); result.put("isList", isList()); @@ -102,9 +103,11 @@ aspect ToYaml { syn MappingElement DumpNormalChildNode.toYaml(boolean fromRelation) { MappingElement result = super.toYaml(fromRelation); + // tokens result.put("LineColor", getLineColor()); result.put("TextColor", getTextColor()); + // attributes result.put("bothVisible", bothVisible()); result.put("innerNodeName", innerNodeName()); @@ -114,6 +117,10 @@ aspect ToYaml { syn MappingElement DumpListChildNode.toYaml(boolean fromRelation) { MappingElement result = super.toYaml(fromRelation); + + // tokens + result.put("Name", getName()); + // children addYamledList(result, "InnerDumpNodes", getInnerDumpNodeList(), fromRelation); return result; @@ -121,9 +128,10 @@ aspect ToYaml { syn MappingElement DumpToken.toYaml(boolean fromRelation) { MappingElement result = new MappingElement(); + // tokens - result.put("Label", getLabel()); result.put("Computed", getComputed()); + // attributes result.put("isList", isList()); result.put("label", label()); @@ -133,6 +141,7 @@ aspect ToYaml { syn MappingElement DumpValueToken.toYaml(boolean fromRelation) { MappingElement result = super.toYaml(fromRelation); + // tokens result.put("Value", getValue().toString()); return result; @@ -140,6 +149,7 @@ aspect ToYaml { syn MappingElement DumpReferenceToken.toYaml(boolean fromRelation) { MappingElement result = super.toYaml(fromRelation); + // attributes result.put("innerNodeName", innerNodeName()); result.put("innerNotNullOrEmpty", innerNotNullOrEmpty()); @@ -150,6 +160,9 @@ aspect ToYaml { syn MappingElement DumpReferenceListToken.toYaml(boolean fromRelation) { MappingElement result = super.toYaml(fromRelation); + // tokens + result.put("Name", getName()); + // children addYamledList(result, "InnerRelationDumpNode", getInnerRelationDumpNodeList(), fromRelation); @@ -160,9 +173,10 @@ aspect ToYaml { syn MappingElement DumpRelation.toYaml(boolean fromRelation) { MappingElement result = new MappingElement(); + // tokens - result.put("Label", getLabel()); result.put("Bidirectional", getBidirectional()); + // attributes result.put("isList", isList()); result.put("label", label()); @@ -172,9 +186,11 @@ aspect ToYaml { syn MappingElement DumpNormalRelation.toYaml(boolean fromRelation) { MappingElement result = super.toYaml(fromRelation); + // tokens result.put("LineColor", getLineColor()); result.put("TextColor", getTextColor()); + // attributes result.put("bothVisible", bothVisible()); result.put("innerNodeName", innerNodeName()); @@ -185,6 +201,10 @@ aspect ToYaml { syn MappingElement DumpListRelation.toYaml(boolean fromRelation) { MappingElement result = super.toYaml(fromRelation); + + // tokens + result.put("Name", getName()); + // children addYamledList(result, "InnerRelationDumpNode", getInnerRelationDumpNodeList(), fromRelation); return result; @@ -192,9 +212,11 @@ aspect ToYaml { syn MappingElement InnerDumpNode.toYaml(boolean fromRelation) { MappingElement result = new MappingElement(); + // tokens result.put("LineColor", getLineColor()); result.put("TextColor", getTextColor()); + // attributes result.put("bothVisible", bothVisible()); result.put("innerNodeName", innerNodeName()); @@ -206,9 +228,11 @@ aspect ToYaml { syn MappingElement InnerRelationDumpNode.toYaml(boolean fromRelation) { MappingElement result = new MappingElement(); + // tokens result.put("LineColor", getLineColor()); result.put("TextColor", getTextColor()); + // attributes result.put("bothVisible", bothVisible()); result.put("innerNodeName", innerNodeName()); @@ -221,6 +245,7 @@ aspect ToYaml { syn MappingElement InvisiblePath.toYaml(boolean fromRelation) { MappingElement result = super.toYaml(fromRelation); + // children addYamledList(result, "InnerRelationDumpNode", getInnerRelationDumpNodeList(), fromRelation); return result; diff --git a/dumpAst.base/src/main/jastadd/Transform.jadd b/dumpAst.base/src/main/jastadd/Transform.jadd index f0468843188d59aa1c03112690c6e1b31a2c1637..9606b1ba704aba482978940f85d2fffcc8e83a00 100644 --- a/dumpAst.base/src/main/jastadd/Transform.jadd +++ b/dumpAst.base/src/main/jastadd/Transform.jadd @@ -99,7 +99,7 @@ aspect Transform { } else { node = new DumpNode(); node.setObject(obj); - node.setName("node" + (tti.nodeCounter++)); + node.setName(tti.nextName()); node.setComputed(options.computed); tti.transformed.put(obj, node); this.addDumpNode(node); @@ -190,6 +190,7 @@ aspect Transform { listChild.setComputed(false); String childName = containmentMethod.getName(); listChild.setLabel(childName); + listChild.setName(tti.nextName()); node.addDumpChildNode(listChild); int index = -1; @@ -252,6 +253,8 @@ aspect Transform { boolean computed = otherMethod.asListChildMethod().isNTAListChildMethod(); listChild.setComputed(computed); listChild.setLabel(childName); + listChild.setName(tti.nextName()); + boolean notAddedYet = true; for (Object target : targetList) { DumpNode targetNode = transform(tti, target, options.asNormal(false).computed(computed)); @@ -296,6 +299,7 @@ aspect Transform { Iterable<?> targetList = (Iterable<?>) otherMethod.getMethod().invoke(obj); DumpListRelation listRelation = new DumpListRelation(); listRelation.setLabel(otherMethod.getName()); + listRelation.setName(tti.nextName()); node.addDumpRelation(listRelation); int index = -1; @@ -348,6 +352,7 @@ aspect Transform { } if (atLeastOneASTNode) { DumpReferenceListToken listToken = new DumpReferenceListToken(); + listToken.setName(tti.nextName()); nodes.forEach(element -> { listToken.addInnerRelationDumpNode(new InnerRelationDumpNode().setDumpNode(element)); }); @@ -370,6 +375,7 @@ aspect Transform { token.setLabel(otherMethod.getName()); token.setComputed(otherMethod.asTokenMethod().isAttributeMethod()); node.addDumpToken(token); + // TODO apply style } } return true; @@ -406,34 +412,40 @@ aspect Transform { // === RelationStyle === interface RelationStylable<SELF> { - default RelationStyle createDefaultStyle() { - return new RelationStyle().setLabel(initialLabel()); - } - default void applyStyle(RelationStyleDefinition relationStyleDefinition) { - RelationStyle style = createDefaultStyle(); - relationStyleDefinition.style(containingDumpNode().getObject(), getDumpNode().getObject(), style); - setLabel(style.getLabel()); - setTextColor(style.getTextColor()); - setLineColor(style.getLineColor()); - } - String initialLabel(); - DumpNode containingDumpNode(); - DumpNode getDumpNode(); + // more methods in TransformPlus.jadd + + // tokens SELF setLabel(String name); SELF setTextColor(String textColor); SELF setLineColor(String lineColor); + + // attributes + BuildConfig buildConfig(); + boolean isComputed(); + boolean isContainment(); + String initialLabel(); + DumpNode containingDumpNode(); + DumpNode getDumpNode(); } DumpNormalChildNode implements RelationStylable<DumpNormalChildNode>; syn String DumpNormalChildNode.initialLabel() = getLabel(); + syn boolean DumpNormalChildNode.isComputed() = getComputed(); + syn boolean DumpNormalChildNode.isContainment() = true; InnerDumpNode implements RelationStylable<InnerDumpNode>; syn String InnerDumpNode.initialLabel() = containingDumpListChildNode().getLabel(); + syn boolean InnerDumpNode.isComputed() = containingDumpListChildNode().getComputed(); + syn boolean InnerDumpNode.isContainment() = true; DumpNormalRelation implements RelationStylable<DumpNormalRelation>; syn String DumpNormalRelation.initialLabel() = getLabel(); + syn boolean DumpNormalRelation.isComputed() = false; + syn boolean DumpNormalRelation.isContainment() = false; InnerRelationDumpNode implements RelationStylable<InnerRelationDumpNode>; syn String InnerRelationDumpNode.initialLabel() = containingDumpListRelation().getLabel(); + syn boolean InnerRelationDumpNode.isComputed() = containingDumpListRelation() == null; + syn boolean InnerRelationDumpNode.isContainment() = false; private void DumpAst.applyStyle(RelationStylable<?> stylable) { stylable.applyStyle(getPrintConfig().getRelationStyleDefinition()); @@ -450,5 +462,9 @@ aspect Transform { java.util.Map<Object, DumpNode> transformed = new java.util.HashMap<>(); java.util.Map<DumpNode, Boolean> relationTargetsUnprocessed = new java.util.HashMap<>(); int nodeCounter = 0; + + String nextName() { + return "node" + (nodeCounter++); + } } } diff --git a/dumpAst.base/src/main/jastadd/TransformPlus.jadd b/dumpAst.base/src/main/jastadd/TransformPlus.jadd new file mode 100644 index 0000000000000000000000000000000000000000..2296ad7d66bf93c1441f79e89a2915a62fe016e3 --- /dev/null +++ b/dumpAst.base/src/main/jastadd/TransformPlus.jadd @@ -0,0 +1,19 @@ +// more stuff from Transform that is not correctly handled by the IntelliJ plugin +aspect Transform { + interface RelationStylable<SELF> { + default RelationStyle createDefaultStyle() { + return new RelationStyle() + .setLabel(initialLabel()) + .setTextColor(isComputed() ? buildConfig().getStyleInformation().getComputedColor() : "") + .setTextColor(isComputed() ? buildConfig().getStyleInformation().getComputedColor() : ""); + } + default void applyStyle(RelationStyleDefinition relationStyleDefinition) { + RelationStyle style = createDefaultStyle(); + relationStyleDefinition.style(containingDumpNode().getObject(), getDumpNode().getObject(), + isComputed(), isContainment(), style); + setLabel(style.getLabel()); + setTextColor(style.getTextColor()); + setLineColor(style.getLineColor()); + } + } +} diff --git a/dumpAst.base/src/main/java/de/tudresden/inf/st/jastadd/dumpAst/ast/DumpBuilder.java b/dumpAst.base/src/main/java/de/tudresden/inf/st/jastadd/dumpAst/ast/DumpBuilder.java index 89d8cf4057224d9385fc48f656d5bbfe2890a4ab..937cf6814ce0c39d04d62818407ef6a04490ee23 100644 --- a/dumpAst.base/src/main/java/de/tudresden/inf/st/jastadd/dumpAst/ast/DumpBuilder.java +++ b/dumpAst.base/src/main/java/de/tudresden/inf/st/jastadd/dumpAst/ast/DumpBuilder.java @@ -39,7 +39,7 @@ public class DumpBuilder { dumpAst.getPrintConfig().setScale(1); dumpAst.getPrintConfig().setVersion(readVersion()); dumpAst.getPrintConfig().setNodeStyleDefinition((node, style) -> {}); - dumpAst.getPrintConfig().setRelationStyleDefinition((sourceNode, targetNode, style) -> {}); + dumpAst.getPrintConfig().setRelationStyleDefinition((sourceNode, targetNode, isComputed, isContainment, style) -> {}); } private DumpBuilder thisWithResetBuilt() { diff --git a/dumpAst.base/src/main/resources/dumpAst.mustache b/dumpAst.base/src/main/resources/dumpAst.mustache index 350e26a5047cfb25d60fae4bb654b5790da62473..4cc82832bbcb57e231869c94cb3352392e2b5b6b 100644 --- a/dumpAst.base/src/main/resources/dumpAst.mustache +++ b/dumpAst.base/src/main/resources/dumpAst.mustache @@ -41,30 +41,34 @@ object "{{{labelAndTextColor}}}" as {{{Name}}} {{{stereotypeList}}} {{#Backgroun {{#DumpTokens}} {{^Invisible}} {{#isList}} +circle " " as {{{Name}}} +{{{outerNodeName}}} .-[norank{{#Computed}},#{{{computedColor}}}{{/Computed}}]-> {{{Name}}}{{#label}} : {{{label}}}{{/label}} {{#InnerRelationDumpNode}} {{#bothVisible}} -{{{outerNodeName}}} .[#black{{#Computed}},#{{{computedColor}}}{{/Computed}}{{#innerNotNullOrEmpty}},norank{{/innerNotNullOrEmpty}}].> {{{innerNodeName}}} {{#needRelationStyling}}{{>RelationStyle}}{{/needRelationStyling}} : {{{label}}} +{{{Name}}} .[#black{{#Computed}},#{{{computedColor}}}{{/Computed}}{{#innerNotNullOrEmpty}},norank{{/innerNotNullOrEmpty}}].> {{{innerNodeName}}} {{#needRelationStyling}}{{>RelationStyle}}{{/needRelationStyling}}{{#label}} : {{{label}}}{{/label}} {{/bothVisible}} {{/InnerRelationDumpNode}} {{/isList}} {{^isList}} {{^isDumpValueToken}} -{{{outerNodeName}}} .[#black{{#Computed}},#{{{computedColor}}}{{/Computed}}{{#innerNotNullOrEmpty}},norank{{/innerNotNullOrEmpty}}].> {{{innerNodeName}}} : {{{label}}} +{{{outerNodeName}}} .[#black{{#Computed}},#{{{computedColor}}}{{/Computed}}{{#innerNotNullOrEmpty}},norank{{/innerNotNullOrEmpty}}].> {{{innerNodeName}}}{{#label}} : {{{label}}}{{/label}} {{/isDumpValueToken}} {{/isList}} {{/Invisible}} {{/DumpTokens}} {{#DumpChildNodes}} {{#isList}} +circle " " as {{{Name}}} +{{{outerNodeName}}} *-{{#Computed}}[#{{{computedColor}}}]{{/Computed}}- {{{Name}}} {{#label}} : {{{label}}}{{/label}} {{#InnerDumpNodes}} {{#bothVisible}} -{{{outerNodeName}}} *-{{#Computed}}[#{{{computedColor}}}]{{/Computed}}- {{{innerNodeName}}} {{#needRelationStyling}}{{>RelationStyle}}{{/needRelationStyling}} : {{{label}}} +{{{Name}}} -{{#Computed}}[#{{{computedColor}}}]{{/Computed}}- {{{innerNodeName}}} {{#needRelationStyling}}{{>RelationStyle}}{{/needRelationStyling}}{{#label}} : {{{label}}}{{/label}} {{/bothVisible}} {{/InnerDumpNodes}} {{/isList}} {{^isList}} {{#bothVisible}} -{{{outerNodeName}}} *-{{#Computed}}[#{{{computedColor}}}]{{/Computed}}- {{{innerNodeName}}} {{#needRelationStyling}}{{>RelationStyle}}{{/needRelationStyling}} : {{{label}}} +{{{outerNodeName}}} *-{{#Computed}}[#{{{computedColor}}}]{{/Computed}}- {{{innerNodeName}}} {{#needRelationStyling}}{{>RelationStyle}}{{/needRelationStyling}}{{#label}} : {{{label}}}{{/label}} {{/bothVisible}} {{/isList}} {{/DumpChildNodes}} @@ -72,13 +76,13 @@ object "{{{labelAndTextColor}}}" as {{{Name}}} {{{stereotypeList}}} {{#Backgroun {{#isList}} {{#InnerRelationDumpNode}} {{#bothVisible}} -{{{outerNodeName}}} {{#Bidirectional}}<{{/Bidirectional}}-{{#innerNotNullOrEmpty}}[norank]{{/innerNotNullOrEmpty}}-> {{{innerNodeName}}} {{#needRelationStyling}}{{>RelationStyle}}{{/needRelationStyling}} : {{{label}}} +{{{outerNodeName}}} {{#Bidirectional}}<{{/Bidirectional}}-{{#innerNotNullOrEmpty}}[norank]{{/innerNotNullOrEmpty}}-> {{{innerNodeName}}} {{#needRelationStyling}}{{>RelationStyle}}{{/needRelationStyling}}{{#label}} : {{{label}}}{{/label}} {{/bothVisible}} {{/InnerRelationDumpNode}} {{/isList}} {{^isList}} {{#bothVisible}} -{{{outerNodeName}}} {{#Bidirectional}}<{{/Bidirectional}}-{{#innerNotNullOrEmpty}}[norank]{{/innerNotNullOrEmpty}}-> {{{innerNodeName}}} {{#needRelationStyling}}{{>RelationStyle}}{{/needRelationStyling}} : {{{label}}} +{{{outerNodeName}}} {{#Bidirectional}}<{{/Bidirectional}}-{{#innerNotNullOrEmpty}}[norank]{{/innerNotNullOrEmpty}}-> {{{innerNodeName}}} {{#needRelationStyling}}{{>RelationStyle}}{{/needRelationStyling}}{{#label}} : {{{label}}}{{/label}} {{/bothVisible}} {{/isList}} {{/DumpRelations}} diff --git a/dumpAst.prototyping/src/main/java/de/tudresden/inf/st/jastadd/featureTest/FeatureTestMain.java b/dumpAst.prototyping/src/main/java/de/tudresden/inf/st/jastadd/featureTest/FeatureTestMain.java index cf3ce5b068a919cafe5604cc3a816dcb609901d1..3a6c733d4013b48869506528e396d45761f75b3c 100644 --- a/dumpAst.prototyping/src/main/java/de/tudresden/inf/st/jastadd/featureTest/FeatureTestMain.java +++ b/dumpAst.prototyping/src/main/java/de/tudresden/inf/st/jastadd/featureTest/FeatureTestMain.java @@ -73,7 +73,11 @@ public class FeatureTestMain { } }) .skinParam(SkinParamBooleanSetting.Shadowing, false) - .relationStyle((source, target, style) -> { + .relationStyle((source, target, isComputed, isContainment, style) -> { + System.out.println(style.getLabel() + ", computed: " + isComputed + ", containment: " + isContainment); + if (isContainment && target != null && style.getLabel().equals(target.getClass().getSimpleName())) { + style.setLabel(""); + } if (style.getLabel().equals("ManyA")) { style.setLabel("ManyA of " + ((Nameable) source).getName()); } else if (style.getLabel().equals("OneA") || style.getLabel().equals("MaybeC?")) { @@ -85,6 +89,9 @@ public class FeatureTestMain { if (node.isA()) { style.setBackgroundColor("yellow"); } + if (node instanceof B && ((B) node).getOtherValue().startsWith("#")) { + style.setBackgroundColor(((B) node).getOtherValue().substring(1)); + } style.setLabel(node.getClass().getSimpleName() + ASTNode.counter++); });