Esempio n. 1
0
  /**
   * returns a flat list of Port scopes for a {@link BindingEndPoint}
   *
   * @param ep - the endpoint
   * @param ref - not used
   * @return a list of scopes
   */
  public IScope scope_BindingEndPoint_port(BindingEndPoint ep, EReference ref) {
    final List<IEObjectDescription> scopes = new ArrayList<IEObjectDescription>();

    ActorContainerClass acc = getActorContainerClass(ep);

    if (ep.getActorRef() == null) {
      if (acc instanceof ActorClass) {
        ActorClass ac = (ActorClass) acc;
        // for all super classes (including this class)
        LinkedList<ActorClass> classes = getBaseClasses(ac);
        for (ActorClass a : classes) {
          // collect internal and relay ports, i.e.
          // structure ports not in interface (internal)
          for (Port p : a.getIntPorts()) {
            scopes.add(EObjectDescription.create(p.getName(), p));
          }
          // interface ports not in structure (relay)
          for (Port p : a.getIfPorts()) {
            if (!isContained(p, a.getExtPorts()))
              scopes.add(EObjectDescription.create(p.getName(), p));
          }
        }
      } else {
        // SubSystemClass has no internal end ports
      }
    } else {
      // all ports in the sub actor's interface
      if (ep.getActorRef() instanceof ActorRef) {
        ActorClass ac = ((ActorRef) ep.getActorRef()).getType();
        LinkedList<ActorClass> classes = getBaseClasses(ac);
        for (ActorClass a : classes) {
          for (Port p : a.getIfPorts()) {
            scopes.add(EObjectDescription.create(p.getName(), p));
          }
        }
      } else {
        SubSystemClass ssc = ((SubSystemRef) ep.getActorRef()).getType();
        for (Port p : ssc.getRelayPorts()) {
          scopes.add(EObjectDescription.create(p.getName(), p));
        }
      }
    }
    return new SimpleScope(IScope.NULLSCOPE, scopes);
  }
Esempio n. 2
0
  /**
   * returns a flat list of SPPRef scopes for a {@link SPPoint}
   *
   * @param pt
   * @param ref
   * @return a list of scopes
   */
  public IScope scope_SPPoint_service(SPPoint pt, EReference ref) {
    final List<IEObjectDescription> scopes = new ArrayList<IEObjectDescription>();

    if (pt.getRef() != null) {
      if (pt.getRef() instanceof ActorRef) {
        ActorClass ac = ((ActorRef) pt.getRef()).getType();
        LinkedList<ActorClass> classes = getBaseClasses(ac);
        for (ActorClass a : classes) {
          for (SPPRef spp : a.getIfSPPs()) {
            scopes.add(EObjectDescription.create(spp.getName(), spp));
          }
        }
      } else if (pt.getRef() instanceof SubSystemRef) {
        SubSystemClass ssc = ((SubSystemRef) pt.getRef()).getType();
        for (SPPRef spp : ssc.getIfSPPs()) {
          scopes.add(EObjectDescription.create(spp.getName(), spp));
        }
      }
    }

    return new SimpleScope(IScope.NULLSCOPE, scopes);
  }