예제 #1
0
 public static IEnumerable <SequentialPair <TValue> > PairwiseEnumerable <TValue>(
     this SequentialQuad <TValue> source)
 {
     for (var i = 0; i >= source.Count - 2; i++)
     {
         yield return(source.PairIndex(i));
     }
 }
예제 #2
0
 public static SequentialQuad <TResult> Select <TSource, TResult>(
     this SequentialQuad <TSource> source,
     Func <TSource, TResult> selector)
 {
     return(new SequentialQuad <TResult>(
                selector(source.Value1),
                selector(source.Value2),
                selector(source.Value3),
                selector(source.Value4)));
 }
예제 #3
0
        private static SequentialPair <TValue> PairIndex <TValue>(
            this SequentialQuad <TValue> source,
            int index)
        {
            if (index >= source.Count - 1)
            {
                throw new IndexOutOfRangeException();
            }

            return(new SequentialPair <TValue>(
                       source[index],
                       source[index + 1]));
        }
예제 #4
0
        public static SequentialTriple <SequentialPair <TValue> > Pairwise <TValue>(
            this SequentialQuad <TValue> source,
            int index)
        {
            if (index >= source.ValueArray.Count - 1)
            {
                throw new IndexOutOfRangeException();
            }

            throw new NotImplementedException();
            //return new SequentialPair<TValue>(
            //  ValueArray[index],
            //  ValueArray[index + 1]);
        }
예제 #5
0
        //public static SequentialQuad<TResult> SelectWithLast<TSource, TResult>(
        //  this SequentialTriple<TSource> source,
        //  Func<TSource, TResult> selector,
        //  TResult seed)
        //{
        //  TResult selectMethod(

        //    Func<TSource, TResult> _selector,
        //    TResult last,
        //    TResult current)
        //  {

        //  }
        //  return new SequentialQuad<TResult>(
        //    ,
        //    selector(source.Value2),
        //    selector(source.Value3));
        //}



        public static SequentialTriple <SequentialPair <TValue> > Pairwise <TValue>(
            this SequentialQuad <TValue> source)
        {
            var pairWiseArray = source
                                .PairwiseEnumerable()
                                .ToArray();

            if (pairWiseArray.Length != 3)
            {
                throw new IndexOutOfRangeException();
            }

            return(SequentialSetFactory.Build(
                       pairWiseArray[0],
                       pairWiseArray[1],
                       pairWiseArray[2]));
        }