using System;
using JD.Collections.Interfaces;
using JD.Kernel.StaticHelpers;
namespace JD.TeaBoxAddinSystem.Addins.Description
{
///
/// Collection of s
///
internal class ExtensionNodeDescriptionCollection : AddinObjectCollection, IKeyedList
{
#region Properties
///
/// Gets an by its id.
///
///
/// Not all s have an id, and ids are not guaranteed to be unique.
/// This method will return the first it finds with the given .
/// This method is O(N).
///
///
public ExtensionNodeDescription this[string id]
{
get
{
Throw.IfEmpty(id, "id");
foreach (ExtensionNodeDescription description in this)
{
if (string.Equals(description.Id, id))
{
return description;
}
}
return null;
}
}
#endregion
#region Methods
///
/// Returns if an with the given is contained in this collection.
///
///
/// Not all s have an id, and ids are not guaranteed to be unique.
/// This method will return true as soon as it finds an with the given .
/// This method is O(N).
///
///
public bool ContainsKey(string id)
{
return (this[id] != null);
}
///
/// Not supported.
///
///
///
public bool Remove(string id)
{
throw new NotSupportedException();
}
public bool TryGetValue(string key, out ExtensionNodeDescription value)
{
value = this[key];
return value != null;
}
#endregion
}
}