
useDynLib(partykit, .registration = TRUE)

importFrom("utils", "getFromNamespace")
import("stats")
import("graphics")
import("grid")
import("Formula")
import("libcoin")
import("inum")
import("mvtnorm")
importFrom("survival",
  "survfit"
)
importFrom("rpart",
  "prune"
)
importFrom("strucchange",
  "sctest"
)
importFrom("grDevices",
  "gray.colors"
)
importFrom("utils",
  "capture.output",
  "head",
  "tail",
  "setTxtProgressBar",
  "txtProgressBar"
)

export(
  ## core infrastructure
  "party",
  "partynode",
  "partysplit",

  ## internal tree growing infrastructure
  "extree_data",
  "extree_fit",

  ## new ctree implementation
  "ctree",
  "ctree_control",

  ## new mob implementation
  "mob",
  "mob_control",


  ## mobsters
  "lmtree",
  "glmtree",

  ## new cforest implementation
  "cforest",

  "varimp",
  "gettree",

  ## as/is class generics
  "as.party",  
  "as.partynode",
  "as.constparty",
  "as.simpleparty",
  "is.constparty",
  "is.partynode",
  "is.simpleparty",

  ## new generics
  "is.terminal",
  "nodeapply",
  "nodeids",
  "width",
  "nodeprune",


  ## workhorse infrastructure
  "breaks_split",
  "character_split",
  "formatinfo_node",
  "data_party",

  "edge_simple",
  "fitted_node",
  "id_node",
  "index_split",
  "info_node",
  "info_split",
  "kidids_node",
  "kidids_split",
  "kids_node",
  "predict_party",
  "prob_split",
  "right_split",
  "split_node",
  "surrogates_node",
  "varid_split",

  ## visualization tools
  "node_barplot",
  "node_bivplot",
  "node_boxplot",
  "node_surv",
  "node_ecdf",
  "node_mvar",
  "node_inner",
  "node_party",
  "node_terminal",


  ## misc infrastructure
  "pmmlTreeModel",
  "get_paths",
  "model_frame_rpart"
)

## methods for class party
S3method("[", "party")
S3method("[[", "party")
S3method("as.simpleparty", "party")
S3method("depth", "party")
S3method("formula", "party")
S3method("getCall", "party")
S3method("getCall", "constparties")
S3method("length", "party")
S3method("model.frame", "party")
S3method("names", "party")
S3method("names<-", "party")
S3method("nodeapply", "party")
S3method("nodeids", "party")
S3method("predict", "party")
S3method("width", "party")
S3method("nodeprune", "party")
S3method("nodeprune", "partynode")
S3method("nodeprune", "default")
S3method("print", "party")
S3method("plot", "party")
S3method("data_party", "default")
S3method("predict_party", "default")

S3method("[[", "extree_data")
S3method("model.frame", "extree_data")

## methods for class partynode
S3method("[", "partynode")
S3method("[[", "partynode")
S3method("as.list", "partynode")
S3method("as.partynode", "partynode")
S3method("depth", "partynode")
S3method("is.terminal", "partynode")
S3method("length", "partynode")
S3method("nodeapply", "partynode")
S3method("nodeids", "partynode")
S3method("print", "partynode")
S3method("width", "partynode")

## methods for class constparty
S3method("as.simpleparty", "constparty")
S3method("plot", "constparty")
S3method("predict_party", "constparty")
S3method("print", "constparty")
S3method("varimp", "constparty")

## methods for class simpleparty
S3method("as.simpleparty", "simpleparty")
S3method("plot", "simpleparty")
S3method("predict_party", "simpleparty")
S3method("print", "simpleparty")

## methods for class modelparty
S3method("coef", "modelparty")
S3method("deviance", "modelparty")
S3method("fitted", "modelparty")
S3method("formula", "modelparty")
S3method("getCall", "modelparty")
S3method("logLik", "modelparty")
S3method("model.frame", "modelparty")
S3method("nobs", "modelparty")
S3method("residuals", "modelparty")
S3method("summary", "modelparty")
S3method("weights", "modelparty")
S3method("predict", "modelparty")
S3method("print", "modelparty")
S3method("plot", "modelparty")
S3method("prune", "modelparty")

## methods for class lmtree
S3method("plot", "lmtree")
S3method("predict", "lmtree")
S3method("print", "lmtree")
S3method("prune", "lmtree")

## methods for class glmtree
S3method("plot", "glmtree")
S3method("predict", "glmtree")
S3method("print", "glmtree")

## methods for class cforest
S3method("predict", "cforest")
S3method("varimp", "cforest")
S3method("gettree", "cforest")
S3method("model.frame", "cforest")

## misc methods
S3method("as.partynode", "list")
S3method("as.party", "Weka_tree")
S3method("as.party", "XMLNode")
S3method("as.simpleparty", "XMLNode")
S3method("as.party", "rpart")

S3method("sctest", "constparty")
S3method("sctest", "modelparty")

### starting in 1.3-0, we try to get rid of exported methods
### in partykit/R/S3.R, remove the first line to start
### issueing warnings
export(
  "varimp.constparty",
  "refit.modelparty",
  "predict.cforest",
  "varimp.cforest",
  "gettree.cforest",
  ## exported methods (to facilitate re-use)
  "plot.party",
  "predict.party",
  "print.party",
  "plot.modelparty",
  "predict.modelparty",
  "print.modelparty",
  "sctest.modelparty",
  "sctest.constparty",
  "prune.modelparty",
  "prune.lmtree",
  "nodeprune.party",
  "data_party.default",
  "predict_party.default",
  ## coercion methods for (non-imported) external classes
  "as.party.Weka_tree",
  "as.party.rpart",
  "as.party.XMLNode",
  "as.simpleparty.XMLNode")
