Example #1
0
        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;
        }
Example #2
0
        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;
        }
Example #3
0
 public VariableExpression(Variable variable)
 {
     this.variable = variable;
 }
Example #4
0
        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);
        }
Example #5
0
 public void SetVariable(Variable variable)
 {
     Namespace ns = this.GetNamespace(variable.Namespace);
     ns.SetVariable(variable);
 }
Example #6
0
 public object GetVariableValue(Variable variable)
 {
     return this.GetVariableValue(variable.Namespace, variable.Name);
 }
Example #7
0
 public Variable GetVariable(Variable variable)
 {
     return this.GetVariable(variable.Namespace, variable.Name);
 }