useDynLib("partykit")
import("stats")
import("graphics")
import("grid")
importFrom("survival", "survfit")
importFrom("grDevices", "gray.colors")
importFrom("utils", "capture.output", "head", "tail",
           "setTxtProgressBar", "txtProgressBar")

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

  ## new ctree implementation
  "ctree",
  "ctree_control",
  "sctest.constparty",

  ## new mob implementation
  "mob",
  "mob_control",
  "refit.modelparty",
  "sctest.modelparty",
  "lmtree",
  "glmtree",

  ## new cforest implementation
  "cforest",
  "predict.cforest",

  ## 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",

  ## exported methods (to facilitate re-use)
  "plot.party",
  "print.party",
  "plot.modelparty",
  "predict.modelparty",
  "print.modelparty",
  "nodeprune.party",

  ## workhorse infrastructure
  "breaks_split",
  "character_split",
  "formatinfo_node",
  "data_party",
  "data_party.default",
  "edge_simple",
  "fitted_node",
  "id_node",
  "index_split",
  "info_node",
  "info_split",
  "kidids_node",
  "kidids_split",
  "kids_node",
  "predict_party",
  "predict_party.default",
  "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",

  ## coercion methods for (non-imported) external classes
  "as.party.Weka_tree",
  "as.party.rpart",
  "as.party.XMLNode",
  "as.simpleparty.XMLNode",

  ## misc infrastructure
  "model.frame.rpart",
  "pmmlTreeModel"
)

## methods for class party
S3method("[", "party")
S3method("[[", "party")
S3method("as.simpleparty", "party")
S3method("depth", "party")
S3method("getCall", "party")
S3method("length", "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("print", "party")
S3method("plot", "party")
S3method("data_party", "default")
S3method("predict_party", "default")

## 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")

## 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")

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

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

## methods for class cforest
S3method("predict", "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("model.frame", "rpart")
