useDynLib(IRanges)

import(methods)
importFrom(utils, head, read.table, tail)
importFrom(stats, start, end, update, var, cov, cor, sd, median, quantile, mad,
           IQR, smoothEnds, runmed, window, "window<-", aggregate, xtabs)

exportClasses(
    characterORNULL,
    Annotated,
    Sequence,
    DataTable, DataTableORNULL,
    SimpleList, CompressedList,
    Ranges, RangesORmissing,
    IRanges, NormalIRanges,
    IntervalTree,
    Grouping, H2LGrouping, Dups,
    Partitioning, PartitioningByEnd, PartitioningByWidth,
    Binning,
    SharedVector, SharedVector_Pool,
    SharedRaw, SharedRaw_Pool,
    SharedInteger, SharedDouble,
    Views,
    XVector, XRaw, XInteger, XDouble,
    GroupedIRanges, XVectorList, XRawList,
    XIntegerViews,
    Rle, RleViews,
    MaskCollection,
    AtomicList, CompressedAtomicList, SimpleAtomicList,
    LogicalList, CompressedLogicalList, SimpleLogicalList,
    IntegerList, CompressedIntegerList, SimpleIntegerList,
    NumericList, CompressedNumericList, SimpleNumericList,
    ComplexList, CompressedComplexList, SimpleComplexList,
    CharacterList, CompressedCharacterList, SimpleCharacterList,
    RawList, CompressedRawList, SimpleRawList,
    RleList, CompressedRleList, SimpleRleList,
    RangesList, SimpleRangesList,
    IRangesList, CompressedIRangesList, SimpleIRangesList,
    RleViewsList, SimpleRleViewsList,
    DataFrame,
    DataFrameList, SimpleDataFrameList,
    SplitDataFrameList, CompressedSplitDataFrameList, SimpleSplitDataFrameList,
    RangedData, RangedDataList, FilterRules, RDApplyParams, RangesMatching)

export(
    ## Non-generic functions:
    setValidity2, new2,
    isTRUEorFALSE, isSingleInteger, isSingleNumber, isSingleString,
    isSingleIntegerOrNA, isSingleNumberOrNA, isSingleStringOrNA,
    isConstant,
    normargShift,
    normargWeight,
    safeExplode,
    strsplitAsListOfIntegerVectors,
    solveUserSEW0, IRanges, solveUserSEW,
    successiveIRanges,
    whichAsIRanges,
    asNormalIRanges,
    H2LGrouping, Dups, PartitioningByEnd, PartitioningByWidth, Binning,
    RangedData, RangedDataList,
    FilterRules, RDApplyParams,
    RangesList,
    IRangesList,
    RleViewsList,
    MaskCollection.show_frame,
    Mask,
    read.gapMask,
    read.agpMask,
    read.liftMask,
    read.rmMask,
    read.trfMask,
    ##read.chain,
    SharedVector.compare,
    SharedVector.copy,
    SharedRaw,
    SharedRaw.readInts, SharedRaw.writeInts,
    SharedRaw.read, SharedRaw.write,
    SharedRaw.readComplexes,
    #SharedInteger, SharedInteger.read, SharedInteger.write,
    #SharedDouble, SharedDouble.read, SharedDouble.write,
    XRaw, XInteger, XDouble, XNumeric,
    newViews, successiveViews,
    SimpleList, DataFrame,
    LogicalList, IntegerList, NumericList, ComplexList,
    CharacterList, RawList, RleList,
    DataFrameList, SplitDataFrameList,
    coverage.normargWidth,

    ## Functions to help migrating the interface of coverage() from "start/end"
    ## to "shift/width" (remove when migration is over):
    coverage.isCalledWithStartEndInterface,
    coverage.getShift0FromStartEnd,
    coverage.getWidthFromStartEnd,

    ## Generic endomorphism functions
    endoapply,
    mendoapply,

    ## Generic functions in the Sequence API:
    seqextract,
    seqselect, "seqselect<-",
    mapply,
    Map,
    isEmpty,

    ## Generic functions in the Ranges API:
    width,
    mid,
    "start<-",
    "width<-",
    "end<-",
    shift,
    restrict,
    narrow,
    resize,
    threebands,
    reduce,
    gaps,
    findOverlaps, overlap, countOverlaps, countOverlap,
    nearest, precede, follow,
    reflect,
    flank,
    punion, pintersect, psetdiff, pgap,
    disjoin, disjointBins,
    ##map,

    ## Generic functions in the Rle API:
    Rle, runLength, runValue, nrun, "runLength<-", "runValue<-", shiftApply,
    findRange, findRun,

    ## Generic functions in the Grouping API:
    nobj, grouplength, members, vmembers, togroup, togrouplength,
    high2low, low2high, grouprank, togrouprank,

    ## Generic functions in the DataTable API:
    as.env,
    
    ## Other generic functions:
    isNormal,
    isDisjoint,
    whichFirstNotNormal,
    IntervalTree,
    xvcopy,
    reverse,
    coverage,
    nir_list,
    active, "active<-",
    maskedwidth, maskedratio,
    collapse,
    ranges, "ranges<-",
    subseq, "subseq<-",
    subject, Views, subviews, trim,
    slice,
    values, "values<-",
    runmean, runsum, runwtsum, runq,
    viewApply, viewMins, viewMaxs, viewSums, viewMeans,
    viewWhichMins, viewWhichMaxs, viewRangeMins, viewRangeMaxs,
    cbind, rbind, table, xtabs,
    rangedData, "rangedData<-", applyFun, "applyFun<-", applyParams,
    "applyParams<-", simplify, "simplify<-",
    ##excludePattern, "excludePattern<-",
    filterRules, "filterRules<-",
    reducerFun, "reducerFun<-", reducerParams, "reducerParams<-",
    rdapply,
    universe, "universe<-", space, score, "score<-",
    elementType, elementLengths,
    metadata, elementMetadata, "metadata<-", "elementMetadata<-",
    matchMatrix, queryHits, subjectHits,

    ## Old stuff (Defunct or Deprecated):
    first, last,
    intToRanges, intToAdjacentRanges, toNormalIRanges,
    views
)

exportMethods(
    ## Methods for generics defined elsewhere:
    lapply, sapply,
    "[", "[<-", "[[", "[[<-", "$",
    "==", "!=", "<=", ">=", "<", ">",
    Ops, Math, Math2, Summary, Complex,
    coerce,
    show,
    summary,
    length, "length<-",
    names, "names<-",
    nrow, NROW, ncol, NCOL, dim,
    rownames, colnames, dimnames,
    "rownames<-", "colnames<-", "dimnames<-",
    duplicated, unique,
    order, sort, rank,
    rev,
    rep, rep.int,
    head, tail,
    start, end,
    min, max, range,
    pmax, pmin, pmax.int, pmin.int, diff,
    mean, var, cov, cor, sd, median, quantile, mad, IQR, smoothEnds, runmed,
    subset, window, "window<-", aggregate,
    nchar, substr, substring, chartr, tolower, toupper, sub, gsub,
    levels, "levels<-",
    as.vector,
    as.logical, as.integer, as.numeric, as.complex, as.character, as.raw,
    as.factor,
    as.matrix,
    as.data.frame,
    as.list,
    as.table,
    toString,
    unlist,
    update,
    append,
    "!", which,
    c,
    union, intersect, setdiff,
    split,
    eval, with,
    t,
    is.na, "%in%", by, match,
    Reduce, Filter, Find, Position,
    updateObject,

    ## Methods for generics defined in this package:
    endoapply,
    mendoapply,
    seqselect, "seqselect<-",
    mapply,
    Map,
    isEmpty,
    width,
    "start<-",
    "width<-",
    "end<-",
    isNormal,
    isDisjoint,
    whichFirstNotNormal,
    shift,
    restrict,
    narrow,
    resize,
    threebands,
    reduce,
    gaps,
    punion, pintersect, psetdiff,
    xvcopy,
    reverse,
    coverage,
    nobj, grouplength, members, vmembers, togroup, togrouplength,
    high2low, low2high, grouprank, togrouprank,
    nir_list,
    active, "active<-",
    desc, "desc<-",
    maskedwidth, maskedratio,
    collapse,
    subseq, "subseq<-",
    subject, Views, subviews, trim,
    Rle, runLength, runValue, nrun, "runLength<-", "runValue<-", shiftApply,
    findRange,
    runmean, runsum, runwtsum, runq,
    viewApply, viewMins, viewMaxs, viewSums, viewMeans,
    viewWhichMins, viewWhichMaxs,

    ## Old stuff (Defunct or Deprecated):
    first, last
)
