/** * Schedules this event to act the given entities at the specified point in simulation time * determined by a sample from the distribution provided to the method. The sample is interpreted * as offset from the the present time in the reference time unit. * * @param who1 E : The first entity this event happens to * @param who2 F : The second entity this event happens to * @param dist NumericalDist<?> : Numerical distribution to sample the offset to the current * simulation time from * @see SimClock */ public void schedule(E who1, F who2, NumericalDist<?> dist) { if ((dist == null)) { sendWarning( "Can't schedule Event!", "Event : " + getName() + " Method: schedule(E who1, F who2, NumericalDist<?> dist)", "The NumericalDist given as parameter is a null reference.", "Be sure to have a valid NumericalDist reference before calling " + "this method."); return; // no proper parameter } if ((who1 == null)) { sendWarning( "Can't schedule Event!", "Event : " + getName() + " Method: schedule(E who1, F who2, NumericalDist<?> dist)", "The first entity given as parameter is a null reference.", "Be sure to have a valid Entity reference for this event to " + "be scheduled with."); return; // no proper parameter } if ((who2 == null)) { sendWarning( "Can't schedule Event!", "Event : " + getName() + " Method: schedule(E who1, F who2, NumericalDist<?> dist)", "The second entity given as parameter is a null reference.", "Be sure to have a valid Entity reference for this event to " + "be scheduled with."); return; // no proper parameter } if (isScheduled()) { sendWarning( "Can't schedule Event! Command ignored.", "Event : " + getName() + " Method: schedule(E who1, F who2, NumericalDist<?> dist)", "The event to be scheduled is already scheduled.", "Use method events only once, do not use them multiple " + "times."); return; // was already scheduled } if (!isModelCompatible(who1)) { sendWarning( "Can't schedule Event! Command ignored", "Entity : " + getName() + " Method: schedule(E who1, F who2, NumericalDist<?> dist)", "The first entity to be scheduled with this event is not " + "modelcompatible.", "Make sure to use compatible model components only."); return; // is not compatible } if (!isModelCompatible(who2)) { sendWarning( "Can't schedule Event! Command ignored", "Entity : " + getName() + " Method: schedule(E who1, F who2, NumericalDist<?> dist)", "The second entity to be scheduled with this event is not " + "modelcompatible.", "Make sure to use compatible model components only."); return; // is not compatible } // determine time span TimeSpan dt = dist.sampleTimeSpan(); // generate trace this.generateTraceForScheduling( who1, who2, null, null, null, TimeOperations.add(presentTime(), dt), " Sampled from " + dist.getQuotedName() + "."); // schedule Event getModel().getExperiment().getScheduler().schedule(who1, who2, this, dt); if (currentlySendDebugNotes()) { sendDebugNote( "schedules on EventList<br>" + getModel().getExperiment().getScheduler().toString()); } }
/** * Returns a <code>SimTime</code> object representing the time it takes to unload the containers * (goods) with the transporter or crane. The time is taken from the given random number stream * unloadTimeStream. * * @return desmoj.SimTime : The time it takes to unload the containers (goods) with the * transporter/crane. */ protected SimTime getUnloadTimeSample() { return new SimTime(unloadTimeStream.sample().doubleValue()); }