The OpenD Programming Language

NegInfInterval.intersection

Returns the intersection of two intervals

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

Parameters

interval PosInfInterval!TP

The interval to intersect with this interval.

Throws

std.datetime.date.DateTimeException if the two intervals do not intersect.

Examples

assert(NegInfInterval!Date(Date(2012, 3, 1)).intersection(
            PosInfInterval!Date(Date(1990, 7, 6))) ==
       Interval!Date(Date(1990, 7 , 6), Date(2012, 3, 1)));

assert(NegInfInterval!Date(Date(2012, 3, 1)).intersection(
            PosInfInterval!Date(Date(1999, 1, 12))) ==
       Interval!Date(Date(1999, 1 , 12), Date(2012, 3, 1)));

Meta