Esempio n. 1
0
 public override void  ExtractTerms(System.Collections.Generic.ISet <Term> terms)
 {
     foreach (SpanQuery clause in clauses)
     {
         clause.ExtractTerms(terms);
     }
 }
            public void loadFamilyExample(Document doc)
            {
                Family family = null;
                FilteredElementCollector a = new FilteredElementCollector(doc).OfClass(typeof(Family));

                family = a.FirstOrDefault <Element>(e => e.Name.Equals("Leiter-02")) as Family;
                if (family == null) // Check if the Familytyp already loaded.
                {
                    string fileName = @"C:\ProgramData\Autodesk\RVT 2020\Libraries\Germany\Architektur - Bauteil\Sonderausstattung\vertikale Erschließung\Leiter-02.rfa";
                    using (Transaction t = new Transaction(doc))
                    {
                        if (t.Start("LoadFamily") == TransactionStatus.Started)
                        {
                            if (!doc.LoadFamily(fileName, out family))// try to load family
                            {
                                throw new Exception("Unable to load " + fileName);
                            }
                            t.Commit();
                        }
                    }
                    // loop through family symbols
                    System.Collections.Generic.ISet <ElementId> familySymbolsId = family.GetFamilySymbolIds();
                    string symbolNames = "";
                    foreach (ElementId symbolId in familySymbolsId)
                    {
                        symbolNames += family.Name + " - " + ((FamilySymbol)
                                                              family.Document.GetElement(symbolId)).Name + "\n";
                    }
                    TaskDialog.Show("Loaded", symbolNames);
                }
                else
                {
                    TaskDialog.Show("Warning", "Family already loaded!");
                }
            }
Esempio n. 3
0
        public Args(string schema, string[] args)
        {
            argsFound = new HashSet <string>();

            argsSchema = new ArgsSchema(schema);
            ParseArgumentStrings(new List <string>(args));
        }
 static (Func <IEnumerable <T>, bool> SetEquals, Func <T, bool> Contains) GetProxy(IEnumerable <T> items)
 {
     return(items switch
     {
         IReadOnlySet <T> set => (set.SetEquals, set.Contains),
         System.Collections.Generic.ISet <T> bclSet => (bclSet.SetEquals, bclSet.Contains),
         _ => ((Func <IEnumerable <T>, bool>)null, (Func <T, bool>)null)
     });
        // TODO: Remove warning after API has been finalized

        /// <summary> WARNING: The List is not necessarily in order of the the positions</summary>
        /// <returns> Collection of &amp;lt;c&amp;gt;byte[]&amp;lt;/c&amp;gt; payloads </returns>
        /// <throws>  IOException </throws>
        public override ICollection <byte[]> GetPayload()
        {
            System.Collections.Generic.ISet <byte[]> matchPayload = Lucene.Net.Support.Compatibility.SetFactory.CreateHashSet <byte[]>();
            for (SpansCell cell = first; cell != null; cell = cell.next)
            {
                if (cell.IsPayloadAvailable())
                {
                    matchPayload.UnionWith(cell.GetPayload());
                }
            }
            return(matchPayload);
        }
Esempio n. 6
0
 /// <inheritdoc/>
 public bool Equals(System.Collections.Generic.ISet <T> other)
 {
     return(this.set.Equals(other));
 }
Esempio n. 7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SetSetAdapter{T}"/> class.
 /// </summary>
 /// <param name="set">
 /// The set to adapt.
 /// </param>
 /// <exception cref="ArgumentNullException">
 /// Thrown when <paramref name="set"/> is <see langword="null"/>.
 /// </exception>
 public SetSetAdapter(System.Collections.Generic.ISet <T> set)
 {
     this.set = set ?? throw new ArgumentNullException(nameof(set));
 }
Esempio n. 8
0
 public override void  ExtractTerms(System.Collections.Generic.ISet <Term> terms)
 {
     match.ExtractTerms(terms);
 }
Esempio n. 9
0
        /// <summary>
        /// Selects a new solution for reproduction.
        /// </summary>
        /// <returns></returns>
        public int Select(TProblem problem, TObjective objective, Individual <TSolution, TFitness>[] population, System.Collections.Generic.ISet <int> exclude)
        {
            var tournamentSizeInt = (int)System.Math.Ceiling(((_tournamentSize / 100f) * (double)population.Length));
            var tempPop           = new List <Tuple <int, Individual <TSolution, TFitness> > >(tournamentSizeInt);

            while (tempPop.Count < tournamentSizeInt)
            { // keep looping until enough individuals are selected or until no more are available.
                var idx = _random.Generate(population.Length);
                if (exclude == null || !exclude.Contains(idx))
                { // do not tournament excluded solutions.
                    tempPop.Add(new Tuple <int, Individual <TSolution, TFitness> >(idx, population[idx]));
                }
            }

            // sort the population..
            tempPop.Sort((x, y) =>
            {
                return(objective.CompareTo(problem, y.Item2.Fitness, x.Item2.Fitness));
            });

            // choose a candidate.
            for (var idx = 0; idx < tempPop.Count; idx++)
            {     // choose a candidate.
                if (_random.Generate(1.0f) < _tournamentProbability)
                { // candidate choosen!
                    return(tempPop[idx].Item1);
                }
            }
            return(-1);
        }
Esempio n. 10
0
 public static ISet <T> ToISet <T>(this System.Collections.Generic.ISet <T> s) => new SetWrapper <T>(s);
Esempio n. 11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SetAdapter{T}"/> class, wrapping the specified
 /// <see cref="System.Collections.Generic.ISet{T}"/> <paramref name="set"/>.
 /// </summary>
 /// <param name="set">
 /// The set to wrap.
 /// </param>
 /// <exception cref="ArgumentNullException">
 /// Thrown when <paramref name="set"/> is <see langword="null"/>.
 /// </exception>
 public SetAdapter(System.Collections.Generic.ISet <T> set)
 {
     this.adapter = new SetSetAdapter <T>(set);
 }
Esempio n. 12
0
 /// <inheritdoc/>
 public bool Equals(System.Collections.Generic.ISet <T> other) => this.adapter.Equals(other);
Esempio n. 13
0
 public bool ActionsHasPotion(System.Collections.Generic.ISet <int> actions)
 {
     return(game.ActionsHasPotion(actions));
 }
Esempio n. 14
0
 public SetWrapper(System.Collections.Generic.ISet <T> set)
 {
     this.set = set;
 }