Analysis.jrag 1.2 KB
Newer Older
Johannes Mey's avatar
Johannes Mey committed
1
aspect Analysis {
René Schöne's avatar
René Schöne committed
2
3
  // --- lookupTokenUpdateDefinition ---
  inh TokenUpdateDefinition TokenUpdateDefinition.lookupTokenUpdateDefinition(TokenComponent token);
4
  eq RagConnect.getUpdateDefinition().lookupTokenUpdateDefinition(TokenComponent token) {
René Schöne's avatar
René Schöne committed
5
6
7
8
    for (UpdateDefinition def : getUpdateDefinitionList()) {
      if (def.isTokenUpdateDefinition() && def.asTokenUpdateDefinition().getToken().equals(token)) {
        return def.asTokenUpdateDefinition();
      }
René Schöne's avatar
René Schöne committed
9
    }
René Schöne's avatar
René Schöne committed
10
    return null;
René Schöne's avatar
René Schöne committed
11
12
  }

René Schöne's avatar
René Schöne committed
13
14
  // --- lookupDependencyDefinition ---
  inh DependencyDefinition DependencyDefinition.lookupDependencyDefinition(TypeDecl source, String id);
15
  eq RagConnect.getDependencyDefinition().lookupDependencyDefinition(TypeDecl source, String id) {
René Schöne's avatar
René Schöne committed
16
17
18
19
20
21
22
    for (DependencyDefinition def : getDependencyDefinitionList()) {
      if (def.getID().equals(id) && def.getSource().containingTypeDecl().equals(source)) {
        return def;
      }
    }
    return null;
  }
Johannes Mey's avatar
Johannes Mey committed
23

René Schöne's avatar
René Schöne committed
24
25
26
  // --- isAlreadyDefined ---
  syn boolean TokenUpdateDefinition.isAlreadyDefined() = lookupTokenUpdateDefinition(getToken()) != this;
  syn boolean DependencyDefinition.isAlreadyDefined() = lookupDependencyDefinition(getSource().containingTypeDecl(), getID()) != this;
Johannes Mey's avatar
Johannes Mey committed
27
}