Exemplo n.º 1
0
 internal OpenClosedInterval(
     LowerOpenBoundary <TPoint, TPointComparer> lowerBoundary,
     UpperClosedBoundary <TPoint, TPointComparer> upperBoundary)
 {
     this.LowerBoundary = lowerBoundary;
     this.UpperBoundary = upperBoundary;
 }
        public InfinityClosedInterval(
            UpperClosedBoundary <TPoint, TPointComparer> upperBoundary)
        {
            LowerInfinityBoundary <TPoint, TPointComparer> lowerInfinityBoundary;

            this.LowerBoundary = lowerInfinityBoundary;
            this.UpperBoundary = upperBoundary;
        }
 public static int Compare <TPoint, TPointComparer>(
     this UpperClosedBoundary <TPoint, TPointComparer> leftClosed,
     UpperInfinityBoundary <TPoint, TPointComparer> rightClosed,
     TPointComparer pointComparer)
     where TPoint : notnull
     where TPointComparer : IComparer <TPoint>, new()
 {
     return(-1);
 }
 public static int Compare <TPoint, TPointComparer>(
     this UpperClosedBoundary <TPoint, TPointComparer> leftClosed,
     UpperClosedBoundary <TPoint, TPointComparer> rightClosed,
     TPointComparer pointComparer)
     where TPoint : notnull
     where TPointComparer : IComparer <TPoint>, new()
 {
     return(pointComparer.Compare(leftClosed.Point, rightClosed.Point));
 }
        public static int Compare <TPoint, TPointComparer>(
            this UpperOpenBoundary <TPoint, TPointComparer> leftClosed,
            UpperClosedBoundary <TPoint, TPointComparer> rightClosed,
            TPointComparer pointComparer)
            where TPoint : notnull
            where TPointComparer : IComparer <TPoint>, new()
        {
            var comparison = pointComparer.Compare(leftClosed.Point, rightClosed.Point);

            return(comparison == 0 ? 1 : comparison);
        }
Exemplo n.º 6
0
 public static IInterval <TPoint, TPointComparer> Build <TPoint, TPointComparer>(
     LowerOpenBoundary <TPoint, TPointComparer> lowerOpen,
     UpperClosedBoundary <TPoint, TPointComparer> upperClosed,
     TPointComparer pointComparer)
     where TPoint : notnull
     where TPointComparer : IComparer <TPoint>, new()
 {
     return(OpenClosedIntervalFactory.Build(
                lowerBoundary: lowerOpen,
                upperBoundary: upperClosed,
                pointComparer: pointComparer)
            .Match(
                closedInterval => (IInterval <TPoint, TPointComparer>)closedInterval,
                () => new EmptyInterval.EmptyInterval <TPoint, TPointComparer>()));
 }
        public static Option <OpenClosedInterval <TPoint, TPointComparer> > Build <TPoint, TPointComparer>(
            LowerOpenBoundary <TPoint, TPointComparer> lowerBoundary,
            UpperClosedBoundary <TPoint, TPointComparer> upperBoundary,
            TPointComparer pointComparer)
            where TPoint : notnull
            where TPointComparer : IComparer <TPoint>, new()
        {
            if (pointComparer.Compare(lowerBoundary.Point, upperBoundary.Point) > 0)
            {
                return(Option.None <OpenClosedInterval <TPoint, TPointComparer> >());
            }

            return(new OpenClosedInterval <TPoint, TPointComparer>(
                       lowerBoundary: lowerBoundary,
                       upperBoundary: upperBoundary)
                   .Some());
        }