The OpenD Programming Language

Interval.intersection

Returns the intersection of two intervals

  1. Interval intersection(Interval interval)
  2. Interval intersection(PosInfInterval!TP interval)
  3. Interval intersection(NegInfInterval!TP interval)
    struct Interval(TP)
    const
    intersection
    (
    scope const NegInfInterval!TP interval
    )

Parameters

interval NegInfInterval!TP

The interval to intersect with this interval.

Throws

std.datetime.date.DateTimeException if the two intervals do not intersect or if this interval is empty.

Examples

assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).intersection(
            NegInfInterval!Date(Date(1999, 7, 6))) ==
       Interval!Date(Date(1996, 1 , 2), Date(1999, 7, 6)));

assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).intersection(
            NegInfInterval!Date(Date(2013, 1, 12))) ==
       Interval!Date(Date(1996, 1 , 2), Date(2012, 3, 1)));

Meta