예제 #1
0
        /// <summary>
        /// Find the forage provider for this forage/provider name
        /// </summary>
        /// <param name="providerName">The forage provider (component) name</param>
        /// <returns>The ForageProvider</returns>
        public ForageProvider FindProvider(string providerName)
        {
            ForageProvider provider = null;
            int            i        = 0;

            while ((provider == null) && (i <= this.forageProviderList.Count - 1))
            {
                // if the name matches
                if (this.forageProviderList[i].ForageHostName == providerName)
                {
                    provider = this.forageProviderList[i];
                }
                i++;
            }
            return(provider);
        }
예제 #2
0
        /// <summary>
        /// Find the forage provider for this component ID.
        /// </summary>
        /// <param name="hostID">The host component ID</param>
        /// <returns>The forage provider</returns>
        public ForageProvider FindProvider(int hostID)
        {
            ForageProvider provider = null;
            int            i        = 0;

            while ((provider == null) && (i <= this.forageProviderList.Count - 1))
            {
                // if the host matches
                if (this.forageProviderList[i].HostID == hostID)
                {
                    provider = this.forageProviderList[i];
                }
                i++;
            }
            return(provider);
        }
예제 #3
0
        /// <summary>
        /// Add a forage provider component
        /// </summary>
        /// <param name="paddock">The paddock info</param>
        /// <param name="paddName">The paddock name</param>
        /// <param name="forageName">The forage name</param>
        /// <param name="hostID">Component ID</param>
        /// <param name="driverID">Driver ID</param>
        /// <param name="forageObj">The forage object</param>
        public void AddProvider(PaddockInfo paddock, string paddName, string forageName, int hostID, int driverID, IPlantDamage forageObj)
        {
            ForageProvider forageProvider;

            // this is a forage provider
            // this provider can host a number of forages/species
            forageProvider = new ForageProvider();
            forageProvider.PaddockOwnerName = paddName;    // owning paddock
            forageProvider.ForageHostName   = forageName;  // host pasture/plant component name
            forageProvider.HostID           = hostID;      // plant/pasture comp
            forageProvider.ForageObj        = forageObj;   // setting property ID
            // keep a ptr to the paddock owned by the model so the forages can be assigned there as they become available
            forageProvider.OwningPaddock = paddock;

            this.forageProviderList.Add(forageProvider);
        }