コード例 #1
0
ファイル: Ranges`1.cs プロジェクト: nh43de/deedle-cs
 public Ranges(IEnumerable <Tuple <T, T> > ranges, IRangeKeyOperations <T> ops)
 {
     Deedle.Ranges.Ranges <T> ranges1 = this;
     this.ops    = ops;
     this.ranges = (Tuple <T, T>[])ArrayModule.OfSeq <Tuple <T, T> >((IEnumerable <M0>)ranges);
     foreach (Tuple <T, T> tuple in this.ranges)
     {
         if (this.ops.Compare(tuple.Item1, tuple.Item2) > 0)
         {
             throw new ArgumentException("Invalid range (first offset is greater than second)", nameof(ranges));
         }
     }
 }
コード例 #2
0
ファイル: Ranges`1.cs プロジェクト: nh43de/deedle-cs
        public Deedle.Ranges.Ranges <T> MergeWith(IEnumerable <Deedle.Ranges.Ranges <T> > ranges)
        {
            IEnumerable <Deedle.Ranges.Ranges <T> > list = (IEnumerable <Deedle.Ranges.Ranges <T> >)SeqModule.ToList <Deedle.Ranges.Ranges <T> >((IEnumerable <M0>) new Ranges.MergeWith <T>(this, ranges, 0, (Deedle.Ranges.Ranges <T>)null));

            if (SeqModule.IsEmpty <Deedle.Ranges.Ranges <T> >((IEnumerable <M0>)list))
            {
                throw new ArgumentException("Range cannot be empty", nameof(ranges));
            }
            IRangeKeyOperations <T>    operations = ((Deedle.Ranges.Ranges <T>)SeqModule.Head <Deedle.Ranges.Ranges <T> >((IEnumerable <M0>)list)).Operations;
            FSharpList <Tuple <T, T> > fsharpList = (FSharpList <Tuple <T, T> >)ListModule.SortWith <Tuple <T, T> >((FSharpFunc <M0, FSharpFunc <M0, int> >) new Ranges.MergeWith <T>(operations), SeqModule.ToList <Tuple <T, T> >((IEnumerable <M0>) new Ranges.MergeWith <T>(list, (Deedle.Ranges.Ranges <T>)null, (IEnumerator <Deedle.Ranges.Ranges <T> >)null, (Tuple <T, T>)null, (IEnumerator <Tuple <T, T> >)null, 0, (Tuple <T, T>)null)));
            FSharpFunc <Tuple <T, T>, FSharpFunc <FSharpList <Tuple <T, T> >, IEnumerable <Tuple <T, T> > > > fsharpFunc = (FSharpFunc <Tuple <T, T>, FSharpFunc <FSharpList <Tuple <T, T> >, IEnumerable <Tuple <T, T> > > >) new Ranges.MergeWith <T>(operations);
            IRangeKeyOperations <T> ops = operations;

            return(new Deedle.Ranges.Ranges <T>((IEnumerable <Tuple <T, T> >)FSharpFunc <Tuple <T, T>, FSharpList <Tuple <T, T> > > .InvokeFast <IEnumerable <Tuple <T, T> > >((FSharpFunc <Tuple <T, T>, FSharpFunc <FSharpList <Tuple <T, T> >, M0> >)fsharpFunc, (Tuple <T, T>)ListModule.Head <Tuple <T, T> >((FSharpList <M0>)fsharpList), (FSharpList <Tuple <T, T> >)ListModule.Tail <Tuple <T, T> >((FSharpList <M0>)fsharpList)), ops));
        }