/// <summary> /// Clone only the relevant environment, i.e., the variables provided. /// </summary> /// <param name="visibleVars"></param> /// <returns></returns> public virtual Valuation GetVariableClone(List <string> visibleVars) { Valuation newEnv = new Valuation(); if (Variables != null) { StringDictionaryWithKey <ExpressionValue> newVar = new StringDictionaryWithKey <ExpressionValue>(); foreach (StringDictionaryEntryWithKey <ExpressionValue> pair in Variables._entries) { if (pair != null) { foreach (string var in visibleVars) { if (var == pair.Key) { newVar.Add(pair.Key, pair.Value.GetClone()); break; } } } } newEnv.Variables = newVar; } newEnv.Channels = this.Channels; return(newEnv); }
public void SetToken(string id, int value) { if (ValuationToken.ContainsKey(id)) { ValuationToken.SetValue(id, value); } else { ValuationToken.Add(id, value); } }
/// <summary> /// Clone only the relevant environment, i.e., the variables provided. /// </summary> /// <param name="visibleVars"></param> /// <returns></returns> public virtual Valuation GetVariableClone(List<string> visibleVars) { Valuation newEnv = new Valuation(); if (Variables != null) { StringDictionaryWithKey<ExpressionValue> newVar = new StringDictionaryWithKey<ExpressionValue>(); foreach (StringDictionaryEntryWithKey<ExpressionValue> pair in Variables._entries) { if (pair != null) { foreach (string var in visibleVars) { if (var == pair.Key) { newVar.Add(pair.Key, pair.Value.GetClone()); break; } } } } newEnv.Variables = newVar; } newEnv.Channels = this.Channels; return newEnv; }