⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 adjacencylist.cs

📁 This is a document about routing [a spatial analysis - network]
💻 CS
字号:
using System;
using System.Collections;


namespace MapService
{
	/// <summary>
	/// AdjacencyList maintains a list of neighbors for a particular <see cref="Node"/>.  It is derived from CollectionBase
	/// and provides a strongly-typed collection of <see cref="EdgeToNeighbor"/> instances.
	/// </summary>
	public class AdjacencyList : CollectionBase
	{
		/// <summary>
		/// Adds a new <see cref="EdgeToNeighbor"/> instance to the AdjacencyList.
		/// </summary>
		/// <param name="e">The <see cref="EdgeToNeighbor"/> instance to add.</param>
		public virtual void Add(EdgeToNeighbor e)
		{
			base.InnerList.Add(e);
		}

        public virtual void Remove(EdgeToNeighbor e)
        {
            base.InnerList.Remove(e);
        }

        public virtual void Remove(Node e)
        {
            int i= InnerList.Count;
            while (i > 0)
            {
                i--;
                EdgeToNeighbor edge = (EdgeToNeighbor)InnerList[i];
                if (edge.Neighbor == e)
                    base.InnerList.Remove(edge);
                
            }
        }

		/// <summary>
		/// Returns a particular <see cref="EdgeToNeighbor"/> instance by index.
		/// </summary>
		public virtual EdgeToNeighbor this[int index]
		{
			get { return (EdgeToNeighbor) base.InnerList[index]; }
			set { base.InnerList[index] = value; }
		}


	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -