package components.Shuttle1;

import de.uni_paderborn.fujaba.umlrt.realtimestatechart.sdm.*;
import java.util.*;
import de.upb.tools.fca.*;
import de.uni_paderborn.fujaba.umlrt.realtimestatechart.sdm.rt.*;

public class Shuttle1
implements FRealtimeStatechart
{
   public static final int CHANNEL_COUNT = 8;

   public static final int CLOCK_COUNT = 4;

   public static final int F_CHANNEL_breakConvoy = 1;

   public static final int F_CHANNEL_buildConvoy = 2;

   public static final int F_CHANNEL_buildNoConvoy = 7;

   public static final int F_CHANNEL_convoyOk = 6;

   public static final int F_CHANNEL_doBreakConvoy = 0;

   public static final int F_CHANNEL_isConvoyOk = 5;

   public static final int F_CHANNEL_isConvoyOk1 = 4;

   public static final int F_CHANNEL_noConvoy = 3;

   public static final int F_CLOCK_INTERN = 1;

   public static final int F_CLOCK_t0 = 2;

   public static final int F_CLOCK_t1 = 3;

   public static final int F_STATECHART_Shuttle1_InitialState = 0;

   public static final int F_STATECHART_Shuttle1_Shuttle_Main_InitialState = 2;

   public static final int F_STATECHART_Shuttle1_Shuttle_Main_sub1_InitialState = 3;

   public static final int F_STATECHART_Shuttle1_myFrontRole_InitialState = 1;

   public static final int F_STATECHART_Shuttle1_myRearRole_InitialState = 4;

   public static final int F_STATE_Shuttle1_InitialState = 0;

   public static final int F_STATE_Shuttle1_Shuttle = 1;

   public static final int F_STATE_Shuttle1_Shuttle_Main_InitialState = 7;

   public static final int F_STATE_Shuttle1_Shuttle_Main_convoyFront = 10;

   public static final int F_STATE_Shuttle1_Shuttle_Main_convoyRear = 14;

   public static final int F_STATE_Shuttle1_Shuttle_Main_intermediate = 9;

   public static final int F_STATE_Shuttle1_Shuttle_Main_intermediate2 = 15;

   public static final int F_STATE_Shuttle1_Shuttle_Main_noConvoy = 8;

   public static final int F_STATE_Shuttle1_Shuttle_Main_sub1_InitialState = 11;

   public static final int F_STATE_Shuttle1_Shuttle_Main_sub1_default = 12;

   public static final int F_STATE_Shuttle1_Shuttle_Main_sub1_wait = 13;

   public static final int F_STATE_Shuttle1_myFrontRole_InitialState = 3;

   public static final int F_STATE_Shuttle1_myFrontRole_answer = 4;

   public static final int F_STATE_Shuttle1_myFrontRole_convoy = 5;

   public static final int F_STATE_Shuttle1_myFrontRole_noConvoy = 2;

   public static final int F_STATE_Shuttle1_myFrontRole_wait = 6;

   public static final int F_STATE_Shuttle1_myRearRole_InitialState = 16;

   public static final int F_STATE_Shuttle1_myRearRole_convoy = 19;

   public static final int F_STATE_Shuttle1_myRearRole_noConvoy = 17;

   public static final int F_STATE_Shuttle1_myRearRole_wait = 18;

   public static final int F_TRANSITION_State24State25 = 1;

   public static final int F_TRANSITION_State26State27 = 16;

   public static final int F_TRANSITION_State29State30 = 7;

   public static final int F_TRANSITION_State36State38 = 13;

   public static final int F_TRANSITION_TRANS0_intermediate_convoyRear = 12;

   public static final int F_TRANSITION_TRANS0_wait_default = 14;

   public static final int F_TRANSITION_TRANS1_wait_convoy = 4;

   public static final int F_TRANSITION_TRANS2_wait_noConvoy = 5;

   public static final int F_TRANSITION_TRANS2_wait_noConvoy1 = 17;

   public static final int F_TRANSITION_TRANS3_convoy_noConvoy = 18;

   public static final int F_TRANSITION_TRANS4_answer_noConvoy1 = 2;

   public static final int F_TRANSITION_TRANS5_convoyFront_noConvoy1 = 8;

   public static final int F_TRANSITION_TRANS7_convoyRear_noConvoy1 = 10;

   public static final int F_TRANSITION_convoyRearState105 = 11;

   public static final int F_TRANSITION_convoyState76 = 3;

   public static final int F_TRANSITION_noConvoy1State24 = 0;

   public static final int F_TRANSITION_noConvoy1State26 = 15;

   public static final int F_TRANSITION_noConvoy1State29 = 6;

   public static final int F_TRANSITION_noConvoy1State31 = 9;

   private static final int HISTORY_DEEP = 2;

   private static final int HISTORY_NONE = 0;

   private static final int HISTORY_SHALLOW = 1;

   public static final long INFINITY = Long.MAX_VALUE;

   public static final int MAX_CONCURRENT_STATES = 3;

   public static final int MAX_DEPTH = 3;

   public static final int NULL = -1;

   public static final long PERIOD_FOR_MAIN_THREAD = 75;

   public static final int RECEIVER = 1;

   public static final int SENDER = 2;

   public static final long SLEEP_AFTER_THREAD_START = 5;

   private static final int STATECHART_COUNT = 5;

   public static final int STATE_COUNT = 20;

   public static final int TRANSITION_COUNT = 19;

   public  Shuttle1()
   {
         initRealtimeStatechart();
   }


   private long activationTime = INFINITY;

   private long getActivationTime()
   {
      return this.activationTime;
   }


   private void setActivationTime(long value)
   {
      if (this.activationTime != value)
      {
         
         this.activationTime = value;
         
      }
   }


   private boolean convoyUseful = false;

   public boolean isConvoyUseful()
   {
      return this.convoyUseful;
   }


   public void setConvoyUseful(boolean value)
   {
      if (this.convoyUseful != value)
      {
         
         this.convoyUseful = value;
         
      }
   }


   private Matrix currentState = null;

   public Matrix getCurrentState()
   {
      return this.currentState;
   }


   public void setCurrentState(Matrix value)
   {
      if (this.currentState != value)
      {
         
         this.currentState = value;
         
      }
   }


   private TransitionMatrix enabledTransition = null;

   private TransitionMatrix getEnabledTransition()
   {
      return this.enabledTransition;
   }


   private void setEnabledTransition(TransitionMatrix value)
   {
      if (this.enabledTransition != value)
      {
         
         this.enabledTransition = value;
         
      }
   }


   private FEventQueue eventQueue = null;

   public FEventQueue getEventQueue()
   {
      return this.eventQueue;
   }


   public void setEventQueue(FEventQueue value)
   {
      if (this.eventQueue != value)
      {
         
         this.eventQueue = value;
         
      }
   }


   private FMainThread fMainThread = null;

   public FMainThread getFMainThread()
   {
      return this.fMainThread;
   }


   public void setFMainThread(FMainThread value)
   {
      if (this.fMainThread != value)
      {
         
         this.fMainThread = value;
         
      }
   }


   private long[] guardTime = new long[TRANSITION_COUNT];

   private long[] getGuardTime()
   {
      return this.guardTime;
   }


   private void setGuardTime(long[] value)
   {
      if (this.guardTime != value)
      {
         
         this.guardTime = value;
         
      }
   }


   private Matrix history = new Matrix(STATECHART_COUNT, 1);

   public Matrix getHistory()
   {
      return this.history;
   }


   public void setHistory(Matrix value)
   {
      if (this.history != value)
      {
         
         this.history = value;
         
      }
   }


   private Matrix init = new Matrix(STATECHART_COUNT, 1);

   public Matrix getInit()
   {
      return this.init;
   }


   public void setInit(Matrix value)
   {
      if (this.init != value)
      {
         
         this.init = value;
         
      }
   }


   private int mainThreadPriority = 0;

   public int getMainThreadPriority()
   {
      return this.mainThreadPriority;
   }


   public void setMainThreadPriority(int value)
   {
      if (this.mainThreadPriority != value)
      {
         
         this.mainThreadPriority = value;
         
      }
   }


   private int[] priority = new int[TRANSITION_COUNT];

   private int[] getPriority()
   {
      return this.priority;
   }


   private void setPriority(int[] value)
   {
      if (this.priority != value)
      {
         
         this.priority = value;
         
      }
   }


   private int[] schedulingPriority = new int[TRANSITION_COUNT];

   public int[] getSchedulingPriority()
   {
      return this.schedulingPriority;
   }


   public void setSchedulingPriority(int[] value)
   {
      if (this.schedulingPriority != value)
      {
         
         this.schedulingPriority = value;
         
      }
   }


   private TransitionMatrix startedTransition = null;

   private TransitionMatrix getStartedTransition()
   {
      return this.startedTransition;
   }


   private void setStartedTransition(TransitionMatrix value)
   {
      if (this.startedTransition != value)
      {
         
         this.startedTransition = value;
         
      }
   }


   private long[] t0 = new long[CLOCK_COUNT];

   private long[] getT0()
   {
      return this.t0;
   }


   private void setT0(long[] value)
   {
      if (this.t0 != value)
      {
         
         this.t0 = value;
         
      }
   }


   private TransitionMatrix waitingTransition = null;

   private TransitionMatrix getWaitingTransition()
   {
      return this.waitingTransition;
   }


   private void setWaitingTransition(TransitionMatrix value)
   {
      if (this.waitingTransition != value)
      {
         
         this.waitingTransition = value;
         
      }
   }


   /**
    * <pre>
    *           0..1     Assoc     0..1 
    * Shuttle1 ------------------------- Shuttle1
    *           rearRole      frontRole 
    * </pre>
    */
   private Shuttle1 frontRole;

   public Shuttle1 getFrontRole()
   {
      return this.frontRole;
   }


   public boolean setFrontRole(Shuttle1 value)
   {
      boolean changed = false;
      if (this.frontRole != value)
      {
         Shuttle1 oldValue = this.frontRole;
         
         if (this.frontRole != null)
         {
            this.frontRole = null;
            oldValue.setRearRole (null);
         }
         this.frontRole = value;
         if (value != null)
         {
            value.setRearRole (this);
         }
         changed = true;
         
      }
      return changed;
   }


   /**
    * <pre>
    *           0..1     Assoc     0..1 
    * Shuttle1 ------------------------- Shuttle1
    *           frontRole      rearRole 
    * </pre>
    */
   private Shuttle1 rearRole;

   public Shuttle1 getRearRole()
   {
      return this.rearRole;
   }


   public boolean setRearRole(Shuttle1 value)
   {
      boolean changed = false;
      if (this.rearRole != value)
      {
         Shuttle1 oldValue = this.rearRole;
         
         if (this.rearRole != null)
         {
            this.rearRole = null;
            oldValue.setFrontRole (null);
         }
         this.rearRole = value;
         if (value != null)
         {
            value.setFrontRole (this);
         }
         changed = true;
         
      }
      return changed;
   }


   public void actionF_TRANSITION_State29State30()
   {
         setConvoyUseful(true);
   }


   public void actionF_TRANSITION_TRANS7_convoyRear_noConvoy1()
   {
         setConvoyUseful(false);
   }


   private void addActivatedTransitions(int state, long actualTime, int concurrencySlot)
   {
         switch(state){
            case F_STATE_Shuttle1_Shuttle_Main_convoyRear:
                  calculateActivationTime (F_TRANSITION_TRANS7_convoyRear_noConvoy1, actualTime, concurrencySlot);
                  calculateActivationTime (F_TRANSITION_convoyRearState105, actualTime, concurrencySlot);
                  break;
            case F_STATE_Shuttle1_myFrontRole_wait:
                  calculateActivationTime (F_TRANSITION_TRANS1_wait_convoy, actualTime, concurrencySlot);
                  calculateActivationTime (F_TRANSITION_TRANS2_wait_noConvoy, actualTime, concurrencySlot);
                  break;
            case F_STATE_Shuttle1_Shuttle_Main_intermediate2:
                  calculateActivationTime (F_TRANSITION_TRANS0_intermediate_convoyRear, actualTime, concurrencySlot);
                  break;
            case F_STATE_Shuttle1_myFrontRole_convoy:
                  calculateActivationTime (F_TRANSITION_convoyState76, actualTime, concurrencySlot);
                  break;
            case F_STATE_Shuttle1_myRearRole_wait:
                  calculateActivationTime (F_TRANSITION_State26State27, actualTime, concurrencySlot);
                  calculateActivationTime (F_TRANSITION_TRANS2_wait_noConvoy1, actualTime, concurrencySlot);
                  break;
            case F_STATE_Shuttle1_Shuttle_Main_sub1_default:
                  calculateActivationTime (F_TRANSITION_State36State38, actualTime, concurrencySlot);
                  break;
            case F_STATE_Shuttle1_Shuttle_Main_intermediate:
                  calculateActivationTime (F_TRANSITION_State29State30, actualTime, concurrencySlot);
                  break;
            case F_STATE_Shuttle1_Shuttle_Main_noConvoy:
                  calculateActivationTime (F_TRANSITION_noConvoy1State29, actualTime, concurrencySlot);
                  calculateActivationTime (F_TRANSITION_noConvoy1State31, actualTime, concurrencySlot);
                  break;
            case F_STATE_Shuttle1_myRearRole_noConvoy:
                  calculateActivationTime (F_TRANSITION_noConvoy1State26, actualTime, concurrencySlot);
                  break;
            case F_STATE_Shuttle1_myRearRole_convoy:
                  calculateActivationTime (F_TRANSITION_TRANS3_convoy_noConvoy, actualTime, concurrencySlot);
                  break;
            case F_STATE_Shuttle1_Shuttle_Main_sub1_wait:
                  calculateActivationTime (F_TRANSITION_TRANS0_wait_default, actualTime, concurrencySlot);
                  break;
            case F_STATE_Shuttle1_myFrontRole_answer:
                  calculateActivationTime (F_TRANSITION_State24State25, actualTime, concurrencySlot);
                  calculateActivationTime (F_TRANSITION_TRANS4_answer_noConvoy1, actualTime, concurrencySlot);
                  break;
            case F_STATE_Shuttle1_Shuttle_Main_convoyFront:
                  calculateActivationTime (F_TRANSITION_TRANS5_convoyFront_noConvoy1, actualTime, concurrencySlot);
                  break;
            case F_STATE_Shuttle1_myFrontRole_noConvoy:
                  calculateActivationTime (F_TRANSITION_noConvoy1State24, actualTime, concurrencySlot);
                  break;
            case F_STATE_Shuttle1_Shuttle:
                  break;
         }
   }


   private void addTargetSubStates(Matrix newStates, int row, int col, boolean deepHistory)
   {
         switch(newStates.get(row, col)){
            case F_STATE_Shuttle1_myRearRole_convoy:
                  break;
            case F_STATE_Shuttle1_Shuttle_Main_sub1_default:
                  break;
            case F_STATE_Shuttle1_Shuttle_Main_convoyFront:
                  if ( F_STATECHART_Shuttle1_Shuttle_Main_sub1_InitialState != getStatechart(newStates.get(row, col)) )
                  {
                        int state0;
                        boolean shallowHistory = (getHistoryKind(F_STATECHART_Shuttle1_Shuttle_Main_sub1_InitialState) == HISTORY_SHALLOW);
                        deepHistory = (deepHistory || (getHistoryKind(F_STATECHART_Shuttle1_Shuttle_Main_sub1_InitialState) == HISTORY_DEEP));
                        if ( deepHistory || shallowHistory )
                        {
                              state0 = history.get(F_STATECHART_Shuttle1_Shuttle_Main_sub1_InitialState, 0);
                              col = newStates.addOrDuplicateAndAdd(row, col, state0);
                              deepHistory = deepHistory || (getHistoryKind(getStatechart(newStates.get(row + 1, col))) == HISTORY_DEEP);
                              addTargetSubStates(newStates, row + 1, col, deepHistory);
                           }
                        else
                        {
                              state0 = init.get(F_STATECHART_Shuttle1_Shuttle_Main_sub1_InitialState, 0);
                              col = newStates.addOrDuplicateAndAdd(row, col, state0);
                              deepHistory = (getHistoryKind(getStatechart(newStates.get(row + 1, col))) == HISTORY_DEEP);
                              addTargetSubStates(newStates, row + 1, col, deepHistory);
                           }
                     } // if
                  break;
            case F_STATE_Shuttle1_Shuttle:
                  if ( F_STATECHART_Shuttle1_myFrontRole_InitialState != getStatechart(newStates.get(row, col)) )
                  {
                        int state0;
                        boolean shallowHistory = (getHistoryKind(F_STATECHART_Shuttle1_myFrontRole_InitialState) == HISTORY_SHALLOW);
                        deepHistory = (deepHistory || (getHistoryKind(F_STATECHART_Shuttle1_myFrontRole_InitialState) == HISTORY_DEEP));
                        if ( deepHistory || shallowHistory )
                        {
                              state0 = history.get(F_STATECHART_Shuttle1_myFrontRole_InitialState, 0);
                              col = newStates.addOrDuplicateAndAdd(row, col, state0);
                              deepHistory = deepHistory || (getHistoryKind(getStatechart(newStates.get(row + 1, col))) == HISTORY_DEEP);
                              addTargetSubStates(newStates, row + 1, col, deepHistory);
                           }
                        else
                        {
                              state0 = init.get(F_STATECHART_Shuttle1_myFrontRole_InitialState, 0);
                              col = newStates.addOrDuplicateAndAdd(row, col, state0);
                              deepHistory = (getHistoryKind(getStatechart(newStates.get(row + 1, col))) == HISTORY_DEEP);
                              addTargetSubStates(newStates, row + 1, col, deepHistory);
                           }
                     } // if
                  if ( F_STATECHART_Shuttle1_Shuttle_Main_InitialState != getStatechart(newStates.get(row, col)) )
                  {
                        int state0;
                        boolean shallowHistory = (getHistoryKind(F_STATECHART_Shuttle1_Shuttle_Main_InitialState) == HISTORY_SHALLOW);
                        deepHistory = (deepHistory || (getHistoryKind(F_STATECHART_Shuttle1_Shuttle_Main_InitialState) == HISTORY_DEEP));
                        if ( deepHistory || shallowHistory )
                        {
                              state0 = history.get(F_STATECHART_Shuttle1_Shuttle_Main_InitialState, 0);
                              col = newStates.addOrDuplicateAndAdd(row, col, state0);
                              deepHistory = deepHistory || (getHistoryKind(getStatechart(newStates.get(row + 1, col))) == HISTORY_DEEP);
                              addTargetSubStates(newStates, row + 1, col, deepHistory);
                           }
                        else
                        {
                              state0 = init.get(F_STATECHART_Shuttle1_Shuttle_Main_InitialState, 0);
                              col = newStates.addOrDuplicateAndAdd(row, col, state0);
                              deepHistory = (getHistoryKind(getStatechart(newStates.get(row + 1, col))) == HISTORY_DEEP);
                              addTargetSubStates(newStates, row + 1, col, deepHistory);
                           }
                     } // if
                  if ( F_STATECHART_Shuttle1_myRearRole_InitialState != getStatechart(newStates.get(row, col)) )
                  {
                        int state0;
                        boolean shallowHistory = (getHistoryKind(F_STATECHART_Shuttle1_myRearRole_InitialState) == HISTORY_SHALLOW);
                        deepHistory = (deepHistory || (getHistoryKind(F_STATECHART_Shuttle1_myRearRole_InitialState) == HISTORY_DEEP));
                        if ( deepHistory || shallowHistory )
                        {
                              state0 = history.get(F_STATECHART_Shuttle1_myRearRole_InitialState, 0);
                              col = newStates.addOrDuplicateAndAdd(row, col, state0);
                              deepHistory = deepHistory || (getHistoryKind(getStatechart(newStates.get(row + 1, col))) == HISTORY_DEEP);
                              addTargetSubStates(newStates, row + 1, col, deepHistory);
                           }
                        else
                        {
                              state0 = init.get(F_STATECHART_Shuttle1_myRearRole_InitialState, 0);
                              col = newStates.addOrDuplicateAndAdd(row, col, state0);
                              deepHistory = (getHistoryKind(getStatechart(newStates.get(row + 1, col))) == HISTORY_DEEP);
                              addTargetSubStates(newStates, row + 1, col, deepHistory);
                           }
                     } // if
                  break;
            case F_STATE_Shuttle1_myRearRole_noConvoy:
                  break;
            case F_STATE_Shuttle1_Shuttle_Main_convoyRear:
                  break;
            case F_STATE_Shuttle1_myFrontRole_convoy:
                  break;
            case F_STATE_Shuttle1_myFrontRole_answer:
                  break;
            case F_STATE_Shuttle1_myRearRole_wait:
                  break;
            case F_STATE_Shuttle1_myFrontRole_noConvoy:
                  break;
            case F_STATE_Shuttle1_Shuttle_Main_intermediate2:
                  break;
            case F_STATE_Shuttle1_myFrontRole_wait:
                  break;
            case F_STATE_Shuttle1_Shuttle_Main_noConvoy:
                  break;
            case F_STATE_Shuttle1_Shuttle_Main_sub1_wait:
                  break;
            case F_STATE_Shuttle1_Shuttle_Main_intermediate:
                  break;
         }
   }


   public void breakConvoy()
   {
         FRealtimeEvent event = FRealtimeEvent.createEvent ();
         event.setName ("breakConvoy");
         event.setTime (FMainThread.getTime());
         getEventQueue().enqueueEvent(event);
   }


   public void breakConvoyProposal()
   {
         FRealtimeEvent event = FRealtimeEvent.createEvent ();
         event.setName ("breakConvoyProposal");
         event.setTime (FMainThread.getTime());
         getEventQueue().enqueueEvent(event);
   }


   public void breakConvoyProposalRejected()
   {
         FRealtimeEvent event = FRealtimeEvent.createEvent ();
         event.setName ("breakConvoyProposalRejected");
         event.setTime (FMainThread.getTime());
         getEventQueue().enqueueEvent(event);
   }


   private void calculateActivationTime(int transition, long actualTime, int concurrencySlot)
   {
         long lowerBound = 0;
         long upperBound = INFINITY;
         long eventTime = getEventTimeOf(transition);
         long long0 = getFMainThread().getLocationReached();
         long long1 = 0;
         if ( guardTime[transition] > long0 )
         {
            long0 = guardTime[transition];
         } // if
         if ( eventTime > long0 )
         {
            long0 = eventTime;
         } // if
         if ( long0 <= actualTime )
         {
            switch(transition){
               case F_TRANSITION_convoyState76:
                        break;
               case F_TRANSITION_TRANS0_intermediate_convoyRear:
                        break;
               case F_TRANSITION_noConvoy1State26:
                        break;
               case F_TRANSITION_State26State27:
                        break;
               case F_TRANSITION_TRANS3_convoy_noConvoy:
                        break;
               case F_TRANSITION_State24State25:
                        break;
               case F_TRANSITION_TRANS0_wait_default:
                        //lowerBound = max_j (a_j + t_0_j);
                        lowerBound = 150 + t0[F_CLOCK_t1];
                        //upperBound = min_j (b_j + t_0_j);
                        break;
               case F_TRANSITION_convoyRearState105:
                        break;
               case F_TRANSITION_TRANS7_convoyRear_noConvoy1:
                        break;
               case F_TRANSITION_TRANS1_wait_convoy:
                        break;
               case F_TRANSITION_TRANS5_convoyFront_noConvoy1:
                        break;
               case F_TRANSITION_noConvoy1State29:
                        break;
               case F_TRANSITION_noConvoy1State24:
                        break;
               case F_TRANSITION_State29State30:
                        break;
               case F_TRANSITION_noConvoy1State31:
                        break;
               case F_TRANSITION_State36State38:
                        break;
               case F_TRANSITION_TRANS2_wait_noConvoy:
                        break;
               case F_TRANSITION_TRANS2_wait_noConvoy1:
                        break;
               case F_TRANSITION_TRANS4_answer_noConvoy1:
                        break;
            }
            if ( lowerBound > long0 )
            {
               long0 = lowerBound;
            } // if
            if ( getFMainThread().getLocationReached() > long0 )
            {
               long0 = getFMainThread().getLocationReached();
            } // if
            if ( (long0 <= upperBound) && (long0 <= actualTime) )
            {
               FRealtimeTransition realtimeTransition = FRealtimeTransition.createFRealtimeTransition(transition, long0, upperBound, concurrencySlot);
               for ( int i = 0;i < enabledTransition.getNumberOfRows();i++ )
               {
                  if ( ((enabledTransition.get(i, concurrencySlot) == null) || (fireBefore(realtimeTransition, enabledTransition.get(i, concurrencySlot)))) )
                  {
                     enabledTransition.insertElementAt(realtimeTransition, i, concurrencySlot);
                     break;
                  } // if
               } // for
            }
         } // long0 <= actualTime
   }


   public void convoyProposal()
   {
         FRealtimeEvent event = FRealtimeEvent.createEvent ();
         event.setName ("convoyProposal");
         event.setTime (FMainThread.getTime());
         getEventQueue().enqueueEvent(event);
   }


   public void convoyProposalRejected()
   {
         FRealtimeEvent event = FRealtimeEvent.createEvent ();
         event.setName ("convoyProposalRejected");
         event.setTime (FMainThread.getTime());
         getEventQueue().enqueueEvent(event);
   }


   public void doAction()
   {
         for ( int i = 0;i < currentState.getNumberOfCols();i++ )
         {
            {
               for ( int j = 0;j < currentState.getNumberOfRows();j++ )
               {
                  int state = currentState.get(j, i);
                  switch(state){
                  }
               } // j...
            } // if
         } // i...
   }


   public void entryAction(int state)
   {
         switch(state){
            case F_STATE_Shuttle1_Shuttle_Main_noConvoy:
                  setConvoyUseful(false);
                  break;
         }
   }


   public boolean executeInMainThread(int transition, boolean doAlreadyExecuted)
   {
         switch(transition){
            case F_TRANSITION_TRANS1_wait_convoy:
                  return (true) ;
            case F_TRANSITION_noConvoy1State31:
                  return (true) ;
            case F_TRANSITION_TRANS3_convoy_noConvoy:
                  return (true) ;
            case F_TRANSITION_State29State30:
                  return (true) ;
            case F_TRANSITION_TRANS2_wait_noConvoy1:
                  return (true) ;
            case F_TRANSITION_noConvoy1State29:
                  return (true) ;
            case F_TRANSITION_noConvoy1State26:
                  return (true) ;
            case F_TRANSITION_TRANS2_wait_noConvoy:
                  return (true) ;
            case F_TRANSITION_TRANS0_intermediate_convoyRear:
                  return (true) ;
            case F_TRANSITION_TRANS5_convoyFront_noConvoy1:
                  return (true) ;
            case F_TRANSITION_TRANS4_answer_noConvoy1:
                  return (true) ;
            case F_TRANSITION_TRANS7_convoyRear_noConvoy1:
                  return (true) ;
            case F_TRANSITION_State36State38:
                  return (true) ;
            case F_TRANSITION_TRANS0_wait_default:
                  return (true) ;
            case F_TRANSITION_State26State27:
                  return (true) ;
            case F_TRANSITION_convoyState76:
                  return (true) ;
            case F_TRANSITION_noConvoy1State24:
                  return (true) ;
            case F_TRANSITION_convoyRearState105:
                  return (true) ;
            case F_TRANSITION_State24State25:
                  return (true) ;
         }
         return false;
   }


   public void exitAction(int state)
   {
         switch(state){
         }
   }


   private boolean fireBefore(FRealtimeTransition transition1, FRealtimeTransition transition2)
   {
         FStarter starter;
         if ( transition1.getActivationStart() < transition2.getActivationStart() )
         {
            return (true) ;
         } // if
         if ( (transition1.getActivationStart() == transition2.getActivationStart()) && (getPriorityForSwitching(transition1.getId()) > getPriorityForSwitching(transition2.getId())) )
         {
            return (true) ;
         } // if
         return (false) ;
   }


   public long getDeadline(int transition)
   {
         long deadline = INFINITY;
         long actualTime = FMainThread.getTime();
         long long0 = 0;
         switch(transition){
            case F_TRANSITION_noConvoy1State29:
                  break;
            case F_TRANSITION_State29State30:
                  long0 = 200 - actualTime + t0[F_CLOCK_t0];
                  if ( long0 < deadline )
                  {
                        deadline = long0;
                     }
                  break;
            case F_TRANSITION_TRANS5_convoyFront_noConvoy1:
                  long0 = 300;
                  if ( long0 < deadline )
                  {
                        deadline = long0;
                     }
                  break;
            case F_TRANSITION_State36State38:
                  long0 = 150 - actualTime + t0[F_CLOCK_t1];
                  if ( long0 < deadline )
                  {
                        deadline = long0;
                     }
                  break;
            case F_TRANSITION_convoyRearState105:
                  break;
            case F_TRANSITION_convoyState76:
                  break;
            case F_TRANSITION_TRANS2_wait_noConvoy1:
                  break;
            case F_TRANSITION_State24State25:
                  break;
            case F_TRANSITION_TRANS3_convoy_noConvoy:
                  break;
            case F_TRANSITION_TRANS4_answer_noConvoy1:
                  break;
            case F_TRANSITION_TRANS1_wait_convoy:
                  break;
            case F_TRANSITION_TRANS0_intermediate_convoyRear:
                  break;
            case F_TRANSITION_State26State27:
                  break;
            case F_TRANSITION_noConvoy1State31:
                  long0 = 200;
                  if ( long0 < deadline )
                  {
                        deadline = long0;
                     }
                  break;
            case F_TRANSITION_TRANS0_wait_default:
                  break;
            case F_TRANSITION_TRANS2_wait_noConvoy:
                  break;
            case F_TRANSITION_noConvoy1State26:
                  break;
            case F_TRANSITION_noConvoy1State24:
                  long0 = 1000 - actualTime + t0[F_CLOCK_t0];
                  if ( long0 < deadline )
                  {
                        deadline = long0;
                     }
                  break;
            case F_TRANSITION_TRANS7_convoyRear_noConvoy1:
                  break;
         }
         return (deadline + actualTime - FMainThread.getTime());
   }


   private long getEventTimeOf(int transition)
   {
         switch(transition){
            case F_TRANSITION_State26State27:
                  {
                        FRealtimeEvent event = eventQueue.getEvent("startConvoy");
                        if ( event != null )
                        {
                              return (event.getTime()) ;
                           } // if
                        else
                        {
                              return (INFINITY) ;
                           } // if
                     }
            case F_TRANSITION_TRANS2_wait_noConvoy:
                  {
                        FRealtimeEvent event = eventQueue.getEvent("breakConvoy");
                        if ( event != null )
                        {
                              return (event.getTime()) ;
                           } // if
                        else
                        {
                              return (INFINITY) ;
                           } // if
                     }
            case F_TRANSITION_noConvoy1State24:
                  {
                        FRealtimeEvent event = eventQueue.getEvent("convoyProposal");
                        if ( event != null )
                        {
                              return (event.getTime()) ;
                           } // if
                        else
                        {
                              return (INFINITY) ;
                           } // if
                     }
            case F_TRANSITION_TRANS3_convoy_noConvoy:
                  {
                        FRealtimeEvent event = eventQueue.getEvent("breakConvoyProposal");
                        if ( event != null )
                        {
                              return (event.getTime()) ;
                           } // if
                        else
                        {
                              return (INFINITY) ;
                           } // if
                     }
            case F_TRANSITION_TRANS2_wait_noConvoy1:
                  {
                        FRealtimeEvent event = eventQueue.getEvent("convoyProposalRejected");
                        if ( event != null )
                        {
                              return (event.getTime()) ;
                           } // if
                        else
                        {
                              return (INFINITY) ;
                           } // if
                     }
            case F_TRANSITION_TRANS1_wait_convoy:
                  {
                        FRealtimeEvent event = eventQueue.getEvent("breakConvoyProposalRejected");
                        if ( event != null )
                        {
                              return (event.getTime()) ;
                           } // if
                        else
                        {
                              return (INFINITY) ;
                           } // if
                     }
         }
         return (0) ;
   }


   public int getHistoryKind(int statechart)
   {
         switch(statechart){
            case F_STATECHART_Shuttle1_InitialState:
                  return (HISTORY_NONE) ;
            case F_STATECHART_Shuttle1_myFrontRole_InitialState:
                  return (HISTORY_NONE) ;
            case F_STATECHART_Shuttle1_myRearRole_InitialState:
                  return (HISTORY_NONE) ;
            case F_STATECHART_Shuttle1_Shuttle_Main_InitialState:
                  return (HISTORY_NONE) ;
            case F_STATECHART_Shuttle1_Shuttle_Main_sub1_InitialState:
                  return (HISTORY_NONE) ;
         }
         return (NULL) ;
   }


   public int getParentState(int state)
   {
         switch(state){
            case F_STATE_Shuttle1_Shuttle_Main_intermediate2:
                  return (F_STATE_Shuttle1_Shuttle) ;
            case F_STATE_Shuttle1_Shuttle_Main_convoyRear:
                  return (F_STATE_Shuttle1_Shuttle) ;
            case F_STATE_Shuttle1_myRearRole_InitialState:
                  return (F_STATE_Shuttle1_Shuttle) ;
            case F_STATE_Shuttle1_myRearRole_convoy:
                  return (F_STATE_Shuttle1_Shuttle) ;
            case F_STATE_Shuttle1_myFrontRole_answer:
                  return (F_STATE_Shuttle1_Shuttle) ;
            case F_STATE_Shuttle1_myRearRole_noConvoy:
                  return (F_STATE_Shuttle1_Shuttle) ;
            case F_STATE_Shuttle1_myFrontRole_noConvoy:
                  return (F_STATE_Shuttle1_Shuttle) ;
            case F_STATE_Shuttle1_Shuttle_Main_InitialState:
                  return (F_STATE_Shuttle1_Shuttle) ;
            case F_STATE_Shuttle1_Shuttle_Main_convoyFront:
                  return (F_STATE_Shuttle1_Shuttle) ;
            case F_STATE_Shuttle1_myFrontRole_wait:
                  return (F_STATE_Shuttle1_Shuttle) ;
            case F_STATE_Shuttle1_InitialState:
                  return (NULL) ;
            case F_STATE_Shuttle1_Shuttle_Main_intermediate:
                  return (F_STATE_Shuttle1_Shuttle) ;
            case F_STATE_Shuttle1_Shuttle_Main_noConvoy:
                  return (F_STATE_Shuttle1_Shuttle) ;
            case F_STATE_Shuttle1_myFrontRole_convoy:
                  return (F_STATE_Shuttle1_Shuttle) ;
            case F_STATE_Shuttle1_Shuttle_Main_sub1_wait:
                  return (F_STATE_Shuttle1_Shuttle_Main_convoyFront) ;
            case F_STATE_Shuttle1_Shuttle_Main_sub1_InitialState:
                  return (F_STATE_Shuttle1_Shuttle_Main_convoyFront) ;
            case F_STATE_Shuttle1_myRearRole_wait:
                  return (F_STATE_Shuttle1_Shuttle) ;
            case F_STATE_Shuttle1_myFrontRole_InitialState:
                  return (F_STATE_Shuttle1_Shuttle) ;
            case F_STATE_Shuttle1_Shuttle_Main_sub1_default:
                  return (F_STATE_Shuttle1_Shuttle_Main_convoyFront) ;
            case F_STATE_Shuttle1_Shuttle:
                  return (NULL) ;
         }
         return (NULL) ;
   }


   public long getPeriodForMainThread()
   {
         return PERIOD_FOR_MAIN_THREAD;
   }


   public long getPriorityForMainThread()
   {
         return mainThreadPriority;
   }


   public int getPriorityForScheduling(int transition)
   {
         return (priority[transition]) ;
   }


   public int getPriorityForSwitching(int transition)
   {
         switch(transition){
            case F_TRANSITION_State29State30:
                  return (1) ;
            case F_TRANSITION_convoyState76:
                  return (1) ;
            case F_TRANSITION_noConvoy1State24:
                  return (1) ;
            case F_TRANSITION_TRANS0_intermediate_convoyRear:
                  return (1) ;
            case F_TRANSITION_TRANS2_wait_noConvoy:
                  return (1) ;
            case F_TRANSITION_TRANS2_wait_noConvoy1:
                  return (1) ;
            case F_TRANSITION_State24State25:
                  return (1) ;
            case F_TRANSITION_TRANS5_convoyFront_noConvoy1:
                  return (1) ;
            case F_TRANSITION_State36State38:
                  return (1) ;
            case F_TRANSITION_TRANS4_answer_noConvoy1:
                  return (1) ;
            case F_TRANSITION_TRANS1_wait_convoy:
                  return (1) ;
            case F_TRANSITION_TRANS3_convoy_noConvoy:
                  return (1) ;
            case F_TRANSITION_noConvoy1State31:
                  return (1) ;
            case F_TRANSITION_noConvoy1State29:
                  return (1) ;
            case F_TRANSITION_convoyRearState105:
                  return (1) ;
            case F_TRANSITION_TRANS0_wait_default:
                  return (1) ;
            case F_TRANSITION_TRANS7_convoyRear_noConvoy1:
                  return (1) ;
            case F_TRANSITION_noConvoy1State26:
                  return (1) ;
            case F_TRANSITION_State26State27:
                  return (1) ;
         }
         return 0;
   }


   public long getSleepAfterThreadStart()
   {
         return (SLEEP_AFTER_THREAD_START) ;
   }


   public int getStartState(int statechart)
   {
         switch(statechart){
            case F_STATECHART_Shuttle1_myFrontRole_InitialState:
                  return (F_STATE_Shuttle1_myFrontRole_noConvoy) ;
            case F_STATECHART_Shuttle1_myRearRole_InitialState:
                  return (F_STATE_Shuttle1_myRearRole_noConvoy) ;
            case F_STATECHART_Shuttle1_InitialState:
                  return (F_STATE_Shuttle1_Shuttle) ;
            case F_STATECHART_Shuttle1_Shuttle_Main_sub1_InitialState:
                  return (F_STATE_Shuttle1_Shuttle_Main_sub1_default) ;
            case F_STATECHART_Shuttle1_Shuttle_Main_InitialState:
                  return (F_STATE_Shuttle1_Shuttle_Main_noConvoy) ;
         }
         return (NULL) ;
   }


   public int getStatechart(int state)
   {
         switch(state){
            case F_STATE_Shuttle1_InitialState:
                  return (F_STATECHART_Shuttle1_InitialState) ;
            case F_STATE_Shuttle1_myRearRole_convoy:
                  return (F_STATECHART_Shuttle1_myRearRole_InitialState) ;
            case F_STATE_Shuttle1_Shuttle_Main_noConvoy:
                  return (F_STATECHART_Shuttle1_Shuttle_Main_InitialState) ;
            case F_STATE_Shuttle1_Shuttle_Main_InitialState:
                  return (F_STATECHART_Shuttle1_Shuttle_Main_InitialState) ;
            case F_STATE_Shuttle1_Shuttle_Main_sub1_wait:
                  return (F_STATECHART_Shuttle1_Shuttle_Main_sub1_InitialState) ;
            case F_STATE_Shuttle1_Shuttle_Main_convoyRear:
                  return (F_STATECHART_Shuttle1_Shuttle_Main_InitialState) ;
            case F_STATE_Shuttle1_myRearRole_wait:
                  return (F_STATECHART_Shuttle1_myRearRole_InitialState) ;
            case F_STATE_Shuttle1_myRearRole_noConvoy:
                  return (F_STATECHART_Shuttle1_myRearRole_InitialState) ;
            case F_STATE_Shuttle1_myFrontRole_noConvoy:
                  return (F_STATECHART_Shuttle1_myFrontRole_InitialState) ;
            case F_STATE_Shuttle1_myFrontRole_InitialState:
                  return (F_STATECHART_Shuttle1_myFrontRole_InitialState) ;
            case F_STATE_Shuttle1_Shuttle_Main_convoyFront:
                  return (F_STATECHART_Shuttle1_Shuttle_Main_InitialState) ;
            case F_STATE_Shuttle1_myRearRole_InitialState:
                  return (F_STATECHART_Shuttle1_myRearRole_InitialState) ;
            case F_STATE_Shuttle1_Shuttle_Main_sub1_InitialState:
                  return (F_STATECHART_Shuttle1_Shuttle_Main_sub1_InitialState) ;
            case F_STATE_Shuttle1_Shuttle:
                  return (F_STATECHART_Shuttle1_InitialState) ;
            case F_STATE_Shuttle1_myFrontRole_convoy:
                  return (F_STATECHART_Shuttle1_myFrontRole_InitialState) ;
            case F_STATE_Shuttle1_Shuttle_Main_intermediate:
                  return (F_STATECHART_Shuttle1_Shuttle_Main_InitialState) ;
            case F_STATE_Shuttle1_Shuttle_Main_intermediate2:
                  return (F_STATECHART_Shuttle1_Shuttle_Main_InitialState) ;
            case F_STATE_Shuttle1_myFrontRole_wait:
                  return (F_STATECHART_Shuttle1_myFrontRole_InitialState) ;
            case F_STATE_Shuttle1_myFrontRole_answer:
                  return (F_STATECHART_Shuttle1_myFrontRole_InitialState) ;
            case F_STATE_Shuttle1_Shuttle_Main_sub1_default:
                  return (F_STATECHART_Shuttle1_Shuttle_Main_sub1_InitialState) ;
         }
         return (NULL) ;
   }


   public int getSynchronizationChannel(int transition)
   {
         switch(transition){
            case F_TRANSITION_convoyState76:
                  return (F_CHANNEL_doBreakConvoy) ;
            case F_TRANSITION_convoyRearState105:
                  return (F_CHANNEL_isConvoyOk) ;
            case F_TRANSITION_TRANS5_convoyFront_noConvoy1:
                  return (F_CHANNEL_breakConvoy) ;
            case F_TRANSITION_TRANS4_answer_noConvoy1:
                  return (F_CHANNEL_buildNoConvoy) ;
            case F_TRANSITION_TRANS2_wait_noConvoy:
                  return (F_CHANNEL_breakConvoy) ;
            case F_TRANSITION_TRANS7_convoyRear_noConvoy1:
                  return (F_CHANNEL_breakConvoy) ;
            case F_TRANSITION_TRANS0_wait_default:
                  return (NULL) ;
            case F_TRANSITION_State24State25:
                  return (F_CHANNEL_convoyOk) ;
            case F_TRANSITION_State26State27:
                  return (NULL) ;
            case F_TRANSITION_noConvoy1State31:
                  return (F_CHANNEL_buildConvoy) ;
            case F_TRANSITION_State36State38:
                  return (F_CHANNEL_doBreakConvoy) ;
            case F_TRANSITION_noConvoy1State26:
                  return (F_CHANNEL_buildConvoy) ;
            case F_TRANSITION_TRANS1_wait_convoy:
                  return (NULL) ;
            case F_TRANSITION_TRANS3_convoy_noConvoy:
                  return (F_CHANNEL_breakConvoy) ;
            case F_TRANSITION_TRANS2_wait_noConvoy1:
                  return (F_CHANNEL_breakConvoy) ;
            case F_TRANSITION_noConvoy1State29:
                  return (F_CHANNEL_isConvoyOk) ;
            case F_TRANSITION_State29State30:
                  return (F_CHANNEL_convoyOk) ;
            case F_TRANSITION_TRANS0_intermediate_convoyRear:
                  return (F_CHANNEL_buildNoConvoy) ;
            case F_TRANSITION_noConvoy1State24:
                  return (F_CHANNEL_isConvoyOk) ;
         }
         return NULL;
   }


   public int getSynchronizationType(int transition)
   {
         switch(transition){
            case F_TRANSITION_State26State27:
                  return (NULL) ;
            case F_TRANSITION_State29State30:
                  return (SENDER) ;
            case F_TRANSITION_noConvoy1State24:
                  return (SENDER) ;
            case F_TRANSITION_convoyState76:
                  return (RECEIVER) ;
            case F_TRANSITION_TRANS0_intermediate_convoyRear:
                  return (SENDER) ;
            case F_TRANSITION_TRANS0_wait_default:
                  return (NULL) ;
            case F_TRANSITION_TRANS2_wait_noConvoy1:
                  return (SENDER) ;
            case F_TRANSITION_convoyRearState105:
                  return (RECEIVER) ;
            case F_TRANSITION_TRANS4_answer_noConvoy1:
                  return (RECEIVER) ;
            case F_TRANSITION_noConvoy1State26:
                  return (RECEIVER) ;
            case F_TRANSITION_TRANS7_convoyRear_noConvoy1:
                  return (RECEIVER) ;
            case F_TRANSITION_State36State38:
                  return (SENDER) ;
            case F_TRANSITION_noConvoy1State29:
                  return (RECEIVER) ;
            case F_TRANSITION_State24State25:
                  return (RECEIVER) ;
            case F_TRANSITION_noConvoy1State31:
                  return (SENDER) ;
            case F_TRANSITION_TRANS1_wait_convoy:
                  return (NULL) ;
            case F_TRANSITION_TRANS2_wait_noConvoy:
                  return (SENDER) ;
            case F_TRANSITION_TRANS5_convoyFront_noConvoy1:
                  return (RECEIVER) ;
            case F_TRANSITION_TRANS3_convoy_noConvoy:
                  return (SENDER) ;
         }
         return NULL;
   }


   public boolean handleTransitions(long actualTime)
   {
         reset();
         boolean anyTransitionExecuted = false;
         enabledTransition.setDimension(currentState.getNumberOfRows(), currentState.getNumberOfCols());
         for ( int i = 0;i < currentState.getNumberOfCols();i++ )
         {
            if (!currentState.isColBlocked(i));
            {
               for ( int j = 0;j < currentState.getNumberOfRows();j++ )
               {
                  if ( currentState.get(j, i) != NULL )
                  {
                     addActivatedTransitions(currentState.get(j, i), actualTime, i);
                  } // if
               } // for (j...)
            } // if
         } // for (i...)
         //now all enabled transitions are in the TransitionMatrix enabledTransition;
         while ( ((!anyTransitionExecuted) && (enabledTransition.getCount() > 0)) )
         {
            //determine earliest activated Transition;
            FRealtimeTransition earliestTransition = null;
            for ( int i = 0;i < enabledTransition.getNumberOfCols();i++ )
            {
               FRealtimeTransition transition = (FRealtimeTransition) enabledTransition.get(0, i);
               if ( transition != null )
               {
                  if ( (earliestTransition == null) || (fireBefore(transition, earliestTransition)) )
                  {
                     earliestTransition = transition;
                  } // if
               } // if
            } // for(i...)
            if ( earliestTransition == null )
            {
               return (anyTransitionExecuted) ;
            } // if
            int channel = getSynchronizationChannel(earliestTransition.getId());
            if ( channel != NULL )
            {
               TransitionMatrix transitionMatrix = waitingTransition.getCol(channel);
               int i = 0; //i is required immediately after the for-loop;
               for ( i = 0;i < transitionMatrix.getNumberOfRows();i++ )
               {
                  FRealtimeTransition transition = (FRealtimeTransition) transitionMatrix.get(i, 0);
                  if ( transition != null )
                  {
                     if ( isExecutable(transition, earliestTransition) )
                     {
                        transitionMatrix.remove(i, 0, true);
                        transition.setActivationStart(earliestTransition.getActivationEnd());
                        startedTransition.addToCol(transition, 0);
                        startedTransition.addToCol(earliestTransition, 0);
                        getFMainThread().executeAperiodicThread(earliestTransition.getId());
                        getFMainThread().executeAperiodicThread(transition.getId());
                        anyTransitionExecuted = true;
                        break;
                     } // if
                  } // if (transition != null)
               } // for (i = 0; i < vector.size(); i++)
               transitionMatrix.removeYou();;
               transitionMatrix = waitingTransition.getCol(channel);
               if ( i == transitionMatrix.getNumberOfRows() )
               {
                  //no fitting transition found in waitingTransition[channel]. Add earliest Transition to waitingTransition[channel].;
                  waitingTransition.addToCol(earliestTransition, channel);
                  enabledTransition.remove(earliestTransition);
               }
               transitionMatrix.removeYou();;
            } // if (channel != NULL)
            else
            {
               if ( isExecutable(earliestTransition) )
               {
                  activationTime = earliestTransition.getActivationStart();
                  startedTransition.addToCol(earliestTransition, 0);
                  enabledTransition.removeFromCol(earliestTransition, earliestTransition.getConcurrencySlot(), true);
                  if ( startedTransition.numberOfElements() > 1 )
                  {
                     getFMainThread().executeAperiodicThread(earliestTransition.getId());
                  } // if
                  else
                  {
                     if ( executeInMainThread(earliestTransition.getId(), getFMainThread().isDoExecutedInCurrentState()) )
                     {
                        run(earliestTransition.getId());
                     } // if
                     else
                     {
                        getFMainThread().executeAperiodicThread(earliestTransition.getId());
                     } // else
                  } // else
                  anyTransitionExecuted = true;
               } // if (isExecutable(earliestTransition))
            } // else
         } // while ((!anyTransitionExecuted) && (enabledTransition.getCount() > 0))
         return (anyTransitionExecuted) ;
   }


   private void initRealtimeStatechart()
   {
         history.set(F_STATECHART_Shuttle1_InitialState, 0, F_STATE_Shuttle1_Shuttle);
         init.set(F_STATECHART_Shuttle1_InitialState, 0, F_STATE_Shuttle1_Shuttle);
         history.set(F_STATECHART_Shuttle1_myFrontRole_InitialState, 0, F_STATE_Shuttle1_myFrontRole_noConvoy);
         init.set(F_STATECHART_Shuttle1_myFrontRole_InitialState, 0, F_STATE_Shuttle1_myFrontRole_noConvoy);
         history.set(F_STATECHART_Shuttle1_Shuttle_Main_InitialState, 0, F_STATE_Shuttle1_Shuttle_Main_noConvoy);
         init.set(F_STATECHART_Shuttle1_Shuttle_Main_InitialState, 0, F_STATE_Shuttle1_Shuttle_Main_noConvoy);
         history.set(F_STATECHART_Shuttle1_Shuttle_Main_sub1_InitialState, 0, F_STATE_Shuttle1_Shuttle_Main_sub1_default);
         init.set(F_STATECHART_Shuttle1_Shuttle_Main_sub1_InitialState, 0, F_STATE_Shuttle1_Shuttle_Main_sub1_default);
         history.set(F_STATECHART_Shuttle1_myRearRole_InitialState, 0, F_STATE_Shuttle1_myRearRole_noConvoy);
         init.set(F_STATECHART_Shuttle1_myRearRole_InitialState, 0, F_STATE_Shuttle1_myRearRole_noConvoy);
         eventQueue = new FEventQueue();
         FRealtimeEvent.initFactory(100);
         TransitionMatrix.initFactory(100);
         enabledTransition = TransitionMatrix.createTransitionMatrix(MAX_DEPTH, MAX_CONCURRENT_STATES);
         waitingTransition = TransitionMatrix.createTransitionMatrix(TRANSITION_COUNT, CHANNEL_COUNT);
         startedTransition = TransitionMatrix.createTransitionMatrix(MAX_DEPTH * MAX_CONCURRENT_STATES, 1);
         FRealtimeTransition.initFactory(MAX_DEPTH * MAX_CONCURRENT_STATES + 1 + 100);
         long time = FMainThread.getTime();
         t0[F_CLOCK_INTERN] = time;
         t0[F_CLOCK_INTERN] = time;
         t0[F_CLOCK_t0] = time;
         t0[F_CLOCK_t1] = time;
         guardTime[F_TRANSITION_noConvoy1State24] = 0;
         guardTime[F_TRANSITION_State24State25] = 0;
         guardTime[F_TRANSITION_TRANS4_answer_noConvoy1] = 0;
         guardTime[F_TRANSITION_convoyState76] = 0;
         guardTime[F_TRANSITION_TRANS1_wait_convoy] = 0;
         guardTime[F_TRANSITION_TRANS2_wait_noConvoy] = 0;
         guardTime[F_TRANSITION_noConvoy1State29] = 0;
         guardTime[F_TRANSITION_State29State30] = 0;
         guardTime[F_TRANSITION_TRANS5_convoyFront_noConvoy1] = 0;
         guardTime[F_TRANSITION_noConvoy1State31] = INFINITY;
         guardTime[F_TRANSITION_TRANS7_convoyRear_noConvoy1] = 0;
         guardTime[F_TRANSITION_convoyRearState105] = 0;
         guardTime[F_TRANSITION_TRANS0_intermediate_convoyRear] = 0;
         guardTime[F_TRANSITION_State36State38] = INFINITY;
         guardTime[F_TRANSITION_TRANS0_wait_default] = 0;
         guardTime[F_TRANSITION_noConvoy1State26] = 0;
         guardTime[F_TRANSITION_State26State27] = 0;
         guardTime[F_TRANSITION_TRANS2_wait_noConvoy1] = 0;
         guardTime[F_TRANSITION_TRANS3_convoy_noConvoy] = 0;
         currentState = MatrixFactory.getInstance().create();
         currentState.setDimension(MAX_DEPTH, MAX_CONCURRENT_STATES);
         currentState.set(0, 0, F_STATE_Shuttle1_Shuttle);
         addTargetSubStates(currentState, 0, 0, false);
   }


   private boolean isExecutable(FRealtimeTransition transition)
   {
         for ( int i = 0;i < startedTransition.getNumberOfRows();i++ )
         {
            if ( ((startedTransition.get(i, 0) != null) && (mutalExclusion(transition.getId(), startedTransition.get(i, 0).getId()))) )
            {
               return (false) ;
            } // if
            if ( ((startedTransition.get(i, 0) != null) && (mutalExclusion(startedTransition.get(i, 0).getId(), transition.getId()))) )
            {
               return (false) ;
            } // if
         } // for
         return (true) ;
   }


   private boolean isExecutable(FRealtimeTransition transition1, FRealtimeTransition transition2)
   {
         if ( transition1.getId() == transition2.getId() )
         {
            return (false) ;
         } // if
         if ( (getSynchronizationType(transition1.getId()) != getSynchronizationType(transition2.getId())) && (!mutalExclusion(transition1.getId(), transition2.getId())) && (transition1.getActivationEnd() >= transition2.getActivationStart()) )
         {
            for ( int i = 0;i < startedTransition.getNumberOfRows();i++ )
            {
               if ( ((startedTransition.get(i, 0) != null) && (mutalExclusion(transition1.getId(), startedTransition.get(i, 0).getId()))) )
               {
                  return (false) ;
               } // if
               if ( ((startedTransition.get(i, 0) != null) && (mutalExclusion(startedTransition.get(i, 0).getId(), transition1.getId()))) )
               {
                  return (false) ;
               } // if
               if ( ((startedTransition.get(i, 0) != null) && (mutalExclusion(transition2.getId(), startedTransition.get(i, 0).getId()))) )
               {
                  return (false) ;
               } // if
               if ( ((startedTransition.get(i, 0) != null) && (mutalExclusion(startedTransition.get(i, 0).getId(), transition2.getId()))) )
               {
                  return (false) ;
               } // if
            } // for
         } // if
         return (true) ;
   }


   public void method()
   {
   }

/**
 * @returns true, if transition2 cannot be executed during the execution of transition1.
 */

   private boolean mutalExclusion(int transition1, int transition2)
   {
         if ( transition1 == transition2 )
         {
            return (true) ;
         } // if
         switch(transition1){
            case F_TRANSITION_TRANS5_convoyFront_noConvoy1:
                  switch(transition2){
               case F_TRANSITION_TRANS0_wait_default:
               case F_TRANSITION_State36State38:
                        return (true) ;
            }
                  break;
            case F_TRANSITION_State36State38:
                  switch(transition2){
               case F_TRANSITION_TRANS5_convoyFront_noConvoy1:
                        return (true) ;
            }
                  break;
            case F_TRANSITION_TRANS0_wait_default:
                  switch(transition2){
               case F_TRANSITION_TRANS5_convoyFront_noConvoy1:
                        return (true) ;
            }
                  break;
         }
         return (false) ;
   }


   private void reset()
   {
         enabledTransition.removeAll();
         waitingTransition.removeAll();;
   }


   public void run(int transition)
   {
         long lowerBound = 0;
         long upperBound = INFINITY;
         int state;
         int stateHight;
         long long0;
         Matrix notedCols = MatrixFactory.getInstance().create();
         notedCols.setDimension(MAX_CONCURRENT_STATES, 1);
         Matrix notedStates = MatrixFactory.getInstance().create();
         notedStates.setDimension(MAX_CONCURRENT_STATES * MAX_DEPTH, 1);
         Matrix newStates = MatrixFactory.getInstance().create();
         switch(transition){
            case F_TRANSITION_TRANS0_intermediate_convoyRear:
                  {
                        //the highest state that is exited;
                        state = F_STATE_Shuttle1_Shuttle_Main_intermediate2;
                        stateHight = 1;
                        //block all Cols that contain state and memorize these cols in notedCols;
                        for ( int j = 0;j < currentState.getNumberOfCols();j++ )
                        {
                              if ( currentState.get(stateHight, j) == state )
                              {
                                    currentState.blockCol(j);
                                    notedCols.addToCol(j, 0);
                                 } // if
                           } // for(j...)
                        //call all exit-Methods and memorize exited states for history;
                        for ( int i = 0;i < notedCols.getNumberOfRows();i++ )
                        {
                              int col = notedCols.get(i, 0);
                              if ( col != Matrix.NULL )
                              {
                                    for ( int j = currentState.getNumberOfRows() - 1;j >= stateHight ;j-- )
                                    {
                                          int state0 = currentState.get(j, col);
                                          if ( !notedStates.containsInCol(state0, 0) )
                                          {
                                                notedStates.addToCol(state0, 0);
                                                history.set(getStatechart(state0), 0, state0);
                                                exitAction(state0);
                                             } // if
                                       } // for (j...
                                 } // if
                           } // for (i...
                        //remove all old states from currentState;
                        int col = notedCols.get(0, 0);
                        for ( int i = 0;i < notedCols.getNumberOfRows();i++ )
                        {
                              currentState.removeCol(notedCols.get(i, 0));
                           }
                        //raise the events and execute the sideeffekt;
                        //the highest state that is entered;
                        state = F_STATE_Shuttle1_Shuttle_Main_convoyRear;
                        stateHight = 1;
                        //create new target states (history, hierarchy and parallelism make this to appear a little bit complicated);
                        newStates.setDimension(stateHight + 1, 1);
                        //go up from targetState to highest entry state "state";
                        newStates.set(1, 0 , F_STATE_Shuttle1_Shuttle_Main_convoyRear);
                        //go down and check if there exists further orthogonal states and respect history;
                        addTargetSubStates(newStates, stateHight, 0, false);
                        //call all entry-Methods;
                        notedStates.removeAll();
                        for ( int i = stateHight;i < newStates.getNumberOfRows();i++ )
                        {
                              for ( int j = 0;j < newStates.getNumberOfCols();j++ )
                              {
                                    int state0 = newStates.get(i, j);
                                    if ( (state0 != NULL) && (!notedStates.containsInCol(state0, 0)) )
                                    {
                                          notedStates.addToCol(state0, 0);
                                          entryAction(state0);
                                       } // if
                                 } // for (j...
                           } // for (i...
                        //add newStates to currentStates;
                        currentState.addColsFrom(newStates);
                        for ( int i = 0;i < currentState.getNumberOfCols();i++ )
                        {
                              for ( int j = currentState.getNumberOfRows() - 2;j >= 0;j-- )
                              {
                                    int state0 = currentState.get(j, i);
                                    if ( state0 == NULL )
                                    {
                                          currentState.set(j, i, getParentState(currentState.get(j + 1, i)));
                                       } // if
                                 } // for j...
                           } // for i...
                        //some resets;
                        notedStates.removeAll();
                        newStates.removeAll();
                        break;
                     }
            case F_TRANSITION_State36State38:
                  {
                        //the highest state that is exited;
                        state = F_STATE_Shuttle1_Shuttle_Main_sub1_default;
                        stateHight = 2;
                        //block all Cols that contain state and memorize these cols in notedCols;
                        for ( int j = 0;j < currentState.getNumberOfCols();j++ )
                        {
                              if ( currentState.get(stateHight, j) == state )
                              {
                                    currentState.blockCol(j);
                                    notedCols.addToCol(j, 0);
                                 } // if
                           } // for(j...)
                        //call all exit-Methods and memorize exited states for history;
                        for ( int i = 0;i < notedCols.getNumberOfRows();i++ )
                        {
                              int col = notedCols.get(i, 0);
                              if ( col != Matrix.NULL )
                              {
                                    for ( int j = currentState.getNumberOfRows() - 1;j >= stateHight ;j-- )
                                    {
                                          int state0 = currentState.get(j, col);
                                          if ( !notedStates.containsInCol(state0, 0) )
                                          {
                                                notedStates.addToCol(state0, 0);
                                                history.set(getStatechart(state0), 0, state0);
                                                exitAction(state0);
                                             } // if
                                       } // for (j...
                                 } // if
                           } // for (i...
                        //remove all old states from currentState;
                        int col = notedCols.get(0, 0);
                        for ( int i = 0;i < notedCols.getNumberOfRows();i++ )
                        {
                              currentState.removeCol(notedCols.get(i, 0));
                           }
                        //raise the events and execute the sideeffekt;
                        //the highest state that is entered;
                        state = F_STATE_Shuttle1_Shuttle_Main_sub1_wait;
                        stateHight = 2;
                        //create new target states (history, hierarchy and parallelism make this to appear a little bit complicated);
                        newStates.setDimension(stateHight + 1, 1);
                        //go up from targetState to highest entry state "state";
                        newStates.set(2, 0 , F_STATE_Shuttle1_Shuttle_Main_sub1_wait);
                        //go down and check if there exists further orthogonal states and respect history;
                        addTargetSubStates(newStates, stateHight, 0, false);
                        //call all entry-Methods;
                        notedStates.removeAll();
                        for ( int i = stateHight;i < newStates.getNumberOfRows();i++ )
                        {
                              for ( int j = 0;j < newStates.getNumberOfCols();j++ )
                              {
                                    int state0 = newStates.get(i, j);
                                    if ( (state0 != NULL) && (!notedStates.containsInCol(state0, 0)) )
                                    {
                                          notedStates.addToCol(state0, 0);
                                          entryAction(state0);
                                       } // if
                                 } // for (j...
                           } // for (i...
                        //add newStates to currentStates;
                        currentState.addColsFrom(newStates);
                        for ( int i = 0;i < currentState.getNumberOfCols();i++ )
                        {
                              for ( int j = currentState.getNumberOfRows() - 2;j >= 0;j-- )
                              {
                                    int state0 = currentState.get(j, i);
                                    if ( state0 == NULL )
                                    {
                                          currentState.set(j, i, getParentState(currentState.get(j + 1, i)));
                                       } // if
                                 } // for j...
                           } // for i...
                        //some resets;
                        notedStates.removeAll();
                        newStates.removeAll();
                        break;
                     }
            case F_TRANSITION_State26State27:
                  {
                        FRealtimeEvent startConvoy = eventQueue.dequeueEvent("startConvoy");
                        //the highest state that is exited;
                        state = F_STATE_Shuttle1_myRearRole_wait;
                        stateHight = 1;
                        //block all Cols that contain state and memorize these cols in notedCols;
                        for ( int j = 0;j < currentState.getNumberOfCols();j++ )
                        {
                              if ( currentState.get(stateHight, j) == state )
                              {
                                    currentState.blockCol(j);
                                    notedCols.addToCol(j, 0);
                                 } // if
                           } // for(j...)
                        //call all exit-Methods and memorize exited states for history;
                        for ( int i = 0;i < notedCols.getNumberOfRows();i++ )
                        {
                              int col = notedCols.get(i, 0);
                              if ( col != Matrix.NULL )
                              {
                                    for ( int j = currentState.getNumberOfRows() - 1;j >= stateHight ;j-- )
                                    {
                                          int state0 = currentState.get(j, col);
                                          if ( !notedStates.containsInCol(state0, 0) )
                                          {
                                                notedStates.addToCol(state0, 0);
                                                history.set(getStatechart(state0), 0, state0);
                                                exitAction(state0);
                                             } // if
                                       } // for (j...
                                 } // if
                           } // for (i...
                        //remove all old states from currentState;
                        int col = notedCols.get(0, 0);
                        for ( int i = 0;i < notedCols.getNumberOfRows();i++ )
                        {
                              currentState.removeCol(notedCols.get(i, 0));
                           }
                        //raise the events and execute the sideeffekt;
                        //the highest state that is entered;
                        state = F_STATE_Shuttle1_myRearRole_convoy;
                        stateHight = 1;
                        //create new target states (history, hierarchy and parallelism make this to appear a little bit complicated);
                        newStates.setDimension(stateHight + 1, 1);
                        //go up from targetState to highest entry state "state";
                        newStates.set(1, 0 , F_STATE_Shuttle1_myRearRole_convoy);
                        //go down and check if there exists further orthogonal states and respect history;
                        addTargetSubStates(newStates, stateHight, 0, false);
                        //call all entry-Methods;
                        notedStates.removeAll();
                        for ( int i = stateHight;i < newStates.getNumberOfRows();i++ )
                        {
                              for ( int j = 0;j < newStates.getNumberOfCols();j++ )
                              {
                                    int state0 = newStates.get(i, j);
                                    if ( (state0 != NULL) && (!notedStates.containsInCol(state0, 0)) )
                                    {
                                          notedStates.addToCol(state0, 0);
                                          entryAction(state0);
                                       } // if
                                 } // for (j...
                           } // for (i...
                        //add newStates to currentStates;
                        currentState.addColsFrom(newStates);
                        for ( int i = 0;i < currentState.getNumberOfCols();i++ )
                        {
                              for ( int j = currentState.getNumberOfRows() - 2;j >= 0;j-- )
                              {
                                    int state0 = currentState.get(j, i);
                                    if ( state0 == NULL )
                                    {
                                          currentState.set(j, i, getParentState(currentState.get(j + 1, i)));
                                       } // if
                                 } // for j...
                           } // for i...
                        //some resets;
                        notedStates.removeAll();
                        newStates.removeAll();
                        break;
                     }
            case F_TRANSITION_noConvoy1State31:
                  {
                        //the highest state that is exited;
                        state = F_STATE_Shuttle1_Shuttle_Main_noConvoy;
                        stateHight = 1;
                        //block all Cols that contain state and memorize these cols in notedCols;
                        for ( int j = 0;j < currentState.getNumberOfCols();j++ )
                        {
                              if ( currentState.get(stateHight, j) == state )
                              {
                                    currentState.blockCol(j);
                                    notedCols.addToCol(j, 0);
                                 } // if
                           } // for(j...)
                        //call all exit-Methods and memorize exited states for history;
                        for ( int i = 0;i < notedCols.getNumberOfRows();i++ )
                        {
                              int col = notedCols.get(i, 0);
                              if ( col != Matrix.NULL )
                              {
                                    for ( int j = currentState.getNumberOfRows() - 1;j >= stateHight ;j-- )
                                    {
                                          int state0 = currentState.get(j, col);
                                          if ( !notedStates.containsInCol(state0, 0) )
                                          {
                                                notedStates.addToCol(state0, 0);
                                                history.set(getStatechart(state0), 0, state0);
                                                exitAction(state0);
                                             } // if
                                       } // for (j...
                                 } // if
                           } // for (i...
                        //remove all old states from currentState;
                        int col = notedCols.get(0, 0);
                        for ( int i = 0;i < notedCols.getNumberOfRows();i++ )
                        {
                              currentState.removeCol(notedCols.get(i, 0));
                           }
                        //raise the events and execute the sideeffekt;
                        //the highest state that is entered;
                        state = F_STATE_Shuttle1_Shuttle_Main_convoyRear;
                        stateHight = 1;
                        //create new target states (history, hierarchy and parallelism make this to appear a little bit complicated);
                        newStates.setDimension(stateHight + 1, 1);
                        //go up from targetState to highest entry state "state";
                        newStates.set(1, 0 , F_STATE_Shuttle1_Shuttle_Main_convoyRear);
                        //go down and check if there exists further orthogonal states and respect history;
                        addTargetSubStates(newStates, stateHight, 0, false);
                        //call all entry-Methods;
                        notedStates.removeAll();
                        for ( int i = stateHight;i < newStates.getNumberOfRows();i++ )
                        {
                              for ( int j = 0;j < newStates.getNumberOfCols();j++ )
                              {
                                    int state0 = newStates.get(i, j);
                                    if ( (state0 != NULL) && (!notedStates.containsInCol(state0, 0)) )
                                    {
                                          notedStates.addToCol(state0, 0);
                                          entryAction(state0);
                                       } // if
                                 } // for (j...
                           } // for (i...
                        //add newStates to currentStates;
                        currentState.addColsFrom(newStates);
                        for ( int i = 0;i < currentState.getNumberOfCols();i++ )
                        {
                              for ( int j = currentState.getNumberOfRows() - 2;j >= 0;j-- )
                              {
                                    int state0 = currentState.get(j, i);
                                    if ( state0 == NULL )
                                    {
                                          currentState.set(j, i, getParentState(currentState.get(j + 1, i)));
                                       } // if
                                 } // for j...
                           } // for i...
                        //some resets;
                        notedStates.removeAll();
                        //lowerBound = max_j (a_j + t_0_j);
                        lowerBound = 0 + activationTime;
                        newStates.removeAll();
                        break;
                     }
            case F_TRANSITION_TRANS7_convoyRear_noConvoy1:
                  {
                        //the highest state that is exited;
                        state = F_STATE_Shuttle1_Shuttle_Main_convoyRear;
                        stateHight = 1;
                        //block all Cols that contain state and memorize these cols in notedCols;
                        for ( int j = 0;j < currentState.getNumberOfCols();j++ )
                        {
                              if ( currentState.get(stateHight, j) == state )
                              {
                                    currentState.blockCol(j);
                                    notedCols.addToCol(j, 0);
                                 } // if
                           } // for(j...)
                        //call all exit-Methods and memorize exited states for history;
                        for ( int i = 0;i < notedCols.getNumberOfRows();i++ )
                        {
                              int col = notedCols.get(i, 0);
                              if ( col != Matrix.NULL )
                              {
                                    for ( int j = currentState.getNumberOfRows() - 1;j >= stateHight ;j-- )
                                    {
                                          int state0 = currentState.get(j, col);
                                          if ( !notedStates.containsInCol(state0, 0) )
                                          {
                                                notedStates.addToCol(state0, 0);
                                                history.set(getStatechart(state0), 0, state0);
                                                exitAction(state0);
                                             } // if
                                       } // for (j...
                                 } // if
                           } // for (i...
                        //remove all old states from currentState;
                        int col = notedCols.get(0, 0);
                        for ( int i = 0;i < notedCols.getNumberOfRows();i++ )
                        {
                              currentState.removeCol(notedCols.get(i, 0));
                           }
                        //raise the events and execute the sideeffekt;
                        //the highest state that is entered;
                        state = F_STATE_Shuttle1_Shuttle_Main_noConvoy;
                        stateHight = 1;
                        //create new target states (history, hierarchy and parallelism make this to appear a little bit complicated);
                        newStates.setDimension(stateHight + 1, 1);
                        //go up from targetState to highest entry state "state";
                        newStates.set(1, 0 , F_STATE_Shuttle1_Shuttle_Main_noConvoy);
                        //go down and check if there exists further orthogonal states and respect history;
                        addTargetSubStates(newStates, stateHight, 0, false);
                        //call all entry-Methods;
                        notedStates.removeAll();
                        for ( int i = stateHight;i < newStates.getNumberOfRows();i++ )
                        {
                              for ( int j = 0;j < newStates.getNumberOfCols();j++ )
                              {
                                    int state0 = newStates.get(i, j);
                                    if ( (state0 != NULL) && (!notedStates.containsInCol(state0, 0)) )
                                    {
                                          notedStates.addToCol(state0, 0);
                                          entryAction(state0);
                                       } // if
                                 } // for (j...
                           } // for (i...
                        //add newStates to currentStates;
                        currentState.addColsFrom(newStates);
                        for ( int i = 0;i < currentState.getNumberOfCols();i++ )
                        {
                              for ( int j = currentState.getNumberOfRows() - 2;j >= 0;j-- )
                              {
                                    int state0 = currentState.get(j, i);
                                    if ( state0 == NULL )
                                    {
                                          currentState.set(j, i, getParentState(currentState.get(j + 1, i)));
                                       } // if
                                 } // for j...
                           } // for i...
                        //some resets;
                        notedStates.removeAll();
                        newStates.removeAll();
                        break;
                     }
            case F_TRANSITION_TRANS1_wait_convoy:
                  {
                        FRealtimeEvent breakConvoyProposalRejected = eventQueue.dequeueEvent("breakConvoyProposalRejected");
                        //the highest state that is exited;
                        state = F_STATE_Shuttle1_myFrontRole_wait;
                        stateHight = 1;
                        //block all Cols that contain state and memorize these cols in notedCols;
                        for ( int j = 0;j < currentState.getNumberOfCols();j++ )
                        {
                              if ( currentState.get(stateHight, j) == state )
                              {
                                    currentState.blockCol(j);
                                    notedCols.addToCol(j, 0);
                                 } // if
                           } // for(j...)
                        //call all exit-Methods and memorize exited states for history;
                        for ( int i = 0;i < notedCols.getNumberOfRows();i++ )
                        {
                              int col = notedCols.get(i, 0);
                              if ( col != Matrix.NULL )
                              {
                                    for ( int j = currentState.getNumberOfRows() - 1;j >= stateHight ;j-- )
                                    {
                                          int state0 = currentState.get(j, col);
                                          if ( !notedStates.containsInCol(state0, 0) )
                                          {
                                                notedStates.addToCol(state0, 0);
                                                history.set(getStatechart(state0), 0, state0);
                                                exitAction(state0);
                                             } // if
                                       } // for (j...
                                 } // if
                           } // for (i...
                        //remove all old states from currentState;
                        int col = notedCols.get(0, 0);
                        for ( int i = 0;i < notedCols.getNumberOfRows();i++ )
                        {
                              currentState.removeCol(notedCols.get(i, 0));
                           }
                        //raise the events and execute the sideeffekt;
                        //the highest state that is entered;
                        state = F_STATE_Shuttle1_myFrontRole_convoy;
                        stateHight = 1;
                        //create new target states (history, hierarchy and parallelism make this to appear a little bit complicated);
                        newStates.setDimension(stateHight + 1, 1);
                        //go up from targetState to highest entry state "state";
                        newStates.set(1, 0 , F_STATE_Shuttle1_myFrontRole_convoy);
                        //go down and check if there exists further orthogonal states and respect history;
                        addTargetSubStates(newStates, stateHight, 0, false);
                        //call all entry-Methods;
                        notedStates.removeAll();
                        for ( int i = stateHight;i < newStates.getNumberOfRows();i++ )
                        {
                              for ( int j = 0;j < newStates.getNumberOfCols();j++ )
                              {
                                    int state0 = newStates.get(i, j);
                                    if ( (state0 != NULL) && (!notedStates.containsInCol(state0, 0)) )
                                    {
                                          notedStates.addToCol(state0, 0);
                                          entryAction(state0);
                                       } // if
                                 } // for (j...
                           } // for (i...
                        //add newStates to currentStates;
                        currentState.addColsFrom(newStates);
                        for ( int i = 0;i < currentState.getNumberOfCols();i++ )
                        {
                              for ( int j = currentState.getNumberOfRows() - 2;j >= 0;j-- )
                              {
                                    int state0 = currentState.get(j, i);
                                    if ( state0 == NULL )
                                    {
                                          currentState.set(j, i, getParentState(currentState.get(j + 1, i)));
                                       } // if
                                 } // for j...
                           } // for i...
                        //some resets;
                        notedStates.removeAll();
                        newStates.removeAll();
                        break;
                     }
            case F_TRANSITION_TRANS5_convoyFront_noConvoy1:
                  {
                        //the highest state that is exited;
                        state = F_STATE_Shuttle1_Shuttle_Main_convoyFront;
                        stateHight = 1;
                        //block all Cols that contain state and memorize these cols in notedCols;
                        for ( int j = 0;j < currentState.getNumberOfCols();j++ )
                        {
                              if ( currentState.get(stateHight, j) == state )
                              {
                                    currentState.blockCol(j);
                                    notedCols.addToCol(j, 0);
                                 } // if
                           } // for(j...)
                        //call all exit-Methods and memorize exited states for history;
                        for ( int i = 0;i < notedCols.getNumberOfRows();i++ )
                        {
                              int col = notedCols.get(i, 0);
                              if ( col != Matrix.NULL )
                              {
                                    for ( int j = currentState.getNumberOfRows() - 1;j >= stateHight ;j-- )
                                    {
                                          int state0 = currentState.get(j, col);
                                          if ( !notedStates.containsInCol(state0, 0) )
                                          {
                                                notedStates.addToCol(state0, 0);
                                                history.set(getStatechart(state0), 0, state0);
                                                exitAction(state0);
                                             } // if
                                       } // for (j...
                                 } // if
                           } // for (i...
                        //remove all old states from currentState;
                        int col = notedCols.get(0, 0);
                        for ( int i = 0;i < notedCols.getNumberOfRows();i++ )
                        {
                              currentState.removeCol(notedCols.get(i, 0));
                           }
                        //raise the events and execute the sideeffekt;
                        //the highest state that is entered;
                        state = F_STATE_Shuttle1_Shuttle_Main_noConvoy;
                        stateHight = 1;
                        //create new target states (history, hierarchy and parallelism make this to appear a little bit complicated);
                        newStates.setDimension(stateHight + 1, 1);
                        //go up from targetState to highest entry state "state";
                        newStates.set(1, 0 , F_STATE_Shuttle1_Shuttle_Main_noConvoy);
                        //go down and check if there exists further orthogonal states and respect history;
                        addTargetSubStates(newStates, stateHight, 0, false);
                        //call all entry-Methods;
                        notedStates.removeAll();
                        for ( int i = stateHight;i < newStates.getNumberOfRows();i++ )
                        {
                              for ( int j = 0;j < newStates.getNumberOfCols();j++ )
                              {
                                    int state0 = newStates.get(i, j);
                                    if ( (state0 != NULL) && (!notedStates.containsInCol(state0, 0)) )
                                    {
                                          notedStates.addToCol(state0, 0);
                                          entryAction(state0);
                                       } // if
                                 } // for (j...
                           } // for (i...
                        //add newStates to currentStates;
                        currentState.addColsFrom(newStates);
                        for ( int i = 0;i < currentState.getNumberOfCols();i++ )
                        {
                              for ( int j = currentState.getNumberOfRows() - 2;j >= 0;j-- )
                              {
                                    int state0 = currentState.get(j, i);
                                    if ( state0 == NULL )
                                    {
                                          currentState.set(j, i, getParentState(currentState.get(j + 1, i)));
                                       } // if
                                 } // for j...
                           } // for i...
                        //some resets;
                        notedStates.removeAll();
                        //lowerBound = max_j (a_j + t_0_j);
                        lowerBound = 0 + activationTime;
                        newStates.removeAll();
                        break;
                     }
            case F_TRANSITION_convoyRearState105:
                  {
                        //the highest state that is exited;
                        state = F_STATE_Shuttle1_Shuttle_Main_convoyRear;
                        stateHight = 1;
                        //block all Cols that contain state and memorize these cols in notedCols;
                        for ( int j = 0;j < currentState.getNumberOfCols();j++ )
                        {
                              if ( currentState.get(stateHight, j) == state )
                              {
                                    currentState.blockCol(j);
                                    notedCols.addToCol(j, 0);
                                 } // if
                           } // for(j...)
                        //call all exit-Methods and memorize exited states for history;
                        for ( int i = 0;i < notedCols.getNumberOfRows();i++ )
                        {
                              int col = notedCols.get(i, 0);
                              if ( col != Matrix.NULL )
                              {
                                    for ( int j = currentState.getNumberOfRows() - 1;j >= stateHight ;j-- )
                                    {
                                          int state0 = currentState.get(j, col);
                                          if ( !notedStates.containsInCol(state0, 0) )
                                          {
                                                notedStates.addToCol(state0, 0);
                                                history.set(getStatechart(state0), 0, state0);
                                                exitAction(state0);
                                             } // if
                                       } // for (j...
                                 } // if
                           } // for (i...
                        //remove all old states from currentState;
                        int col = notedCols.get(0, 0);
                        for ( int i = 0;i < notedCols.getNumberOfRows();i++ )
                        {
                              currentState.removeCol(notedCols.get(i, 0));
                           }
                        //raise the events and execute the sideeffekt;
                        //the highest state that is entered;
                        state = F_STATE_Shuttle1_Shuttle_Main_intermediate2;
                        stateHight = 1;
                        //create new target states (history, hierarchy and parallelism make this to appear a little bit complicated);
                        newStates.setDimension(stateHight + 1, 1);
                        //go up from targetState to highest entry state "state";
                        newStates.set(1, 0 , F_STATE_Shuttle1_Shuttle_Main_intermediate2);
                        //go down and check if there exists further orthogonal states and respect history;
                        addTargetSubStates(newStates, stateHight, 0, false);
                        //call all entry-Methods;
                        notedStates.removeAll();
                        for ( int i = stateHight;i < newStates.getNumberOfRows();i++ )
                        {
                              for ( int j = 0;j < newStates.getNumberOfCols();j++ )
                              {
                                    int state0 = newStates.get(i, j);
                                    if ( (state0 != NULL) && (!notedStates.containsInCol(state0, 0)) )
                                    {
                                          notedStates.addToCol(state0, 0);
                                          entryAction(state0);
                                       } // if
                                 } // for (j...
                           } // for (i...
                        //add newStates to currentStates;
                        currentState.addColsFrom(newStates);
                        for ( int i = 0;i < currentState.getNumberOfCols();i++ )
                        {
                              for ( int j = currentState.getNumberOfRows() - 2;j >= 0;j-- )
                              {
                                    int state0 = currentState.get(j, i);
                                    if ( state0 == NULL )
                                    {
                                          currentState.set(j, i, getParentState(currentState.get(j + 1, i)));
                                       } // if
                                 } // for j...
                           } // for i...
                        //some resets;
                        notedStates.removeAll();
                        newStates.removeAll();
                        break;
                     }
            case F_TRANSITION_TRANS3_convoy_noConvoy:
                  {
                        FRealtimeEvent breakConvoyProposal = eventQueue.dequeueEvent("breakConvoyProposal");
                        //the highest state that is exited;
                        state = F_STATE_Shuttle1_myRearRole_convoy;
                        stateHight = 1;
                        //block all Cols that contain state and memorize these cols in notedCols;
                        for ( int j = 0;j < currentState.getNumberOfCols();j++ )
                        {
                              if ( currentState.get(stateHight, j) == state )
                              {
                                    currentState.blockCol(j);
                                    notedCols.addToCol(j, 0);
                                 } // if
                           } // for(j...)
                        //call all exit-Methods and memorize exited states for history;
                        for ( int i = 0;i < notedCols.getNumberOfRows();i++ )
                        {
                              int col = notedCols.get(i, 0);
                              if ( col != Matrix.NULL )
                              {
                                    for ( int j = currentState.getNumberOfRows() - 1;j >= stateHight ;j-- )
                                    {
                                          int state0 = currentState.get(j, col);
                                          if ( !notedStates.containsInCol(state0, 0) )
                                          {
                                                notedStates.addToCol(state0, 0);
                                                history.set(getStatechart(state0), 0, state0);
                                                exitAction(state0);
                                             } // if
                                       } // for (j...
                                 } // if
                           } // for (i...
                        //remove all old states from currentState;
                        int col = notedCols.get(0, 0);
                        for ( int i = 0;i < notedCols.getNumberOfRows();i++ )
                        {
                              currentState.removeCol(notedCols.get(i, 0));
                           }
                        //raise the events and execute the sideeffekt;
                        frontRole.breakConvoy();
                        //the highest state that is entered;
                        state = F_STATE_Shuttle1_myRearRole_noConvoy;
                        stateHight = 1;
                        //create new target states (history, hierarchy and parallelism make this to appear a little bit complicated);
                        newStates.setDimension(stateHight + 1, 1);
                        //go up from targetState to highest entry state "state";
                        newStates.set(1, 0 , F_STATE_Shuttle1_myRearRole_noConvoy);
                        //go down and check if there exists further orthogonal states and respect history;
                        addTargetSubStates(newStates, stateHight, 0, false);
                        //call all entry-Methods;
                        notedStates.removeAll();
                        for ( int i = stateHight;i < newStates.getNumberOfRows();i++ )
                        {
                              for ( int j = 0;j < newStates.getNumberOfCols();j++ )
                              {
                                    int state0 = newStates.get(i, j);
                                    if ( (state0 != NULL) && (!notedStates.containsInCol(state0, 0)) )
                                    {
                                          notedStates.addToCol(state0, 0);
                                          entryAction(state0);
                                       } // if
                                 } // for (j...
                           } // for (i...
                        //add newStates to currentStates;
                        currentState.addColsFrom(newStates);
                        for ( int i = 0;i < currentState.getNumberOfCols();i++ )
                        {
                              for ( int j = currentState.getNumberOfRows() - 2;j >= 0;j-- )
                              {
                                    int state0 = currentState.get(j, i);
                                    if ( state0 == NULL )
                                    {
                                          currentState.set(j, i, getParentState(currentState.get(j + 1, i)));
                                       } // if
                                 } // for j...
                           } // for i...
                        //some resets;
                        notedStates.removeAll();
                        newStates.removeAll();
                        break;
                     }
            case F_TRANSITION_convoyState76:
                  {
                        //the highest state that is exited;
                        state = F_STATE_Shuttle1_myFrontRole_convoy;
                        stateHight = 1;
                        //block all Cols that contain state and memorize these cols in notedCols;
                        for ( int j = 0;j < currentState.getNumberOfCols();j++ )
                        {
                              if ( currentState.get(stateHight, j) == state )
                              {
                                    currentState.blockCol(j);
                                    notedCols.addToCol(j, 0);
                                 } // if
                           } // for(j...)
                        //call all exit-Methods and memorize exited states for history;
                        for ( int i = 0;i < notedCols.getNumberOfRows();i++ )
                        {
                              int col = notedCols.get(i, 0);
                              if ( col != Matrix.NULL )
                              {
                                    for ( int j = currentState.getNumberOfRows() - 1;j >= stateHight ;j-- )
                                    {
                                          int state0 = currentState.get(j, col);
                                          if ( !notedStates.containsInCol(state0, 0) )
                                          {
                                                notedStates.addToCol(state0, 0);
                                                history.set(getStatechart(state0), 0, state0);
                                                exitAction(state0);
                                             } // if
                                       } // for (j...
                                 } // if
                           } // for (i...
                        //remove all old states from currentState;
                        int col = notedCols.get(0, 0);
                        for ( int i = 0;i < notedCols.getNumberOfRows();i++ )
                        {
                              currentState.removeCol(notedCols.get(i, 0));
                           }
                        //raise the events and execute the sideeffekt;
                        rearRole.breakConvoyProposal();
                        //the highest state that is entered;
                        state = F_STATE_Shuttle1_myFrontRole_wait;
                        stateHight = 1;
                        //create new target states (history, hierarchy and parallelism make this to appear a little bit complicated);
                        newStates.setDimension(stateHight + 1, 1);
                        //go up from targetState to highest entry state "state";
                        newStates.set(1, 0 , F_STATE_Shuttle1_myFrontRole_wait);
                        //go down and check if there exists further orthogonal states and respect history;
                        addTargetSubStates(newStates, stateHight, 0, false);
                        //call all entry-Methods;
                        notedStates.removeAll();
                        for ( int i = stateHight;i < newStates.getNumberOfRows();i++ )
                        {
                              for ( int j = 0;j < newStates.getNumberOfCols();j++ )
                              {
                                    int state0 = newStates.get(i, j);
                                    if ( (state0 != NULL) && (!notedStates.containsInCol(state0, 0)) )
                                    {
                                          notedStates.addToCol(state0, 0);
                                          entryAction(state0);
                                       } // if
                                 } // for (j...
                           } // for (i...
                        //add newStates to currentStates;
                        currentState.addColsFrom(newStates);
                        for ( int i = 0;i < currentState.getNumberOfCols();i++ )
                        {
                              for ( int j = currentState.getNumberOfRows() - 2;j >= 0;j-- )
                              {
                                    int state0 = currentState.get(j, i);
                                    if ( state0 == NULL )
                                    {
                                          currentState.set(j, i, getParentState(currentState.get(j + 1, i)));
                                       } // if
                                 } // for j...
                           } // for i...
                        //some resets;
                        notedStates.removeAll();
                        newStates.removeAll();
                        break;
                     }
            case F_TRANSITION_State24State25:
                  {
                        //the highest state that is exited;
                        state = F_STATE_Shuttle1_myFrontRole_answer;
                        stateHight = 1;
                        //block all Cols that contain state and memorize these cols in notedCols;
                        for ( int j = 0;j < currentState.getNumberOfCols();j++ )
                        {
                              if ( currentState.get(stateHight, j) == state )
                              {
                                    currentState.blockCol(j);
                                    notedCols.addToCol(j, 0);
                                 } // if
                           } // for(j...)
                        //call all exit-Methods and memorize exited states for history;
                        for ( int i = 0;i < notedCols.getNumberOfRows();i++ )
                        {
                              int col = notedCols.get(i, 0);
                              if ( col != Matrix.NULL )
                              {
                                    for ( int j = currentState.getNumberOfRows() - 1;j >= stateHight ;j-- )
                                    {
                                          int state0 = currentState.get(j, col);
                                          if ( !notedStates.containsInCol(state0, 0) )
                                          {
                                                notedStates.addToCol(state0, 0);
                                                history.set(getStatechart(state0), 0, state0);
                                                exitAction(state0);
                                             } // if
                                       } // for (j...
                                 } // if
                           } // for (i...
                        //remove all old states from currentState;
                        int col = notedCols.get(0, 0);
                        for ( int i = 0;i < notedCols.getNumberOfRows();i++ )
                        {
                              currentState.removeCol(notedCols.get(i, 0));
                           }
                        //raise the events and execute the sideeffekt;
                        rearRole.startConvoy();
                        //the highest state that is entered;
                        state = F_STATE_Shuttle1_myFrontRole_convoy;
                        stateHight = 1;
                        //create new target states (history, hierarchy and parallelism make this to appear a little bit complicated);
                        newStates.setDimension(stateHight + 1, 1);
                        //go up from targetState to highest entry state "state";
                        newStates.set(1, 0 , F_STATE_Shuttle1_myFrontRole_convoy);
                        //go down and check if there exists further orthogonal states and respect history;
                        addTargetSubStates(newStates, stateHight, 0, false);
                        //call all entry-Methods;
                        notedStates.removeAll();
                        for ( int i = stateHight;i < newStates.getNumberOfRows();i++ )
                        {
                              for ( int j = 0;j < newStates.getNumberOfCols();j++ )
                              {
                                    int state0 = newStates.get(i, j);
                                    if ( (state0 != NULL) && (!notedStates.containsInCol(state0, 0)) )
                                    {
                                          notedStates.addToCol(state0, 0);
                                          entryAction(state0);
                                       } // if
                                 } // for (j...
                           } // for (i...
                        //add newStates to currentStates;
                        currentState.addColsFrom(newStates);
                        for ( int i = 0;i < currentState.getNumberOfCols();i++ )
                        {
                              for ( int j = currentState.getNumberOfRows() - 2;j >= 0;j-- )
                              {
                                    int state0 = currentState.get(j, i);
                                    if ( state0 == NULL )
                                    {
                                          currentState.set(j, i, getParentState(currentState.get(j + 1, i)));
                                       } // if
                                 } // for j...
                           } // for i...
                        //some resets;
                        notedStates.removeAll();
                        newStates.removeAll();
                        break;
                     }
            case F_TRANSITION_TRANS4_answer_noConvoy1:
                  {
                        //the highest state that is exited;
                        state = F_STATE_Shuttle1_myFrontRole_answer;
                        stateHight = 1;
                        //block all Cols that contain state and memorize these cols in notedCols;
                        for ( int j = 0;j < currentState.getNumberOfCols();j++ )
                        {
                              if ( currentState.get(stateHight, j) == state )
                              {
                                    currentState.blockCol(j);
                                    notedCols.addToCol(j, 0);
                                 } // if
                           } // for(j...)
                        //call all exit-Methods and memorize exited states for history;
                        for ( int i = 0;i < notedCols.getNumberOfRows();i++ )
                        {
                              int col = notedCols.get(i, 0);
                              if ( col != Matrix.NULL )
                              {
                                    for ( int j = currentState.getNumberOfRows() - 1;j >= stateHight ;j-- )
                                    {
                                          int state0 = currentState.get(j, col);
                                          if ( !notedStates.containsInCol(state0, 0) )
                                          {
                                                notedStates.addToCol(state0, 0);
                                                history.set(getStatechart(state0), 0, state0);
                                                exitAction(state0);
                                             } // if
                                       } // for (j...
                                 } // if
                           } // for (i...
                        //remove all old states from currentState;
                        int col = notedCols.get(0, 0);
                        for ( int i = 0;i < notedCols.getNumberOfRows();i++ )
                        {
                              currentState.removeCol(notedCols.get(i, 0));
                           }
                        //raise the events and execute the sideeffekt;
                        rearRole.convoyProposalRejected();
                        //the highest state that is entered;
                        state = F_STATE_Shuttle1_myFrontRole_noConvoy;
                        stateHight = 1;
                        //create new target states (history, hierarchy and parallelism make this to appear a little bit complicated);
                        newStates.setDimension(stateHight + 1, 1);
                        //go up from targetState to highest entry state "state";
                        newStates.set(1, 0 , F_STATE_Shuttle1_myFrontRole_noConvoy);
                        //go down and check if there exists further orthogonal states and respect history;
                        addTargetSubStates(newStates, stateHight, 0, false);
                        //call all entry-Methods;
                        notedStates.removeAll();
                        for ( int i = stateHight;i < newStates.getNumberOfRows();i++ )
                        {
                              for ( int j = 0;j < newStates.getNumberOfCols();j++ )
                              {
                                    int state0 = newStates.get(i, j);
                                    if ( (state0 != NULL) && (!notedStates.containsInCol(state0, 0)) )
                                    {
                                          notedStates.addToCol(state0, 0);
                                          entryAction(state0);
                                       } // if
                                 } // for (j...
                           } // for (i...
                        //add newStates to currentStates;
                        currentState.addColsFrom(newStates);
                        for ( int i = 0;i < currentState.getNumberOfCols();i++ )
                        {
                              for ( int j = currentState.getNumberOfRows() - 2;j >= 0;j-- )
                              {
                                    int state0 = currentState.get(j, i);
                                    if ( state0 == NULL )
                                    {
                                          currentState.set(j, i, getParentState(currentState.get(j + 1, i)));
                                       } // if
                                 } // for j...
                           } // for i...
                        //some resets;
                        notedStates.removeAll();
                        newStates.removeAll();
                        break;
                     }
            case F_TRANSITION_TRANS2_wait_noConvoy1:
                  {
                        FRealtimeEvent convoyProposalRejected = eventQueue.dequeueEvent("convoyProposalRejected");
                        //the highest state that is exited;
                        state = F_STATE_Shuttle1_myRearRole_wait;
                        stateHight = 1;
                        //block all Cols that contain state and memorize these cols in notedCols;
                        for ( int j = 0;j < currentState.getNumberOfCols();j++ )
                        {
                              if ( currentState.get(stateHight, j) == state )
                              {
                                    currentState.blockCol(j);
                                    notedCols.addToCol(j, 0);
                                 } // if
                           } // for(j...)
                        //call all exit-Methods and memorize exited states for history;
                        for ( int i = 0;i < notedCols.getNumberOfRows();i++ )
                        {
                              int col = notedCols.get(i, 0);
                              if ( col != Matrix.NULL )
                              {
                                    for ( int j = currentState.getNumberOfRows() - 1;j >= stateHight ;j-- )
                                    {
                                          int state0 = currentState.get(j, col);
                                          if ( !notedStates.containsInCol(state0, 0) )
                                          {
                                                notedStates.addToCol(state0, 0);
                                                history.set(getStatechart(state0), 0, state0);
                                                exitAction(state0);
                                             } // if
                                       } // for (j...
                                 } // if
                           } // for (i...
                        //remove all old states from currentState;
                        int col = notedCols.get(0, 0);
                        for ( int i = 0;i < notedCols.getNumberOfRows();i++ )
                        {
                              currentState.removeCol(notedCols.get(i, 0));
                           }
                        //raise the events and execute the sideeffekt;
                        //the highest state that is entered;
                        state = F_STATE_Shuttle1_myRearRole_noConvoy;
                        stateHight = 1;
                        //create new target states (history, hierarchy and parallelism make this to appear a little bit complicated);
                        newStates.setDimension(stateHight + 1, 1);
                        //go up from targetState to highest entry state "state";
                        newStates.set(1, 0 , F_STATE_Shuttle1_myRearRole_noConvoy);
                        //go down and check if there exists further orthogonal states and respect history;
                        addTargetSubStates(newStates, stateHight, 0, false);
                        //call all entry-Methods;
                        notedStates.removeAll();
                        for ( int i = stateHight;i < newStates.getNumberOfRows();i++ )
                        {
                              for ( int j = 0;j < newStates.getNumberOfCols();j++ )
                              {
                                    int state0 = newStates.get(i, j);
                                    if ( (state0 != NULL) && (!notedStates.containsInCol(state0, 0)) )
                                    {
                                          notedStates.addToCol(state0, 0);
                                          entryAction(state0);
                                       } // if
                                 } // for (j...
                           } // for (i...
                        //add newStates to currentStates;
                        currentState.addColsFrom(newStates);
                        for ( int i = 0;i < currentState.getNumberOfCols();i++ )
                        {
                              for ( int j = currentState.getNumberOfRows() - 2;j >= 0;j-- )
                              {
                                    int state0 = currentState.get(j, i);
                                    if ( state0 == NULL )
                                    {
                                          currentState.set(j, i, getParentState(currentState.get(j + 1, i)));
                                       } // if
                                 } // for j...
                           } // for i...
                        //some resets;
                        notedStates.removeAll();
                        newStates.removeAll();
                        break;
                     }
            case F_TRANSITION_noConvoy1State29:
                  {
                        //the highest state that is exited;
                        state = F_STATE_Shuttle1_Shuttle_Main_noConvoy;
                        stateHight = 1;
                        //block all Cols that contain state and memorize these cols in notedCols;
                        for ( int j = 0;j < currentState.getNumberOfCols();j++ )
                        {
                              if ( currentState.get(stateHight, j) == state )
                              {
                                    currentState.blockCol(j);
                                    notedCols.addToCol(j, 0);
                                 } // if
                           } // for(j...)
                        //call all exit-Methods and memorize exited states for history;
                        for ( int i = 0;i < notedCols.getNumberOfRows();i++ )
                        {
                              int col = notedCols.get(i, 0);
                              if ( col != Matrix.NULL )
                              {
                                    for ( int j = currentState.getNumberOfRows() - 1;j >= stateHight ;j-- )
                                    {
                                          int state0 = currentState.get(j, col);
                                          if ( !notedStates.containsInCol(state0, 0) )
                                          {
                                                notedStates.addToCol(state0, 0);
                                                history.set(getStatechart(state0), 0, state0);
                                                exitAction(state0);
                                             } // if
                                       } // for (j...
                                 } // if
                           } // for (i...
                        //remove all old states from currentState;
                        int col = notedCols.get(0, 0);
                        for ( int i = 0;i < notedCols.getNumberOfRows();i++ )
                        {
                              currentState.removeCol(notedCols.get(i, 0));
                           }
                        //raise the events and execute the sideeffekt;
                        //the highest state that is entered;
                        state = F_STATE_Shuttle1_Shuttle_Main_intermediate;
                        stateHight = 1;
                        //create new target states (history, hierarchy and parallelism make this to appear a little bit complicated);
                        newStates.setDimension(stateHight + 1, 1);
                        //go up from targetState to highest entry state "state";
                        newStates.set(1, 0 , F_STATE_Shuttle1_Shuttle_Main_intermediate);
                        //go down and check if there exists further orthogonal states and respect history;
                        addTargetSubStates(newStates, stateHight, 0, false);
                        //call all entry-Methods;
                        notedStates.removeAll();
                        for ( int i = stateHight;i < newStates.getNumberOfRows();i++ )
                        {
                              for ( int j = 0;j < newStates.getNumberOfCols();j++ )
                              {
                                    int state0 = newStates.get(i, j);
                                    if ( (state0 != NULL) && (!notedStates.containsInCol(state0, 0)) )
                                    {
                                          notedStates.addToCol(state0, 0);
                                          entryAction(state0);
                                       } // if
                                 } // for (j...
                           } // for (i...
                        //add newStates to currentStates;
                        currentState.addColsFrom(newStates);
                        for ( int i = 0;i < currentState.getNumberOfCols();i++ )
                        {
                              for ( int j = currentState.getNumberOfRows() - 2;j >= 0;j-- )
                              {
                                    int state0 = currentState.get(j, i);
                                    if ( state0 == NULL )
                                    {
                                          currentState.set(j, i, getParentState(currentState.get(j + 1, i)));
                                       } // if
                                 } // for j...
                           } // for i...
                        //some resets;
                        notedStates.removeAll();
                        newStates.removeAll();
                        break;
                     }
            case F_TRANSITION_TRANS2_wait_noConvoy:
                  {
                        FRealtimeEvent breakConvoy = eventQueue.dequeueEvent("breakConvoy");
                        //the highest state that is exited;
                        state = F_STATE_Shuttle1_myFrontRole_wait;
                        stateHight = 1;
                        //block all Cols that contain state and memorize these cols in notedCols;
                        for ( int j = 0;j < currentState.getNumberOfCols();j++ )
                        {
                              if ( currentState.get(stateHight, j) == state )
                              {
                                    currentState.blockCol(j);
                                    notedCols.addToCol(j, 0);
                                 } // if
                           } // for(j...)
                        //call all exit-Methods and memorize exited states for history;
                        for ( int i = 0;i < notedCols.getNumberOfRows();i++ )
                        {
                              int col = notedCols.get(i, 0);
                              if ( col != Matrix.NULL )
                              {
                                    for ( int j = currentState.getNumberOfRows() - 1;j >= stateHight ;j-- )
                                    {
                                          int state0 = currentState.get(j, col);
                                          if ( !notedStates.containsInCol(state0, 0) )
                                          {
                                                notedStates.addToCol(state0, 0);
                                                history.set(getStatechart(state0), 0, state0);
                                                exitAction(state0);
                                             } // if
                                       } // for (j...
                                 } // if
                           } // for (i...
                        //remove all old states from currentState;
                        int col = notedCols.get(0, 0);
                        for ( int i = 0;i < notedCols.getNumberOfRows();i++ )
                        {
                              currentState.removeCol(notedCols.get(i, 0));
                           }
                        //raise the events and execute the sideeffekt;
                        //the highest state that is entered;
                        state = F_STATE_Shuttle1_myFrontRole_noConvoy;
                        stateHight = 1;
                        //create new target states (history, hierarchy and parallelism make this to appear a little bit complicated);
                        newStates.setDimension(stateHight + 1, 1);
                        //go up from targetState to highest entry state "state";
                        newStates.set(1, 0 , F_STATE_Shuttle1_myFrontRole_noConvoy);
                        //go down and check if there exists further orthogonal states and respect history;
                        addTargetSubStates(newStates, stateHight, 0, false);
                        //call all entry-Methods;
                        notedStates.removeAll();
                        for ( int i = stateHight;i < newStates.getNumberOfRows();i++ )
                        {
                              for ( int j = 0;j < newStates.getNumberOfCols();j++ )
                              {
                                    int state0 = newStates.get(i, j);
                                    if ( (state0 != NULL) && (!notedStates.containsInCol(state0, 0)) )
                                    {
                                          notedStates.addToCol(state0, 0);
                                          entryAction(state0);
                                       } // if
                                 } // for (j...
                           } // for (i...
                        //add newStates to currentStates;
                        currentState.addColsFrom(newStates);
                        for ( int i = 0;i < currentState.getNumberOfCols();i++ )
                        {
                              for ( int j = currentState.getNumberOfRows() - 2;j >= 0;j-- )
                              {
                                    int state0 = currentState.get(j, i);
                                    if ( state0 == NULL )
                                    {
                                          currentState.set(j, i, getParentState(currentState.get(j + 1, i)));
                                       } // if
                                 } // for j...
                           } // for i...
                        //some resets;
                        notedStates.removeAll();
                        newStates.removeAll();
                        break;
                     }
            case F_TRANSITION_TRANS0_wait_default:
                  {
                        //the highest state that is exited;
                        state = F_STATE_Shuttle1_Shuttle_Main_sub1_wait;
                        stateHight = 2;
                        //block all Cols that contain state and memorize these cols in notedCols;
                        for ( int j = 0;j < currentState.getNumberOfCols();j++ )
                        {
                              if ( currentState.get(stateHight, j) == state )
                              {
                                    currentState.blockCol(j);
                                    notedCols.addToCol(j, 0);
                                 } // if
                           } // for(j...)
                        //call all exit-Methods and memorize exited states for history;
                        for ( int i = 0;i < notedCols.getNumberOfRows();i++ )
                        {
                              int col = notedCols.get(i, 0);
                              if ( col != Matrix.NULL )
                              {
                                    for ( int j = currentState.getNumberOfRows() - 1;j >= stateHight ;j-- )
                                    {
                                          int state0 = currentState.get(j, col);
                                          if ( !notedStates.containsInCol(state0, 0) )
                                          {
                                                notedStates.addToCol(state0, 0);
                                                history.set(getStatechart(state0), 0, state0);
                                                exitAction(state0);
                                             } // if
                                       } // for (j...
                                 } // if
                           } // for (i...
                        //remove all old states from currentState;
                        int col = notedCols.get(0, 0);
                        for ( int i = 0;i < notedCols.getNumberOfRows();i++ )
                        {
                              currentState.removeCol(notedCols.get(i, 0));
                           }
                        //raise the events and execute the sideeffekt;
                        //the highest state that is entered;
                        state = F_STATE_Shuttle1_Shuttle_Main_sub1_default;
                        stateHight = 2;
                        //create new target states (history, hierarchy and parallelism make this to appear a little bit complicated);
                        newStates.setDimension(stateHight + 1, 1);
                        //go up from targetState to highest entry state "state";
                        newStates.set(2, 0 , F_STATE_Shuttle1_Shuttle_Main_sub1_default);
                        //go down and check if there exists further orthogonal states and respect history;
                        addTargetSubStates(newStates, stateHight, 0, false);
                        //call all entry-Methods;
                        notedStates.removeAll();
                        for ( int i = stateHight;i < newStates.getNumberOfRows();i++ )
                        {
                              for ( int j = 0;j < newStates.getNumberOfCols();j++ )
                              {
                                    int state0 = newStates.get(i, j);
                                    if ( (state0 != NULL) && (!notedStates.containsInCol(state0, 0)) )
                                    {
                                          notedStates.addToCol(state0, 0);
                                          entryAction(state0);
                                       } // if
                                 } // for (j...
                           } // for (i...
                        //add newStates to currentStates;
                        currentState.addColsFrom(newStates);
                        for ( int i = 0;i < currentState.getNumberOfCols();i++ )
                        {
                              for ( int j = currentState.getNumberOfRows() - 2;j >= 0;j-- )
                              {
                                    int state0 = currentState.get(j, i);
                                    if ( state0 == NULL )
                                    {
                                          currentState.set(j, i, getParentState(currentState.get(j + 1, i)));
                                       } // if
                                 } // for j...
                           } // for i...
                        //some resets;
                        notedStates.removeAll();
                        newStates.removeAll();
                        break;
                     }
            case F_TRANSITION_noConvoy1State24:
                  {
                        FRealtimeEvent convoyProposal = eventQueue.dequeueEvent("convoyProposal");
                        //the highest state that is exited;
                        state = F_STATE_Shuttle1_myFrontRole_noConvoy;
                        stateHight = 1;
                        //block all Cols that contain state and memorize these cols in notedCols;
                        for ( int j = 0;j < currentState.getNumberOfCols();j++ )
                        {
                              if ( currentState.get(stateHight, j) == state )
                              {
                                    currentState.blockCol(j);
                                    notedCols.addToCol(j, 0);
                                 } // if
                           } // for(j...)
                        //call all exit-Methods and memorize exited states for history;
                        for ( int i = 0;i < notedCols.getNumberOfRows();i++ )
                        {
                              int col = notedCols.get(i, 0);
                              if ( col != Matrix.NULL )
                              {
                                    for ( int j = currentState.getNumberOfRows() - 1;j >= stateHight ;j-- )
                                    {
                                          int state0 = currentState.get(j, col);
                                          if ( !notedStates.containsInCol(state0, 0) )
                                          {
                                                notedStates.addToCol(state0, 0);
                                                history.set(getStatechart(state0), 0, state0);
                                                exitAction(state0);
                                             } // if
                                       } // for (j...
                                 } // if
                           } // for (i...
                        //remove all old states from currentState;
                        int col = notedCols.get(0, 0);
                        for ( int i = 0;i < notedCols.getNumberOfRows();i++ )
                        {
                              currentState.removeCol(notedCols.get(i, 0));
                           }
                        //raise the events and execute the sideeffekt;
                        //the highest state that is entered;
                        state = F_STATE_Shuttle1_myFrontRole_answer;
                        stateHight = 1;
                        //create new target states (history, hierarchy and parallelism make this to appear a little bit complicated);
                        newStates.setDimension(stateHight + 1, 1);
                        //go up from targetState to highest entry state "state";
                        newStates.set(1, 0 , F_STATE_Shuttle1_myFrontRole_answer);
                        //go down and check if there exists further orthogonal states and respect history;
                        addTargetSubStates(newStates, stateHight, 0, false);
                        //call all entry-Methods;
                        notedStates.removeAll();
                        for ( int i = stateHight;i < newStates.getNumberOfRows();i++ )
                        {
                              for ( int j = 0;j < newStates.getNumberOfCols();j++ )
                              {
                                    int state0 = newStates.get(i, j);
                                    if ( (state0 != NULL) && (!notedStates.containsInCol(state0, 0)) )
                                    {
                                          notedStates.addToCol(state0, 0);
                                          entryAction(state0);
                                       } // if
                                 } // for (j...
                           } // for (i...
                        //add newStates to currentStates;
                        currentState.addColsFrom(newStates);
                        for ( int i = 0;i < currentState.getNumberOfCols();i++ )
                        {
                              for ( int j = currentState.getNumberOfRows() - 2;j >= 0;j-- )
                              {
                                    int state0 = currentState.get(j, i);
                                    if ( state0 == NULL )
                                    {
                                          currentState.set(j, i, getParentState(currentState.get(j + 1, i)));
                                       } // if
                                 } // for j...
                           } // for i...
                        //some resets;
                        notedStates.removeAll();
                        newStates.removeAll();
                        break;
                     }
            case F_TRANSITION_noConvoy1State26:
                  {
                        //the highest state that is exited;
                        state = F_STATE_Shuttle1_myRearRole_noConvoy;
                        stateHight = 1;
                        //block all Cols that contain state and memorize these cols in notedCols;
                        for ( int j = 0;j < currentState.getNumberOfCols();j++ )
                        {
                              if ( currentState.get(stateHight, j) == state )
                              {
                                    currentState.blockCol(j);
                                    notedCols.addToCol(j, 0);
                                 } // if
                           } // for(j...)
                        //call all exit-Methods and memorize exited states for history;
                        for ( int i = 0;i < notedCols.getNumberOfRows();i++ )
                        {
                              int col = notedCols.get(i, 0);
                              if ( col != Matrix.NULL )
                              {
                                    for ( int j = currentState.getNumberOfRows() - 1;j >= stateHight ;j-- )
                                    {
                                          int state0 = currentState.get(j, col);
                                          if ( !notedStates.containsInCol(state0, 0) )
                                          {
                                                notedStates.addToCol(state0, 0);
                                                history.set(getStatechart(state0), 0, state0);
                                                exitAction(state0);
                                             } // if
                                       } // for (j...
                                 } // if
                           } // for (i...
                        //remove all old states from currentState;
                        int col = notedCols.get(0, 0);
                        for ( int i = 0;i < notedCols.getNumberOfRows();i++ )
                        {
                              currentState.removeCol(notedCols.get(i, 0));
                           }
                        //raise the events and execute the sideeffekt;
                        frontRole.convoyProposal();
                        //the highest state that is entered;
                        state = F_STATE_Shuttle1_myRearRole_wait;
                        stateHight = 1;
                        //create new target states (history, hierarchy and parallelism make this to appear a little bit complicated);
                        newStates.setDimension(stateHight + 1, 1);
                        //go up from targetState to highest entry state "state";
                        newStates.set(1, 0 , F_STATE_Shuttle1_myRearRole_wait);
                        //go down and check if there exists further orthogonal states and respect history;
                        addTargetSubStates(newStates, stateHight, 0, false);
                        //call all entry-Methods;
                        notedStates.removeAll();
                        for ( int i = stateHight;i < newStates.getNumberOfRows();i++ )
                        {
                              for ( int j = 0;j < newStates.getNumberOfCols();j++ )
                              {
                                    int state0 = newStates.get(i, j);
                                    if ( (state0 != NULL) && (!notedStates.containsInCol(state0, 0)) )
                                    {
                                          notedStates.addToCol(state0, 0);
                                          entryAction(state0);
                                       } // if
                                 } // for (j...
                           } // for (i...
                        //add newStates to currentStates;
                        currentState.addColsFrom(newStates);
                        for ( int i = 0;i < currentState.getNumberOfCols();i++ )
                        {
                              for ( int j = currentState.getNumberOfRows() - 2;j >= 0;j-- )
                              {
                                    int state0 = currentState.get(j, i);
                                    if ( state0 == NULL )
                                    {
                                          currentState.set(j, i, getParentState(currentState.get(j + 1, i)));
                                       } // if
                                 } // for j...
                           } // for i...
                        //some resets;
                        notedStates.removeAll();
                        newStates.removeAll();
                        break;
                     }
            case F_TRANSITION_State29State30:
                  {
                        //the highest state that is exited;
                        state = F_STATE_Shuttle1_Shuttle_Main_intermediate;
                        stateHight = 1;
                        //block all Cols that contain state and memorize these cols in notedCols;
                        for ( int j = 0;j < currentState.getNumberOfCols();j++ )
                        {
                              if ( currentState.get(stateHight, j) == state )
                              {
                                    currentState.blockCol(j);
                                    notedCols.addToCol(j, 0);
                                 } // if
                           } // for(j...)
                        //call all exit-Methods and memorize exited states for history;
                        for ( int i = 0;i < notedCols.getNumberOfRows();i++ )
                        {
                              int col = notedCols.get(i, 0);
                              if ( col != Matrix.NULL )
                              {
                                    for ( int j = currentState.getNumberOfRows() - 1;j >= stateHight ;j-- )
                                    {
                                          int state0 = currentState.get(j, col);
                                          if ( !notedStates.containsInCol(state0, 0) )
                                          {
                                                notedStates.addToCol(state0, 0);
                                                history.set(getStatechart(state0), 0, state0);
                                                exitAction(state0);
                                             } // if
                                       } // for (j...
                                 } // if
                           } // for (i...
                        //remove all old states from currentState;
                        int col = notedCols.get(0, 0);
                        for ( int i = 0;i < notedCols.getNumberOfRows();i++ )
                        {
                              currentState.removeCol(notedCols.get(i, 0));
                           }
                        //raise the events and execute the sideeffekt;
                        actionF_TRANSITION_State29State30();
                        //the highest state that is entered;
                        state = F_STATE_Shuttle1_Shuttle_Main_convoyFront;
                        stateHight = 1;
                        //create new target states (history, hierarchy and parallelism make this to appear a little bit complicated);
                        newStates.setDimension(stateHight + 1, 1);
                        //go up from targetState to highest entry state "state";
                        newStates.set(1, 0 , F_STATE_Shuttle1_Shuttle_Main_convoyFront);
                        //go down and check if there exists further orthogonal states and respect history;
                        addTargetSubStates(newStates, stateHight, 0, false);
                        //call all entry-Methods;
                        notedStates.removeAll();
                        for ( int i = stateHight;i < newStates.getNumberOfRows();i++ )
                        {
                              for ( int j = 0;j < newStates.getNumberOfCols();j++ )
                              {
                                    int state0 = newStates.get(i, j);
                                    if ( (state0 != NULL) && (!notedStates.containsInCol(state0, 0)) )
                                    {
                                          notedStates.addToCol(state0, 0);
                                          entryAction(state0);
                                       } // if
                                 } // for (j...
                           } // for (i...
                        //add newStates to currentStates;
                        currentState.addColsFrom(newStates);
                        for ( int i = 0;i < currentState.getNumberOfCols();i++ )
                        {
                              for ( int j = currentState.getNumberOfRows() - 2;j >= 0;j-- )
                              {
                                    int state0 = currentState.get(j, i);
                                    if ( state0 == NULL )
                                    {
                                          currentState.set(j, i, getParentState(currentState.get(j + 1, i)));
                                       } // if
                                 } // for j...
                           } // for i...
                        //some resets;
                        notedStates.removeAll();
                        lowerBound = 0 + t0[F_CLOCK_t0];
                        newStates.removeAll();
                        break;
                     }
         }
         long actionEnd = FMainThread.getTime();
         t0[F_CLOCK_INTERN] = activationTime;
         //resetActivationVariables();;
         if ( actionEnd > lowerBound )
         {
            getFMainThread().setLocationReached(actionEnd);
         } // if
         else
         {
            getFMainThread().setLocationReached(lowerBound);
         } // else
         startedTransition.removeFromCol(transition, 1, true);
         notedCols.removeYou();
         notedStates.removeYou();
         newStates.removeYou();
   }


   public void setGuardTime(long t)
   {
         for ( int i = 0;i < currentState.getNumberOfRows();i++ )
         {
            for ( int j = 0;j < currentState.getNumberOfCols();j++ )
            {
               int state = currentState.get(i, j);
               switch(state){
                  case F_STATE_Shuttle1_myFrontRole_answer:
                  case F_STATE_Shuttle1_myFrontRole_convoy:
                  case F_STATE_Shuttle1_Shuttle_Main_sub1_wait:
                  case F_STATE_Shuttle1_Shuttle_Main_intermediate:
                  case F_STATE_Shuttle1_Shuttle_Main_noConvoy:
                              if ( convoyUseful )
                              {
                                    if ( guardTime[F_TRANSITION_noConvoy1State31] == INFINITY )
                                    {
                                          guardTime[F_TRANSITION_noConvoy1State31] = t;
                                       }
                                 }
                              else
                              {
                                    guardTime[F_TRANSITION_noConvoy1State31] = INFINITY;
                                 }
                  case F_STATE_Shuttle1_myRearRole_noConvoy:
                  case F_STATE_Shuttle1_myRearRole_wait:
                  case F_STATE_Shuttle1_myRearRole_convoy:
                  case F_STATE_Shuttle1_Shuttle_Main_intermediate2:
                  case F_STATE_Shuttle1_Shuttle_Main_convoyRear:
                  case F_STATE_Shuttle1_Shuttle_Main_sub1_default:
                              if ( !convoyUseful )
                              {
                                    if ( guardTime[F_TRANSITION_State36State38] == INFINITY )
                                    {
                                          guardTime[F_TRANSITION_State36State38] = t;
                                       }
                                 }
                              else
                              {
                                    guardTime[F_TRANSITION_State36State38] = INFINITY;
                                 }
                  case F_STATE_Shuttle1_Shuttle_Main_convoyFront:
                  case F_STATE_Shuttle1_myFrontRole_noConvoy:
                  case F_STATE_Shuttle1_myFrontRole_wait:
                  case F_STATE_Shuttle1_Shuttle:
               }
            } // for(j...)
         } // for(i...)
   }


   public void startConvoy()
   {
         FRealtimeEvent event = FRealtimeEvent.createEvent ();
         event.setName ("startConvoy");
         event.setTime (FMainThread.getTime());
         getEventQueue().enqueueEvent(event);
   }


   public void startRealtimeStatechart()
   {
         FStarter starter;
         starter = new FStarter ( );
         starter.setHandler (this);
         starter.start ();
   }


   public void removeYou()
   {
         FMainThread tmpFMainThread = getFMainThread ();;
         if (tmpFMainThread != null)//;
         {
            setFMainThread (null);
         }
   }


}

