Example #1
0
        private List <FuzzyLogicOperator> GetFuzzyLogicOperators(LinguisticVariable linguisticVariable, IEnumerable <StrongIdentifierValue> operatorsIdentifiers)
        {
            if (operatorsIdentifiers.IsNullOrEmpty())
            {
                return(new List <FuzzyLogicOperator>());
            }

            var result = new List <FuzzyLogicOperator>();

            var globalFuzzyLogicStorage = _context.Storage.GlobalStorage.FuzzyLogicStorage;

            foreach (var op in operatorsIdentifiers)
            {
#if DEBUG
                //Log($"op = {op}");
#endif

                var item = linguisticVariable.GetOperator(op);

#if DEBUG
                //Log($"item = {item}");
#endif

                if (item == null)
                {
                    item = globalFuzzyLogicStorage.GetDefaultOperator(op);

#if DEBUG
                    //Log($"item (2) = {item}");
#endif

                    if (item == null)
                    {
                        throw new Exception($"Unexpected fuzzy logic operator `{op.NameValue}`!");
                    }
                }

                result.Add(item);
            }

            return(result);
        }