private void OnVarAccess(VarAccessEventArgs args) { if (VarAccess != null) { VarAccess(args); } }
public void Declare(string name, T value) { VarAccessEventArgs eventArgs = new VarAccessEventArgs(); OnVarAccess(eventArgs); variables[VarNameToInstancedName(name, eventArgs)] = value; }
private string VarNameToInstancedName(string name, VarAccessEventArgs args) { for (int i = 0; i < args.Instances.Count; i++) { name += RepeatedSuffix + args.Instances[i].ToString(); } return(name); }
public DictionaryKeyValueObserver <string, T> GetRange(string name) { VarAccessEventArgs eventArgs = new VarAccessEventArgs(); OnVarAccess(eventArgs); string instancedName = VarNameToInstancedName(name, eventArgs) + RepeatedSuffix; return(new DictionaryKeyValueObserver <string, T>(variables, (kv) => kv.Key.StartsWith(instancedName))); }
public T GetDeclared(string name) { VarAccessEventArgs eventArgs = new VarAccessEventArgs(); OnVarAccess(eventArgs); if (eventArgs.IsInstanced) { string instancedName = VarNameToInstancedName(name, eventArgs); for (string stepName = instancedName; stepName.IndexOf(RepeatedSuffix) >= 0; stepName = stepName.Substring(0, stepName.LastIndexOf(RepeatedSuffix))) { if (variables.ContainsKey(stepName)) { return(variables[stepName]); } } } return(variables[name]); }