useDynLib("arules", .registration = TRUE)

import("methods")
import("graphics")
importFrom("stats", "predict", "aggregate", "confint")
importFrom("Matrix", "summary", "image", "t", 
  "head", "tail", "drop0", "diag")
importClassesFrom("Matrix", "dgCMatrix", "ngCMatrix")
importMethodsFrom("Matrix", "crossprod", "rowSums", "colSums")

export(
  "addAggregate",
  "apriori", 
  "discretize",
  "discretizeDF",
  "eclat",
  "filterAggregate",
  "fim4r",
  "hits",
  "itemsets",
  "random.transactions", 
  "random.patterns",
  "read.transactions", 
  "read.PMML", 
  "rules",
  "toLongFormat",
  "transactions",
  "write.PMML", 
  "weclat"
  )

exportClasses(
  "ASparameter", "AScontrol",
  "APparameter", "APcontrol", "APappearance",
  "ECparameter", "ECcontrol",
  "ar_similarity", "ar_cross_dissimilarity", 
  "associations", "summary.associations",
  "itemMatrix", "summary.itemMatrix",
  "itemsets", "summary.itemsets",
  "transactions", "summary.transactions",
  "tidLists", "summary.tidLists", 
  "rules", "summary.rules"
)

exportMethods(
  "%in%",
  "%ain%",
  "%oin%",
  "%pin%",
  "LIST",
  "DATAFRAME",
  "[",
  "aggregate",
  "abbreviate",
  "addComplement",
  "compatible",
  "coverage",
  "crossTable",
  "c", 
  "coerce",           ### for setAs
  "decode", 
  "dim", 
  "dimnames", "dimnames<-",
  "duplicated",
  "encode",
  "generatingItemsets",
  "head",
  "image", 
  "info", "info<-", 
  "initialize", 
  "inspect", 
  "intersect", 
  "itemInfo", "itemInfo<-", 
  "itemsetInfo", "itemsetInfo<-", 
  "items", "items<-",
  "itemLabels", "itemLabels<-", 
  "itemFrequency", 
  "itemFrequencyPlot",
  "itemUnion",
  "itemSetdiff",
  "itemIntersect",
  "is.significant",
  "is.redundant",
  "is.closed",
  "is.element",
  "is.maximal",
  "is.generator",
  "is.subset",
  "is.superset",
  "labels", 
  "length", 
  "lhs", "lhs<-",
  "match",
  "merge",
  "interestMeasure",
  "nitems",
  "quality", "quality<-",
  "recode",
  "rhs", "rhs<-", 
  "ruleInduction",
  "sample",
  "setdiff",
  "setequal",
  "show", 
  "size",
  "sort",
  "tail",
  "write",
  "subset", 
  "summary", 
  "support", 
  "supportingTransactions", 
  "t", 
  "tidLists", 
  "transactionInfo", "transactionInfo<-",
  "union",
  "unique",
  "affinity", 
  "predict",
  "dissimilarity"
)

export("plot.itemMatrix",
       "plot.associations"
)
S3method(plot, associations)
S3method(plot, itemMatrix)

S3method(confint, rules)

# register S4 methods also as S3 methods to avoid name clashes with other packages
importFrom("generics", "union", "intersect", "setequal", "setdiff", "is.element")
S3method("union", "associations")
S3method("union", "itemMatrix")
S3method("intersect", "associations")
S3method("intersect", "itemMatrix")
S3method("setequal", "associations")
S3method("setequal", "itemMatrix")
S3method("setdiff", "associations")
S3method("setdiff", "itemMatrix")
S3method("is.element", "associations")
S3method("is.element", "itemMatrix")