/// <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 PNValuation GetPNValuationClone() { var newEnv = new PNValuation(); #region Based on Valuation.GetClone() code if (Variables != null) { var newVars = new StringDictionaryWithKey <ExpressionValue>(Variables); for (int i = 0; i < Variables._entries.Length; i++) { StringDictionaryEntryWithKey <ExpressionValue> pair = Variables._entries[i]; if (pair != null) { newVars._entries[i] = new StringDictionaryEntryWithKey <ExpressionValue>(pair.HashA, pair.HashB, pair.Value.GetClone(), pair.Key); } } newEnv.Variables = newVars; } if (Channels != null) { newEnv.Channels = new Dictionary <string, ChannelQueue>(this.Channels); } #endregion newEnv.ValuationToken = new StringDictionaryWithKey <int>(ValuationToken); return(newEnv); }
public virtual Valuation GetClone() { Valuation newEnv = new Valuation(); if (Variables != null) { StringDictionaryWithKey <ExpressionValue> newVars = new StringDictionaryWithKey <ExpressionValue>(Variables); for (int i = 0; i < Variables._entries.Length; i++) { StringDictionaryEntryWithKey <ExpressionValue> pair = Variables._entries[i]; if (pair != null) { newVars._entries[i] = new StringDictionaryEntryWithKey <ExpressionValue>(pair.HashA, pair.HashB, pair.Value.GetClone(), pair.Key); } } newEnv.Variables = newVars; } if (Channels != null) { newEnv.Channels = new Dictionary <string, ChannelQueue>(this.Channels); } return(newEnv); }
public PNValuation GetPNValuationClone() { var newEnv = new PNValuation(); #region Based on Valuation.GetClone() code if (Variables != null) { var newVars = new StringDictionaryWithKey<ExpressionValue>(Variables); for (int i = 0; i < Variables._entries.Length; i++) { StringDictionaryEntryWithKey<ExpressionValue> pair = Variables._entries[i]; if (pair != null) newVars._entries[i] = new StringDictionaryEntryWithKey<ExpressionValue>(pair.HashA, pair.HashB, pair.Value.GetClone(), pair.Key); } newEnv.Variables = newVars; } if (Channels != null) newEnv.Channels = new Dictionary<string, ChannelQueue>(this.Channels); #endregion newEnv.ValuationToken = new StringDictionaryWithKey<int>(ValuationToken); return newEnv; }
public static string GetVariableString(StringDictionaryWithKey <ExpressionValue> Variables) { string id = ""; if (Variables != null) { foreach (StringDictionaryEntryWithKey <ExpressionValue> pair in Variables._entries) { if (pair != null) { id += pair.Value.ExpressionID + ","; } } } return(id); }
public PNValuation() { ValuationToken = new StringDictionaryWithKey <int>(); }
/// <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 virtual Valuation GetVariableClone() { Valuation newEnv = new Valuation(); if (Variables != null) { StringDictionaryWithKey<ExpressionValue> newVars = new StringDictionaryWithKey<ExpressionValue>(Variables); for (int i = 0; i < Variables._entries.Length; i++) { StringDictionaryEntryWithKey<ExpressionValue> pair = Variables._entries[i]; if (pair != null) { newVars._entries[i] = new StringDictionaryEntryWithKey<ExpressionValue>(pair.HashA, pair.HashB, pair.Value.GetClone(), pair.Key); } } newEnv.Variables = newVars; } newEnv.Channels = this.Channels; return newEnv; }
public PNValuation() { ValuationToken = new StringDictionaryWithKey<int>(); }