コード例 #1
0
  @Check(CheckType.FAST)
  public void checkUnusedExit(final Exit exit) {
    if (exit.getParentRegion().getComposite() instanceof org.yakindu.sct.model.sgraph.State
        && exit.getOutgoingTransitions().isEmpty()) {
      org.yakindu.sct.model.sgraph.State state =
          (org.yakindu.sct.model.sgraph.State) exit.getParentRegion().getComposite();

      if (!STextValidationModelUtils.isDefault(exit)) {
        boolean hasOutgoingTransition = false;
        Iterator<Transition> transitionIt = state.getOutgoingTransitions().iterator();
        while (transitionIt.hasNext() && !hasOutgoingTransition) {
          Transition transition = transitionIt.next();
          hasOutgoingTransition =
              STextValidationModelUtils.isDefaultExitTransition(transition)
                  ? true
                  : STextValidationModelUtils.isNamedExitTransition(transition, exit.getName());
        }
        if (!hasOutgoingTransition) {
          error(EXIT_UNUSED, exit, null, -1);
        }
      } else {
        boolean hasOutgoingTransition = false;
        Iterator<Transition> transitionIt = state.getOutgoingTransitions().iterator();
        while (transitionIt.hasNext() && !hasOutgoingTransition) {
          hasOutgoingTransition =
              STextValidationModelUtils.isDefaultExitTransition(transitionIt.next());
        }
        if (!hasOutgoingTransition) {
          error(EXIT_DEFAULT_UNUSED, exit, null, -1);
        }
      }
    }
  }
コード例 #2
0
 @Check(CheckType.FAST)
 public void exitWithOutgoingTransition(Exit exit) {
   if (exit.getOutgoingTransitions().size() > 0) {
     error(ISSUE_EXIT_WITH_OUT_TRANS, exit, null, -1);
   }
 }