useDynLib(seriation)

import("TSP")
import("grid")
import("registry")

importFrom("graphics", "plot", "text", "title")
importFrom("stats", "reorder", "as.dist", "hclust", "runif", "rnorm",
  "as.dendrogram", "as.hclust", "nobs", "order.dendrogram", "heatmap",
  "cmdscale", "prcomp", "cor", "cor.test", "dist")

export(
    bertinplot,
    bertin_cut_line,
    ggbertinplot,
    criterion,
    dissplot,
    ggdissplot,
    get_method,
    get_order,
    get_rank,
    get_permutation_matrix,
    panel.bars,
    panel.circles,
    panel.rectangles,
    panel.tiles,
    panel.squares, # deprecated
    panel.blocks, # deprecated
    panel.lines,
    permute,
    ser_permutation,
    ser_permutation_vector,
    permutation_matrix2vector,
    permutation_vector2matrix,
    seriate,
    is.robinson,
    random.robinson,

    pimage,
    ggpimage,

    hmap,
    gghmap,

    path_dist,
    VAT,
    iVAT,
    ggVAT,
    ggiVAT,
    create_lines_data,
    create_ordered_data,

    orderplot,
    uniscale,

    bluered,
    greenred,
    reds,
    blues,
    greens,
    grays,
    greys,

    # local search
    LS_insert,
    LS_swap,
    LS_reverse,
    LS_mixed,

  ## registries
    set_criterion_method,
    get_criterion_method,
    list_criterion_methods,
    show_criterion_methods,
    set_seriation_method,
    get_seriation_method,
    list_seriation_methods,
    show_seriation_methods,
    registry_criterion,
    registry_seriate,

    ser_dist,
    ser_cor,
    ser_align,

    register_DendSer,
    register_tsne,
    register_umap,
    register_optics,
    register_GA,
    gaperm_mixedMutation
    )

S3method("c", "ser_permutation")
S3method("c", "ser_permutation_vector")
S3method("[", "ser_permutation")

S3method(criterion, dist)
S3method(criterion, matrix)
S3method(criterion, array)

S3method(get_order, ser_permutation_vector)
S3method(get_order, integer)
S3method(get_order, hclust)
S3method(get_order, dendrogram)
S3method(get_order, ser_permutation)
S3method(rev, ser_permutation_vector)

S3method(length, ser_permutation_vector)
# ser_permutations gets length from list

S3method(pimage, matrix)
S3method(pimage, dist)
S3method(ggpimage, matrix)
S3method(ggpimage, dist)

S3method(plot, reordered_cluster_dissimilarity_matrix)

S3method(print, ser_permutation_vector)
S3method(print, ser_permutation)
S3method(print, reordered_cluster_dissimilarity_matrix)
S3method(print, seriation_method)
S3method(print, criterion_method)

S3method(permute, array)
S3method(permute, matrix)
S3method(permute, numeric)
S3method(permute, list)
S3method(permute, dist)
S3method(permute, character)
S3method(permute, data.frame)
S3method(permute, hclust)
S3method(permute, dendrogram)

S3method(seriate, dist)
S3method(seriate, matrix)
S3method(seriate, array)
S3method(seriate, data.frame)

S3method(reorder, hclust)

S3method(summary, ser_permutation)
S3method(summary, ser_permutation_vector)
