/// <inheritdoc/>
 public IList<Parameter> Find(ParameterType type, string name)
 {
     var key = new ParameterKey(type, name);
     if (!_dictionary.ContainsKey(key))
         return new List<Parameter>();
     var foundParameters = _dictionary[key];
     var result = new List<Parameter>(foundParameters.Count);
     result.AddRange(foundParameters.Select(x => x.Parameter));
     return result;
 }
 /// <inheritdoc/>
 public void AddOrUpdate(Parameter parameter)
 {
     ulong order;
     var key = new ParameterKey(parameter);
     IReadOnlyCollection<ParameterEntry> oldEntries;
     if (_dictionary.TryGetValue(key, out oldEntries))
     {
         order = oldEntries.First().Order;
         _dictionary.Remove(key);
     }
     else
     {
         order = _order++;
     }
     _dictionary.Add(key, new ParameterEntry(order, parameter));
 }
Exemple #3
0
        /// <inheritdoc/>
        public bool Remove(Parameter item)
        {
            var key = new ParameterKey(item);
            IReadOnlyCollection <ParameterEntry> entries;

            if (!_dictionary.TryGetValue(key, out entries))
            {
                return(false);
            }
            var entry = entries.FirstOrDefault(x => ReferenceEquals(x.Parameter, item));

            if (entry == null)
            {
                return(false);
            }
            return(_dictionary.Remove(key, entry));
        }
Exemple #4
0
        /// <inheritdoc/>
        public void AddOrUpdate(Parameter parameter)
        {
            ulong order;
            var   key = new ParameterKey(parameter);
            IReadOnlyCollection <ParameterEntry> oldEntries;

            if (_dictionary.TryGetValue(key, out oldEntries))
            {
                order = oldEntries.First().Order;
                _dictionary.Remove(key);
            }
            else
            {
                order = _order++;
            }
            _dictionary.Add(key, new ParameterEntry(order, parameter));
        }
Exemple #5
0
        /// <inheritdoc/>
        public bool Remove(ParameterType type, string name)
        {
            var key = new ParameterKey(type, name);

            return(_dictionary.Remove(key));
        }
 /// <inheritdoc/>
 public bool Remove(Parameter item)
 {
     var key = new ParameterKey(item);
     IReadOnlyCollection<ParameterEntry> entries;
     if (!_dictionary.TryGetValue(key, out entries))
         return false;
     var entry = entries.FirstOrDefault(x => ReferenceEquals(x.Parameter, item));
     if (entry == null)
         return false;
     return _dictionary.Remove(key, entry);
 }
 /// <inheritdoc/>
 public bool Remove(ParameterType type, string name)
 {
     var key = new ParameterKey(type, name);
     return _dictionary.Remove(key);
 }