Пример #1
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);
        }
Пример #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;
        }