Exemplo n.º 1
0
        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));
        }
Exemplo n.º 2
0
 public static Interval <V> InfinityStartInfinityEnd <V>() where V : IComparable <V>
 {
     return(new Interval <V>(IntervalPoint <V> .NegativeInfinity <V>(), IntervalPoint <V> .PositiveInfinity <V>()));
 }
Exemplo n.º 3
0
 public static Interval <V> InfinityStartClosedEnd <V>(V end) where V : IComparable <V>
 {
     ValidatePointValueNotNull <V>(end);
     return(new Interval <V>(IntervalPoint <V> .NegativeInfinity <V>(), IntervalPoint <V> .Closed(end)));
 }