Exemplo n.º 1
0
        /// <summary>
        /// Sucht die Gruppe und filtert die Ansicht
        /// </summary>
        public void SearchGroup()
        {
            // Prüft damit nicht der selbe Text nochmal gesucht wird
            if ((string.IsNullOrEmpty(LastSearchTextGroup) && string.IsNullOrEmpty(SearchTextGroup)) ||
                string.Equals(LastSearchTextGroup, SearchTextGroup))
            {
                return;
            }

            // Wenn wir keinen Suchtext haben
            if (string.IsNullOrEmpty(SearchTextGroup))
            {
                // Mache gefilterte Liste gleich Allen Gruppen
                GroupsFiltered = new ObservableCollection <GroupPrincipal>(AllGroups);

                // Setze letzte Suche
                LastSearchTextGroup = SearchTextGroup;

                return;
            }

            // Finde alle Items die den Text enthalten
            GroupsFiltered = new ObservableCollection <GroupPrincipal>(
                AllGroups.Where(x => x.Name.ToLower().Contains(SearchTextGroup.ToLower())));

            // Setze letzte Suche
            LastSearchTextGroup = SearchTextGroup;
        }
Exemplo n.º 2
0
        public override void CalculateAdjustedFecundity( )
        {
            var lostFecunditySum  = AllGroups.Sum(x => x.LostFecundity);
            var totalFecunditySum = AllGroups.Sum(x => x.TotalFecundity);

            foreach (var group in AllGroups.Where(x => x.TotalFecundity != 0))
            {
                var term2      = (1d - V.R) * V.Y * lostFecunditySum / totalFecunditySum;
                var term1      = V.R * V.Y * group.LostFecundity / group.TotalFecundity;
                var multiplier = 1d + term1 + term2;

                foreach (var individual in group)
                {
                    individual.AdjustedFecundity = individual.Fecundity * multiplier;
                }
            }

            if (IsLoggingEnabled)
            {
                Logger.Debug("\n\nCalculate Adjusted Fecundity:\n");
                foreach (var group in AllGroups)
                {
                    Logger.Debug(group.ToTable(
                                     x => new
                    {
                        _1_Id                = x.Id,
                        _2_Qp                = $"{x.PhenotypicQuality:F4}",
                        _3_Fecundity         = $"{x.Fecundity:F4}",
                        _4_AdjustedFecundity = $"{x.AdjustedFecundity:F4}"
                    }
                                     )
                                 );
                }
            }
        }
Exemplo n.º 3
0
 private void Invalidate()
 {
     enabled = false;
     foreach (ContractGroup child in AllGroups.Where(g => g != null && g.parent == this))
     {
         child.Invalidate();
     }
 }