Exemplo n.º 1
0
        static TotalOrder()
        {
            var defaultBound = IntervalBound.Open(default(A)).ToOption();
            var noBound      = Option.Empty <IntervalBound <A> >();

            emptyInterval    = new Interval <A>(defaultBound, defaultBound, isEmpty: true);
            unbounedInterval = new Interval <A>(noBound, noBound, isEmpty: false);
            emptyIntervalSet = new IntervalSet <A>(Enumerable.Empty <Interval <A> >());
        }
Exemplo n.º 2
0
 /// <summary>
 /// Creates a new interval with the specified bounds.
 /// </summary>
 public Interval <A> Interval(IntervalBound <A> lowerBound = null, IntervalBound <A> upperBound = null)
 {
     return(Interval(lowerBound.ToOption(), upperBound.ToOption()));
 }
Exemplo n.º 3
0
 /// <summary>
 /// Creates an unbounded interval with closed upper bound.
 /// </summary>
 public Interval <A> UnboundedClosedInterval(A upperBound)
 {
     return(Interval(upperBound: IntervalBound.Closed(upperBound)));
 }
Exemplo n.º 4
0
 /// <summary>
 /// Creates an unbounded interval with open upper bound.
 /// </summary>
 public Interval <A> UnboundedOpenInterval(A upperBound)
 {
     return(Interval(upperBound: IntervalBound.Open(upperBound)));
 }
Exemplo n.º 5
0
 /// <summary>
 /// Creates an unbounded interval with closed lower bound.
 /// </summary>
 public Interval <A> ClosedUnboundedInterval(A lowerBound)
 {
     return(Interval(lowerBound: IntervalBound.Closed(lowerBound)));
 }
Exemplo n.º 6
0
 /// <summary>
 /// Creates an unbounded interval with open lower bound.
 /// </summary>
 public Interval <A> OpenUnboundedInterval(A lowerBound)
 {
     return(Interval(lowerBound: IntervalBound.Open(lowerBound)));
 }
Exemplo n.º 7
0
 /// <summary>
 /// Creates a closed interval with the specified bounds.
 /// </summary>
 public Interval <A> ClosedInterval(A lowerBound, A upperBound)
 {
     return(Interval(IntervalBound.Closed(lowerBound), IntervalBound.Closed(upperBound)));
 }
Exemplo n.º 8
0
 /// <summary>
 /// Creates an open interval with the specified bounds.
 /// </summary>
 public Interval <A> OpenInterval(A lowerBound, A upperBound)
 {
     return(Interval(IntervalBound.Open(lowerBound), IntervalBound.Open(upperBound)));
 }
Exemplo n.º 9
0
        /// <summary>
        /// Creates a new degenerate interval that consists of just one value.
        /// </summary>
        public Interval <A> SingleValueInterval(A value)
        {
            var bound = IntervalBound.Closed(value).ToOption();

            return(new Interval <A>(bound, bound, isEmpty: false));
        }