Пример #1
0
 protected static void _privk3_initRegion(
     final RegionAspectRegionAspectProperties _self_,
     final Region _self,
     final Hashtable<String, Object> context) {
   State _history = RegionAspect.history(_self);
   boolean _equals = Objects.equal(_history, null);
   if (_equals) {
     ArrayList<AbstractState> regionCurrentState = new ArrayList<AbstractState>();
     String _contextPathByRegion = RegionAspect.getContextPathByRegion(_self);
     context.put(_contextPathByRegion, regionCurrentState);
     EList<AbstractState> _subvertex = _self.getSubvertex();
     final Function1<AbstractState, Boolean> _function =
         (AbstractState _vertex) -> {
           boolean _and = false;
           if (!(_vertex instanceof Pseudostate)) {
             _and = false;
           } else {
             _and = (_vertex instanceof InitialState);
           }
           return Boolean.valueOf(_and);
         };
     AbstractState _findFirst = IterableExtensions.<AbstractState>findFirst(_subvertex, _function);
     Pseudostate initialPseudostate = ((Pseudostate) _findFirst);
     ArrayList<AbstractState> initialCurrentState = new ArrayList<AbstractState>();
     ArrayList<Transition> initialCurrentTransitions = new ArrayList<Transition>();
     EList<Transition> _outgoing = initialPseudostate.getOutgoing();
     for (final Transition _transition : _outgoing) {
       {
         initialCurrentTransitions.add(_transition);
         AbstractState _target = _transition.getTarget();
         initialCurrentState.add(_target);
       }
     }
     ((ArrayList<AbstractState>) regionCurrentState).addAll(initialCurrentState);
     final Consumer<Transition> _function_1 =
         (Transition transition) -> {
           TransitionAspect.evalTransition(transition, context);
         };
     initialCurrentTransitions.forEach(_function_1);
   } else {
     String _name = _self.getName();
     String _plus = ("currentState-" + _name);
     Object _get = context.get(_plus);
     State _history_1 = RegionAspect.history(_self);
     ((ArrayList<AbstractState>) _get).add(_history_1);
   }
 }
Пример #2
0
 protected static void _privk3_saveHistoryState(
     final RegionAspectRegionAspectProperties _self_,
     final Region _self,
     final Hashtable<String, Object> context) {
   InputOutput.<String>println("saving the history state");
   EList<AbstractState> _subvertex = _self.getSubvertex();
   final Function1<AbstractState, Boolean> _function =
       (AbstractState _vertex) -> {
         boolean _and = false;
         if (!(_vertex instanceof Pseudostate)) {
           _and = false;
         } else {
           _and = (_vertex instanceof ShallowHistory);
         }
         return Boolean.valueOf(_and);
       };
   boolean _exists = IterableExtensions.<AbstractState>exists(_subvertex, _function);
   if (_exists) {
     String _name = _self.getName();
     String _plus = ("currentState-" + _name);
     Object _get = context.get(_plus);
     final Function1<AbstractState, Boolean> _function_1 =
         (AbstractState _state) -> {
           boolean _and = false;
           if (!(_state instanceof State)) {
             _and = false;
           } else {
             Region _ownerRegion = ((State) _state).getOwnerRegion();
             boolean _equals = Objects.equal(_ownerRegion, _self);
             _and = _equals;
           }
           return Boolean.valueOf(_and);
         };
     AbstractState _findFirst =
         IterableExtensions.<AbstractState>findFirst(
             ((ArrayList<AbstractState>) _get), _function_1);
     RegionAspect.history(_self, ((State) _findFirst));
   }
 }