Example #1
0
        public static void OfType_NoneValid(Labeled <ParallelQuery <int> > labeled, int count)
        {
            _ = count;
            ParallelQuery <int> query = labeled.Item;

            Assert.Empty(query.OfType <long>());
        }
        internal static ParallelQuery <int> MakeOfType(bool orderPreserved)
        {
            object[] a = Enumerable.Range(0, 50)
                         .Cast <object>()
                         .Concat(Enumerable.Repeat <object>(null, 50))
                         .Concat(Enumerable.Range(50, 50).Cast <object>()).ToArray();

            ParallelQuery <object> ipe = a.AsParallel();

            if (orderPreserved)
            {
                ipe = ipe.AsOrdered();
            }

            return(ipe.OfType <int>());
        }
Example #3
0
 /// <summary>
 /// Returns all of the RelativePronouns in the collection. Standard Pronouns are not
 /// included in the result.
 /// </summary>
 /// <param name="words">The sequence of Words to filter.</param>
 /// <returns>All RelativePronouns in the collection.</returns>
 public static ParallelQuery <RelativePronoun> OfRelativePronoun(this ParallelQuery <Word> words) => words.OfType <RelativePronoun>();
Example #4
0
 /// <summary>
 /// Returns all Quantifiers in the collection.
 /// </summary>
 /// <param name="words">The sequence of Words to filter.</param>
 /// <returns>All Quantifiers in the collection.</returns>
 public static ParallelQuery <Quantifier> OfQuantifier(this ParallelQuery <Word> words) => words.OfType <Quantifier>();
Example #5
0
 /// <summary>
 /// Returns all ConjunctionPhrases in the sequence.
 /// </summary>
 /// <param name="phrases">The sequence of componentPhrases to filter</param>
 /// <returns>All ConjunctionPhrases in the sequence</returns>
 public static ParallelQuery <ConjunctionPhrase> OfConjunctionPhrase(this ParallelQuery <Phrase> phrases) => phrases.OfType <ConjunctionPhrase>();
Example #6
0
 /// <summary>Returns all Entities in the sequence.</summary>
 /// <param name="elements">The sequence of Lexicals to filter.</param>
 /// <returns>All Entities in the sequence.</returns>
 public static ParallelQuery <IEntity> OfEntity(this ParallelQuery <ILexical> elements) => elements.OfType <IEntity>();
Example #7
0
        public static void OfType_NoneValid_NotPipelined(Labeled <ParallelQuery <int> > labeled, int count)
        {
            ParallelQuery <int> query = labeled.Item;

            Assert.Empty(query.OfType <long>().ToList());
        }
Example #8
0
 /// <summary>
 /// Returns all ToLinkers in the collection.
 /// </summary>
 /// <param name="words">The sequence of Words to filter.</param>
 /// <returns>All ToLinkers in the collection.</returns>
 public static ParallelQuery <ToLinker> OfToLinker(this ParallelQuery <Word> words) => words.OfType <ToLinker>();
Example #9
0
 /// <summary>
 /// Returns all ModalAuxilaries in the collection.
 /// </summary>
 /// <param name="words">The sequence of Words to filter.</param>
 /// <returns>All ModalAuxilarys in the collection.</returns>
 public static ParallelQuery <ModalAuxilary> OfModal(this ParallelQuery <Word> words) => words.OfType <ModalAuxilary>();
Example #10
0
 /// <summary>
 /// Returns all GenericNouns in the collection.
 /// </summary>
 /// <param name="words">The sequence of Words to filter.</param>
 /// <returns>All GenericNouns in the collection.</returns>
 public static ParallelQuery <CommonNoun> OfCommonNoun(this ParallelQuery <Word> words) => words.OfType <CommonNoun>();
Example #11
0
 /// <summary>
 /// Returns all Determiners in the collection.
 /// </summary>
 /// <param name="words">The sequence of Words to filter.</param>
 /// <returns>All Determiners in the collection.</returns>
 public static ParallelQuery <Determiner> OfDeterminer(this ParallelQuery <Word> words) => words.OfType <Determiner>();
Example #12
0
 /// <summary>
 /// Returns all Adjectives in the collection.
 /// </summary>
 /// <param name="words">The sequence of Words to filter.</param>
 /// <returns>All Adjectives in the collection.</returns>
 public static ParallelQuery <Adjective> OfAdjective(this ParallelQuery <Word> words) => words.OfType <Adjective>();
Example #13
0
 /// <summary>
 /// Returns all VerbPhrases in the sequence.
 /// </summary>
 /// <param name="phrases">The sequence of componentPhrases to filter.</param>
 /// <returns>All VerbPhrases in the sequence</returns>
 public static ParallelQuery <VerbPhrase> OfVerbPhrase(this ParallelQuery <Phrase> phrases) => phrases.OfType <VerbPhrase>();
Example #14
0
 /// <summary>
 /// Returns all PronounPhrase in the sequence.
 /// </summary>
 /// <param name="phrases">The sequence of componentPhrases to filter</param>
 /// <returns>All PronounPhrase in the sequence</returns>
 public static ParallelQuery <PronounPhrase> OfPronounPhrase(this ParallelQuery <Phrase> phrases) => phrases.OfType <PronounPhrase>();
Example #15
0
 /// <summary>
 /// Returns all PrepositionalPhrases in the sequence.
 /// </summary>
 /// <param name="phrases">The sequence of componentPhrases to filter</param>
 /// <returns>All PrepositionalPhrases in the sequence</returns>
 public static ParallelQuery <PrepositionalPhrase> OfPrepositionalPhrase(this ParallelQuery <Phrase> phrases) => phrases.OfType <PrepositionalPhrase>();
Example #16
0
 /// <summary>
 /// Returns all GenericSingularNouns in the GenericNoun sequence.
 /// </summary>
 /// <param name="nouns">The sequence of GenericNouns to filter.</param>
 /// <returns>All GenericSingularNouns in the GenericNoun sequence.</returns>
 public static ParallelQuery <CommonSingularNoun> OfSingular(this ParallelQuery <CommonNoun> nouns) => nouns.OfType <CommonSingularNoun>();
Example #17
0
 /// <summary>
 /// Returns all ProperSingularNouns in the ProperNoun sequence.
 /// </summary>
 /// <param name="nouns">The sequence of ProperNouns to filter.</param>
 /// <returns>All ProperSingularNouns in the ProperNoun sequence.</returns>
 public static ParallelQuery <ProperSingularNoun> OfSingular(this ParallelQuery <ProperNoun> nouns) => nouns.OfType <ProperSingularNoun>();
Example #18
0
 /// <summary>
 /// Returns all Nouns in the collection.
 /// </summary>
 /// <param name="words">The sequence of Words to filter.</param>
 /// <returns>All Nouns in the collection.</returns>
 public static ParallelQuery <Noun> OfNoun(this ParallelQuery <Word> words) => words.OfType <Noun>();
Example #19
0
 /// <summary>
 /// Returns all Verbs in the collection.
 /// </summary>
 /// <param name="words">The sequence of Words to filter.</param>
 /// <returns>All Verbs in the collection.</returns>
 public static ParallelQuery <Verb> OfVerb(this ParallelQuery <Word> words) => words.OfType <Verb>();
Example #20
0
 /// <summary>
 /// Returns all GenericPluralNouns in the GenericNoun sequence.
 /// </summary>
 /// <param name="nouns">The sequence of GenericNouns to filter.</param>
 /// <returns>All GenericNouns in the GenericNoun sequence.</returns>
 public static ParallelQuery <CommonPluralNoun> OfPlural(this ParallelQuery <CommonNoun> nouns) => nouns.OfType <CommonPluralNoun>();
Example #21
0
 /// <summary>Gets all of the Clause instances in the sequence of ILexicals.</summary>
 /// <param name="elements">The source sequence of ILexical instances.</param>
 /// <returns>All of the Clause instances in the sequence of ILexicals.</returns>
 public static ParallelQuery <Clause> OfClause(this ParallelQuery <ILexical> elements) => elements.OfType <Clause>();
Example #22
0
 /// <summary>
 /// Returns all ProperPluralNouns in the ProperNoun sequence.
 /// </summary>
 /// <param name="nouns">The sequence of ProperNouns to filter.</param>
 /// <returns>All ProperPluralNouns in the ProperNoun sequence.</returns>
 public static ParallelQuery <ProperPluralNoun> OfPlural(this ParallelQuery <ProperNoun> nouns) => nouns.OfType <ProperPluralNoun>();
Example #23
0
 /// <summary>Returns all Referencers in the sequence.</summary>
 /// <param name="elements">The sequence of Lexicals to filter.</param>
 /// <returns>All Referencers in the sequence.</returns>
 public static ParallelQuery <IReferencer> OfReferencer(this ParallelQuery <ILexical> elements) => elements.OfType <IReferencer>();
Example #24
0
 /// <summary>
 /// Returns all ProperNouns in the collection.
 /// </summary>
 /// <param name="words">The sequence of Words to filter.</param>
 /// <returns>All ProperNouns in the collection.</returns>
 public static ParallelQuery <ProperNoun> OfProperNoun(this ParallelQuery <Word> words) => words.OfType <ProperNoun>();
Example #25
0
 /// <summary>
 /// Returns all Punctuators in the collection.
 /// </summary>
 /// <param name="words">The sequence of Words to filter.</param>
 /// <returns>All Punctuators in the collection.</returns>
 public static ParallelQuery <Punctuator> OfPunctuator(this ParallelQuery <Word> words) => words.OfType <Punctuator>();
Example #26
0
 /// <summary>
 /// Returns all AdjectivePhrases in the sequence.
 /// </summary>
 /// <param name="phrases">The sequence of componentPhrases to filter</param>
 /// <returns>All AdjectivePhrases in the sequence</returns>
 public static ParallelQuery <AdjectivePhrase> OfAdjectivePhrase(this ParallelQuery <Phrase> phrases) => phrases.OfType <AdjectivePhrase>();