public void SetVariable(Variable variable) { if (!Utilities.Equals(variable.Namespace, this.name)) throw new InvalidOperationException("Variable belongs to another namespace"); if (this.variables.ContainsKey(variable.Name)) throw new InvalidOperationException(string.Format("Variable {0} already exists in namespace", variable.FullName)); this.variables[variable.Name] = variable; }
public static Variable Intern(Machine machine, string ns, string name) { if (string.IsNullOrEmpty(ns)) throw new InvalidOperationException("Variable has no namespace"); Variable variable = machine.GetVariable(ns, name); if (variable != null) return variable; variable = new Variable(ns, name); machine.SetVariable(variable); return variable; }
public VariableExpression(Variable variable) { this.variable = variable; }
public void SetVariableValue(Variable variable, object value) { Namespace ns = this.GetNamespace(variable.Namespace); Variable var = ns.GetVariable(variable.Name); if (var == null) ns.SetVariable(variable); ns.SetValue(variable.Name, value); }
public void SetVariable(Variable variable) { Namespace ns = this.GetNamespace(variable.Namespace); ns.SetVariable(variable); }
public object GetVariableValue(Variable variable) { return this.GetVariableValue(variable.Namespace, variable.Name); }
public Variable GetVariable(Variable variable) { return this.GetVariable(variable.Namespace, variable.Name); }