UnityAI.Core.Fuzzy.ContinuousFuzzyRuleVariable.SetExist C# (CSharp) Method

SetExist() private method

Check if the Set Exists
private SetExist ( string setName ) : bool
setName string
return bool
        internal virtual bool SetExist(string setName)
        {
            return moSetList.ContainsKey(setName);
        }

Usage Example

Example #1
0
        /// <summary>
        /// Get the FuzzySet based on the hedges
        /// </summary>
        /// <param name="lhs">Left Hand Side</param>
        /// <param name="setName">The Set Name that contains the Right Hand Side</param>
        /// <param name="hedges">The Hedge Name that contains the list of hedges</param>
        /// <returns></returns>
        private FuzzySet GetFuzzySet(ContinuousFuzzyRuleVariable lhs, string setName, string hedges)
        {
            FuzzySet rhs = null;
            string sValue = setName.Trim();
            string tmpHedges = hedges.Trim();

            // The value on the Rhs represents a fuzzy set name;
            // The named set must exist.
            if (lhs.SetExist(sValue))
            {
                if (tmpHedges.Length == 0)
                {
                    rhs = lhs.GetSet(sValue);
                }
                else
                {
                    rhs = lhs.GetOrAddHedgedSet(sValue, tmpHedges);
                }
            }
            else
            {
                Console.Out.WriteLine("Error: Invalid fuzzy set name " + sValue);
            }
            return rhs;
        }