Skip to content
Snippets Groups Projects
Commit a92013fa authored by René Schöne's avatar René Schöne
Browse files

2.0.2

- keep original indices of children when filtered (untested)
parent 898a84c3
No related branches found
No related tags found
1 merge request!133.0.1
Pipeline #14745 passed
...@@ -5,9 +5,9 @@ DumpNode ::= DumpChildNode* DumpToken* DumpRelation* ...@@ -5,9 +5,9 @@ DumpNode ::= DumpChildNode* DumpToken* DumpRelation*
<Name> <Label> <BackgroundColor> <TextColor> <Object:Object> <Invisible:boolean> <Computed:boolean> <ManualStereotypes> <Name> <Label> <BackgroundColor> <TextColor> <Object:Object> <Invisible:boolean> <Computed:boolean> <ManualStereotypes>
/InvisiblePath/ ; /InvisiblePath/ ;
InnerDumpNode ; InnerDumpNode ::= <OriginalIndex:int>;
rel InnerDumpNode.DumpNode <-> DumpNode.ContainerOfInner ; rel InnerDumpNode.DumpNode <-> DumpNode.ContainerOfInner ;
InnerRelationDumpNode; InnerRelationDumpNode ::= <OriginalIndex:int>;
rel InnerRelationDumpNode.DumpNode -> DumpNode ; // .ContainerOfInner* rel InnerRelationDumpNode.DumpNode -> DumpNode ; // .ContainerOfInner*
abstract DumpChildNode ::= <Name> <Computed:boolean> ; abstract DumpChildNode ::= <Name> <Computed:boolean> ;
......
...@@ -25,10 +25,15 @@ aspect Printing { ...@@ -25,10 +25,15 @@ aspect Printing {
syn String DumpNode.label() = getLabel(); syn String DumpNode.label() = getLabel();
inh String InnerDumpNode.label(); inh String InnerDumpNode.label();
inh String InnerRelationDumpNode.label(); inh String InnerRelationDumpNode.label();
eq DumpListChildNode.getInnerDumpNode(int index).label() = label() + "[" + index + "]"; eq DumpListChildNode.getInnerDumpNode(int index).label() = label() + "[" +
eq DumpListRelation.getInnerRelationDumpNode(int index).label() = label() + "[" + index + "]"; chooseIndex(getInnerDumpNode(index).getOriginalIndex(), index) + "]";
eq DumpListRelation.getInnerRelationDumpNode(int index).label() = label() + "[" +
chooseIndex(getInnerRelationDumpNode(index).getOriginalIndex(), index) + "]";
eq DumpReferenceListToken.getInnerRelationDumpNode(int index).label() = label() + "[" + index + "]"; eq DumpReferenceListToken.getInnerRelationDumpNode(int index).label() = label() + "[" + index + "]";
eq InvisiblePath.getInnerRelationDumpNode(int index).label() = null; eq InvisiblePath.getInnerRelationDumpNode(int index).label() = null;
protected int ASTNode.chooseIndex(int originalIndex, int inheritedIndex) {
return originalIndex != 0 ? originalIndex : inheritedIndex;
}
// --- bothVisible --- // --- bothVisible ---
boolean ASTNode.bothVisible(DumpNode one, DumpNode two) { boolean ASTNode.bothVisible(DumpNode one, DumpNode two) {
......
...@@ -26,7 +26,7 @@ aspect TemplateContext { ...@@ -26,7 +26,7 @@ aspect TemplateContext {
syn InvisiblePath DumpNode.getInvisiblePath() { syn InvisiblePath DumpNode.getInvisiblePath() {
InvisiblePath result = new InvisiblePath(); InvisiblePath result = new InvisiblePath();
for (DumpNode successor : reachableThroughInvisible()) { for (DumpNode successor : reachableThroughInvisible()) {
result.addInnerRelationDumpNode(new InnerRelationDumpNode(successor)); result.addInnerRelationDumpNode(new InnerRelationDumpNode().setDumpNode(successor));
} }
return result; return result;
} }
......
...@@ -155,13 +155,15 @@ aspect Transform { ...@@ -155,13 +155,15 @@ aspect Transform {
listChild.setComputed(false); listChild.setComputed(false);
String childName = containmentMethod.getName(); String childName = containmentMethod.getName();
listChild.setName(childName); listChild.setName(childName);
int index = -1;
for (Object target : targetList) { for (Object target : targetList) {
index++;
if (!getBuildConfig().getIncludeChildMethod().shouldInclude(obj, target, childName)) { if (!getBuildConfig().getIncludeChildMethod().shouldInclude(obj, target, childName)) {
continue; continue;
} }
DumpNode targetNode = transform(tti, target, options.asNormal(false)); DumpNode targetNode = transform(tti, target, options.asNormal(false));
if (target != null && targetNode != null) { if (target != null && targetNode != null) {
listChild.addInnerDumpNode(new InnerDumpNode().setDumpNode(targetNode)); listChild.addInnerDumpNode(new InnerDumpNode().setDumpNode(targetNode).setOriginalIndex(index));
} }
} }
if (listChild.getNumInnerDumpNode() > 0) { if (listChild.getNumInnerDumpNode() > 0) {
...@@ -229,13 +231,16 @@ aspect Transform { ...@@ -229,13 +231,16 @@ aspect Transform {
Iterable<?> targetList = (Iterable<?>) otherMethod.getMethod().invoke(obj); Iterable<?> targetList = (Iterable<?>) otherMethod.getMethod().invoke(obj);
DumpListRelation listRelation = new DumpListRelation(); DumpListRelation listRelation = new DumpListRelation();
listRelation.setName(otherMethod.getName()); listRelation.setName(otherMethod.getName());
int index = -1;
for (Object target : targetList) { for (Object target : targetList) {
index++;
if (!getBuildConfig().getIncludeRelationMethod().shouldInclude(obj, target, otherMethod.getName())) { if (!getBuildConfig().getIncludeRelationMethod().shouldInclude(obj, target, otherMethod.getName())) {
continue; continue;
} }
DumpNode targetNode = transform(tti, target, options.asRelation()); DumpNode targetNode = transform(tti, target, options.asRelation());
if (target != null && targetNode != null) { if (target != null && targetNode != null) {
listRelation.addInnerRelationDumpNode(new InnerRelationDumpNode(targetNode)); listRelation.addInnerRelationDumpNode(new InnerRelationDumpNode().setDumpNode(targetNode)
.setOriginalIndex(index));
} }
} }
if (listRelation.getNumInnerRelationDumpNode() > 0) { if (listRelation.getNumInnerRelationDumpNode() > 0) {
......
...@@ -23,18 +23,18 @@ public class FeatureTestMain { ...@@ -23,18 +23,18 @@ public class FeatureTestMain {
A a = new A().setName("A2"); A a = new A().setName("A2");
a.setB(new B().setName("B2.1")); a.setB(new B().setName("B2.1"));
// a.setMyC(new C().setName("C2.1")); // a.setMyC(new C().setName("C2.1"));
// B b1 = new B().setName("B3").setOtherValue("some long text"); B b1 = new B().setName("B3").setOtherValue("some long text");
// C c = new C().setName("C4"); // C c = new C().setName("C4");
// c.setA(new A().setName("A4.1").setB(new B().setName("B4.1.1"))); // c.setA(new A().setName("A4.1").setB(new B().setName("B4.1.1")));
// c.setRawReference(a); // c.setRawReference(a);
// b1.setOneA(a); // b1.setOneA(a);
// B b2 = new B().setName("B5").setOtherValue("#ff00ff"); B b2 = new B().setName("B5").setOtherValue("#ff00ff");
// C myC = new C().setName("C6"); // C myC = new C().setName("C6");
// c.setA(new A().setName("A6.1").setB(new B().setName("B6.1.1"))); // c.setA(new A().setName("A6.1").setB(new B().setName("B6.1.1")));
// a.setMyC(myC); // a.setMyC(myC);
root.setA(a); root.setA(a);
// root.addB(b1); root.addB(b1);
// root.addB(b2); root.addB(b2);
// root.setC(c); // root.setC(c);
Path pathToYaml = Paths.get("featureTest.yml"); Path pathToYaml = Paths.get("featureTest.yml");
...@@ -51,6 +51,9 @@ public class FeatureTestMain { ...@@ -51,6 +51,9 @@ public class FeatureTestMain {
if (parentNode instanceof A && ((A) parentNode).getName().equals("A2")) { if (parentNode instanceof A && ((A) parentNode).getName().equals("A2")) {
return false; return false;
} }
if (parentNode instanceof Root && childNode instanceof B) {
return !"B3".equals(((B) childNode).getName());
}
return !contextName.equals("MyC"); return !contextName.equals("MyC");
}) })
.includeRelationsWhen((sourceNode, targetNode, roleName) -> .includeRelationsWhen((sourceNode, targetNode, roleName) ->
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment