Navigation.jrag 3.18 KB
Newer Older
1
2
aspect Navigation {

3
4
  // --- program ---
  eq Ros2Rag.getChild().program() = getProgram();
5
  eq MRos2Rag.getChild().program() = getRos2Rag().program();
6

René Schöne's avatar
René Schöne committed
7
  // --- ros2rag ---
8
9
  inh Ros2Rag ASTNode.ros2rag();
  eq Ros2Rag.getChild().ros2rag() = this;
10
  eq MRos2Rag.getChild().ros2rag() = getRos2Rag();
11

12
  // --- containedFile (first equation should be in preprocessor) ---
René Schöne's avatar
René Schöne committed
13
14
15
  eq Program.getChild().containedFile() = null;
  eq Ros2Rag.getChild().containedFile() = null;

16
  // --- isTypeComponent (should be in preprocessor) ---
René Schöne's avatar
René Schöne committed
17
18
  syn boolean Component.isTypeComponent() = false;
  eq TypeComponent.isTypeComponent() = true;
19

René Schöne's avatar
René Schöne committed
20
21
22
23
  // --- asTypeComponent (should be in preprocessor) ---
  syn TypeComponent Component.asTypeComponent() = null;
  eq TypeComponent.asTypeComponent() = this;

René Schöne's avatar
René Schöne committed
24
25
26
27
28
29
30
31
32
33
34
35
36
  // --- isListComponent (should be in preprocessor) ---
  syn boolean Component.isListComponent() = false;
  eq ListComponent.isListComponent() = true;

  // --- asListComponent (should be in preprocessor) ---
  syn ListComponent Component.asListComponent() = null;
  eq ListComponent.asListComponent() = this;

  // --- containedFileName (should replace containedFile in preprocessor) ---
  inh String ASTNode.containedFileName();
  eq GrammarFile.getChild().containedFileName() = getFileName();
  eq Ros2Rag.getChild().containedFileName() = getFileName();
  eq Program.getChild().containedFileName() = null;
37
  eq MRos2Rag.getChild().containedFileName() = null;
René Schöne's avatar
René Schöne committed
38
39
40
41
42
43
44
45
46

  // --- isTokenUpdateDefinition ---
  syn boolean UpdateDefinition.isTokenUpdateDefinition() = false;
  eq TokenUpdateDefinition.isTokenUpdateDefinition() = true;

  // --- asTokenUpdateDefinition ---
  syn TokenUpdateDefinition UpdateDefinition.asTokenUpdateDefinition() = null;
  eq TokenUpdateDefinition.asTokenUpdateDefinition() = this;

René Schöne's avatar
René Schöne committed
47
48
49
50
51
52
53
54
  // --- isWriteToMqttDefinition ---
  syn boolean UpdateDefinition.isWriteToMqttDefinition() = false;
  eq WriteToMqttDefinition.isWriteToMqttDefinition() = true;

  // --- asWriteToMqttDefinition ---
  syn WriteToMqttDefinition UpdateDefinition.asWriteToMqttDefinition() = null;
  eq WriteToMqttDefinition.asWriteToMqttDefinition() = this;

René Schöne's avatar
René Schöne committed
55
56
57
58
  // --- asReadFromMqttDefinition ---
  syn ReadFromMqttDefinition UpdateDefinition.asReadFromMqttDefinition() = null;
  eq ReadFromMqttDefinition.asReadFromMqttDefinition() = this;

René Schöne's avatar
René Schöne committed
59
60
61
62
63
64
65
66
67
68
69
  // --- targetUpdateDefinition ---
  syn WriteToMqttDefinition DependencyDefinition.targetUpdateDefinition() {
    // resolve definition in here, as we do not need resolveMethod in any other place (yet)
    for (UpdateDefinition updateDefinition : ros2rag().getUpdateDefinitionList()) {
      if (updateDefinition.isWriteToMqttDefinition() &&
          updateDefinition.asWriteToMqttDefinition().getToken().equals(this.getTarget())) {
        return updateDefinition.asWriteToMqttDefinition();
      }
    }
    return null;
  }
70
71
72
73

  // --- isDefaultMappingDefinition ---
  syn boolean MappingDefinition.isDefaultMappingDefinition() = false;
  eq DefaultMappingDefinition.isDefaultMappingDefinition() = true;
René Schöne's avatar
René Schöne committed
74
75
76
77
78
79

  // --- allTokenComponents ---
  coll java.util.Set<TokenComponent> Program.allTokenComponents() [new java.util.HashSet<>()] root Program;
  TokenComponent contributes this
    to Program.allTokenComponents()
    for program();
80
}