protected static void _privk3_findNewActiveTransitions( final RegionAspectRegionAspectProperties _self_, final Region _self, final ArrayList<Transition> newActiveTransitions, final Transition selectedTransition, 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(); newActiveTransitions.addAll(_outgoing); } else { newActiveTransitions.add(selectedTransition); ArrayList<Transition> activeTransitions = new ArrayList<Transition>(); activeTransitions.addAll(newActiveTransitions); activeTransitions.add(selectedTransition); boolean conflictingTransition = RegionAspect.deepestConflictingTransition(_self, activeTransitions); if ((!conflictingTransition)) { newActiveTransitions.add(selectedTransition); } else { newActiveTransitions.clear(); newActiveTransitions.addAll(activeTransitions); } } AbstractState _target_3 = selectedTransition.getTarget(); EList<Transition> _outgoing_1 = _target_3.getOutgoing(); for (final Transition _candidate : _outgoing_1) { boolean _and_1 = false; AbstractState _target_4 = _candidate.getTarget(); if (!(_target_4 instanceof Pseudostate)) { _and_1 = false; } else { AbstractState _target_5 = _candidate.getTarget(); _and_1 = (_target_5 instanceof Join); } if (_and_1) { newActiveTransitions.add(_candidate); } } }
protected static String _privk3_getContextPath( final RegionAspectRegionAspectProperties _self_, final Region _self, final AbstractState _vertex) { String root = "currentState"; ArrayList<Region> parentRegions = new ArrayList<Region>(); Region currentRegion = _vertex.getOwnerRegion(); while ((!Objects.equal(currentRegion, null))) { { parentRegions.add(currentRegion); State _ownerState = currentRegion.getOwnerState(); boolean _notEquals = (!Objects.equal(_ownerState, null)); if (_notEquals) { State _ownerState_1 = currentRegion.getOwnerState(); Region _ownerRegion = _ownerState_1.getOwnerRegion(); currentRegion = _ownerRegion; } else { currentRegion = null; } } } for (int i = (parentRegions.size() - 1); (i >= 0); i--) { String _root = root; Region _get = parentRegions.get(i); String _name = _get.getName(); String _plus = ("-" + _name); root = (_root + _plus); } return root; }
protected static EList<Transition> _privk3_getActiveTransitions( final RegionAspectRegionAspectProperties _self_, final Region _self, final AbstractState vertex, final EList<String> events) { final BasicEList<Transition> res = new BasicEList<Transition>(); EList<Transition> _outgoing = vertex.getOutgoing(); for (final Transition transition : _outgoing) { boolean _or = false; Trigger _trigger = transition.getTrigger(); boolean _equals = Objects.equal(_trigger, null); if (_equals) { _or = true; } else { boolean _or_1 = false; boolean _and = false; Trigger _trigger_1 = transition.getTrigger(); boolean _notEquals = (!Objects.equal(_trigger_1, null)); if (!_notEquals) { _and = false; } else { Trigger _trigger_2 = transition.getTrigger(); boolean _evalTrigger = TriggerAspect.evalTrigger(_trigger_2, events); _and = _evalTrigger; } if (_and) { _or_1 = true; } else { boolean _and_1 = false; AbstractState _target = transition.getTarget(); if (!(_target instanceof Pseudostate)) { _and_1 = false; } else { AbstractState _target_1 = transition.getTarget(); _and_1 = (_target_1 instanceof Junction); } _or_1 = _and_1; } _or = _or_1; } if (_or) { res.add(transition); } } return res; }
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); } } } }
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); } } } } }