Ejemplo 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);
  }
Ejemplo n.º 2
0
  private boolean isPortRelay() {
    if (internal) return false;

    if (acc instanceof SubSystemClass) return true;
    else if (acc instanceof ActorClass) {
      for (ExternalPort xp : ((ActorClass) acc).getExternalPorts()) {
        if (xp.getInterfacePort() == port) return false;
      }
      return true;
    }

    return false;
  }
Ejemplo n.º 3
0
  @Override
  protected void okPressed() {
    if (relay != oldRelay) {
      // we know it's an ActorClass (else the flag couldn't have changed)
      ActorClass ac = (ActorClass) acc;

      if (relay) {
        for (ExternalPort xp : ac.getExternalPorts()) {
          if (xp.getInterfacePort() == port) {
            ac.getExternalPorts().remove(xp);
            break;
          }
        }
      } else {
        ExternalPort xp = RoomFactory.eINSTANCE.createExternalPort();
        xp.setInterfacePort(port);
        ac.getExternalPorts().add(xp);
      }
    }

    super.okPressed();
  }
Ejemplo n.º 4
0
 /**
  * check whether port is referenced by external port
  *
  * @param p - port to be checked
  * @param ports - list of external ports
  * @return true if contained
  */
 private boolean isContained(Port p, EList<ExternalPort> ports) {
   for (ExternalPort port : ports) {
     if (port.getIfport() == p) return true;
   }
   return false;
 }