new_rbundle()
is a developer focused tool that is not required for normal
usage of almanac. It constructs a new rbundle directly from a list of
existing rschedules.
rbundle_restore()
is a generic function that rbundle subclasses can provide
a method for. It dispatches off of to
. Its sole purpose is to restore
classes and fields of the subclass after calling any of the following
functions:
[list]
A list of rschedules.
[Date]
A vector of dates to forcibly include in the event set.
[Date]
A vector of dates to forcibly exclude from the event set.
[named dots]
Additional named elements added to the rbundle object.
[character]
An optional subclass.
[rbundle]
An updated rbundle that needs to be restored to the type of to
.
[rbundle subclass]
An rbundle subclass that you are restoring to.
new_rbundle()
returns a new rbundle.
rbundle_restore()
should return an rbundle subclass of the same type
as to
.
An rbundle is an abstract class that rintersect, runion, and rsetdiff all
inherit from. The sole purpose of an rbundle subclass is to implement an
rbundle_restore()
method that defines how to recover the original
rbundle subclass after adding a new rschedule, rdate, or exdate.
Additionally, because rbundles are also rschedules, a rschedule_events()
method must be implemented.
new_rbundle()
#> $rschedules
#> list()
#>
#> $rdates
#> Date of length 0
#>
#> $exdates
#> Date of length 0
#>
#> attr(,"class")
#> [1] "rbundle" "rschedule"
x <- daily()
y <- weekly()
rschedules <- list(x, y)
new_rbundle(rschedules)
#> $rschedules
#> $rschedules[[1]]
#> <rrule[daily / 1900-01-01 / 2100-01-01]>
#>
#> $rschedules[[2]]
#> <rrule[weekly / 1900-01-01 / 2100-01-01]>
#>
#>
#> $rdates
#> Date of length 0
#>
#> $exdates
#> Date of length 0
#>
#> attr(,"class")
#> [1] "rbundle" "rschedule"