📄 edgetoneighbor.cs
字号:
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -