Exemplo n.º 1
0
        // The following INamespace properties are implemented on DictionaryTree
        //public string Name { get; protected set; }
        //public string FullName { get; protected set; }

        #endregion

        #region IParameterSource

        /// <summary>
        /// This method inserts or overwrites a parameter and its value in the Primary dictionary.
        /// Note that this only affects the top-level Primary dictionary. If parents contain entries
        /// for the same parameter, those entries remain unaffected and will "shadow" whatever
        /// entry is created or overwritten here. In other words, if this entry is later removed
        /// from the dictionary at this level, then the parent entries will come back into view.
        /// </summary>
        /// <param name="parameter">The parameter that will be used as the key.</param>
        /// <param name="paramValue">The parameter value that will be associated with the key.</param>
        public void SetParameter(IParameter parameter, string paramValue)
        {
            if (LocalEntries.ContainsKey(parameter.Param)) // update existing entry
            {
                LocalEntries[parameter.Param] = paramValue;
            }
            else
            {
                LocalEntries.Add(parameter.Param, paramValue); // add new entry
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// This performs a "deep" search for the specified key.
 /// That is, the Primary dictionary,
 /// and the Primary dictionaries of all ancestors will be searched.
 /// If a "shallow" search is required, call "Shallow().ContainsKey()" instead.
 /// </summary>
 /// <remarks>If the key is found, it is added to the Accessed list if TrackAccessed is enabled.</remarks>
 /// <param name="key">The key that will be searched.</param>
 /// <returns>A boolean indicating if the specified entry was found.</returns>
 public bool ContainsKey(TKey key)
 {
     lock (_syncRoot)
     {
         if (LocalEntries.ContainsKey(key))
         {
             return(true);
         }
         for (var x = Parents.Count - 1; x >= 0; x--)
         {
             if (Parents[x].ContainsKey(key))
             {
                 return(true);
             }
         }
         return(false);
     }
 }