24
24
# ' @param .trj the trajectory object.
25
25
# ' @inheritParams select
26
26
# ' @param resource the name of the resource.
27
- # ' @param amount the amount to seize/release, accepts either a numeric or a callable
28
- # ' object (a function) which must return a numeric.
27
+ # ' @param amount the amount to seize/release, accepts either a numeric or a
28
+ # ' callable object (a function) which must return a numeric.
29
29
# ' @param continue a boolean (if \code{post.seize} OR \code{reject} is defined)
30
30
# ' or a pair of booleans (if \code{post.seize} AND \code{reject} are defined; if
31
31
# ' only one value is provided, it will be recycled) to indicate whether these
32
32
# ' subtrajectories should continue to the next activity in the main trajectory.
33
- # ' @param post.seize an optional trajectory object which will be followed after a successful seize.
34
- # ' @param reject an optional trajectory object which will be followed if the arrival is rejected.
33
+ # ' @param post.seize an optional trajectory object which will be followed after
34
+ # ' a successful seize.
35
+ # ' @param reject an optional trajectory object which will be followed if the
36
+ # ' arrival is rejected. Note that if the arrival is accepted (either in the
37
+ # ' queue or in the server) and then it is dropped afterwards due to preemption
38
+ # ' or resource shrinkage, then this trajectory won't be executed. Instead, see
39
+ # ' \code{\link{handle_unfinished}} for another, more general, method for
40
+ # ' handling all kinds of unfinished arrivals.
35
41
# '
36
42
# ' @return Returns the trajectory object.
37
43
# ' @seealso \code{\link{select}}, \code{\link{set_capacity}}, \code{\link{set_queue_size}},
@@ -353,12 +359,37 @@ rollback.trajectory <- function(.trj, amount, times=Inf, check=NULL) .trj$rollba
353
359
# ' @param prob a probability or a function returning a probability.
354
360
# '
355
361
# ' @return Returns the trajectory object.
362
+ # '
363
+ # ' @details Arrivals that leave the trajectory will set the \code{finished} flag
364
+ # ' to \code{FALSE} in the output of \code{\link{get_mon_arrivals}}. Unfinished
365
+ # ' arrivals can be handled with a drop-out trajectory that can be set using the
366
+ # ' \code{\link{handle_unfinished}} activity.
367
+ # '
368
+ # ' @seealso \code{\link{handle_unfinished}}, \code{\link{renege_in}}
356
369
# ' @export
357
370
leave <- function (.trj , prob ) UseMethod(" leave" )
358
371
359
372
# ' @export
360
373
leave.trajectory <- function (.trj , prob ) .trj $ leave(prob )
361
374
375
+ # ' Handle Unfinished Arrivals
376
+ # '
377
+ # ' Activity for setting a drop-out trajectory for unfinished arrivals, i.e.,
378
+ # ' those dropped from a resource (due to preemption, resource shrinkage or a
379
+ # ' rejected \code{\link{seize}}) or those that \code{\link{leave}} a trajectory.
380
+ # '
381
+ # ' @inheritParams seize
382
+ # ' @param handler trajectory object to handle unfinished arrivals. A \code{NULL}
383
+ # ' value will unset the drop-out trajectory.
384
+ # '
385
+ # ' @return Returns the trajectory object.
386
+ # ' @seealso \code{\link{leave}}, \code{\link{set_capacity}}
387
+ # ' @export
388
+ handle_unfinished <- function (.trj , handler ) UseMethod(" handle_unfinished" )
389
+
390
+ # ' @export
391
+ handle_unfinished.trajectory <- function (.trj , handler ) .trj $ handle_unfinished(handler )
392
+
362
393
# ' Renege on some Condition
363
394
# '
364
395
# ' Activities for setting or unsetting a timer or a signal after which the arrival will abandon.
@@ -379,7 +410,7 @@ renege_in.trajectory <- function(.trj, t, out=NULL) .trj$renege_in(t, out)
379
410
# ' (a function) which must return a string.
380
411
# '
381
412
# ' @rdname renege_in
382
- # ' @seealso \code{\link{send}}
413
+ # ' @seealso \code{\link{send}}, \code{\link{leave}}
383
414
# ' @export
384
415
renege_if <- function (.trj , signal , out = NULL ) UseMethod(" renege_if" )
385
416
0 commit comments