本文整理汇总了C#中IEdge.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# IEdge.GetType方法的具体用法?C# IEdge.GetType怎么用?C# IEdge.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEdge
的用法示例。
在下文中一共展示了IEdge.GetType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddEdge
/// <summary>
/// Used for serialization. Not for private use.
/// </summary>
/// <param name="e">edge to add.</param>
public virtual void AddEdge(IEdge e)
{
if (e==null)
throw new ArgumentNullException("vertex");
if (e.GetType() != EdgeProvider.EdgeType)
throw new ArgumentNullException("vertex type not valid");
if (!VertexOutEdges.ContainsKey(e.Source))
throw new VertexNotFoundException("Could not find source vertex");
if (!VertexOutEdges.ContainsKey(e.Target))
throw new VertexNotFoundException("Could not find target vertex");
// if parralel edges are not allowed check if already in the graph
if (!this.AllowParallelEdges)
{
if (ContainsEdge(e.Source,e.Target))
throw new ArgumentException("graph does not allow duplicate edges");
}
// create edge
EdgeProvider.UpdateEdge(e);
VertexOutEdges[e.Source].Add(e);
}
示例2: IEdgeToEdge
//*************************************************************************
// Method: IEdgeToEdge
//
/// <summary>
/// Casts an <see cref="IEdge" /> to an <see cref="Edge" /> object.
/// </summary>
///
/// <param name="oEdge">
/// The <see cref="IEdge" /> to cast to an <see cref="Edge" /> object.
/// </param>
///
/// <param name="sClassName">
/// Name of the class calling this method.
/// </param>
///
/// <param name="sMethodOrPropertyName">
/// Name of the method or property calling this method.
/// </param>
///
/// <returns>
/// The <see cref="Edge" /> object.
/// </returns>
///
/// <remarks>
/// An exception is thrown if <paramref name="oEdge" /> is null or not of
/// type <see cref="Edge" />.
/// </remarks>
//*************************************************************************
protected internal static Edge IEdgeToEdge(
IEdge oEdge,
String sClassName,
String sMethodOrPropertyName
)
{
Debug.Assert( !String.IsNullOrEmpty(sClassName) );
Debug.Assert( !String.IsNullOrEmpty(sMethodOrPropertyName) );
if (oEdge == null)
{
throw new ApplicationException(String.Format(
"{0}.{1}: An edge is null."
,
sClassName,
sMethodOrPropertyName
) );
}
if ( !(oEdge is Edge) )
{
throw new ApplicationException(String.Format(
"{0}.{1}: An edge is not of type Edge. The type is {2}."
,
sClassName,
sMethodOrPropertyName,
oEdge.GetType().FullName
) );
}
return ( (Edge)oEdge );
}
示例3: AddEdge
public virtual void AddEdge(IEdge e)
{
if (e == null)
{
throw new ArgumentNullException("vertex");
}
if (e.GetType() != this.EdgeProvider.get_EdgeType())
{
throw new ArgumentNullException("vertex type not valid");
}
if (!this.VertexOutEdges.ContainsKey(e.get_Source()))
{
throw new VertexNotFoundException("Could not find source vertex");
}
if (!this.VertexOutEdges.ContainsKey(e.get_Target()))
{
throw new VertexNotFoundException("Could not find target vertex");
}
if (!this.AllowParallelEdges && this.ContainsEdge(e.get_Source(), e.get_Target()))
{
throw new ArgumentException("graph does not allow duplicate edges");
}
this.EdgeProvider.UpdateEdge(e);
this.VertexOutEdges.get_Item(e.get_Source()).Add(e);
}