Ejemplo n.º 1
0
 /// <summary>
 ///     Verifies whether the <see cref="MathProgram" /> contains a constant value, i.e., whether any one of its
 ///     descendant programs are instances have a constant value equal to <paramref name="val" />.
 /// </summary>
 /// <returns>
 ///     <c>true</c>, if program contains a constant value equal to <paramref name="val" />, <c>false</c> otherwise.
 /// </returns>
 /// <param name="program">The program to verify whether it contains a constant.</param>
 /// <param name="val">The value to test for the program.</param>
 public static bool ContainsConstant(this ITreeProgram <double> program, double val)
 {
     return(program != null &&
            (program.EqualsConstant(val) ||
             program.Input != null && program.Input.Count > 0 &&
             program.Input.Any(child => child.ContainsConstant(val))));
 }