Commit 46360fec authored by René Schöne's avatar René Schöne
Browse files

Merge branch 'dev' into 'main'

3.0.1

See merge request !13
parents 5e0a3728 2b5428a6
Pipeline #15024 passed with stages
in 2 minutes and 28 seconds
......@@ -44,8 +44,8 @@ publish_dev:
script:
- "./gradlew setDevVersionForCI"
- "./gradlew publish"
except:
- main
only:
- dev
publish_main:
image: openjdk:11
......@@ -60,7 +60,6 @@ publish_main:
ragdoc_build:
image:
name: "git-st.inf.tu-dresden.de:4567/jastadd/ragdoc-builder"
entrypoint: [""]
stage: ragdoc
needs:
- build
......@@ -68,6 +67,9 @@ ragdoc_build:
- JAVA_FILES=$(find dumpAst.base/src/ -name '*.java')
- echo $JAVA_FILES | wc -l
- /ragdoc-builder/start-builder.sh -excludeGenerated -d data/ $JAVA_FILES
only:
- dev
- main
artifacts:
paths:
- "data/"
......@@ -75,7 +77,6 @@ ragdoc_build:
ragdoc_view:
image:
name: "git-st.inf.tu-dresden.de:4567/jastadd/ragdoc-view:relations"
entrypoint: [""]
stage: ragdoc
needs:
- ragdoc_build
......@@ -84,7 +85,7 @@ ragdoc_view:
- mkdir -p pages/docs/ragdoc
- OUTPUT_DIR=$(pwd -P)/pages/docs/ragdoc
- cd /ragdoc-view/src/ && rm -rf data && ln -s $DATA_DIR
- /ragdoc-view/build-view.sh --output-path=$OUTPUT_DIR
- BASE_HREF=/dumpAst/ragdoc/ /ragdoc-view/build-view.sh --output-path=$OUTPUT_DIR
only:
- dev
- main
......@@ -92,7 +93,7 @@ ragdoc_view:
paths:
- "pages/docs/ragdoc"
pages:
build_pages:
image: python:3.10.0-bullseye
stage: publish
needs:
......@@ -105,5 +106,14 @@ pages:
artifacts:
paths:
- public/
only:
- main
pages:
stage: publish
needs:
- build_pages
script: [ "true" ]
artifacts:
paths:
- public
rules:
- if: '$CI_COMMIT_BRANCH == "main"'
BSD 3-Clause License
Copyright (c) 2022, TU Dresden, Software Technology Group
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
......@@ -147,7 +147,7 @@ task newVersion() {
task setDevVersionForCI() {
doFirst {
def props = new Properties()
props['version'] = version + "-$System.env.CI_PIPELINE_IID"
props['version'] = version + "-dev-$System.env.CI_PIPELINE_IID"
props.store(file(versionFile).newWriter(), null)
}
}
......@@ -179,6 +179,15 @@ publishing {
}
}
// --- Misc ---
task ensureNoTrainlingNewlineForRelationStyleMustache() {
doFirst {
def text = project.file("src/main/resources/RelationStyle.mustache").text
project.file("src/main/resources/RelationStyle.mustache").write(text.strip())
}
}
// --- Task order ---
compileJava.dependsOn ensureNoTrainlingNewlineForRelationStyleMustache
generateAst.dependsOn relast
publish.dependsOn jar
......@@ -48,29 +48,28 @@ aspect ClassAnalysis {
String tokenName = invokeName(annotation);
if (tokenName.startsWith("_impl_")) {
String relationName = titleCase(tokenName.substring(6));
try {
java.lang.reflect.Method relationMethod = clazz.getMethod("get" + relationName);
if (present(getMethod(clazz, "get" + relationName), relationMethod -> {
// normal get + token-name -> singleRelation
SingleRelationMethod singleRelationMethod = new SingleRelationMethod();
SingleRelationMethod singleRelationMethod = getMethod(clazz, "has" + relationName).isPresent() ?
new OptRelationMethod() : new SingleRelationMethod();
singleRelationMethod.setMethod(relationMethod);
singleRelationMethod.setName(relationName);
result.addOtherMethod(singleRelationMethod);
})) {
continue;
} catch (NoSuchMethodException e) {
// ignore, but we know this is probably not a single relation
}
// we know here this is probably not a single or opt relation
// try list-relation next
try {
java.lang.reflect.Method relationMethod = clazz.getMethod("get" + relationName + "List");
if (present(getMethod(clazz, "get" + relationName + "List"), relationMethod -> {
// normal get + token-name + "List" -> listRelation
ListRelationMethod listRelationMethod = new ListRelationMethod();
listRelationMethod.setMethod(relationMethod);
listRelationMethod.setName(relationName);
result.addOtherMethod(listRelationMethod);
})) {
continue;
} catch (NoSuchMethodException e) {
// ignore, but we know this is probably not a relation at all
}
// we know here this is probably not a relation at all
}
IntrinsicTokenMethod tokenMethod = new IntrinsicTokenMethod();
tokenMethod.setMethod(method);
......@@ -201,6 +200,20 @@ aspect ClassAnalysis {
}
}
private static java.util.Optional<java.lang.reflect.Method> DumpAst.getMethod(Class<?> clazz, String methodName) {
try {
java.lang.reflect.Method method = clazz.getMethod(methodName);
return java.util.Optional.of(method);
} catch (NoSuchMethodException e) {
return java.util.Optional.empty();
}
}
private static <T> boolean DumpAst.present(java.util.Optional<T> optional, java.util.function.Consumer<T> callback) {
optional.ifPresent(callback);
return optional.isPresent();
}
// --- astNodeAnnotationPrefix ---
syn String DumpAst.astNodeAnnotationPrefix() = getPackageName() + ".ASTNodeAnnotation";
inh String DumpNode.astNodeAnnotationPrefix();
......
......@@ -5,26 +5,26 @@ DumpNode ::= DumpChildNode* DumpToken* DumpRelation*
<Name> <Label> <BackgroundColor> <TextColor> <Object:Object> <Invisible:boolean> <Computed:boolean> <ManualStereotypes>
/InvisiblePath/ ;
InnerDumpNode ;
rel InnerDumpNode.DumpNode <-> DumpNode.ContainerOfInner ;
InnerRelationDumpNode;
rel InnerRelationDumpNode.DumpNode -> DumpNode ; // .ContainerOfInner*
InnerDumpNode ::= <OriginalIndex:int> <Label> <LineColor> <TextColor> ; //TODO remove colors (and label?)
rel InnerDumpNode.DumpNode <-> DumpNode.ContainerOfInner? ;
InnerRelationDumpNode ::= <OriginalIndex:int> <Label> <LineColor> <TextColor> ; //TODO remove colors (and label?)
rel InnerRelationDumpNode.DumpNode <-> DumpNode.ContainerOfRelationInner* ;
abstract DumpChildNode ::= <Name> <Computed:boolean> ;
DumpNormalChildNode : DumpChildNode ;
rel DumpNormalChildNode.DumpNode <-> DumpNode.ContainerOfNormalChild ;
DumpListChildNode : DumpChildNode ::= InnerDumpNode* ;
abstract DumpChildNode ::= <Label> <Computed:boolean> <LineColor> <TextColor> ;
DumpNormalChildNode : DumpChildNode ::= ;
rel DumpNormalChildNode.DumpNode <-> DumpNode.ContainerOfNormalChild? ;
DumpListChildNode : DumpChildNode ::= InnerDumpNode* <Name> ;
abstract DumpToken ::= <Name> <Computed:boolean> ;
DumpReferenceToken : DumpToken ;
rel DumpReferenceToken.Value -> DumpNode ;
DumpReferenceListToken : DumpToken ::= InnerRelationDumpNode* ;
abstract DumpToken ::= <Label> <Computed:boolean> ;
DumpReferenceToken : DumpToken ::= <LineColor> <TextColor> ;
rel DumpReferenceToken.DumpNode -> DumpNode ;
DumpReferenceListToken : DumpToken ::= InnerRelationDumpNode* <Name> <LineColor> <TextColor> ;
DumpValueToken : DumpToken ::= <Value:Object> ;
abstract DumpRelation ::= <Name> <Bidirectional:boolean> ;
DumpNormalRelation : DumpRelation ;
abstract DumpRelation ::= <Label> <Bidirectional:boolean> <LineColor> <TextColor> ;
DumpNormalRelation : DumpRelation ::= ;
rel DumpNormalRelation.DumpNode -> DumpNode ;
DumpListRelation : DumpRelation ::= InnerRelationDumpNode* ;
DumpListRelation : DumpRelation ::= InnerRelationDumpNode* <Name> ;
// type of NTA
InvisiblePath ::= InnerRelationDumpNode* ;
......@@ -45,6 +45,7 @@ NormalListChildMethod : ListChildMethod ;
NTAListChildMethod : ListChildMethod ;
SingleRelationMethod : AnalysedMethod ;
OptRelationMethod : SingleRelationMethod ;
ListRelationMethod : AnalysedMethod ;
// TODO can the refine bug also happen for refined attributes?
......@@ -53,9 +54,6 @@ IntrinsicTokenMethod : TokenMethod ::= <Refined:boolean> ;
AttributeMethod : TokenMethod ;
BuildConfig ::= StyleInformation
GlobalPatternCollection:PatternCollection
ExcludeTypePattern:TypePatternCollectionMapping*
IncludeTypePattern:TypePatternCollectionMapping*
<IncludeRelationMethod:IncludeRelationMethod>
<IncludeChildMethod:IncludeChildMethod>
<IncludeAttributeMethod:IncludeAttributeMethod>
......@@ -64,13 +62,16 @@ BuildConfig ::= StyleInformation
<IncludeEmptyString:boolean>
<ExcludeNullNodes:boolean>
<Debug:boolean>;
TypePatternCollectionMapping ::= <TypeRegex> PatternCollection ;
PatternCollection ::= <TokenPattern> <ChildPattern> <RelationPattern> <AttributePattern> <NonterminalAttributePattern> ;
StyleInformation ::= <NameMethod:StyleMethod> <BackgroundColorMethod:StyleMethod> <TextColorMethod:StyleMethod> <StereotypeMethod:StyleMethod> <ComputedColor>;
StyleInformation ::= <ComputedColor>;
PrintConfig ::= Header*
<Scale:double>
<Version>
<RelationWithRank:boolean>
<OrderChildren:boolean> ;
<OrderChildren:boolean>
<NodeStyleDefinition:NodeStyleDefinition>
<RelationStyleDefinition:RelationStyleDefinition>;
Header ::= <Value> ;
NodeStyle ::= <Label> <BackgroundColor> <TextColor> <StereoTypes> ;
RelationStyle ::= <Label> <LineColor> <TextColor> ;
aspect Frontend {
// --- match{In,Ex}cludePatternCollection ---
syn PatternCollection BuildConfig.matchIncludePatternCollection(String typeName) {
for (TypePatternCollectionMapping mapping : getIncludeTypePatternList()) {
if (matches(mapping.typePattern(), typeName)) {
return mapping.getPatternCollection();
}
}
return null;
}
syn PatternCollection BuildConfig.matchExcludePatternCollection(String typeName) {
for (TypePatternCollectionMapping mapping : getExcludeTypePatternList()) {
if (matches(mapping.typePattern(), typeName)) {
return mapping.getPatternCollection();
}
}
return null;
}
static StyleInformation StyleInformation.createDefault() {
StyleInformation result = new StyleInformation();
result.setNameMethod(n -> n == null ? "null" : n.getClass().getSimpleName() + "@" + Integer.toHexString(n.hashCode()));
result.setBackgroundColorMethod(n -> "");
result.setTextColorMethod(n -> "");
result.setStereotypeMethod(n -> "");
result.setComputedColor("blue");
return result;
}
@FunctionalInterface
public interface StyleMethod<ASTNODE> {
String get(ASTNODE node);
public interface NodeStyleDefinition<ASTNODE> {
void style(ASTNODE node, NodeStyle style);
}
@FunctionalInterface
public interface RelationStyleDefinition<ASTNODE> {
void style(ASTNODE source, ASTNODE target, boolean isComputed, boolean isContainment, RelationStyle style);
}
public void NodeStyle.useSimpleLabel() {
setLabel(node.getObject() == null ? "null" : node.getObject().getClass().getSimpleName());
}
public void NodeStyle.useSimpleLabelWithHashCode() {
setLabel(node.getObject() == null ? "null" :
node.getObject().getClass().getSimpleName() + "@" + Integer.toHexString(node.getObject().hashCode()));
}
@FunctionalInterface
......
......@@ -36,6 +36,12 @@ aspect Navigation {
syn boolean AnalysedMethod.isSingleRelationMethod() = false;
eq SingleRelationMethod.isSingleRelationMethod() = true;
/** Tests if SingleRelationMethod is a OptRelationMethod.
* @return 'true' if this is a OptRelationMethod, otherwise 'false'
*/
syn boolean SingleRelationMethod.isOptRelationMethod() = false;
eq OptRelationMethod.isOptRelationMethod() = true;
/** Tests if AnalysedMethod is a ListRelationMethod.
* @return 'true' if this is a ListRelationMethod, otherwise 'false'
*/
......@@ -102,6 +108,12 @@ aspect Navigation {
syn boolean DumpToken.isDumpReferenceToken() = false;
eq DumpReferenceToken.isDumpReferenceToken() = true;
/** Tests if DumpToken is a DumpReferenceListToken.
* @return 'true' if this is a DumpReferenceListToken, otherwise 'false'
*/
syn boolean DumpToken.isDumpReferenceListToken() = false;
eq DumpReferenceListToken.isDumpReferenceListToken() = true;
/** Tests if DumpToken is a DumpValueToken.
* @return 'true' if this is a DumpValueToken, otherwise 'false'
*/
......@@ -227,6 +239,13 @@ aspect Navigation {
eq DumpToken.asDumpReferenceToken() = null;
eq DumpReferenceToken.asDumpReferenceToken() = this;
/** casts a DumpToken into a DumpReferenceListToken if possible.
* @return 'this' cast to a DumpReferenceListToken or 'null'
*/
syn DumpReferenceListToken DumpToken.asDumpReferenceListToken();
eq DumpToken.asDumpReferenceListToken() = null;
eq DumpReferenceListToken.asDumpReferenceListToken() = this;
/** casts a DumpToken into a DumpValueToken if possible.
* @return 'this' cast to a DumpValueToken or 'null'
*/
......
......@@ -10,6 +10,11 @@ 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();
inh BuildConfig DumpToken.buildConfig();
eq DumpAst.getChild().buildConfig() = getBuildConfig();
// --- printConfig ---
......@@ -25,11 +30,23 @@ aspect Navigation {
inh DumpNode InnerRelationDumpNode.containingDumpNode();
inh DumpNode DumpChildNode.containingDumpNode();
inh DumpNode DumpRelation.containingDumpNode();
inh DumpNode DumpReferenceToken.containingDumpNode();
inh DumpNode DumpReferenceListToken.containingDumpNode();
eq DumpNode.getDumpChildNode().containingDumpNode() = this;
eq DumpNode.getDumpRelation().containingDumpNode() = this;
eq DumpNode.getDumpToken().containingDumpNode() = this;
eq DumpNode.getInvisiblePath().containingDumpNode() = this;
// --- containingDumpListChildNode ---
inh DumpListChildNode InnerDumpNode.containingDumpListChildNode();
eq DumpListChildNode.getInnerDumpNode().containingDumpListChildNode() = this;
// --- containingDumpListRelation ---
inh DumpListRelation InnerRelationDumpNode.containingDumpListRelation();
eq DumpListRelation.getInnerRelationDumpNode().containingDumpListRelation() = this;
eq DumpReferenceListToken.getInnerRelationDumpNode().containingDumpListRelation() = null;
eq InvisiblePath.getInnerRelationDumpNode().containingDumpListRelation() = null;
// --- container ---
syn DumpNode DumpNode.container() {
if (getContainerOfNormalChild() != null) {
......@@ -85,10 +102,10 @@ aspect Navigation {
return result;
}
// --- innerNotNull ---
syn boolean DumpNormalRelation.innerNotNull() = !printConfig().getRelationWithRank() && getDumpNode() != null && getDumpNode().getObject() != null;
syn boolean DumpReferenceToken.innerNotNull() = !printConfig().getRelationWithRank() && getValue() != null && getValue().getObject() != null;
syn boolean InnerRelationDumpNode.innerNotNull() = !printConfig().getRelationWithRank() && getDumpNode() != null && getDumpNode().getObject() != null;
// --- innerNotNullOrEmpty ---
syn boolean DumpNormalRelation.innerNotNullOrEmpty() = !printConfig().getRelationWithRank() && getDumpNode() != null && getDumpNode().getObject() != null && getDumpNode().getObject() != DumpAst.EMPTY;
syn boolean DumpReferenceToken.innerNotNullOrEmpty() = !printConfig().getRelationWithRank() && getDumpNode() != null && getDumpNode().getObject() != null && getDumpNode().getObject() != DumpAst.EMPTY;
syn boolean InnerRelationDumpNode.innerNotNullOrEmpty() = !printConfig().getRelationWithRank() && getDumpNode() != null && getDumpNode().getObject() != null && getDumpNode().getObject() != DumpAst.EMPTY;
// === Method naviagtion ===
coll java.util.List<SingleChildMethod> ClassAnalysisResult.singleChildMethods() [new java.util.ArrayList<>()] root ClassAnalysisResult;
......
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() = getName() + (getComputed() ? "()" : "");
syn String DumpRelation.label() = getName();
syn String DumpToken.label() = getName() + (getComputed() ? "()" : "");
syn String DumpNode.label() = getLabel();
inh String InnerDumpNode.label();
inh String InnerRelationDumpNode.label();
eq DumpListChildNode.getInnerDumpNode(int index).label() = label() + "[" + index + "]";
eq DumpListRelation.getInnerRelationDumpNode(int index).label() = label() + "[" + index + "]";
eq DumpReferenceListToken.getInnerRelationDumpNode(int index).label() = label() + "[" + index + "]";
eq InvisiblePath.getInnerRelationDumpNode(int index).label() = null;
// --- 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 {
......
......@@ -8,6 +8,11 @@ aspect TemplateContext {
return getObject() == null;
}
// --- isEmpty ---
syn boolean DumpNode.isEmpty() {
return getObject() == DumpAst.EMPTY;
}
// --- isAstNode ---
syn boolean DumpNode.isAstNode() {
if (getObject() == null) {
......@@ -22,11 +27,63 @@ 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() = getDumpNode().name();
// --- label ---
syn String DumpChildNode.label() = safeLabel(getLabel() + (getComputed() ? "()" : ""));
syn String DumpRelation.label() = safeLabel(getLabel());
syn String DumpToken.label() = safeLabel(getLabel() + (getComputed() ? "()" : ""));
syn String DumpNode.label() = safeLabel(getLabel());
inh String InnerDumpNode.label();
inh String InnerRelationDumpNode.label();
eq DumpListChildNode.getInnerDumpNode(int index).label() {
InnerDumpNode inner = getInnerDumpNode(index);
return safeLabel(
(inner.getDumpNode().isEmpty() ? "" : "[" + chooseIndex(inner.getOriginalIndex(), index) + "]"));
}
eq DumpListRelation.getInnerRelationDumpNode(int index).label() {
InnerRelationDumpNode inner = getInnerRelationDumpNode(index);
return safeLabel(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;
}
static String ASTNode.safeLabel(String s) {
return s.isEmpty() ? " " : s;
}
// --- 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();
for (DumpNode successor : reachableThroughInvisible()) {
result.addInnerRelationDumpNode(new InnerRelationDumpNode(successor));
result.addInnerRelationDumpNode(new InnerRelationDumpNode().setDumpNode(successor));
}
return result;
}
......@@ -49,9 +106,9 @@ aspect TemplateContext {
// --- labelAndTextColor ---
syn String DumpNode.labelAndTextColor() {
if (getTextColor().isEmpty()) {
return getLabel();
return label();
} else {
return "<color:" + getTextColor() + ">" + getLabel() + "</color>";
return "<color:" + getTextColor() + ">" + label() + "</color>";
}
}
......
......@@ -32,9 +32,9 @@ aspect ToYaml {
addYamledList(result, "Headers", getHeaderList(), fromRelation);
// tokens
result.put("scale", getScale());
result.put("version", getVersion());
result.put("orderChildren", getOrderChildren());
result.put("OrderChildren", getOrderChildren());
result.put("Scale", getScale());
result.put("Version", getVersion());
// attributes
result.put("debug", debug());
......@@ -44,7 +44,7 @@ aspect ToYaml {
syn MappingElement Header.toYaml(boolean fromRelation) {
MappingElement result = new MappingElement();
// tokens
result.put("value", getValue());
result.put("Value", getValue());
return result;
}
......@@ -59,19 +59,19 @@ aspect ToYaml {
}
// tokens
result.put("name", getName());
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());
result.put("BackgroundColor", getBackgroundColor());
result.put("Invisible", getInvisible());
result.put("TextColor", getTextColor());
}
// attributes
if (!fromRelation) {
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);
......@@ -88,12 +88,15 @@ aspect ToYaml {
syn MappingElement DumpChildNode.toYaml(boolean fromRelation) {
MappingElement result = new MappingElement();
// tokens
result.put("name", getName());
result.put("computed", getComputed());
result.put("LineColor", getLineColor());
result.put("TextColor", getTextColor());
// attributes
result.put("label", label());
result.put("isList", isList());
result.put("label", label());
result.put("needRelationStyling", needRelationStyling());
result.put("outerNodeName", outerNodeName());
return result;
......@@ -101,6 +104,7 @@ aspect ToYaml {
syn MappingElement DumpNormalChildNode.toYaml(boolean fromRelation) {
MappingElement result = super.toYaml(fromRelation);
// attributes
result.put("bothVisible", bothVisible());
result.put("innerNodeName", innerNodeName());
......@@ -109,6 +113,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;
......@@ -116,28 +124,33 @@ aspect ToYaml {
syn MappingElement DumpToken.toYaml(boolean fromRelation) {
MappingElement result = new MappingElement();
// tokens
result.put("name", getName());
result.put("computed", getComputed());
// attributes