% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/simList-class.R
\docType{class}
\name{simList-class}
\alias{simList-class}
\alias{simList}
\alias{simList_-class}
\alias{simList_}
\title{The \code{simList} class}
\description{
Contains the minimum components of a \code{SpaDES} simulation.
Various slot accessor methods (i.e., get and set functions) are provided
(see 'Accessor Methods' below).
}
\details{
Based on code from chapter 7.8.3 of Matloff (2011): "Discrete event simulation".
Here, we implement a discrete event simulation in a more modular fashion so
it's easier to add simulation components (i.e., "simulation modules").
We use S4 classes and methods, and use \code{\link[data.table:data.table]{data.table::data.table()}} instead of
\code{\link[=data.frame]{data.frame()}} to implement the event queue (because it is much
more efficient).
}
\section{Slots}{

\describe{
\item{\code{modules}}{List of character names specifying which modules to load.}

\item{\code{params}}{Named list of potentially other lists specifying simulation
parameters.}

\item{\code{events}}{The list of scheduled events (i.e., event queue), which can
be converted to a sorted \code{data.table} with \code{events(sim)}.
See 'Event Lists' for more information.}

\item{\code{current}}{The current event, as a \code{data.table}.
See 'Event Lists' for more information..}

\item{\code{completed}}{An environment consisting of completed events, with
each object named a character representation of the order
of events. This was converted from a previous version which
was a list. This was changed because the list became
slow as number of events increased.
See 'Event Lists' for more information. It is kept
as an environment of individual events for speed. The \code{completed}
method converts it to a sorted \code{data.table}.}

\item{\code{depends}}{A \code{.simDeps} list of \code{\link[=.moduleDeps]{.moduleDeps()}} objects
containing module object dependency information.}

\item{\code{simtimes}}{List of numerical values describing the simulation start
and end times; as well as the current simulation time.}

\item{\code{inputs}}{a \code{data.frame} or \code{data.table} of files and
metadata}

\item{\code{outputs}}{a \code{data.frame}  or \code{data.table} of files and
metadata}

\item{\code{paths}}{Named list of paths. See \code{?.paths}. Partial matching is performed.}

\item{\code{.xData}}{Environment referencing the objects used in the simulation.
Several "shortcuts" to accessing objects referenced by this
environment are provided, and can be used on the
\code{simList} object directly instead of specifying the
\code{.xData} slot: \code{$}, \code{[[}, \code{ls},
\code{ls.str}, \code{objs}. See examples.}

\item{\code{.envir}}{Deprecated. Please do not use any more.}
}}

\note{
The \code{simList} class extends the \code{environment}, by adding
several slots that provide information about the metadata for a discrete
event simulation. The environment slot, if accessed directly is \code{.xData}
and this is where input and output objects from modules are placed.
The \code{\link[=simList_]{simList_()}} class is similar, but it extends the \code{list}
class. All other slots are the same.
Thus, \code{simList} is identical to \code{simList_}, except that the former
uses an environment for objects and the latter uses a list.
The class \code{simList_} is only used internally when saving/loading, because
saving/loading a list behaves more reliably than saving/loading an environment.
}
\section{Accessor Methods}{


Several slot (and sub-slot) accessor methods are provided for use, and
categorized into separate help pages:
\tabular{ll}{
\code{\link[=simList-accessors-envir]{simList-accessors-envir()}} \tab Simulation environment. \cr
\code{\link[=simList-accessors-events]{simList-accessors-events()}} \tab Scheduled and completed events. \cr
\code{\link[=simList-accessors-inout]{simList-accessors-inout()}} \tab Passing data in to / out of simulations. \cr
\code{\link[=simList-accessors-modules]{simList-accessors-modules()}} \tab Modules loaded and used; module dependencies. \cr
\code{\link[=simList-accessors-objects]{simList-accessors-objects()}} \tab Accessing objects used in the simulation. \cr
\code{\link[=simList-accessors-params]{simList-accessors-params()}} \tab Global and module-specific parameters. \cr
\code{\link[=simList-accessors-paths]{simList-accessors-paths()}} \tab File paths for modules, inputs, and outputs. \cr
\code{\link[=simList-accessors-times]{simList-accessors-times()}} \tab Simulation times. \cr
}
}

\section{Event Lists}{


The main event list is a sorted \code{data.table} (keyed) on \code{eventTime}, and \code{eventPriority.}
The completed event list is an ordered list in the exact order that the events were executed.
Each event is represented by a \code{\link[data.table:data.table]{data.table::data.table()}} row consisting of:
\tabular{ll}{
\code{eventTime} \tab The time the event is to occur.\cr
\code{moduleName} \tab The module from which the event is taken.\cr
\code{eventType} \tab A character string for the programmer-defined event type.\cr
\code{eventPriority} \tab The priority given to the event. \cr
}
}

\references{
Matloff, N. (2011). The Art of R Programming (ch. 7.8.3).
San Francisco, CA: No Starch Press, Inc. ISBN 978-1-59327-384-2.
}
\author{
Alex Chubaty and Eliot McIntire
}
