Ejemplo n.º 1
0
 internal HeuristicSearchSelectMany(HeuristicSearchBase <TSource, TStep> source,
                                    Func <TSource, int, IEnumerable <TCollection> > collectionSelector, Func <TSource, TCollection, TFactor> factorSelector)
     : base(source.From, source.To, source.StepComparer, source.Expander)
 {
     _source             = source;
     _collectionSelector = collectionSelector;
     _factorSelector     = factorSelector;
 }
Ejemplo n.º 2
0
        public static HeuristicSearchBase <TFactor, TStep> Reverse <TFactor, TStep>(this HeuristicSearchBase <TFactor, TStep> source)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }

            source.IsReversed = !source.IsReversed;

            return(source);
        }
Ejemplo n.º 3
0
        public static HeuristicSearchBase <TResult, TStep> Contains <TResult, TStep>(this HeuristicSearchBase <TResult, TStep> source, IEnumerable <TResult> collection)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }
            if (collection == null)
            {
                throw new ArgumentNullException(nameof(collection));
            }

            return(new HeuristicSearchContains <TResult, TStep>(source, collection, null));
        }
Ejemplo n.º 4
0
        public static HeuristicSearchBase <TResult, TStep> Where <TResult, TStep>(this HeuristicSearchBase <TResult, TStep> source, Func <TResult, int, bool> predicate)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }
            if (predicate == null)
            {
                throw new ArgumentNullException(nameof(predicate));
            }

            return(new HeuristicSearchWhere <TResult, TStep>(source, predicate));
        }
Ejemplo n.º 5
0
        public static HeuristicSearchBase <TFactor, TStep> Where <TFactor, TStep>(this HeuristicSearchBase <TFactor, TStep> source, Func <TFactor, bool> predicate)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }
            if (predicate == null)
            {
                throw new ArgumentNullException(nameof(predicate));
            }

            return(new HeuristicSearchWhere <TFactor, TStep>(source, (r, i) => predicate(r)));
        }
Ejemplo n.º 6
0
        public static HeuristicSearchBase <TFactor, TStep> Contains <TFactor, TStep>(this HeuristicSearchBase <TFactor, TStep> source, IEnumerable <TFactor> collection, IEqualityComparer <TFactor> comparer)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }
            if (collection == null)
            {
                throw new ArgumentNullException(nameof(collection));
            }

            return(new HeuristicSearchContains <TFactor, TStep>(source, collection, comparer));
        }
Ejemplo n.º 7
0
        public static HeuristicSearchBase <TFactor, TStep> Except <TFactor, TStep>(this HeuristicSearchBase <TFactor, TStep> source, IEnumerable <TFactor> collection)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }
            if (collection == null)
            {
                throw new ArgumentNullException(nameof(collection));
            }

            return(new HeuristicSearchExcept <TFactor, TStep>(source, collection, null));
        }
Ejemplo n.º 8
0
 public HeuristicSearchSelect(HeuristicSearchBase <TSource, TStep> source, Func <TSource, int, TFactor> selector)
     : base(source.From, source.To, source.StepComparer, source.Expander)
 {
     _source   = source;
     _selector = selector;
 }
Ejemplo n.º 9
0
        public static HeuristicSearchOrderBy <TResult, TStep> OrderBy <TResult, TKey, TStep>(this HeuristicSearchBase <TResult, TStep> source, Func <TResult, TKey> keySelector, IComparer <TKey> comparer)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }
            if (keySelector == null)
            {
                throw new ArgumentNullException(nameof(keySelector));
            }

            return(new HeuristicSearchOrderBy <TResult, TStep>(source, HeuristicSearch.CreateComparer <TResult, TKey, TStep>(keySelector, comparer, false)));
        }
Ejemplo n.º 10
0
 internal HeuristicSearchExcept(HeuristicSearchBase <TResult, TStep> source, IEnumerable <TResult> collection, IEqualityComparer <TResult> comparer)
     : base(source)
 {
     _collection = collection;
     _comparer   = comparer;
 }
Ejemplo n.º 11
0
        public static HeuristicSearchOrderBy <TFactor, TStep> OrderBy <TFactor, TStep>(this HeuristicSearchBase <TFactor, TStep> source, Func <TFactor, ushort> keySelector)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }
            if (keySelector == null)
            {
                throw new ArgumentNullException(nameof(keySelector));
            }

            return(new HeuristicSearchOrderBy <TFactor, TStep>(source, new HeuristicComparer <TFactor, TStep>(keySelector, false)));
        }
Ejemplo n.º 12
0
        public static HeuristicSearchOrderBy <TFactor, TStep> OrderByDescending <TFactor, TKey, TStep>(this HeuristicSearchBase <TFactor, TStep> source, Func <TFactor, TKey> keySelector, IComparer <TKey> comparer)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }
            if (keySelector == null)
            {
                throw new ArgumentNullException(nameof(keySelector));
            }

            return(new HeuristicSearchOrderBy <TFactor, TStep>(source, new NormalComparer <TFactor, TKey, TStep>(keySelector, null, true)));
        }
Ejemplo n.º 13
0
 public static HeuristicSearchOrderBy <TFactor, TStep> OrderByDescending <TFactor, TKey, TStep>(this HeuristicSearchBase <TFactor, TStep> source, Func <TFactor, TKey> keySelector)
 {
     return(OrderByDescending(source, keySelector, null));
 }
Ejemplo n.º 14
0
        public static HeuristicSearchBase <TFactor, TStep> SelectMany <TSource, TCollection, TFactor, TStep>(this HeuristicSearchBase <TSource, TStep> source, Func <TSource, int, IEnumerable <TCollection> > collectionSelector, Func <TSource, TCollection, TFactor> factorSelector)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }
            if (collectionSelector == null)
            {
                throw new ArgumentNullException(nameof(collectionSelector));
            }
            if (factorSelector == null)
            {
                throw new ArgumentNullException(nameof(factorSelector));
            }

            return(new HeuristicSearchSelectMany <TSource, TCollection, TFactor, TStep>(source, collectionSelector, factorSelector));
        }
Ejemplo n.º 15
0
 public static HeuristicSearchOrderBy <TResult, TStep> OrderBy <TResult, TKey, TStep>(this HeuristicSearchBase <TResult, TStep> source, Func <TResult, TKey> keySelector)
 {
     return(OrderBy(source, keySelector, null));
 }
Ejemplo n.º 16
0
 internal HeuristicSearchContains(HeuristicSearchBase <TFactor, TStep> source, IEnumerable <TFactor> collection, IEqualityComparer <TFactor> comparer)
     : base(source)
 {
     _collection = collection;
     _comparer   = comparer;
 }
Ejemplo n.º 17
0
 internal HeuristicSearchBase(HeuristicSearchBase <TFactor, TStep> source)
     : this(source.From, source.To, source.StepComparer, source.Converter, source.Expander)
 {
     _source = source;
 }
Ejemplo n.º 18
0
 internal HeuristicSearchOrderBy(HeuristicSearchBase <TFactor, TStep> source, INodeComparer <TFactor, TStep> nodeComparer)
     : base(source)
 {
     _nodeComparer = nodeComparer;
 }
Ejemplo n.º 19
0
        public static HeuristicSearchBase <TResult, TStep> SelectMany <TSource, TCollection, TResult, TStep>(this HeuristicSearchBase <TSource, TStep> source, Func <TSource, IEnumerable <TCollection> > collectionSelector, Func <TSource, TCollection, TResult> resultSelector)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }
            if (collectionSelector == null)
            {
                throw new ArgumentNullException(nameof(collectionSelector));
            }
            if (resultSelector == null)
            {
                throw new ArgumentNullException(nameof(resultSelector));
            }

            return(new HeuristicSearchSelectMany <TSource, TCollection, TResult, TStep>(source, (s, i) => collectionSelector(s), resultSelector));
        }
Ejemplo n.º 20
0
        public static HeuristicSearchBase <TResult, TStep> SelectMany <TSource, TResult, TStep>(this HeuristicSearchBase <TSource, TStep> source, Func <TSource, int, IEnumerable <TResult> > selector)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }
            if (selector == null)
            {
                throw new ArgumentNullException(nameof(selector));
            }

            return(new HeuristicSearchSelectMany <TSource, TResult, TStep>(source, selector));
        }
Ejemplo n.º 21
0
 internal HeuristicSearchWhere(HeuristicSearchBase <TFactor, TStep> source, Func <TFactor, int, bool> predicate)
     : base(source)
 {
     _predicate = predicate;
 }
Ejemplo n.º 22
0
        public static HeuristicSearchBase <TFactor, TStep> Select <TSource, TFactor, TStep>(this HeuristicSearchBase <TSource, TStep> source, Func <TSource, TFactor> selector)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }
            if (selector == null)
            {
                throw new ArgumentNullException(nameof(selector));
            }

            return(new HeuristicSearchSelect <TSource, TFactor, TStep>(source, (s, i) => selector(s)));
        }