# 
# Copyright (c) 2010, 2014, 2018 IBM Corp. All rights reserved.
# 		
# 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/>. 
#

importFrom("graphics", "hist")
importFrom("stats", "cov", "complete.cases", "pt", "runif", "setNames","terms", "weights",  "as.formula", "reshape")
importFrom("utils", "head", "object.size","capture.output", "write.table")
importFrom("methods", "show", "as", "new", "setMethod", "signature", "is")
importFrom("rpart.plot","prp")
importFrom("Matrix","Matrix", "sparseMatrix")
importFrom("grDevices", "dev.off", "png")

import(RODBC)
import(MASS)
import(arules)
import(rpart)
import(parallel)

S3method(predict, idaKMeans)
S3method(predict, idaTwoStep)
S3method(predict, idaDivCluster)
S3method(predict, idaNaiveBayes)
S3method(print, idaKMeans)
S3method(print, idaTwoStep)
S3method(print, idaDivCluster)
S3method(print, idaNaiveBayes)
S3method(predict, idaTree)
S3method(predict, idaLm)
S3method(plot, idaTree)
S3method(predict, idaGlm)
S3method(plot, idaLm)
S3method(print, idaLm)
S3method(print, idaGlm)

exportMethods("cov", "hist", "print",
   # ida.data.frame
	"as.data.frame", "[", "<=", "<", ">=", ">", "!=", "==",
	"dim", "NROW", "NCOL", "length", "head",  "names",
	"mean", "min", "max", "colnames", "sd", "var", "cov", "cor", "summary","as.vector",
	# ida.data.frame.rows
	"|", "&", "$", ifelse,as.character,as.integer,as.numeric)	

export(
	# ida.data.frame
	ida.data.frame, is.ida.data.frame,
	idaCreateView, idaDropView,
	as.ida.data.frame,
	
	# DB2 general
	idaShowTables, idaDeleteTable, idaExistTable,
	idaGetValidTableName, idaIsView, idaAppend,
	
	# DB2 for z/OS
	idaGetAccelerator, idaListAccelerators, idaGetAcceleratorDetails,
	
	# initialization
	idaInit, idaSetAccelerator,

	# query
	idaQuery, idaScalarQuery,
	
	#ida.list
	ida.list,is.ida.list,
	
	#Mining methods
	idaGlm,
	print.idaGlm,
	predict.idaGlm,
	idaLm,
	plot.idaLm,
	print.idaLm,
	predict.idaLm,
	idaKMeans,
	print.idaKMeans,
	predict.idaKMeans,
	idaTwoStep,
	print.idaTwoStep,
	predict.idaTwoStep,
	idaDivCluster,
	print.idaDivCluster,
	predict.idaDivCluster,
	idaNaiveBayes,
	predict.idaNaiveBayes,
	print.idaNaiveBayes,
	idaArule,
	idaApplyRules,
	idaTree,
	plot.idaTree,
	predict.idaTree,
  
	#Model management
	idaRetrieveModel,
	idaListModels,
	idaDropModel,
	idaModelExists,
	idaGetModelname,
	
	#Merge
	idaMerge,
	
	#Statistics and info
	idaTable,
	#idaTableDef,
	
	#Column definitions
	db.is.null,
		
	#Sampling
	idaSample,

	# Apply functions
	idaTApply,
 	
	#Original bluR functions
	idaClose,
	idaConnect,
	idadf,
	idaSave,
	idaUpdate
	
)
