/// <summary>
        /// Create an TaxaFilterFromFactorViewModel.
        /// </summary>
        /// <param name="factor"></param>
        /// <returns></returns>
        public TaxaFilterFromFactorViewModel CreateTaxaFilterFromFactorViewModel(IFactor factor)
        {
            var model = new TaxaFilterFromFactorViewModel();

            model.Factor = factor;
            return(model);
        }
        private bool Add_Sub(BNode node, IFactor factor)
        {
            if (_comparer.Compare(node.value, factor.Value) > 0 && factor.GetType() == typeof(PrimeNumber))
            {
                if (node.right == null)
                {
                    node.right = new BNode(factor);
                    Count++;
                    return(true);
                }

                Add_Sub(node.right, factor);
            }

            if (_comparer.Compare(node.value, factor.Value) > 0)
            {
                if (node.left == null)
                {
                    node.left = new BNode(factor);
                    Count++;
                    return(true);
                }

                return(Add_Sub(node.left, factor));
            }

            return(false);
        }
        /// <summary>
        /// Get all species facts that are needed to initialize
        /// properties in class TaxonListInformation.
        /// </summary>
        /// <param name="taxa">The taxa.</param>
        /// <returns>Taxon list information about specified taxa.</returns>
        private SpeciesFactList GetSpeciesFacts(IEnumerable <ITaxon> taxa)
        {
            ISpeciesFactSearchCriteria searchCriteria = new SpeciesFactSearchCriteria();

            searchCriteria.Factors = new FactorList();
            FactorList landscapeFactors = CoreData.FactorManager.GetFactorTree(mContext, FactorId.LandscapeFactors).GetAllLeafFactors();

            searchCriteria.Factors.AddRange(landscapeFactors);
            IFactor redlistCategoryFactor = CoreData.FactorManager.GetFactor(mContext, FactorId.RedlistCategory);

            searchCriteria.Factors.Add(redlistCategoryFactor);
            IFactor redlistTaxonTypeFactor = CoreData.FactorManager.GetFactor(mContext, FactorId.Redlist_TaxonType);

            searchCriteria.Factors.Add(redlistTaxonTypeFactor);
            IFactor redlistOrganismLabel1 = CoreData.FactorManager.GetFactor(mContext, FactorId.Redlist_OrganismLabel1);

            searchCriteria.Factors.Add(redlistOrganismLabel1);
            IFactor redlistCriteriaFactor = CoreData.FactorManager.GetFactor(mContext, FactorId.RedlistCriteriaString);

            searchCriteria.Factors.Add(redlistCriteriaFactor);
            searchCriteria.IndividualCategories = new IndividualCategoryList
            {
                CoreData.FactorManager.GetDefaultIndividualCategory(mContext)
            };
            searchCriteria.Periods = new PeriodList {
                CoreData.FactorManager.GetCurrentRedListPeriod(mContext)
            };
            searchCriteria.Taxa = new TaxonList();
            searchCriteria.Taxa.AddRange(taxa);
            ISpeciesFactDataSource speciesFactDataSource = new RedListSpeciesFactDataSource();
            SpeciesFactList        speciesFacts          = speciesFactDataSource.GetSpeciesFacts(mContext, searchCriteria);

            return(speciesFacts);
        }
예제 #4
0
        private IFactor GetStructuralFactor()
        {
            _referenceHeight      = new ReferenceHeight(_building, _terrain);
            _turbulentLengthScale = new TurbulentLengthScale(_terrain);

            var logarithmicDecrementOfDamping = GetLogarithmicDecrementOfDamping();

            _fundamentalFlexuralFrequency =
                new FundamentalFlexuralFrequencyForHeightAbove50(_building);

            var resonanceResponse = GetResonanceResponse(
                logarithmicDecrementOfDamping);

            var backgroundFactor =
                new BackgroundFactor(
                    _building,
                    _referenceHeight,
                    _turbulentLengthScale);

            var dynamicFactor = GetDynamicFactor(
                resonanceResponse, backgroundFactor);
            var sizeFactor =
                new SizeFactor(
                    _referenceHeight,
                    _windLoadData,
                    backgroundFactor);
            var structuralFactor =
                new StructuralFactor(sizeFactor, dynamicFactor);

            return(structuralFactor);
        }
예제 #5
0
        // function ELIMINATION-ASK(X, e, bn) returns a distribution over X

        /**
         * The ELIMINATION-ASK algorithm in Figure 14.11.
         *
         * @param X
         *            the query variables.
         * @param e
         *            observed values for variables E.
         * @param bn
         *            a Bayes net with variables {X} &cup; E &cup; Y /* Y = hidden
         *            variables //
         * @return a distribution over the query variables.
         */
        public ICategoricalDistribution eliminationAsk(IRandomVariable[] X, AssignmentProposition[] e, IBayesianNetwork bn)
        {
            ISet <IRandomVariable>        hidden = CollectionFactory.CreateSet <IRandomVariable>();
            ICollection <IRandomVariable> VARS   = CollectionFactory.CreateQueue <IRandomVariable>();

            calculateVariables(X, e, bn, hidden, VARS);

            // factors <- []
            ICollection <IFactor> factors = CollectionFactory.CreateQueue <IFactor>();

            // for each var in ORDER(bn.VARS) do
            foreach (IRandomVariable var in order(bn, VARS))
            {
                // factors <- [MAKE-FACTOR(var, e) | factors]
                factors.Insert(0, makeFactor(var, e, bn));
                // if var is hidden variable then factors <- SUM-OUT(var, factors)
                if (hidden.Contains(var))
                {
                    factors = sumOut(var, factors, bn);
                }
            }
            // return NORMALIZE(POINTWISE-PRODUCT(factors))
            IFactor product = pointwiseProduct(factors);

            // Note: Want to ensure the order of the product matches the
            // query variables
            return(((ProbabilityTable)product.pointwiseProductPOS(_identity, X)).normalize());
        }
예제 #6
0
 public StructuralFactor(
     IFactor sizeFactor,
     IFactor dynamicFactor)
 {
     _sizeFactor    = sizeFactor;
     _dynamicFactor = dynamicFactor;
 }
예제 #7
0
        private IFactor GetResonanceResponse(IFactor logarithmicDecrementOfDamping)
        {
            var nonDimensionalFrequency =
                new NonDimensionalFrequency(
                    _windLoadData,
                    _fundamentalFlexuralFrequency,
                    _turbulentLengthScale);

            var nonDimensionalPowerSpectralDensity =
                new NonDimensionalPowerSpectralDensity(nonDimensionalFrequency);
            var aerodynamicAdmittanceWidth =
                new AerodynamicAdmittanceWidth(
                    _building,
                    _referenceHeight,
                    _turbulentLengthScale,
                    nonDimensionalFrequency);
            var aerodynamicAdmittanceHeight =
                new AerodynamicAdmittanceHeight(
                    _building,
                    _referenceHeight,
                    _turbulentLengthScale,
                    nonDimensionalFrequency);

            return(new ResonanceResponse(
                       _referenceHeight,
                       logarithmicDecrementOfDamping,
                       nonDimensionalPowerSpectralDensity,
                       aerodynamicAdmittanceWidth,
                       aerodynamicAdmittanceHeight));
        }
 /// <summary>
 /// Expands a Species Fact List with empty species facts so that every combination from the user parameter selection is represented.
 /// Factor Headers are excluded.
 /// Periodic factors are not expanded to individual categories other than the default.
 /// </summary>
 /// <param name="userContext">The user context.</param>
 /// <param name="taxon">Taxon object of the species fact.</param>
 /// <param name="individualCategory">Individual category object of the species fact.</param>
 /// <param name="factor">Factor object of the species fact.</param>
 /// <param name="host">Host taxon object of the species fact.</param>
 /// <param name="period">Period object of the species fact.</param>
 /// <param name="speciesFacts">Species fact list to be expanded.</param>
 private static void ExpandSpeciesFactListWithEmptySpeciesFact(
     IUserContext userContext,
     ITaxon taxon,
     IIndividualCategory individualCategory,
     IFactor factor,
     ITaxon host,
     IPeriod period,
     SpeciesFactList speciesFacts)
 {
     if (!speciesFacts.Exists(CoreData.SpeciesFactManager.GetSpeciesFactIdentifier(
                                  taxon,
                                  individualCategory,
                                  factor,
                                  host,
                                  period)))
     {
         speciesFacts.Add(CoreData.SpeciesFactManager.GetSpeciesFact(
                              userContext,
                              taxon,
                              individualCategory,
                              factor,
                              host,
                              period));
     }
 }
        /// <summary>
        /// Get swedish occurrence type species facts.
        /// </summary>
        private void GetSwedishOccurrenceSpeciesFactsToCache()
        {
            ISpeciesFactSearchCriteria searchCriteria = new SpeciesFactSearchCriteria();

            searchCriteria.Factors = new FactorList();
            IFactor factor = CoreData.FactorManager.GetFactor(mContext, FactorId.SwedishOccurrence);

            searchCriteria.Factors.Add(factor);
            searchCriteria.IndividualCategories = new IndividualCategoryList
            {
                CoreData.FactorManager.GetDefaultIndividualCategory(mContext)
            };
            ISpeciesFactDataSource speciesFactDataSource = new RedListSpeciesFactDataSource();
            SpeciesFactList        speciesFacts          = speciesFactDataSource.GetSpeciesFacts(mContext, searchCriteria);

            if (speciesFacts.IsNotEmpty())
            {
                foreach (ISpeciesFact speciesFact in speciesFacts)
                {
                    if (TaxonInformationCache.TaxonInformation.ContainsKey(speciesFact.Taxon.Id))
                    {
                        TaxonInformationCache.TaxonInformation[speciesFact.Taxon.Id].SetSpeciesFact(speciesFact);
                    }
                }
            }
        }
예제 #10
0
        public static Terrain Create(
            TerrainType terrainType,
            IFactor heightDisplacement = null,
            IFactorAt terrainOrography = null)
        {
            switch (terrainType)
            {
            case TerrainType.Terrain_0:
                return(new TerrainCategory0(terrainOrography));

            case TerrainType.Terrain_I:
                return(new TerrainCategoryI(terrainOrography));

            case TerrainType.Terrain_II:
                return(new TerrainCategoryII(terrainOrography));

            case TerrainType.Terrain_III:
                return(new TerrainCategoryIII(terrainOrography));

            case TerrainType.Terrain_IV:
                return(new TerrainCategoryIV(heightDisplacement, terrainOrography));

            default:
                throw new ArgumentException(nameof(terrainType));
            }
        }
 public NonDimensionalFrequency(IWindLoadData windLoadData,
                                IFactor fundamentalFlexuralFrequency,
                                IFactorAt turbulentLengthScale)
 {
     _windLoadData = windLoadData;
     _fundamentalFlexuralFrequency = fundamentalFlexuralFrequency;
     _turbulentLengthScale         = turbulentLengthScale;
 }
예제 #12
0
 public TerrainCategoryIV(IFactor heightDisplacement,
                          IFactorAt terrainOrography = null)
     : base(roughnessLength: 1, minimumHeight: 10,
            maximumHeight: 500, terrainOrography: terrainOrography)
 {
     HeightDisplacement = heightDisplacement ??
                          throw new ArgumentNullException(nameof(heightDisplacement));
 }
예제 #13
0
 public BackgroundFactor(IStructure building,
                         IFactor referenceHeight,
                         IFactorAt turbulentLengthScale)
 {
     _building             = building;
     _referenceHeight      = referenceHeight;
     _turbulentLengthScale = turbulentLengthScale;
 }
예제 #14
0
 public UpCrossingFrequency(IFactor fundamentalFlexuralFrequency,
                            IFactor backgroundFactor,
                            IFactor resonanceResponse)
 {
     _fundamentalFlexuralFrequency = fundamentalFlexuralFrequency;
     _backgroundFactor             = backgroundFactor;
     _resonanceResponse            = resonanceResponse;
 }
예제 #15
0
 public SizeFactor(IFactor referenceHeight,
                   IWindLoadData windLoadData,
                   IFactor backgroundFactor)
 {
     _referenceHeight  = referenceHeight;
     _windLoadData     = windLoadData;
     _backgroundFactor = backgroundFactor;
 }
예제 #16
0
 public LogarithmicDecrementOfDamping(
     IFactor logarithmicDecrementOfStructuralDamping,
     IFactor logarithmicDecrementOfAerodynamicDamping,
     IFactor logarithmicDecrementOfDampingSpecialDevices)
 {
     _logarithmicDecrementOfStructuralDamping     = logarithmicDecrementOfStructuralDamping;
     _logarithmicDecrementOfAerodynamicDamping    = logarithmicDecrementOfAerodynamicDamping;
     _logarithmicDecrementOfDampingSpecialDevices = logarithmicDecrementOfDampingSpecialDevices;
 }
 /// <summary>
 /// Creates a species fact instance with no data from web service.
 /// </summary>
 /// <param name="userContext">
 /// Information about the user that makes this method call.
 /// </param>
 /// <param name="taxon">Taxon object of the species fact</param>
 /// <param name="individualCategory">Individual category object of the species fact</param>
 /// <param name="factor">Factor object of the species fact</param>
 /// <param name="host">Host taxon object of the species fact</param>
 /// <param name="period">Period object of the species fact</param>
 public SpeciesFactRedListCriteriaDocumentation(IUserContext userContext,
                                                ITaxon taxon,
                                                IIndividualCategory individualCategory,
                                                IFactor factor,
                                                ITaxon host,
                                                IPeriod period)
     : base(userContext, taxon, individualCategory, factor, host, period)
 {
 }
        /// <summary>
        /// Remove factor from current species fact data set scope.
        /// The species facts in the data set are updated
        /// to the new species fact data set scope.
        /// </summary>
        /// <param name="userContext">
        /// Information about the user that makes this method call.
        /// </param>
        /// <param name="selection">Changed scope of the data set.</param>
        public virtual void RemoveSelection(IUserContext userContext,
                                            IFactor selection)
        {
            ISpeciesFactDataSetSelection newSelection;

            newSelection = new SpeciesFactDataSetSelection();
            newSelection.Factors.Merge(selection);
            RemoveSelection(userContext, newSelection);
        }
        /// <summary>
        /// Add factor to search criteria.
        /// </summary>
        /// <param name="factor">The factor.</param>
        public void Add(IFactor factor)
        {
            if (Factors.IsNull())
            {
                Factors = new FactorList();
            }

            Factors.Add(factor);
        }
예제 #20
0
 private void GrowTo(int n)
 {
     /* extend the internal list if needed. Size to be 2 for n<=1, 3 for n<=2 etc.
         */
     while (factors.Count <= n) {
         int lastn = factors.Count - 1;
         var nextn = new IFactor(lastn + 1);
         factors.Add(factors[lastn].Multiply(nextn));
     }
 }
        /// <summary>
        /// Get picture relations related to specified factor.
        /// </summary>
        /// <param name="userContext">
        /// Information about the user that makes this method call.
        /// </param>
        /// <param name="factor">Factor that may be related to pictures.</param>
        /// <returns>Picture relations related to specified factor.</returns>
        public virtual PictureRelationList GetPictureRelations(IUserContext userContext,
                                                               IFactor factor)
        {
            var pictureRelationType = GetPictureRelationType(userContext,
                                                             PictureRelationTypeIdentifier.Factor);

            return(DataSource.GetPictureRelations(userContext,
                                                  factor.Id.ToString(),
                                                  pictureRelationType));
        }
 /// <summary>
 /// Creates a species fact instance with no data from web service.
 /// </summary>
 /// <param name="userContext">
 /// Information about the user that makes this method call.
 /// </param>
 /// <param name="taxon">Taxon object of the species fact</param>
 /// <param name="individualCategory">Individual category object of the species fact</param>
 /// <param name="factor">Factor object of the species fact</param>
 /// <param name="host">Host taxon object of the species fact</param>
 /// <param name="period">Period object of the species fact</param>
 public SpeciesFactRedListCategory(IUserContext userContext,
                                   ITaxon taxon,
                                   IIndividualCategory individualCategory,
                                   IFactor factor,
                                   ITaxon host,
                                   IPeriod period)
     : base(userContext, taxon, individualCategory, factor, host, period)
 {
     _redListCategoryAutomaticFactor = CoreData.FactorManager.GetFactor(userContext, FactorId.RedListCategoryAutomatic);
 }
예제 #23
0
 public AerodynamicAdmittanceWidth(
     IStructure building,
     IFactor referenceHeight,
     IFactorAt turbulentLengthScale,
     IFactorAt nondimensionalFrequency)
 {
     _building                = building;
     _referenceHeight         = referenceHeight;
     _turbulentLengthScale    = turbulentLengthScale;
     _nondimensionalFrequency = nondimensionalFrequency;
 }
예제 #24
0
        public BuildingSite(double heightAboveSeaLevel, WindZone windZone, ITerrain terrain,
                            IFactor seasonalFactor = null, IFactor directionalFactor = null)
        {
            HeightAboveSeaLevel = heightAboveSeaLevel;
            WindZone            = windZone;
            Terrain             = terrain;
            _seasonalFactor     = seasonalFactor;
            _directionalFactor  = directionalFactor;

            FundamentalValueBasicWindVelocity = GetFundamentalValueBasicWindVelocity();
        }
예제 #25
0
        private IFactor pointwiseProduct(ICollection <IFactor> factors)
        {
            IFactor product = factors.Get(0);

            for (int i = 1; i < factors.Size(); ++i)
            {
                product = product.pointwiseProduct(factors.Get(i));
            }

            return(product);
        }
예제 #26
0
 public DynamicFactor(IFactor referenceHeight,
                      IWindLoadData windLoadData,
                      IFactor peakFactor,
                      IFactor backgroundFactor,
                      IFactor resonanceResponse)
 {
     _referenceHeight   = referenceHeight;
     _windLoadData      = windLoadData;
     _peakFactor        = peakFactor;
     _backgroundFactor  = backgroundFactor;
     _resonanceResponse = resonanceResponse;
 }
예제 #27
0
 public ResonanceResponse(IFactor referenceHeight,
                          IFactor logarithmicDecrementOfDamping,
                          IFactorAt nonDimensionalPowerSpectralDensity,
                          IFactor aerodynamicAdmittanceWidth,
                          IFactor aerodynamicAdmittanceHeight)
 {
     _referenceHeight = referenceHeight;
     _logarithmicDecrementOfDamping      = logarithmicDecrementOfDamping;
     _nonDimensionalPowerSpectralDensity = nonDimensionalPowerSpectralDensity;
     _aerodynamicAdmittanceWidth         = aerodynamicAdmittanceWidth;
     _aerodynamicAdmittanceHeight        = aerodynamicAdmittanceHeight;
 }
예제 #28
0
        private void CreateSortButton(Control ctr, string name, IFactor factor = null,
                                      SortingModes sortMode = SortingModes.PositionAll)
        {
            Button btn = new Button
            {
                Text    = @"S",
                Size    = new Size(15, 20),
                Enabled = Stock.AllStocksInListAnalyzed
            };

            SortButtons.Add(btn);
            ctr.Parent.Controls.Add(btn);
            btn.BringToFront();
            btn.Location = new Point(ctr.Location.X + ctr.Width + (factor == null ? 12 : factor is Metric ? 30 : 40),
                                     ctr.Location.Y - 2);
            btn.Click += (o, args) =>
            {
                sortMode = factor is Coefficient ? SortingModes.Coefficeint :
                           factor is Metric ? SortingModes.Metric : sortMode;
                SortList(sortMode, m_selectedList.StList.ToList(), factor);
            };
            var text = "Sort";

            Label tb = null;

            btn.MouseEnter += (o, args) =>
            {
                var sender = o as Control ?? throw new ArgumentNullException();
                if (tb == null)
                {
                    tb = new Label
                    {
                        Margin      = new Padding(4),
                        Name        = $"textBoxHelp_{name}",
                        BorderStyle = BorderStyle.Fixed3D,
                        Text        = text,
                        AutoSize    = true
                    };
                    int x = sender.Location.X;
                    int y = sender.Location.Y;
                    tb.Font     = new Font(tb.Font.FontFamily, tb.Font.Size + 1);
                    tb.Location = new Point(x - sender.Width / 2, y - sender.Height + 1);
                    btn.Parent.Controls.Add(tb);
                    tb.BringToFront();
                }
                else
                {
                    tb.Visible = true;
                    tb.BringToFront();
                }
            };
            btn.MouseLeave += (o, args) => { tb.Visible = false; };
        }
 public bool Add(IFactor factor)
 {
     if (_root == null)
     {
         _root = new BNode(factor);
         Count++;
         return(true);
     }
     else
     {
         return(Add_Sub(_root, factor));
     }
 }
예제 #30
0
        /// <summary>
        /// Get an empty (only default data) SpeciesFact instance.
        /// </summary>
        /// <param name="userContext">
        /// Information about the user that makes this method call.
        /// </param>
        /// <param name="taxon">Taxon object of the species fact</param>
        /// <param name="individualCategory">Individual category object of the species fact</param>
        /// <param name="factor">Factor object of the species fact</param>
        /// <param name="host">Host taxon object of the species fact</param>
        /// <param name="period">Period object of the species fact</param>
        /// <returns>A SpeciesFact instance.</returns>
        public virtual ISpeciesFact GetSpeciesFact(IUserContext userContext,
                                                   ITaxon taxon,
                                                   IIndividualCategory individualCategory,
                                                   IFactor factor,
                                                   ITaxon host,
                                                   IPeriod period)
        {
            ISpeciesFact speciesFact;

            switch (factor.Id)
            {
            case (Int32)(FactorId.RedListCategoryAutomatic):
                speciesFact = new SpeciesFactRedListCategory(userContext,
                                                             taxon,
                                                             individualCategory,
                                                             factor,
                                                             host,
                                                             period);
                break;

            case (Int32)(FactorId.RedListCriteriaAutomatic):
                speciesFact = new SpeciesFactRedListCriteria(userContext,
                                                             taxon,
                                                             individualCategory,
                                                             factor,
                                                             host,
                                                             period);
                break;

            case (Int32)(FactorId.RedListCriteriaDocumentationAutomatic):
                speciesFact = new SpeciesFactRedListCriteriaDocumentation(userContext,
                                                                          taxon,
                                                                          individualCategory,
                                                                          factor,
                                                                          host,
                                                                          period);
                break;

            default:
                speciesFact = new SpeciesFact(userContext,
                                              taxon,
                                              individualCategory,
                                              factor,
                                              host,
                                              period);
                break;
            }

            return(speciesFact);
        }
 /// <summary>
 /// Creates a species fact instance with data from web service.
 /// </summary>
 /// <param name="userContext">
 /// Information about the user that makes this method call.
 /// </param>
 /// <param name="id">Id of the species fact</param>
 /// <param name="taxonId">Taxon Id of the species fact</param>
 /// <param name="individualCategoryId">Individual Category Id of the species fact</param>
 /// <param name="factorId">Foctor Id of the species fact</param>
 /// <param name="hostId">Taxon Id of the host taxon associated with the species fact</param>
 /// <param name="hasHost">Indicates if this species fact has a host.</param>
 /// <param name="periodId">Period Id of the species fact</param>
 /// <param name="hasPeriod">Indicates if this species fact has a period.</param>
 /// <param name="fieldValue1">Field value of field 1 for the species fact</param>
 /// <param name="hasFieldValue1">Indicates if field 1 has a value.</param>
 /// <param name="fieldValue2">Field value of field 2 for the species fact</param>
 /// <param name="hasFieldValue2">Indicates if field 2 has a value.</param>
 /// <param name="fieldValue3">Field value of field 3 for the species fact</param>
 /// <param name="hasFieldValue3">Indicates if field 3 has a value.</param>
 /// <param name="fieldValue4">Field value of field 4 for the species fact</param>
 /// <param name="hasFieldValue4">Indicates if field 4 has a value.</param>
 /// <param name="fieldValue5">Field value of field 5 for the species fact</param>
 /// <param name="hasFieldValue5">Indicates if field 5 has a value.</param>
 /// <param name="qualityId">Quality Id of the species fact</param>
 /// <param name="referenceId">Reference id of the species fact</param>
 /// <param name="updateUserFullName">Full Name of the pdate user of the species fact</param>
 /// <param name="updateDate">Update date of the species fact</param>
 public SpeciesFactRedListCategory(IUserContext userContext,
                                   Int32 id,
                                   Int32 taxonId,
                                   Int32 individualCategoryId,
                                   Int32 factorId,
                                   Int32 hostId,
                                   Boolean hasHost,
                                   Int32 periodId,
                                   Boolean hasPeriod,
                                   Double fieldValue1,
                                   Boolean hasFieldValue1,
                                   Double fieldValue2,
                                   Boolean hasFieldValue2,
                                   Double fieldValue3,
                                   Boolean hasFieldValue3,
                                   String fieldValue4,
                                   Boolean hasFieldValue4,
                                   String fieldValue5,
                                   Boolean hasFieldValue5,
                                   Int32 qualityId,
                                   Int32 referenceId,
                                   String updateUserFullName,
                                   DateTime updateDate)
     : base(userContext,
            id,
            taxonId,
            individualCategoryId,
            factorId,
            hostId,
            hasHost,
            periodId,
            hasPeriod,
            fieldValue1,
            hasFieldValue1,
            fieldValue2,
            hasFieldValue2,
            fieldValue3,
            hasFieldValue3,
            fieldValue4,
            hasFieldValue4,
            fieldValue5,
            hasFieldValue5,
            qualityId,
            referenceId,
            updateUserFullName,
            updateDate)
 {
     _redListCategoryAutomaticFactor = CoreData.FactorManager.GetFactor(userContext, FactorId.RedListCategoryAutomatic);
 }
예제 #32
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            // Lfac = new List<Fac>();
            if (File.Exists("FactorSettings.xml"))
            {
                FileInfo file = new FileInfo("FactorSettings.xml");
                if (file.Length != 0)
                {
                    XmlSerializer formatter = new XmlSerializer(typeof(ObservableCollection<Fac>));
                    using (FileStream fs = new FileStream("FactorSettings.xml", FileMode.Open))
                    {
                        Lfac = (ObservableCollection<Fac>)formatter.Deserialize(fs);

                    }
                }
            }
            FillFactor(ref Factors);
            IFactor[] factors = new IFactor[Factors.Count];
            int factorIndex = 0;
            foreach (var factor in Factors)
            {
                factors[factorIndex] = factor.CreateInstance(true);
                factors[factorIndex].Initialize(fine: factor.Fine, data: factor.Data);
                bool contain = false;
                for (int i = 0; i < Lfac.Count; i++)
                {
                    if (Lfac[i].Name == factors[factorIndex].GetName()) { contain = true; break; }
                }
                if (contain == false)
                {
                    Fac fac = new Fac(factors[factorIndex].GetName(), 0, factors[factorIndex].GetDescription());
                    Lfac.Add(fac);
                }

                factorIndex++;

            }
            dataGrid.ItemsSource = null;
            dataGrid.ItemsSource = Lfac;
        }
예제 #33
0
 IFactor[] CreateFactorsArray()
 {
     IFactor[] factors = new IFactor[Factors.Count];
     int factorIndex = 0;
     foreach(var factor in Factors)
     {
         factors[factorIndex] = factor.CreateInstance(false);
         factors[factorIndex].Initialize(fine: factor.Fine, data: factor.Data);
         factorIndex++;
     }
     return factors;
 }
예제 #34
0
        void InsertFirstClass(StudentsClass[] sortedStudentsClasses, FullSchedule resultSchedule, IFactor[] factors)
        {
            StudentsClassPosition[] positions = resultSchedule.GetSuitableClassRooms(sortedStudentsClasses[0]);
            int[] fines = new int[positions.Length];
            for (int positionIndex = 0; positionIndex < positions.Length; positionIndex++)
            {
                fines[positionIndex] = GetSumFine(positions[positionIndex], factors, resultSchedule, sortedStudentsClasses[0]);
            }
            Logger_StartInstallClass(sortedStudentsClasses[0], positions, fines);
            int indexMinFine = Array.IndexOf<int>(fines, Array.FindAll<int>(fines, (f) => f != Constants.BLOCK_FINE).Min());
            resultSchedule.SetClass(sortedStudentsClasses[0], positions[indexMinFine]);

            Logger_ClassInstalled(sortedStudentsClasses[0], positions[indexMinFine], 0, sortedStudentsClasses.Length, fines[indexMinFine]);
        }
예제 #35
0
 int GetSumFine(StudentsClassPosition position, IFactor[] factors, FullSchedule scheduleForCreateTemp, StudentsClass sClass)
 {
     FullSchedule schedule = new FullSchedule(scheduleForCreateTemp);
     schedule.SetClass(sClass, position);
     int fine = 0;
     int resultFine = position.Fine;
     for (int factorIndex = 0; factorIndex < factors.Length; factorIndex++)
     {
         fine = factors[factorIndex].GetFineOfAddedClass(schedule, EStorage);
         if (fine != Constants.BLOCK_FINE)
         {
             resultFine += fine;
         }
         else
         {
             return Constants.BLOCK_FINE;
         }
     }
     return resultFine;
 }