public Define ( string variable, MathExpression expression ) : void | ||
variable | string | |
expression | MathExpression | |
return | void |
public void Define(string variable, MathExpression expression)
{
try
{
_lock.EnterWriteLock();
// Make sure the variable isn't refering to itself.
if (_variableFinder.HasVariableDefined(expression, this, variable))
{
string message = string.Format("Variable '{0}' is refering to itself recursively.", variable);
throw new MathExpressionException(message);
}
if (_lookup.ContainsKey(variable))
{
_lookup[variable] = expression;
}
else
{
_lookup.Add(variable, expression);
}
}
finally
{
_lock.ExitWriteLock();
}
}
MathExpressionContext::Define ( string variable, double value ) : void |