edgetoneighbor.cs

来自「This is a document about routing [a spat」· CS 代码 · 共 72 行

CS
72
字号
using System;

namespace MapService
{
	/// <summary>
	/// EdgeToNeighbor represents an edge eminating from one <see cref="Node"/> to its neighbor.  The EdgeToNeighbor
	/// class, then, contains a reference to the neighbor and the weight of the edge.
	/// </summary>
	public class EdgeToNeighbor
	{
		#region Private Member Variables
		// private member variables
        private Node source;
        private int cost;
		private Node neighbor;
        private bool twoway;

        public bool IsTwoWay
        {
            get { return twoway; }
            set { twoway= value; }
        }
	
		#endregion

		#region Constructors
		private EdgeToNeighbor() {}

		public EdgeToNeighbor(Node source,Node neighbor,bool twoway)
		{
            this.source = source;
            this.neighbor = neighbor;
            this.twoway= twoway;
			this.cost = Common.Len(source,neighbor);
		}
		#endregion

		#region Public Properties
		/// <summary>
		/// The weight of the edge.
		/// </summary>
		/// <remarks>A value of 0 would indicate that there is no weight, and is the value used when an unweighted
		/// edge is added via the <see cref="Graph"/> class.</remarks>
		public virtual int Cost
		{
			get
			{
				return cost;
			}
		}

		/// <summary>
		/// The neighbor the edge is leading to.
		/// </summary>
		public virtual Node Neighbor
		{
			get
			{
				return neighbor;
			}
		}
        public virtual Node Source
        {
            get
            {
                return source;
            }
        }
		#endregion
	}
}

⌨️ 快捷键说明

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