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

3
4
  // --- program ---
  eq Ros2Rag.getChild().program() = getProgram();
Johannes Mey's avatar
Johannes Mey committed
5

6
7
8
9
  // --- ros2rag
  inh Ros2Rag ASTNode.ros2rag();
  eq Ros2Rag.getChild().ros2rag() = this;

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

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

René Schöne's avatar
René Schöne committed
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
  // --- 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
37
}