// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved. using System.Collections.Generic; using System.Collections.Specialized; namespace FlaxEngine.Collections { /// /// Interface for a dictionary object that allows rapid hash lookups using keys, but also maintains the key insertion order so that values can be retrieved by key index. /// /// The type of keys in the dictionary. /// The type of values in the dictionary. public interface IOrderedDictionary : IDictionary, IOrderedDictionary { /// /// Gets or sets the element at the specified index. /// /// The index of the element to get or set. /// The element at the specified index. new TValue this[int index] { get; set; } /// /// Gets or sets the element with the specified key. /// /// The key of the element to get or set. /// The element with the specified key. new TValue this[TKey key] { get; set; } /// /// Gets the number of elements contained in the collection. /// new int Count { get; } /// /// Gets the collection of the keys. /// new ICollection Keys { get; } /// /// Gets the collection of the values. /// new ICollection Values { get; } /// /// Adds an element with the provided key and value to the collection. /// /// The object to use as the key of the element to add. /// The object to use as the value of the element to add. new void Add(TKey key, TValue value); /// /// Removes all items from the collection. /// new void Clear(); /// /// Inserts the item at the specified index. /// /// The index. /// The object to use as the key of the element to add. /// The object to use as the value of the element to add. void Insert(int index, TKey key, TValue value); /// /// Determines whether an element is in the collection. /// /// The object to locate in the current dictionary. The element to locate can be null for reference types. /// The index of the item. int IndexOf(TKey key); /// /// Determines whether the dictionary contains the specified value. /// /// The value to check. /// true if the dictionary contains the specified value; otherwise, false. bool ContainsValue(TValue value); /// /// Determines whether the dictionary contains the specified value. /// /// The value to check. /// The equality comparer. /// true if the dictionary contains the specified value; otherwise, false. bool ContainsValue(TValue value, IEqualityComparer comparer); /// /// Determines whether the dictionary contains the specified key. /// /// The key to check. /// true if the dictionary contains the specified key; otherwise, false. new bool ContainsKey(TKey key); /// /// Returns an enumerator that iterates through the collection. /// /// An enumerator that can be used to iterate through the collection. new IEnumerator> GetEnumerator(); /// /// Removes the element with the specified key from the collection. /// /// The key of the element to remove. /// if the element is successfully removed; otherwise, . This method also returns if was not found in the original collection. new bool Remove(TKey key); /// /// Removes the element at the specified index. /// /// The zero-based index of the element to remove. new void RemoveAt(int index); /// /// Gets the value associated with the specified key. /// /// The key whose value to get. /// When this method returns, the value associated with the specified key, if the key is found; otherwise, the default value for the type of the parameter. This parameter is passed uninitialized. /// if the object that implements collection contains an element with the specified key; otherwise, . new bool TryGetValue(TKey key, out TValue value); /// /// Gets the value by the key. /// /// The key. /// The value. TValue GetValue(TKey key); /// /// Sets the 0 by the key. /// /// The key. /// The value. void SetValue(TKey key, TValue value); /// /// Gets the item at the specified index. /// /// The index. /// The key-value pair. KeyValuePair GetItem(int index); /// /// Sets the value. /// /// The index. /// The value. void SetItem(int index, TValue value); } }