예제 #1
0
  private void collectStates(StateGraph sg, LinkedList<BaseState> states) {

    if (sg == null) return;

    for (State s : sg.getStates()) {
      if (s instanceof BaseState) states.add((BaseState) s);
    }
    for (State s : sg.getStates()) {
      collectStates(s.getSubgraph(), states);
    }
  }
예제 #2
0
  /**
   * returns a flat list of TransitionPoint scopes for a {@link SubStateTrPointTerminal}
   *
   * @param ep - the transition endpoint or terminal
   * @param ref - not used
   * @return a list of scopes
   */
  public IScope scope_SubStateTrPointTerminal_trPoint(SubStateTrPointTerminal ep, EReference ref) {
    final List<IEObjectDescription> scopes = new ArrayList<IEObjectDescription>();

    StateGraph parent = getStateGraph(ep);
    StateGraph targetStateGraph = parent;
    if (ep.getState() != null) {
      targetStateGraph = ep.getState().getSubgraph(); // always a BaseState

      // if one of our siblings is a RefinedState of our target we take that as target
      for (State sibling : parent.getStates()) {
        if (sibling instanceof RefinedState) {
          if (((RefinedState) sibling).getBase() == ep.getState())
            targetStateGraph = sibling.getSubgraph();
        }
      }
    }

    if (targetStateGraph != null) getTrPointScopes(scopes, targetStateGraph);

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