示例#1
0
        /// <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);
        }
示例#2
0
        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);
        }
示例#3
0
        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);
        }
示例#4
0
        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;
        }
示例#5
0
        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);
        }
示例#6
0
 public PNValuation()
 {
     ValuationToken = new StringDictionaryWithKey <int>();
 }
示例#7
0
 /// <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;
 }
示例#8
0
        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;
        }
示例#9
0
 public PNValuation()
 {
     ValuationToken = new StringDictionaryWithKey<int>();
 }