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

3
  // --- program ---
4
5
  eq RagConnect.getChild().program() = getProgram();
  eq MRagConnect.getChild().program() = getRagConnect().program();
6

7
8
9
10
  // --- ragconnect ---
  inh RagConnect ASTNode.ragconnect();
  eq RagConnect.getChild().ragconnect() = this;
  eq MRagConnect.getChild().ragconnect() = getRagConnect();
11

12
  // --- containedFile
13
  eq RagConnect.getChild().containedFile() = null;
René Schöne's avatar
René Schöne committed
14

15
  // --- containedFileName ---
16
17
  eq RagConnect.getChild().containedFileName() = getFileName();
  eq MRagConnect.getChild().containedFileName() = null;
René Schöne's avatar
René Schöne committed
18
19
20
21
22
23
24
25
26

  // --- 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
27
28
29
30
31
32
33
34
  // --- 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
35
36
37
38
  // --- asReadFromMqttDefinition ---
  syn ReadFromMqttDefinition UpdateDefinition.asReadFromMqttDefinition() = null;
  eq ReadFromMqttDefinition.asReadFromMqttDefinition() = this;

René Schöne's avatar
René Schöne committed
39
40
41
  // --- targetUpdateDefinition ---
  syn WriteToMqttDefinition DependencyDefinition.targetUpdateDefinition() {
    // resolve definition in here, as we do not need resolveMethod in any other place (yet)
42
    for (UpdateDefinition updateDefinition : ragconnect().getUpdateDefinitionList()) {
René Schöne's avatar
René Schöne committed
43
44
45
46
47
48
49
      if (updateDefinition.isWriteToMqttDefinition() &&
          updateDefinition.asWriteToMqttDefinition().getToken().equals(this.getTarget())) {
        return updateDefinition.asWriteToMqttDefinition();
      }
    }
    return null;
  }
50
51
52
53

  // --- isDefaultMappingDefinition ---
  syn boolean MappingDefinition.isDefaultMappingDefinition() = false;
  eq DefaultMappingDefinition.isDefaultMappingDefinition() = true;
54
}