/// <summary>
            /// Does this DerivativeOperation's calculation on a number.
            /// </summary>
            /// <param name="source">The original number.</param>
            /// <returns>The number after calculation.</returns>
            public double Calc(double source)
            {
                double val = source;

                if (reference == null)
                {
                    char   oper = logic[0];
                    double mod  = double.Parse(logic.Substring(1));
                    val = Operate(oper, source, mod);
                }
                else if (reference is ModuleCheck)
                {
                    ModuleCheck check  = reference as ModuleCheck;
                    string[]    logics = logic.Split(',');
                    if (check.IsChecked)
                    {
                        char   oper = logics[0][0];
                        double mod  = double.Parse(logics[0].Substring(1));
                        val = Operate(oper, source, mod);
                    }
                    else if (logics.Length > 1)
                    {
                        char   oper = logics[1][0];
                        double mod  = double.Parse(logics[1].Substring(1));
                        val = Operate(oper, source, mod);
                    }
                }
                else if (reference is ModuleMenu)
                {
                    ModuleMenu menu   = reference as ModuleMenu;
                    string[]   logics = logic.Split(',');
                    char       oper   = logics[menu.MenuIndex - 1][0];
                    double     mod    = double.Parse(logics[menu.MenuIndex - 1].Substring(1));
                    val = Operate(oper, source, mod);
                }
                else if (reference is ModuleNumeric)
                {
                    ModuleNumeric numeric = reference as ModuleNumeric;
                    char          oper    = logic[0];
                    double        mod     = numeric.Number;
                    val = Operate(oper, source, mod);
                }
                else
                {
                    throw new ArgumentException("Cannot calculate a DerivativeOperation based on a " + reference.ModuleType + " module.");
                }

                return(val);
            }
 /// <summary>
 /// Creates a new derivative operation from a check module and two operator/double pairs.
 /// The first operator and double will happen when the module is checked. The second
 /// operator and double will happen when it isn't.
 /// </summary>
 /// <param name="reference">The check module.</param>
 /// <param name="oper1">The first operator.</param>
 /// <param name="val1">The first double.</param>
 /// <param name="oper2">The second operator.</param>
 /// <param name="val2">The second double.</param>
 public DerivativeOperation(ModuleCheck reference, char oper1, double val1, char oper2, double val2)
 {
     this.reference = reference;
     this.logic     = oper1 + "" + val1 + "," + oper2 + "" + val2;
 }