% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/60-interval_index-methods.R
\name{merge.interval_index}
\alias{merge.interval_index}
\title{Merge Two Interval Indices}
\usage{
\method{merge}{interval_index}(x, y, ...)
}
\arguments{
\item{x}{An \code{interval_index}.}

\item{y}{An \code{interval_index}.}

\item{...}{Unused.}
}
\value{
A new \code{interval_index} of size \code{length(x) + length(y)}.
}
\description{
Returns a new \code{interval_index} containing every entry from both inputs,
preserving start-position order. On tied start positions, \code{x}'s entries
precede \code{y}'s (left-biased FIFO).
}
\details{
The merge runs in O(m + n) via a zipper-style traversal on interval
starts, with a fast path to O(log(min(m, n))) when the start ranges are
disjoint.

Both indices must share the same endpoint type and the same \code{bounds}
convention (e.g. \code{"[)"} half-open vs. \code{"[]"} closed), and the same
monoid set. Mismatches error.

The reserved monoids \code{.ivx_min_end} / \code{.ivx_max_end} recompute
automatically on the merged tree, so \code{min_endpoint()} / \code{max_endpoint()}
and interval-relation queries work immediately on the result.

Both inputs are left unmodified.
}
\examples{
a <- interval_index("A1", "A2", start = c(1, 5), end = c(4, 8))
b <- interval_index("B1", "B2", start = c(3, 7), end = c(6, 10))
m <- merge(a, b)
as.list(m)
}
