private void InitVariable(TLine programLine, IVariable v) { IValueStore vs; if (v is Variable <double> ) { var vvar = (Variable <double>)v; Variables.TryGetValue(v.Name, out vs); var dvs = vs as ValueStore <double>; if (dvs == null) { dvs = new ValueStore <double>(0); Variables.Add(v.Name, dvs); } vvar.SetStore(dvs); } else if (v is Variable <string> ) { var vvar = (Variable <string>)v; Variables.TryGetValue(v.Name, out vs); var dvs = vs as ValueStore <string>; if (dvs == null) { dvs = new ValueStore <string>(""); Variables.Add(v.Name, dvs); } vvar.SetStore(dvs); } else if (!(v is ArrayVariable <double> || v is ArrayVariable <string>)) { throw new InterpreterException(programLine, "Unknown variable"); } }
public void SetStore(ValueStore <T> store) { _store = store; }