useDynLib(IRanges)

import(methods)
importFrom(utils, head, tail)
importFrom(stats, start, end, update, var, cov, cor, sd, median, quantile, mad,
           window, aggregate)

exportClasses(
    characterORNULL,
    ListLike,
    Ranges, RangesORmissing, IRanges, NormalIRanges, XRanges, IntervalTree,
    SequencePtr, RawPtr, IntegerPtr, NumericPtr,
    Sequence, Views,
    XSequence, XRaw, XInteger, XIntegerViews, XNumeric,
    Rle, RleViews,
    XRle, XRleInteger, XRleIntegerViews,
    MaskCollection,
    TypedList, AnnotatedList,
    LogicalList, IntegerList, NumericList, ComplexList,
    CharacterList, RawList, RleList,
    RangesList, IRangesList,
    XDataFrame, XDataFrameList, SplitXDataFrameList,
    RangedData, RangedDataList, FilterRules, RDApplyParams, RangesMatching)

export(
    ## Non-generic functions:
    setValidity2, new2,
    isTRUEorFALSE, isSingleInteger, isSingleNumber, isSingleString,
    isSingleIntegerOrNA, isSingleNumberOrNA, isSingleStringOrNA,
    isConstant,
    normargShift,
    normargWeight,
    sapplyLength,
    safeExplode,
    solveUserSEW0, IRanges, solveUserSEW,
    successiveIRanges,
    whichAsIRanges,
    asNormalIRanges,
    RangedData, updateRangedData, RangedDataList,
    FilterRules, RDApplyParams,
    RangesList,
    IRangesList,
    AnnotatedList,
    MaskCollection.show_frame,
    Mask,
    read.gapMask,
    read.agpMask,
    read.liftMask,
    read.rmMask,
    read.trfMask,
    ##read.chain,
    RawPtr, RawPtr.readInts, RawPtr.writeInts, RawPtr.read, RawPtr.write,
    RawPtr.copy, RawPtr.reverseCopy, RawPtr.readComplexes, RawPtr.append,
    RawPtr.compare,
    #IntegerPtr, IntegerPtr.read, IntegerPtr.write,
    #NumericPtr, NumericPtr.read, NumericPtr.write,
    XRaw, XInteger, XNumeric, XDataFrame,
    XRleInteger,
    newViews, successiveViews,
    updateTypedList,
    LogicalList, IntegerList, NumericList, ComplexList,
    CharacterList, RawList, RleList,
    XDataFrameList, SplitXDataFrameList,
    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 functions in the ListLike API:
    sapply,
    isEmpty,

    ## Generic functions in the Ranges API:
    width,
    mid,
    "start<-",
    "width<-",
    "end<-",
    shift,
    restrict,
    narrow,
    threebands,
    reduce,
    gaps,
    overlap, nearest, precede, follow,
    reflect,
    flank,
    punion, pintersect, psetdiff, pgap,
    overlap,
    disjoin, disjointBins,
    ##map,
    score,
    Rle, runLength, runValue, nrun, "runLength<-", "runValue<-", shiftApply,
    findRange, findRun,

    ## Other generic functions:
    isNormal,
    isDisjoint,
    whichFirstNotNormal,
    IntervalTree,
    reverse,
    coverage,
    nir_list,
    active, "active<-",
    maskedwidth, maskedratio,
    ranges,
    subseq, "subseq<-",
    subject, Views, subviews, trim,
    slice,
    values,
    viewApply, viewMins, viewMaxs, viewSums, viewWhichMins, viewWhichMaxs,
    viewRangeMins, viewRangeMaxs,
    cbind, rbind, table,
    rangedData, "rangedData<-", applyFun, "applyFun<-", applyParams,
    "applyParams<-", simplify, "simplify<-",
    ##excludePattern, "excludePattern<-",
    filterRules, "filterRules<-",
    reducerFun, "reducerFun<-", reducerParams, "reducerParams<-",
    rdapply,
    universe, "universe<-", space,
    elementClass, elementLengths,
    metadata, elementMetadata, "metadata<-", "elementMetadata<-",
    matchMatrix,

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

exportMethods(
    ## Methods for generics defined elsewhere:
    lapply,
    Arith,
    Ops, Math, Math2, Summary, Complex,
    coerce,
    show,
    summary,
    length,
    names, "names<-",
    "[", "[<-", "[[", "[[<-", "$",
    "==", "!=", duplicated, unique,
    "<=", ">=", "<", ">", order, sort, rank,
    rev,
    rep, rep.int,
    head, tail,
    start,
    end,
    max,
    min,
    range,
    pmax, pmin, pmax.int, pmin.int, diff,
    mean, var, cov, cor, sd, median, quantile, mad, window, aggregate,
    nchar, substr, substring, chartr, tolower, toupper, sub, gsub,
    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,
    t,
    is.na, "%in%",
    
    ## Methods for generics defined in this package:
    sapply,
    isEmpty,
    width,
    "start<-",
    "width<-",
    "end<-",
    isNormal,
    isDisjoint,
    whichFirstNotNormal,
    shift,
    restrict,
    narrow,
    threebands,
    reduce,
    gaps,
    punion, pintersect, psetdiff,
    reverse,
    coverage,
    nir_list,
    active, "active<-",
    desc, "desc<-",
    maskedwidth, maskedratio,
    subseq, "subseq<-",
    subject, Views, subviews, trim,
    Rle, runLength, runValue, nrun, "runLength<-", "runValue<-", shiftApply,
    findRange,
    viewApply, viewMins, viewMaxs, viewSums, viewWhichMins, viewWhichMaxs,

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