Analysis.jrag 1.22 KB
Newer Older
Johannes Mey's avatar
Johannes Mey committed
1
aspect Analysis {
2
3
4
5
6
7
  // --- lookupTokenEndpointDefinition ---
  inh TokenEndpointDefinition TokenEndpointDefinition.lookupTokenEndpointDefinition(TokenComponent token);
  eq RagConnect.getEndpointDefinition().lookupTokenEndpointDefinition(TokenComponent token) {
    for (EndpointDefinition def : getEndpointDefinitionList()) {
      if (def.isTokenEndpointDefinition() && def.asTokenEndpointDefinition().getToken().equals(token)) {
        return def.asTokenEndpointDefinition();
René Schöne's avatar
René Schöne committed
8
      }
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
  // --- isAlreadyDefined ---
25
  syn boolean TokenEndpointDefinition.isAlreadyDefined() = lookupTokenEndpointDefinition(getToken()) != this;
René Schöne's avatar
René Schöne committed
26
  syn boolean DependencyDefinition.isAlreadyDefined() = lookupDependencyDefinition(getSource().containingTypeDecl(), getID()) != this;
Johannes Mey's avatar
Johannes Mey committed
27
}