-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cross village interaction #97
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
a7982e8
Bump version & change Thomas' email
ThomasThelen 259464b
Add a village manager to ocontain villages
ThomasThelen 27af05f
Fix enumerating villages & readme example
ThomasThelen 8e8c5d3
Fix vignettes to include villager_mgr
ThomasThelen 6822e6f
Update workflow versions
ThomasThelen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 |
---|---|---|
@@ -1,12 +1,12 @@ | ||
Package: villager | ||
Title: A Framework for Designing and Running Agent Based Models | ||
Version: 1.2.2 | ||
Version: 2.0.0 | ||
Authors@R: c( | ||
person( | ||
given = "Thomas", | ||
family = "Thelen", | ||
role = c("aut", "cre"), | ||
email = "[email protected]" | ||
email = "[email protected]" | ||
), | ||
person( | ||
given = "Gerardo", | ||
|
@@ -31,7 +31,7 @@ License: MIT + file LICENSE | |
Encoding: UTF-8 | ||
LazyData: false | ||
Roxygen: list(markdown = TRUE) | ||
RoxygenNote: 7.1.1 | ||
RoxygenNote: 7.3.1 | ||
Depends: R (>= 3.5.0) | ||
Imports: | ||
readr, | ||
|
@@ -46,7 +46,8 @@ Suggests: | |
remotes, | ||
rmarkdown, | ||
testthat, | ||
roxygen2, | ||
pandoc, | ||
URL: https://github.com/zizroc/villager/ | ||
BugReports: https://github.com/zizroc/villager/issues/ | ||
VignetteBuilder: knitr | ||
|
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
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,52 @@ | ||
#' @export | ||
#' @title Village Manager | ||
#' @docType class | ||
#' @description This object manages all of the villages. It acts as an interface to them | ||
#' @section Methods: | ||
#' \describe{ | ||
#' \item{\code{initialize()}}{Creates a new manager} | ||
#' \item{\code{get_villages()}}{Gets all of the villages that the manager has} | ||
#' \item{\code{get_village()}}{Retrieves a specific village from the manager, by name} | ||
#' \item{\code{add_village()}}{Adds a village to the manager} | ||
#' } | ||
village_manager <- R6::R6Class( | ||
"village_manager", | ||
public = list( | ||
#' @field villages A list of village objects | ||
villages = NULL, | ||
#' Creates a new, village manager | ||
#' @description Get a new instance of a village_manager | ||
initialize = function(villages) { | ||
self$villages <- villages | ||
}, | ||
|
||
#' Gets all of the managed villages | ||
#' | ||
#' @return A list of resources | ||
get_villages = function() { | ||
return(self$villages) | ||
}, | ||
|
||
#' Gets a village given a village name | ||
#' | ||
#' @param name The name of the requested village | ||
#' @return A village object | ||
get_village = function(name) { | ||
for (village in self$villages) { | ||
if (village$name == name) { | ||
return(village) | ||
} | ||
} | ||
}, | ||
|
||
#' Adds a village to the manager. | ||
#' | ||
#' @param ... The villages to add | ||
#' @return None | ||
add_resource = function(...) { | ||
for (new_village in list(...)) { | ||
self$villages <- append(self$villages, new_village) | ||
} | ||
} | ||
) | ||
) |
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
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.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine, though haven't tested it.