Beispiel #1
0
  public IScope scope_MessageHandler_msg(MessageHandler handler, EReference ref) {
    final List<IEObjectDescription> scopes = new ArrayList<IEObjectDescription>();

    ProtocolClass pc = RoomHelpers.getProtocolClass(handler);
    if (pc != null) {
      for (Message m : pc.getIncomingMessages()) {
        scopes.add(EObjectDescription.create(m.getName(), m));
      }
      for (Message m : pc.getOutgoingMessages()) {
        scopes.add(EObjectDescription.create(m.getName(), m));
      }
    }

    return new SimpleScope(IScope.NULLSCOPE, scopes);
  }
Beispiel #2
0
  /**
   * returns a flat list of Message scopes for a {@link SemanticsInRule}
   *
   * @param sr - the semantics rule for incoming messages
   * @param ref - not used
   * @return a list of scopes
   */
  public IScope scope_SemanticsRule_msg(SemanticsRule sr, EReference ref) {
    final List<IEObjectDescription> scopes = new ArrayList<IEObjectDescription>();

    ProtocolClass pc = RoomHelpers.getProtocolClass(sr);
    LinkedList<ProtocolClass> classes = getBaseClasses(pc);
    for (ProtocolClass bpc : classes) {
      for (Message m : bpc.getIncomingMessages()) {
        scopes.add(EObjectDescription.create(m.getName(), m));
      }
      for (Message m : bpc.getOutgoingMessages()) {
        scopes.add(EObjectDescription.create(m.getName(), m));
      }
    }

    return new SimpleScope(IScope.NULLSCOPE, scopes);
  }
Beispiel #3
0
  /**
   * returns a flat list of Message scopes for a {@link MessageFromIf}
   *
   * @param mfi - the message from interface
   * @param ref - not used
   * @return a list of scopes
   */
  public IScope scope_MessageFromIf_message(MessageFromIf mfi, EReference ref) {
    final List<IEObjectDescription> scopes = new ArrayList<IEObjectDescription>();

    InterfaceItem item = mfi.getFrom();
    if (item != null) {
      ProtocolClass protocol = item.getProtocol();
      boolean conjugated = false;
      if (item instanceof Port) conjugated = ((Port) item).isConjugated();
      else if (item instanceof SAPRef) conjugated = true;
      for (Message msg :
          conjugated ? protocol.getOutgoingMessages() : protocol.getIncomingMessages()) {
        scopes.add(EObjectDescription.create(msg.getName(), msg));
      }
    }

    return new SimpleScope(IScope.NULLSCOPE, scopes);
  }
Beispiel #4
0
  public IScope scope_PortOperation_sendsMsg(PortOperation op, EReference ref) {
    final List<IEObjectDescription> scopes = new ArrayList<IEObjectDescription>();

    PortClass pcls = (PortClass) op.eContainer();
    ProtocolClass pc = RoomHelpers.getProtocolClass(op);
    if (pc != null) {
      if (pcls == pc.getConjugate())
        for (Message m : pc.getIncomingMessages()) {
          scopes.add(EObjectDescription.create(m.getName(), m));
        }
      else
        for (Message m : pc.getOutgoingMessages()) {
          scopes.add(EObjectDescription.create(m.getName(), m));
        }
    }

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