-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c1a5425
commit 086242e
Showing
5 changed files
with
132 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# date Adjustment Attribute | ||
|
||
|
||
# Class ---------------------------- | ||
|
||
#' An S4 class for a date adjustment attribute | ||
#' @slot name the name of the attribute | ||
#' @slot startWith character string either START_DATE or END_DATE | ||
#' @slot startOffset an integer value, default 0 | ||
#' @slot endWith character string either START_DATE or END_DATE | ||
#' @slot endOffset an integer value, default 0 | ||
setClass("dateAdjustmentAttribute", | ||
slots = c(name = "character", | ||
startWith = "character", | ||
startOffset = "integer", | ||
endWith = "character", | ||
endOffset = "integer" | ||
), | ||
prototype = list( | ||
name = "DateAdjustment", | ||
startWith = "START_DATE", | ||
startOffset = 0L, | ||
endWith = "END_DATE", | ||
endOffset = 0L | ||
) | ||
) | ||
|
||
# Builder ----------------- | ||
|
||
#' Function to create age attribute | ||
#' @param startWith character string either START_DATE or END_DATE | ||
#' @param startOffset an integer value, default 0 | ||
#' @param endWith character string either START_DATE or END_DATE | ||
#' @param endOffset an integer value, default 0 | ||
#' @return A dateAdjustment attribute class that can be used with a query | ||
#' @export | ||
dateAdjustment <- function(startWith = "START_DATE", | ||
startOffset = 0L, | ||
endWith = "END_DATE", | ||
endOffset = 0L) { | ||
|
||
|
||
methods::new("dateAdjustmentAttribute", | ||
startWith = startWith, | ||
startOffset = startOffset, | ||
endWith = endWith, | ||
endOffset = endOffset) | ||
|
||
} | ||
|
||
# Coercion -------------- | ||
|
||
setMethod("as.list", "dateAdjustmentAttribute", function(x) { | ||
|
||
atr <- list( | ||
StartWith = x@startWith, | ||
StartOffset = x@startOffset, | ||
EndWith = x@endWith, | ||
EndOffset = x@endOffset) | ||
|
||
tibble::lst(`:=`(!!x@name, atr)) | ||
}) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters