# ----------------------------------------------------------------------

useDynLib(phylobase)

#----------------------------------------------------------------------

import(methods)
importFrom(graphics, plot)
importFrom(stats, reorder)
importFrom(utils, head, tail)

#----------------------------------------------------------------------

exportClasses(phylo4, phylo4d, multiPhylo4, multiPhylo4d)

#----------------------------------------------------------------------

# utility methods
exportMethods(print, head, tail, reorder, plot, summary)

# tree constructor methods
exportMethods(phylo4, phylo4d)

# counting methods
exportMethods(nTips, nNodes, nEdges, depthTips)

# edge methods
exportMethods(edges, edgeId, hasEdgeLength, edgeLength, "edgeLength<-",
    sumEdgeLength, edgeOrder)

# root methods
exportMethods(isRooted, rootNode, "rootNode<-")
#export(rootEdge)  # no methods defined yet?

# node methods
exportMethods(nodeId, nodeType, nodeDepth)

# tree properties methods
exportMethods(isUltrametric)

# tree data methods
exportMethods(tdata, "tdata<-", tipData, "tipData<-", nodeData,
    "nodeData<-", hasTipData, hasNodeData, addData, nData)

# subset methods
exportMethods(subset, prune, "[")

# pdata methods
exportMethods("[<-", "[[", "[[<-")

# label methods
exportMethods(labels, "labels<-", nodeLabels, "nodeLabels<-",
    tipLabels, "tipLabels<-", edgeLabels, "edgeLabels<-",
    hasNodeLabels, hasEdgeLabels, hasDuplicatedLabels)

#----------------------------------------------------------------------

# tree structure functions
export(hasPoly, hasSingle, hasRetic)

# treewalk functions
export(getNode, ancestor, children, descendants, siblings, ancestors,
    MRCA, shortestPath, getEdge)

# Import functions
export(readNexus)
export(readNewick)
export(readNCL)

# pdata functions
export(pdata, check_pdata)

# plotting functions
export(treePlot, plotOneTree, tip.data.plot)
export(phyloXXYY, phylobubbles)

# misc functions
export(extractTree, tbind)
export(checkPhylo4, checkTree, checkPhylo4Data, formatData)
export(as_phylo4vcov)
export(printphylo4)

#----------------------------------------------------------------------

# misc objects
export(phylo4_orderings)

## options
export(phylobase.options)

importFrom(ade4,newick2phylog)
## commented out in source code, probably should be omitted here
#export(phyloStripchart)
#export(internEdges, terminEdges, isPoly)

## presumably these should remain hidden
##export(.createLabels, .createEdge, .phylo4Data, orderIndex, .genlab,
##    .chnumsort, .phylo4ToDataFrame, .bubLegendGrob)
## hidden: drawDetails.bubLegend)

## recently removed:
##  tree.plot
##  segs
##  checkData
##  attachData
##  orderIndex

#----------------------------------------------------------------------
## For reference, quick & dirty UNIX-y commandline statements to pull
## out methods and functions from package code; use in pkg/R/ dir:
# grep "^ *setMethod" *.R | sed 's/setMethod(//' | sed 's/.*:["]\([^,]*\)["].*/\1/' | sort | uniq
# grep "^ *setReplaceMethod" *.R | sed 's/setReplaceMethod(//' | sed 's/.*:["]\([^,]*\)["].*/\1/' | sort | uniq
# grep "^[^ ].*<- *function *(" *.R | sed 's/.*R://'

