Exemplo n.º 1
0
  /**
   * returns a flat list of Port scopes for a {@link MessageFromIf}
   *
   * @param mfi - the message from interface
   * @param ref - not used
   * @return a list of scopes
   */
  public IScope scope_MessageFromIf_port(MessageFromIf mfi, EReference ref) {
    final List<IEObjectDescription> scopes = new ArrayList<IEObjectDescription>();

    ActorClass ac = getActorClass(mfi);
    for (Port p : ac.getIntPorts()) {
      scopes.add(EObjectDescription.create(p.getName(), p));
    }
    for (ExternalPort p : ac.getExtPorts()) {
      scopes.add(EObjectDescription.create(p.getIfport().getName(), p.getIfport()));
    }

    return new SimpleScope(IScope.NULLSCOPE, scopes);
  }
Exemplo n.º 2
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);
  }