/** This method is called from a SimProcessAnimation which wants to cooperate as a slave. */
 public boolean waitOnCoop() {
   SimProcess slave = this.currentSimProcess();
   boolean out;
   TimeInstant simTime = this.getModel().presentTime();
   boolean init = this.cmdGen.isInitPhase();
   Command c;
   String[] insertSlave = {
     slave.getName(), Integer.toString(slave.getPriority()), this.slavePriorityAttribute
   };
   if (this.showInAnimation) {
     try {
       if (init) c = Command.getCommandInit("setWaitQueue", this.cmdGen.getAnimationTime(simTime));
       else c = Command.getCommandTime("setWaitQueue", this.cmdGen.getAnimationTime(simTime));
       c.addParameter("WaitQueueId", this.id);
       c.addParameter("InsertSlave", Parameter.cat(insertSlave));
       c.setRemark(this.getGeneratedBy(WaitQueueAnimation.class.getSimpleName()));
       cmdGen.checkAndLog(c);
       cmdGen.write(c);
     } catch (CommandException e1) {
       // TODO Auto-generated catch block
       e1.printStackTrace();
     }
   }
   out = super.waitOnCoop();
   return out;
 }
Beispiel #2
0
  /**
   * Activates the given SimProcess and schedules him right after the current process. Then the
   * process is responsible to check if the desired condition has become true. This is done in the
   * method <code>waitUntil()</code>.
   *
   * @param process SimProcess : The process that will be activated now to check its condition.
   */
  protected void activateAsNext(SimProcess process) {
    _where = "protected void activateAsNext (SimProcess process)";

    if (process != null) // if queue is not empty or a successor is found
    {
      if (!checkProcess(process, _where)) // if next is a null pointer or
      {
        return;
      } // not modelcompatible just return

      if (process.isScheduled()) // different from DESMO, see DESMO-C
      {
        process.skipTraceNote(); // don't tell the user, that we ...
        process.cancel(); // get the process from the event-list
      }

      boolean wasBlocked = process.isBlocked();
      if (wasBlocked) {
        process.setBlocked(false); // the process is not blocked
        // anymore
        // and
      } // ready to become activated

      process.skipTraceNote(); // don't tell the user, that we ...
      process.activateAfter(current()); // activate process after
      // current
      // process

      if (wasBlocked) {
        process.setBlocked(true); // the process status is still
        // "blocked"
      } // end inner if
    } // end outer if otherwise no one is to be activated
  }