Esempio n. 1
1
        private void InitializeQueries()
        {
            seqQuery = from n in names
                       where n.Name.Equals(queryInfo.Name, StringComparison.InvariantCultureIgnoreCase) &&
                             n.State == queryInfo.State && 
                             n.Year >= yearStart && n.Year <= yearEnd
                       orderby n.Year ascending
                       select n;

            parQuery = from n in names.AsParallel().WithDegreeOfParallelism(ProcessorsToUse.Value)
                       where n.Name.Equals(queryInfo.Name, StringComparison.InvariantCultureIgnoreCase) &&
                             n.State == queryInfo.State && 
                             n.Year >= yearStart && n.Year <= yearEnd
                       orderby n.Year ascending
                       select n;
        }
Esempio n. 2
0
 public int Each(int count, System.Linq.ParallelQuery info)
 {
     if (TypeChoose.SelectedValue.ToString() == "textBox")
     {
         foreach (var item in info)
         {
             TextOut.Text += Frame((string)item) + "\n" + item + "\n";
             //Console.WriteLine(Frame((string)item));
             //Console.WriteLine(item);
             count++;
         }
     }
     if (TypeChoose.SelectedValue.ToString() == "listBox")
     {
         foreach (var item in info)
         {
             ListOut.Items.Add(
                 Frame((string)item) + "\n" + item + "\n"
                 );
             //Console.WriteLine(Frame((string)item));
             //Console.WriteLine(item);
             count++;
         }
     }
     return(count);
 }
Esempio n. 3
0
 void IsEmptyRecur(string path, ParallelQuery<string> files)
 {
     string pathToTest = path.EndsWith(@"\") ? path : path + @"\";
     if (files.Any(f => f.IndexOf(pathToTest.ToLower()) >= 0))
     {
         var dirs = Directory.EnumerateDirectories(path);
         foreach (var dir in dirs)
         {
             IsEmptyRecur(dir, files);
         }
     }
     else
     {
         // empty
         lbFolders.Items.Add(path);
     }
 }
Esempio n. 4
0
        private static List<tagLibrary.Objects.FileTags> ConvertLocalTypesToFileTags(ParallelQuery<tagLibrary.Objects.FileInformationLocalTypes> data)
        {
            var tagInfo = data
                            .AsParallel()
                            .Select(m =>
                            new tagLibrary.Objects.FileTags(
                                m.FileName,
                                m.TagInfo.Genres.ToList(),
                                m.TagInfo.Album,
                                m.Name,
                                m.Properties.AudioBitrate,
                                m.Properties.Duration,

                                m.TagInfo.AlbumArtists.ToList(),
                                m.TagInfo.Track,
                                m.TagInfo.Year
                            )
                            )

                            .ToList();
            return tagInfo;
        }
Esempio n. 5
0
        public Hero GetAllyHero(ParallelQuery<Hero> allies)
        {
            switch (Type)
            {
                case GetHeroType.ModifierSource:
                    return allies.FirstOrDefault(x => x.Equals(Source));
                case GetHeroType.LowestHealthPct:
                    return
                        allies.Where(x => x.HasModifier(Modifier.Name))
                            .OrderByDescending(x => x.Equals(Hero))
                            .ThenBy(x => x.Health / x.MaximumHealth)
                            .FirstOrDefault();
                case GetHeroType.LowestHealth:
                    return
                        allies.Where(x => x.HasModifier(Modifier.Name))
                            .OrderByDescending(x => x.Equals(Hero))
                            .ThenBy(x => x.Health)
                            .FirstOrDefault();
                case GetHeroType.ClosestToSource:
                    return
                        allies.Where(x => x.Distance2D(Source) <= MaximumDistanceToSource)
                            .OrderBy(x => x.Distance2D(Source))
                            .FirstOrDefault();
            }

            return null;
        }
Esempio n. 6
0
 public static void Intersect_SourceMultiple(ParallelQuery<int> leftQuery, int leftCount, ParallelQuery<int> rightQuery, int rightCount, int count)
 {
     int seen = 0;
     Assert.All(leftQuery.Intersect(rightQuery), x => Assert.Equal(seen++, x));
     Assert.Equal(count, seen);
 }
Esempio n. 7
0
 public static ParallelQuery <TResult> Select <TSource, TResult>(this ParallelQuery <TSource> source, Func <TSource, TResult> selector)
 {
     throw new NotImplementedException();
 }
Esempio n. 8
0
 public static TSource LastOrDefault <TSource>(this ParallelQuery <TSource> source, Func <TSource, bool> predicate)
 {
     throw new NotImplementedException();
 }
Esempio n. 9
0
 public static Dictionary <TKey, TElement> ToDictionary <TSource, TKey, TElement>(this ParallelQuery <TSource> source, Func <TSource, TKey> keySelector, Func <TSource, TElement> elementSelector)
 {
     throw new NotImplementedException();
 }
Esempio n. 10
0
 public static ILookup <TKey, TElement> ToLookup <TSource, TKey, TElement>(this ParallelQuery <TSource> source, Func <TSource, TKey> keySelector, Func <TSource, TElement> elementSelector, IEqualityComparer <TKey> comparer)
 {
     throw new NotImplementedException();
 }
Esempio n. 11
0
 public static bool Contains <TSource>(this ParallelQuery <TSource> source, TSource value, IEqualityComparer <TSource> comparer)
 {
     throw new NotImplementedException();
 }
Esempio n. 12
0
 public static double Average(this ParallelQuery <double> source)
 {
     throw new NotImplementedException();
 }
Esempio n. 13
0
 public static Nullable <decimal> Average <TSource>(this ParallelQuery <TSource> source, Func <TSource, Nullable <decimal> > selector)
 {
     throw new NotImplementedException();
 }
Esempio n. 14
0
 public static bool Contains <TSource>(this ParallelQuery <TSource> source, TSource value)
 {
     throw new NotImplementedException();
 }
Esempio n. 15
0
 public static double Average <TSource>(this ParallelQuery <TSource> source, Func <TSource, double> selector)
 {
     throw new NotImplementedException();
 }
Esempio n. 16
0
 public static Nullable <decimal> Average(this ParallelQuery <Nullable <decimal> > source)
 {
     throw new NotImplementedException();
 }
Esempio n. 17
0
 public static decimal Average(this ParallelQuery <decimal> source)
 {
     throw new NotImplementedException();
 }
Esempio n. 18
0
 public static void Union_SourceMultiple(ParallelQuery<int> leftQuery, int leftCount, ParallelQuery<int> rightQuery, int rightCount, int count)
 {
     int seen = 0;
     Assert.All(leftQuery.AsOrdered().Union(rightQuery.AsOrdered()), x => Assert.Equal(seen++, x));
     Assert.Equal(count, seen);
 }
Esempio n. 19
0
 public static ParallelQuery <TSource> Skip <TSource>(this ParallelQuery <TSource> source, int count)
 {
     throw new NotImplementedException();
 }
Esempio n. 20
0
 public static void Union_SecondOrdered_SourceMultiple_Longrunning(ParallelQuery<int> leftQuery, int leftCount, ParallelQuery<int> rightQuery, int rightCount, int count)
 {
     Union_SecondOrdered_SourceMultiple(leftQuery, leftCount, rightQuery, rightCount, count);
 }
Esempio n. 21
0
 public static bool SequenceEqual <TSource>(this ParallelQuery <TSource> first, IEnumerable <TSource> second)
 {
     throw new NotImplementedException();
 }
Esempio n. 22
0
 public static Nullable <double> Max <TSource>(this ParallelQuery <TSource> source, Func <TSource, Nullable <double> > selector)
 {
     throw new NotImplementedException();
 }
Esempio n. 23
0
 public static bool SequenceEqual <TSource>(this ParallelQuery <TSource> first, ParallelQuery <TSource> second, IEqualityComparer <TSource> comparer)
 {
     throw new NotImplementedException();
 }
Esempio n. 24
0
 public static ILookup <TKey, TSource> ToLookup <TSource, TKey>(this ParallelQuery <TSource> source, Func <TSource, TKey> keySelector)
 {
     throw new NotImplementedException();
 }
Esempio n. 25
0
 public static void ForAll <TSource>(this ParallelQuery <TSource> source, Action <TSource> action)
 {
     throw new NotImplementedException();
 }
Esempio n. 26
0
 public static ParallelQuery <TResult> Cast <TResult>(this ParallelQuery source)
 {
     throw new NotImplementedException();
 }
Esempio n. 27
0
 public static ParallelQuery <TSource> Distinct <TSource>(this ParallelQuery <TSource> source, IEqualityComparer <TSource> comparer)
 {
     throw new NotImplementedException();
 }
Esempio n. 28
0
 public static TSource Last <TSource>(this ParallelQuery <TSource> source)
 {
     throw new NotImplementedException();
 }
Esempio n. 29
0
 public static ParallelQuery <TSource> Intersect <TSource>(this ParallelQuery <TSource> first, ParallelQuery <TSource> second)
 {
     throw new NotImplementedException();
 }
Esempio n. 30
0
 public static ParallelQuery <TSource> WithMergeOptions <TSource>(this ParallelQuery <TSource> source, ParallelMergeOptions mergeOptions)
 {
     throw new NotImplementedException();
 }
Esempio n. 31
0
 public static ParallelQuery <TSource> Except <TSource>(this ParallelQuery <TSource> first, IEnumerable <TSource> second)
 {
     throw new NotImplementedException();
 }
Esempio n. 32
0
        private bool DotModifiers(ParallelQuery<Unit> nearEnemies)
        {
            var heroModifiers = Hero.HasModifiers(cantToggleArmletHeroModifiers, false);
            var enemyModifiers = nearEnemies.Any(x => x.HasModifiers(cantToggleArmletEnemyModifiers, false));

            return enemyModifiers || heroModifiers;
        }
Esempio n. 33
0
 public static void Except_SourceMultiple(ParallelQuery<int> leftQuery, int leftCount, ParallelQuery<int> rightQuery, int rightCount, int start, int count)
 {
     int seen = start;
     Assert.All(leftQuery.Except(rightQuery), x => Assert.Equal(seen++, x));
     Assert.Equal(start + count, seen);
 }
Esempio n. 34
0
 public static void Intersect_SourceMultiple_Longrunning(ParallelQuery<int> leftQuery, int leftCount, ParallelQuery<int> rightQuery, int rightCount, int count)
 {
     Intersect_SourceMultiple(leftQuery, leftCount, rightQuery, rightCount, count);
 }
Esempio n. 35
0
 public static decimal Max <TSource>(this ParallelQuery <TSource> source, Func <TSource, decimal> selector)
 {
     throw new NotImplementedException();
 }
Esempio n. 36
0
 public static void Union_SecondOrdered_SourceMultiple(ParallelQuery<int> leftQuery, int leftCount, ParallelQuery<int> rightQuery, int rightCount, int count)
 {
     IntegerRangeSet seenUnordered = new IntegerRangeSet(0, leftCount);
     int seen = leftCount;
     foreach (int i in leftQuery.Union(rightQuery.AsOrdered()))
     {
         if (i >= leftCount)
         {
             Assert.Equal(seen++, i);
         }
         else
         {
             seenUnordered.Add(i);
         }
     }
     Assert.Equal(count, seen);
     seenUnordered.AssertComplete();
 }
Esempio n. 37
0
 public static void Distinct_SourceMultiple(ParallelQuery<int> query, int count)
 {
     int seen = 0;
     Assert.All(query.Distinct(), x => Assert.Equal(seen++, x));
     Assert.Equal(count, seen);
 }
Esempio n. 38
0
 public static ParallelQuery <TSource> Except <TSource>(this ParallelQuery <TSource> first, IEnumerable <TSource> second, IEqualityComparer <TSource> comparer)
 {
     throw new NotImplementedException();
 }
Esempio n. 39
0
 public static float Average(this ParallelQuery <float> source)
 {
     throw new NotImplementedException();
 }
Esempio n. 40
0
 public static void Except_SourceMultiple_Longrunning(ParallelQuery<int> leftQuery, int leftCount, ParallelQuery<int> rightQuery, int rightCount, int start, int count)
 {
     Except_SourceMultiple(leftQuery, leftCount, rightQuery, rightCount, start, count);
 }
Esempio n. 41
0
 public static IEnumerable <TSource> AsEnumerable <TSource>(this ParallelQuery <TSource> source)
 {
     throw new NotImplementedException();
 }
Esempio n. 42
0
 public static void Distinct_Unordered_SourceMultiple(ParallelQuery<int> query, int count)
 {
     // The difference between this test and the previous, is that it's not possible to
     // get non-unique results from ParallelEnumerable.Range()...
     // Those tests either need modification of source (via .Select(x => x / DuplicateFactor) or similar,
     // or via a comparator that considers some elements equal.
     IntegerRangeSet seen = new IntegerRangeSet(0, count);
     Assert.All(query.AsUnordered().Distinct(), x => seen.Add(x));
     seen.AssertComplete();
 }
Esempio n. 43
0
 public static ParallelQuery <TSource> Where <TSource>(this ParallelQuery <TSource> source, Func <TSource, int, bool> predicate)
 {
     throw new NotImplementedException();
 }
Esempio n. 44
0
 public static void Distinct_SourceMultiple_Longrunning(ParallelQuery<int> query, int count)
 {
     Distinct_SourceMultiple(query, count);
 }
Esempio n. 45
0
 public static Dictionary <TKey, TSource> ToDictionary <TSource, TKey>(this ParallelQuery <TSource> source, Func <TSource, TKey> keySelector, IEqualityComparer <TKey> comparer)
 {
     throw new NotImplementedException();
 }