mirror of
https://github.com/InsanusMokrassar/krontab.git
synced 2024-11-26 03:58:50 +00:00
CronDateTimeScheduler adding
This commit is contained in:
parent
3162780447
commit
4995a34c1a
@ -5,6 +5,8 @@
|
||||
* Versions:
|
||||
* `Coroutines`: `1.4.1` -> `1.4.2`
|
||||
* `Klock`: `2.0.0` -> `2.0.1`
|
||||
* `CronDateTimeScheduler` now is public
|
||||
* New functions for `CronDateTimeScheduler`
|
||||
* Add `CollectionKronScheduler`. It will give opportunity to unite several schedulers in one
|
||||
|
||||
## 0.4.0
|
||||
|
@ -17,7 +17,7 @@ import dev.inmo.krontab.anyCronDateTime
|
||||
* @see dev.inmo.krontab.builder.buildSchedule
|
||||
* @see dev.inmo.krontab.builder.SchedulerBuilder
|
||||
*/
|
||||
internal data class CronDateTimeScheduler internal constructor(
|
||||
data class CronDateTimeScheduler internal constructor(
|
||||
internal val cronDateTimes: List<CronDateTime>
|
||||
) : KronScheduler {
|
||||
/**
|
||||
@ -35,6 +35,17 @@ internal data class CronDateTimeScheduler internal constructor(
|
||||
* [kronDateTimeSchedulers] included
|
||||
*/
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
internal inline fun merge(kronDateTimeSchedulers: List<CronDateTimeScheduler>) = CronDateTimeScheduler(
|
||||
fun merge(kronDateTimeSchedulers: List<CronDateTimeScheduler>) = CronDateTimeScheduler(
|
||||
kronDateTimeSchedulers.flatMap { it.cronDateTimes }.distinct()
|
||||
)
|
||||
|
||||
/**
|
||||
* @return Vararg shortcyut for [merge]
|
||||
*/
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun merge(vararg kronDateTimeSchedulers: CronDateTimeScheduler) = merge(kronDateTimeSchedulers.toList())
|
||||
/**
|
||||
* Use [merge] operation to internalcreate new [CronDateTimeScheduler] with all [CronDateTimeScheduler.cronDateTimes]
|
||||
*/
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun CronDateTimeScheduler.plus(other: CronDateTimeScheduler) = merge(this, other)
|
||||
|
Loading…
Reference in New Issue
Block a user