Esempio n. 1
1
 protected static boolean _privk3_deepestConflictingTransition(
     final RegionAspectRegionAspectProperties _self_,
     final Region _self,
     final ArrayList<Transition> activeTransitions) {
   final int res = activeTransitions.size();
   final ArrayList<Transition> toDelete = new ArrayList<Transition>();
   final Consumer<Transition> _function =
       (Transition x) -> {
         final Consumer<Transition> _function_1 =
             (Transition y) -> {
               AbstractState _source = x.getSource();
               if ((_source instanceof State)) {
                 ArrayList<AbstractState> children = new ArrayList<AbstractState>();
                 AbstractState _source_1 = x.getSource();
                 RegionAspect.getAllChildren(_self, ((State) _source_1), children);
                 AbstractState _source_2 = y.getSource();
                 boolean _contains = children.contains(_source_2);
                 if (_contains) {
                   toDelete.add(x);
                 }
               }
             };
         activeTransitions.forEach(_function_1);
       };
   activeTransitions.forEach(_function);
   activeTransitions.removeAll(toDelete);
   int _size = activeTransitions.size();
   return (res != _size);
 }
Esempio n. 2
0
 protected static void _privk3_getAllChildren(
     final RegionAspectRegionAspectProperties _self_,
     final Region _self,
     final AbstractState vertex,
     final ArrayList<AbstractState> children) {
   if ((vertex instanceof State)) {
     EList<Region> _ownedRegions = ((State) vertex).getOwnedRegions();
     boolean _notEquals = (!Objects.equal(_ownedRegions, null));
     if (_notEquals) {
       EList<Region> _ownedRegions_1 = ((State) vertex).getOwnedRegions();
       final Consumer<Region> _function =
           (Region _region) -> {
             EList<AbstractState> _subvertex = _region.getSubvertex();
             children.addAll(_subvertex);
             EList<AbstractState> _subvertex_1 = _region.getSubvertex();
             final Consumer<AbstractState> _function_1 =
                 (AbstractState _vertex) -> {
                   RegionAspect.getAllChildren(_self, _vertex, children);
                 };
             _subvertex_1.forEach(_function_1);
           };
       _ownedRegions_1.forEach(_function);
     }
   }
 }
Esempio n. 3
0
 protected static void _privk3_findNewActiveStates(
     final RegionAspectRegionAspectProperties _self_,
     final Region _self,
     final ArrayList<AbstractState> newActiveStates,
     final Transition selectedTransition,
     final ArrayList<Transition> currentActiveTransitions,
     final Hashtable<String, Object> context) {
   boolean _and = false;
   AbstractState _target = selectedTransition.getTarget();
   if (!(_target instanceof Pseudostate)) {
     _and = false;
   } else {
     AbstractState _target_1 = selectedTransition.getTarget();
     _and = (_target_1 instanceof Fork);
   }
   if (_and) {
     AbstractState _target_2 = selectedTransition.getTarget();
     EList<Transition> _outgoing = ((Pseudostate) _target_2).getOutgoing();
     for (final Transition _transition : _outgoing) {
       AbstractState _target_3 = _transition.getTarget();
       newActiveStates.add(_target_3);
     }
   } else {
     final ArrayList<AbstractState> targetParents = new ArrayList<AbstractState>();
     AbstractState _target_4 = selectedTransition.getTarget();
     RegionAspect.getAllParents(_self, _target_4, targetParents);
     final Consumer<AbstractState> _function =
         (AbstractState _parent) -> {
           boolean _contains = newActiveStates.contains(_parent);
           boolean _not = (!_contains);
           if (_not) {
             newActiveStates.add(_parent);
           }
         };
     targetParents.forEach(_function);
     for (final Transition _currentTransition : currentActiveTransitions) {
       boolean _and_1 = false;
       AbstractState _target_5 = selectedTransition.getTarget();
       boolean _contains = newActiveStates.contains(_target_5);
       boolean _not = (!_contains);
       if (!_not) {
         _and_1 = false;
       } else {
         boolean _alreadyFired = TransitionAspect.alreadyFired(selectedTransition, context);
         boolean _not_1 = (!_alreadyFired);
         _and_1 = _not_1;
       }
       if (_and_1) {
         AbstractState _target_6 = selectedTransition.getTarget();
         newActiveStates.add(_target_6);
       }
     }
     ArrayList<AbstractState> toDelete = new ArrayList<AbstractState>();
     final ArrayList<AbstractState> targetChildren = new ArrayList<AbstractState>();
     AbstractState _source = selectedTransition.getSource();
     RegionAspect.getAllChildren(_self, _source, targetChildren);
     for (final AbstractState _newState : newActiveStates) {
       {
         boolean delete = true;
         List<Transition> transitions = new ArrayList<Transition>();
         EList<Transition> _incoming = _newState.getIncoming();
         transitions.addAll(_incoming);
         for (final AbstractState _children : targetChildren) {
           EList<Transition> _incoming_1 = _children.getIncoming();
           transitions.addAll(_incoming_1);
         }
         for (final Transition _incoming_2 : transitions) {
           {
             if ((_newState instanceof State)) {
               ArrayList<AbstractState> children =
                   CollectionLiterals.<AbstractState>newArrayList();
               RegionAspect.getAllChildren(_self, _newState, children);
               final Function1<AbstractState, Boolean> _function_1 =
                   (AbstractState child) -> {
                     return Boolean.valueOf(newActiveStates.contains(child));
                   };
               AbstractState _findFirst =
                   IterableExtensions.<AbstractState>findFirst(children, _function_1);
               boolean _notEquals = (!Objects.equal(_findFirst, null));
               if (_notEquals) {
                 delete = false;
               }
             }
             boolean _contains_1 = currentActiveTransitions.contains(_incoming_2);
             if (_contains_1) {
               delete = false;
             }
           }
         }
         if (delete) {
           toDelete.add(_newState);
         }
       }
     }
     final ArrayList<AbstractState> moreToDelete = new ArrayList<AbstractState>();
     final Consumer<AbstractState> _function_1 =
         (AbstractState _state) -> {
           final ArrayList<AbstractState> child = new ArrayList<AbstractState>();
           RegionAspect.getAllChildren(_self, _state, child);
           boolean _and_2 = false;
           EList<Transition> _incoming = _state.getIncoming();
           final Function1<Transition, Boolean> _function_2 =
               (Transition t) -> {
                 return Boolean.valueOf(currentActiveTransitions.contains(t));
               };
           boolean _exists = IterableExtensions.<Transition>exists(_incoming, _function_2);
           boolean _not_2 = (!_exists);
           if (!_not_2) {
             _and_2 = false;
           } else {
             final Function1<AbstractState, Boolean> _function_3 =
                 (AbstractState s) -> {
                   EList<Transition> _incoming_1 = s.getIncoming();
                   final Function1<Transition, Boolean> _function_4 =
                       (Transition t) -> {
                         return Boolean.valueOf(currentActiveTransitions.contains(t));
                       };
                   return Boolean.valueOf(
                       IterableExtensions.<Transition>exists(_incoming_1, _function_4));
                 };
             boolean _exists_1 = IterableExtensions.<AbstractState>exists(child, _function_3);
             boolean _not_3 = (!_exists_1);
             _and_2 = _not_3;
           }
           if (_and_2) {
             moreToDelete.add(_state);
           }
         };
     newActiveStates.forEach(_function_1);
     toDelete.addAll(moreToDelete);
     newActiveStates.removeAll(toDelete);
   }
   AbstractState _target_7 = selectedTransition.getTarget();
   EList<Transition> _outgoing_1 = _target_7.getOutgoing();
   for (final Transition _candidate : _outgoing_1) {
     boolean _and_2 = false;
     AbstractState _target_8 = _candidate.getTarget();
     if (!(_target_8 instanceof Pseudostate)) {
       _and_2 = false;
     } else {
       AbstractState _target_9 = _candidate.getTarget();
       _and_2 = (_target_9 instanceof Join);
     }
     if (_and_2) {
       AbstractState _target_10 = _candidate.getTarget();
       boolean _contains_1 = newActiveStates.contains(_target_10);
       boolean _not_2 = (!_contains_1);
       if (_not_2) {
         AbstractState _target_11 = _candidate.getTarget();
         newActiveStates.add(_target_11);
       }
     }
   }
 }
Esempio n. 4
0
 protected static void _privk3_findOldActiveStates(
     final RegionAspectRegionAspectProperties _self_,
     final Region _self,
     final ArrayList<AbstractState> oldActiveStates,
     final Transition selectedTransition,
     final Hashtable<String, Object> context) {
   boolean _and = false;
   AbstractState _source = selectedTransition.getSource();
   if (!(_source instanceof Pseudostate)) {
     _and = false;
   } else {
     AbstractState _source_1 = selectedTransition.getSource();
     _and = (_source_1 instanceof Junction);
   }
   boolean sourceIsJunction = _and;
   if (sourceIsJunction) {
     AbstractState _source_2 = selectedTransition.getSource();
     EList<Transition> _outgoing = _source_2.getOutgoing();
     final Function1<Transition, Boolean> _function =
         (Transition _transition) -> {
           boolean _alreadyFired = TransitionAspect.alreadyFired(_transition, context);
           return Boolean.valueOf((!_alreadyFired));
         };
     boolean _exists = IterableExtensions.<Transition>exists(_outgoing, _function);
     boolean allOutputFired = (!_exists);
     boolean junctionComplete = (sourceIsJunction && allOutputFired);
     boolean _and_1 = false;
     AbstractState _source_3 = selectedTransition.getSource();
     boolean _contains = oldActiveStates.contains(_source_3);
     boolean _not = (!_contains);
     if (!_not) {
       _and_1 = false;
     } else {
       _and_1 = junctionComplete;
     }
     if (_and_1) {
       AbstractState _source_4 = selectedTransition.getSource();
       oldActiveStates.add(_source_4);
     }
   } else {
     AbstractState _source_5 = selectedTransition.getSource();
     boolean _contains_1 = oldActiveStates.contains(_source_5);
     boolean _not_1 = (!_contains_1);
     if (_not_1) {
       AbstractState _source_6 = selectedTransition.getSource();
       oldActiveStates.add(_source_6);
     }
     final ArrayList<AbstractState> sourceChildren = new ArrayList<AbstractState>();
     AbstractState _source_7 = selectedTransition.getSource();
     RegionAspect.getAllChildren(_self, _source_7, sourceChildren);
     final Consumer<AbstractState> _function_1 =
         (AbstractState _children) -> {
           boolean _contains_2 = oldActiveStates.contains(_children);
           boolean _not_2 = (!_contains_2);
           if (_not_2) {
             oldActiveStates.add(_children);
           }
         };
     sourceChildren.forEach(_function_1);
     final ArrayList<AbstractState> sourceParents = new ArrayList<AbstractState>();
     AbstractState _source_8 = selectedTransition.getSource();
     RegionAspect.getAllParents(_self, _source_8, sourceParents);
     final ArrayList<AbstractState> targetParents = new ArrayList<AbstractState>();
     AbstractState _target = selectedTransition.getTarget();
     RegionAspect.getAllParents(_self, _target, targetParents);
     final Function1<AbstractState, Boolean> _function_2 =
         (AbstractState _parent) -> {
           boolean _contains_2 = targetParents.contains(_parent);
           return Boolean.valueOf((!_contains_2));
         };
     Iterable<AbstractState> leavingParents =
         IterableExtensions.<AbstractState>filter(sourceParents, _function_2);
     Iterables.<AbstractState>addAll(oldActiveStates, leavingParents);
     AbstractState _target_1 = selectedTransition.getTarget();
     EList<Transition> _outgoing_1 = _target_1.getOutgoing();
     for (final Transition _candidate : _outgoing_1) {
       boolean _and_2 = false;
       AbstractState _target_2 = _candidate.getTarget();
       if (!(_target_2 instanceof Pseudostate)) {
         _and_2 = false;
       } else {
         AbstractState _target_3 = _candidate.getTarget();
         _and_2 = (_target_3 instanceof Join);
       }
       if (_and_2) {
         AbstractState _source_9 = _candidate.getSource();
         boolean _contains_2 = oldActiveStates.contains(_source_9);
         boolean _not_2 = (!_contains_2);
         if (_not_2) {
           AbstractState _source_10 = _candidate.getSource();
           oldActiveStates.add(_source_10);
         }
       }
     }
   }
 }