// METHODE PUBLIQUES /// <summary> /// Adds a LinguisticValue object to the Values collection property /// </summary> /// <param name="a_value">LinguisticValue object to add</param> public void AddValue(LinguisticValue a_value) { Values.Add(a_value); double lastMinValue = minValue; double lastMaxValue = maxValue; ComputeMinMax(); if (minValue > lastMinValue) { minValue = lastMinValue; } if (maxValue < lastMaxValue) { maxValue = lastMaxValue; } }
// METHODE PRIVEE /// <summary> /// Search and compute the premise degree for given problem : if premise is applicable returns the degree, if not returns double.Nan /// </summary> /// <param name="a_problem">FuzzyValue collections of a given problem</param> /// <param name="a_localPremise">Premise to check</param> /// <returns>Degree of the premise or double.Nan if premise not applicable</returns> protected double SearchAndComputePremiseDegree(List <FuzzyValue> a_problem, FuzzyExpression a_localPremise) { List <FuzzyValue> .Enumerator enumerator = a_problem.GetEnumerator(); LinguisticValue linguisticValue = null; while (enumerator.MoveNext()) { if (a_localPremise.VariableName == enumerator.Current.VariableName) { linguisticValue = a_localPremise.VariableName.LinguisticValueByName(a_localPremise.ValueName); if (linguisticValue != null) { return(linguisticValue.DegreeAtValue(enumerator.Current.Value)); } else { return(double.NaN); } } } return(double.NaN); }