Navigation.jrag 2.56 KB
Newer Older
Johannes Mey's avatar
Johannes Mey committed
1
2
aspect Navigation {

3
  // --- program ---
Johannes Mey's avatar
Johannes Mey committed
4
5
  inh Program ASTNode.program();
  eq Program.getChild().program() = this;
6
  eq Ros2Rag.getChild().program() = getProgram();
Johannes Mey's avatar
Johannes Mey committed
7

8
9
10
11
12
  // --- ros2rag
  inh Ros2Rag ASTNode.ros2rag();
  eq Ros2Rag.getChild().ros2rag() = this;

  // --- typeDecls ---
Johannes Mey's avatar
Johannes Mey committed
13
14
15
16
17
  coll java.util.Set<TypeDecl> Program.typeDecls() [new java.util.HashSet<>()] root Program;
  TypeDecl contributes this
    to Program.typeDecls()
    for program();

18
  // --- relations ---
Johannes Mey's avatar
Johannes Mey committed
19
20
21
22
23
  coll java.util.Set<Relation> Program.relations() [new java.util.HashSet<>()] root Program;
  Relation contributes this
    to Program.relations()
    for program();

24
  // --- containingTypeDecl ---
25
26
27
  inh TypeDecl Component.containingTypeDecl();
  eq TypeDecl.getChild().containingTypeDecl() = this;

Johannes Mey's avatar
Johannes Mey committed
28
29
30
31
32
33
34
//  syn boolean RelationComponent.multiplicityOne() = false;
//  eq OneRelationComponent.multiplicityOne() = true;
//  syn boolean RelationComponent.multiplicityOpt() = false;
//  eq OptionalRelationComponent.multiplicityOpt() = true;
//  syn boolean RelationComponent.multiplicityMany() = false;
//  eq ManyRelationComponent.multiplicityMany() = true;

35
  // --- containedFile ---
Johannes Mey's avatar
Johannes Mey committed
36
37
  inh GrammarFile ASTNode.containedFile();
  eq GrammarFile.getChild().containedFile() = this;
René Schöne's avatar
René Schöne committed
38
39
40
41
42
43
  eq Program.getChild().containedFile() = null;
  eq Ros2Rag.getChild().containedFile() = null;

  // --- isTypeComponent ---
  syn boolean Component.isTypeComponent() = false;
  eq TypeComponent.isTypeComponent() = true;
44
45
46
47
48
49
50
51

  // --- isTokenComponent ---
  syn boolean Component.isTokenComponent() = false;
  eq TokenComponent.isTokenComponent() = true;

  // --- asTokenComponent ---
  syn TokenComponent Component.asTokenComponent() = null;
  eq TokenComponent.asTokenComponent() = this;
René Schöne's avatar
René Schöne committed
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71

  // --- isWriteToMqttDefinition ---
  syn boolean UpdateDefinition.isWriteToMqttDefinition() = false;
  eq WriteToMqttDefinition.isWriteToMqttDefinition() = true;

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

  // --- 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;
  }
Johannes Mey's avatar
Johannes Mey committed
72
}