コード例 #1
0
ファイル: RoomScopeProvider.java プロジェクト: hckkid/eTrice
  /**
   * returns a flat list of Choicepoint scopes for a {@link SubStateTrPointTerminal}
   *
   * @param ct - the transition endpoint or terminal
   * @param ref - not used
   * @return a list of scopes
   */
  public IScope scope_ChoicepointTerminal_cp(ChoicepointTerminal ct, EReference ref) {
    final List<IEObjectDescription> scopes = new ArrayList<IEObjectDescription>();

    // first state in container hierarchy
    StateGraph parent = getStateGraph(ct);

    // collect choicepoints of my parent
    if (parent != null)
      for (ChoicePoint cp : parent.getChPoints()) {
        scopes.add(EObjectDescription.create(cp.getName(), cp));
      }

    // if my parent is a refined state we also add its base state contents
    if (parent.eContainer() instanceof RefinedState) {
      parent = ((RefinedState) parent.eContainer()).getBase().getSubgraph();
      if (parent != null)
        for (ChoicePoint cp : parent.getChPoints()) {
          scopes.add(EObjectDescription.create(cp.getName(), cp));
        }
    } else if (parent.eContainer() instanceof ActorClass) {
      ActorClass ac = (ActorClass) parent.eContainer();
      if (ac.getBase() != null) {
        for (ChoicePoint cp : ac.getBase().getStateMachine().getChPoints()) {
          scopes.add(EObjectDescription.create(cp.getName(), cp));
        }
      }
    }

    return new SimpleScope(IScope.NULLSCOPE, scopes);
  }
コード例 #2
0
ファイル: RoomScopeProvider.java プロジェクト: hckkid/eTrice
  private IScope getStateScopes(EObject obj) {
    final List<IEObjectDescription> scopes = new ArrayList<IEObjectDescription>();

    // first state in container hierarchy
    StateGraph parent = getStateGraph(obj);

    // collect states of my parent
    if (parent != null) {
      for (State s : parent.getStates()) {
        BaseState bs = getBaseState(s);
        scopes.add(EObjectDescription.create(bs.getName(), bs));
      }

      // if my parent is a refined state we also add its base state contents
      if (parent.eContainer() instanceof RefinedState) {
        parent = ((RefinedState) parent.eContainer()).getBase().getSubgraph();
        if (parent != null)
          for (State s : parent.getStates()) {
            BaseState bs = getBaseState(s);
            scopes.add(EObjectDescription.create(bs.getName(), bs));
          }
      } else if (parent.eContainer() instanceof ActorClass) {
        ActorClass ac = (ActorClass) parent.eContainer();
        if (ac.getBase() != null) {
          for (State s : ac.getBase().getStateMachine().getStates()) {
            BaseState bs = getBaseState(s);
            scopes.add(EObjectDescription.create(bs.getName(), bs));
          }
        }
      }
    }
    return new SimpleScope(IScope.NULLSCOPE, scopes);
  }
コード例 #3
0
ファイル: RoomScopeProvider.java プロジェクト: hckkid/eTrice
  /**
   * returns a flat list of Port scopes for a {@link ExternalPort}
   *
   * @param ar - the external port
   * @param ref - not used
   * @return a list of scopes
   */
  public IScope scope_ExternalPort_ifport(ExternalPort ep, EReference ref) {
    final List<IEObjectDescription> scopes = new ArrayList<IEObjectDescription>();

    ActorClass ac = getActorClass(ep);
    for (Port ip : ac.getIfPorts()) {
      scopes.add(EObjectDescription.create(ip.getName(), ip));
    }

    return new SimpleScope(IScope.NULLSCOPE, scopes);
  }
コード例 #4
0
ファイル: RoomScopeProvider.java プロジェクト: hckkid/eTrice
  /**
   * returns a flat list of BaseState scopes for a {@link RefinedState}
   *
   * @param rs - the refined state
   * @param ref - not used
   * @return a list of scopes
   */
  public IScope scope_RefinedState_base(RefinedState rs, EReference ref) {
    final List<IEObjectDescription> scopes = new ArrayList<IEObjectDescription>();

    ActorClass ac = getActorClass(rs);
    LinkedList<BaseState> states = new LinkedList<BaseState>();
    collectAllStates(ac.getBase(), states);
    for (BaseState bs : states) {
      scopes.add(EObjectDescription.create(getStatePath(bs), bs));
    }
    return new SimpleScope(IScope.NULLSCOPE, scopes);
  }
コード例 #5
0
ファイル: RoomScopeProvider.java プロジェクト: hckkid/eTrice
  /**
   * returns a flat list of SPPRef scopes for a {@link RelaySAPoint}
   *
   * @param pt
   * @param ref
   * @return a list of scopes
   */
  public IScope scope_RelaySAPoint_relay(RelaySAPoint pt, EReference ref) {
    final List<IEObjectDescription> scopes = new ArrayList<IEObjectDescription>();

    ActorClass ac = getActorClass(pt);
    LinkedList<ActorClass> classes = getBaseClasses(ac);
    for (ActorClass a : classes) {
      for (SPPRef spp : a.getIfSPPs()) {
        scopes.add(EObjectDescription.create(spp.getName(), spp));
      }
    }

    return new SimpleScope(IScope.NULLSCOPE, scopes);
  }
コード例 #6
0
ファイル: RoomScopeProvider.java プロジェクト: hckkid/eTrice
  /**
   * 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);
  }
コード例 #7
0
ファイル: RoomScopeProvider.java プロジェクト: hckkid/eTrice
  /**
   * returns a flat list of ActorRef scopes for a {@link SPPoint}
   *
   * @param pt
   * @param ref
   * @return a list of scopes
   */
  public IScope scope_SPPoint_actorRef(SPPoint pt, EReference ref) {
    final List<IEObjectDescription> scopes = new ArrayList<IEObjectDescription>();

    ActorContainerClass acc = getActorContainerClass(pt);
    if (acc instanceof ActorClass) {
      LinkedList<ActorClass> classes = getBaseClasses((ActorClass) acc);
      for (ActorClass a : classes) {
        for (ActorRef ar : a.getActorRefs()) {
          scopes.add(EObjectDescription.create(ar.getName(), ar));
        }
      }
    } else {
      for (ActorRef ar : acc.getActorRefs()) {
        scopes.add(EObjectDescription.create(ar.getName(), ar));
      }
    }

    return new SimpleScope(IScope.NULLSCOPE, scopes);
  }
コード例 #8
0
ファイル: RoomScopeProvider.java プロジェクト: hckkid/eTrice
 /**
  * return a list of base classes of an {@link ActorClass}, parent classes first. The list includes
  * the class itself
  *
  * @param ac
  * @return
  */
 private LinkedList<ActorClass> getBaseClasses(ActorClass ac) {
   LinkedList<ActorClass> classes = new LinkedList<ActorClass>();
   if (ac != null) {
     classes.addFirst(ac);
     while (ac.getBase() != null) {
       ac = ac.getBase();
       classes.addFirst(ac);
     }
   }
   return classes;
 }
コード例 #9
0
ファイル: RoomScopeProvider.java プロジェクト: hckkid/eTrice
  /**
   * 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);
  }
コード例 #10
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();
  }
コード例 #11
0
 /**
  *
  * <!-- begin-user-doc -->
  * <!-- end-user-doc -->
  *
  * @generated
  */
 public ActorClass getActor() {
   if (actor != null && actor.eIsProxy()) {
     InternalEObject oldActor = (InternalEObject) actor;
     actor = (ActorClass) eResolveProxy(oldActor);
     if (actor != oldActor) {
       if (eNotificationRequired())
         eNotify(
             new ENotificationImpl(
                 this,
                 Notification.RESOLVE,
                 ConfigPackage.ACTOR_CLASS_CONFIG__ACTOR,
                 oldActor,
                 actor));
     }
   }
   return actor;
 }
コード例 #12
0
ファイル: RoomScopeProvider.java プロジェクト: hckkid/eTrice
  /**
   * 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);
  }
コード例 #13
0
ファイル: RoomScopeProvider.java プロジェクト: hckkid/eTrice
 /**
  * recursively collect all {@link BaseState}s of an actor class in a list
  *
  * @param ac
  * @param states
  */
 private void collectAllStates(ActorClass ac, LinkedList<BaseState> states) {
   while (ac != null) {
     collectStates(ac.getStateMachine(), states);
     ac = ac.getBase();
   }
 }