Exemplo n.º 1
0
  @Check(CheckType.FAST)
  public void checkUnusedEntry(final Entry entry) {
    if (entry.getParentRegion().getComposite() instanceof org.yakindu.sct.model.sgraph.State
        && entry.getIncomingTransitions().isEmpty()) {
      org.yakindu.sct.model.sgraph.State state =
          (org.yakindu.sct.model.sgraph.State) entry.getParentRegion().getComposite();

      if (!STextValidationModelUtils.isDefault(entry)) {

        boolean hasIncomingTransition = false;
        Iterator<Transition> transitionIt = state.getIncomingTransitions().iterator();

        while (transitionIt.hasNext() && !hasIncomingTransition) {

          Iterator<ReactionProperty> propertyIt = transitionIt.next().getProperties().iterator();

          while (propertyIt.hasNext() && !hasIncomingTransition) {

            ReactionProperty property = propertyIt.next();

            if (property instanceof EntryPointSpec) {

              hasIncomingTransition =
                  entry.getName().equals(((EntryPointSpec) property).getEntrypoint());
            }
          }
        }
        if (!hasIncomingTransition) {
          warning(ENTRY_UNUSED, entry, null, -1);
        }
      }
    }
  }
Exemplo n.º 2
0
 @Check(CheckType.FAST)
 public void initialEntryWithoutIncomingTransitions(Entry entry) {
   if (entry.getIncomingTransitions().size() > 0 && entry.getKind().equals(EntryKind.INITIAL)) {
     warning(ISSUE_INITIAL_ENTRY_WITH_IN_TRANS, entry, null, -1);
   }
 }