#' Bring items forward
#'
#' Move selected items to the start of a list.
#'
#' @param ll list to adjust item order.
#' @param items vector of items to bring to the front. Any not in the list will
#'        be ignored.
#'
#' @return list with selected items first
bringItemsForward <- function(ll, items) {

    checkmate::check_list(ll, min.len = 1, names = "unique")
    checkmate::check_character(items, any.missing = FALSE, min.len = 1,
                               unique = TRUE)

    items <- items[items %in% names(ll)]

    if (length(items) > 0) {
        ll.front <- ll[items]
        ll.back <- ll[!(names(ll) %in% items)]

        ll <- c(ll.front, ll.back)
    }

    return(ll)
}

#' cum_discr_si
#'
#' cum_discr_si
#'
#' @param vecTimeSinceExp ?
#' @param scale ?
#' @param shape ?
#' 
#' @return Value of coefficient of variation for vector
#' @importFrom stats sd
cum_discr_si <- function(vecTimeSinceExp, scale, shape) {
    vlen <- length(vecTimeSinceExp)
    if (vlen > 0) {
        probVec <- numeric(vlen)
        for (p in 1:vlen) {
            probVec[p] <- pweibull(vecTimeSinceExp[p], shape=shape, scale=scale)
        }
    } else {
        probVec <- 0    
    }
    return(probVec)
}