A stand and its ranking.
コード例 #1
0
        //---------------------------------------------------------------------

        void IStandRankingMethod.RankStands(List<Stand>    stands,
                                            StandRanking[] rankings)
        {
            int i = 0;
            foreach (Stand stand in stands)
            {
                double standEconImportance = 0.0;
//                foreach (ActiveSite site in stand)
//                {
//                    double siteEconImportance = 0.0;
//                    foreach (AgeCohort cohort in site)
//                    {
//                        if (cohort.Age > 0 && cohort.Age > Prescription.EconomicTable[cohort.Species].MinimumAge)
//                            siteEconImportance += Prescription.EconomicTable[cohort.Species].Rank / Prescription.EconomicTable[cohort.Species].MinimumAge * cohort.Age;
//                    }
//                    standEconImportance += siteEconImportance;
//                }
//                standEconImportance /= stand.SiteCount;

                StandRanking ranking = new StandRanking();
                ranking.Stand = stand;
                ranking.Rank = standEconImportance;
                rankings[i] = ranking;
            }
        }
コード例 #2
0
        //---------------------------------------------------------------------

        void IStandRankingMethod.RankStands(List<Stand> stands,
                                            StandRanking[] rankings)
        {
            for (int i = 0; i < stands.Count; i++) {
                Stand stand = stands[i];
                rankings[i].Stand = stand;
                rankings[i].Rank = stand.Age;
            }
        }
コード例 #3
0
        //---------------------------------------------------------------------

        void IStandRankingMethod.RankStands(List<Stand> stands,
                                            StandRanking[] rankings)
        {
            for (int i = 0; i < stands.Count; i++) {
                Stand stand = stands[i];
                double rank = 0;
                if (! stand.IsSetAside) {
                    bool meetsAllRequirements = true;
                    foreach (IRankingRequirement requirement in requirements) {
                        if (! requirement.MetBy(stand)) {
                            meetsAllRequirements = false;
                            break;
                        }
                    }
                    if (meetsAllRequirements)
                        rank = ComputeRank(stand);
                }
                rankings[i].Stand = stand;
                rankings[i].Rank = rank;
            }
        }
        //---------------------------------------------------------------------

        void IStandRankingMethod.RankStands(List<Stand> stands,
                                            StandRanking[] rankings) {
            InitializeForRanking(stands, stands.Count);
            for (int i = 0; i < stands.Count; i++) {
                Stand stand = stands[i];
                double rank = 0;
                if (! stand.IsSetAside) {
                    //check if stand meets all the ranking requirements
                    bool meetsAllRequirements = true;
                    foreach (IRequirement requirement in requirements) {
                        if (! requirement.MetBy(stand)) {
                            meetsAllRequirements = false;
							//set stand rank to 0
							rankings[i].Rank = 0;
                            break;
                        }
                    }
					
                    //if the stand meets all the requirements and is not set-aside,, get its rank
                    if (meetsAllRequirements) {
                        rank = ComputeRank(stand, i);
                    }
                    //otherwise, rank it 0 (so it will not be harvested.)
                    else {
                        rank = 0;
                    }
                }
				else {
					rankings[i].Rank = 0;
				}
                rankings[i].Stand = stand;
                rankings[i].Rank = rank;
                //assign rank to stand
//				UI.WriteLine("stand {0} rank = {1}\n\n", rankings[i].Stand.MapCode, rankings[i].Rank);
            }
        }
コード例 #5
0
        //---------------------------------------------------------------------

        /// <summary>
        /// Compares two stand rankings such that the higher ranking comes
        /// before the lower ranking.
        /// </summary>
        public static int CompareRankings(StandRanking x,
                                          StandRanking y)
        {
            if (x.Rank > y.Rank)
                return -1;
            else if (x.Rank < y.Rank)
                return 1;
            else
                return 0;
        }