public static Interval <V> ClosedStartOpenEnd <V>(V start, V end) where V : IComparable <V> { ValidatePointValueNotNull <V>(start); ValidatePointValueNotNull <V>(end); ValidateStartBeforeEnd(start, end); return(new Interval <V>(IntervalPoint <V> .Closed(start), IntervalPoint <V> .Open(end))); }
public static Interval <V> OpenBetween <V>(Maybe <V> start, Maybe <V> end) where V : IComparable <V> { var startIntervalPoint = IntervalPoint <V> .PositiveInfinity <V>(); var endIntervalPoint = IntervalPoint <V> .NegativeInfinity <V>(); if (start.HasValue) { ValidatePointValueNotNull <V>(start.Value); startIntervalPoint = IntervalPoint <V> .Open(start.Value); } if (end.HasValue) { ValidatePointValueNotNull <V>(end.Value); endIntervalPoint = IntervalPoint <V> .Open(end.Value); } if (start.HasValue && end.HasValue) { ValidateStartBeforeEnd(start.Value, end.Value); } return(new Interval <V>(startIntervalPoint, endIntervalPoint)); }
public static Interval <V> InfinityStartOpenEnd <V>(V end) where V : IComparable <V> { ValidatePointValueNotNull <V>(end); return(new Interval <V>(IntervalPoint <V> .NegativeInfinity <V>(), IntervalPoint <V> .Open(end))); }
public static Interval <V> OpenStartInfinityEnd <V>(V start) where V : IComparable <V> { ValidatePointValueNotNull <V>(start); return(new Interval <V>(IntervalPoint <V> .Open(start), IntervalPoint <V> .PositiveInfinity <V>())); }