## Copyright (C) 2012 Marius Hofert and Martin Maechler
##
## This program is free software; you can redistribute it and/or modify it under
## the terms of the GNU General Public License as published by the Free Software
## Foundation; either version 3 of the License, or (at your option) any later
## version.
##
## This program is distributed in the hope that it will be useful, but WITHOUT
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
## details.
##
## You should have received a copy of the GNU General Public License along with
## this program; if not, see <http://www.gnu.org/licenses/>.


### Imports ####################################################################

##  codetoolsBioC::writeNamespaceImports("simsalapar") :
##- #Generated by codetoolsBioC version 0.0-24

importClassesFrom("methods", character, list, namedList)

importMethodsFrom("colorspace", show)
importMethodsFrom("methods", coerce, "coerce<-")

## Standard Packages

importFrom("stats", median, runif, setNames)

importFrom("utils", packageVersion, str, tail, toLatex)

importFrom("methods", as, "as<-", is, new, setAs, setClass, coerce,
           getDataPart, slot, "slot<-")

importFrom("grDevices", adjustcolor, axisTicks, colorRampPalette,
           dev.off, extendrange)
importFrom("graphics", axTicks, axis, boxplot.matrix, lines,
             mtext, par, plot.new, plot.window)

## "grid": --> below

importFrom("parallel", detectCores, makeCluster, stopCluster, clusterExport,
	   mclapply,
	   clusterApply, clusterApplyLB, clusterCall,
	   nextRNGStream)

## only used in doRmpi():
## importFrom("Rmpi", mpi.universe.size, mpi.comm.size,
##            mpi.spawn.Rslaves, mpi.close.Rslaves,
##            mpi.bcast.Robj2slave, mpi.apply, mpi.applyLB)

## both of these packages are used only for doForeach():
## as 'iterators' do not work when imported, require() everything in doForeach():
## importFrom("foreach", foreach, "%dopar%", getDoParWorkers)
## importFrom("doParallel", registerDoParallel)

## simulation analysis: plots (apart from package 'graphics'): --> R/graphics.R
importFrom("sfsmisc", eaxis)
importFrom("colorspace", heat_hcl, hex2RGB)
importFrom("gridBase", gridPLT)

importFrom("grid"
	   , gpar, unit, is.unit, unit.c, is.grob
	   , viewport, pushViewport, popViewport, upViewport
	   , grob, rectGrob, textGrob, pointsGrob, polylineGrob, nullGrob
           , linesGrob, segmentsGrob, frameGrob, packGrob
           , gTree, gList, grobTree
	   , grid.rect, grid.text, grid.polyline, grid.points
           , grid.grill
	   , grid.draw, grid.layout, grid.show.layout)
if(getRversion() >= "3.1.0")# now (2015-11) required by DESCRIPTION
    importFrom("grid", legendGrob, grid.legend)


### Exports ####################################################################

exportClasses(varlist)

## Various auxiliary functions
export(varlist, doRes.equal, doCheck,
       mkGrid, mkNms, getEl, get.n.sim, set.n.sim, get.nonGrids,
       tryCatch.W.E, doCallWE, LEseeds, printInfo, subjob, mkTimer,
       doLapply, doForeach, doRmpi, doMclapply, doClusterApply,
       ul, fftable, mkAL, saveSim, maybeRead, getArray, dimnames2varlist,
       dev.off.pdf)

exportMethods(coerce, # <- setAs()
              show)

S3method("$<-", varlist)
S3method("[", varlist)
S3method(print, varlist)

## varList -> LaTeX table
export(expr2latex, escapeLatex)

## simulation analysis: for producing tables
export(wrapLaTable, tablines, cattablines)
S3method(toLatex, varlist)
S3method(toLatex, ftable)
if(getRversion() <= "3.0.1") { ## ftable(<array>, dimnames=list(A=NULL,..))
  importFrom("stats", ftable)
  S3method(ftable, array)
  S3method(ftable, matrix)
}


## simulation analysis: for producing graphics
export(array2df)
export(mayplot)
