From 5364356a1815b4eaf06bf741e88ef14ccfcb7413 Mon Sep 17 00:00:00 2001 From: Elia Sulimanov Date: Tue, 16 Jun 2020 08:53:40 +0300 Subject: [PATCH] Done TempDictionary api docs --- .../Cosmos.System2/Network/TempDictionary.cs | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/source/Cosmos.System2/Network/TempDictionary.cs b/source/Cosmos.System2/Network/TempDictionary.cs index 387c27598..2b95bc9b1 100644 --- a/source/Cosmos.System2/Network/TempDictionary.cs +++ b/source/Cosmos.System2/Network/TempDictionary.cs @@ -3,22 +3,42 @@ using System.Collections.Generic; namespace Cosmos.System.Network { + /// + /// TempDictionary template class. + /// + /// TempDictionary type name. internal class TempDictionary { private List mKeys; private List mValues; + /// + /// Get the number of elements in the list. + /// public int Count { get; private set; } + /// + /// Create new inctanse of the class. + /// + /// Thrown on fatal error (contact support). public TempDictionary() :this(2) { } + + /// + /// Create new inctanse of the class, with a specified initial size. + /// + /// Initial size. + /// Thrown if initialSize is less than 0. public TempDictionary(int initialSize) { this.mKeys = new List(initialSize); this.mValues = new List(initialSize); } + /// + /// Get TempDictionary{TValue} keys array. + /// public UInt32[] Keys { get @@ -26,6 +46,10 @@ namespace Cosmos.System.Network return this.mKeys.ToArray(); } } + + /// + /// Get TempDictionary{TValue} values array. + /// public TValue[] Values { get @@ -34,6 +58,12 @@ namespace Cosmos.System.Network } } + /// + /// Get and set the element with the specified key. + /// + /// Key of an element. + /// TValue value. + /// (set) Thrown if no element with the specified key is found. public TValue this[UInt32 key] { get @@ -63,6 +93,11 @@ namespace Cosmos.System.Network } } + /// + /// Check if the key exists in the TempDictionary{TValue}. + /// + /// Key to check if exists. + /// bool value. public bool ContainsKey(UInt32 key) { for (int i = 0; i < mKeys.Count; i++) @@ -76,6 +111,12 @@ namespace Cosmos.System.Network return false; } + /// + /// Adds an object at the end of the TempDictionary{TValue}. + /// + /// Object key. + /// Object value. + /// Thrown if key already exists. public void Add(UInt32 key, TValue val) { if (ContainsKey(key) == true) @@ -87,6 +128,11 @@ namespace Cosmos.System.Network mValues.Add(val); } + /// + /// Removes the element with the specified key of the TempDictionary{TValue}. + /// + /// Key of the item to remove. + /// Thrown on fatal error (contact support). public void Remove(UInt32 key) { int idx = mKeys.IndexOf(key); @@ -95,6 +141,12 @@ namespace Cosmos.System.Network this.Remove(idx); } } + + /// + /// Removes the element at the specified index of the TempDictionary{TValue}. + /// + /// Index of the item to remove. + /// Thrown if no such index exists in the TempDictionary. public void Remove(int index) { if (index > mKeys.Count - 1) @@ -106,6 +158,9 @@ namespace Cosmos.System.Network mValues.RemoveAt(index); } + /// + /// Removes all elements from the TempDictionary{TValue}. + /// public void Clear() { mKeys.Clear();