当前位置: 首页>>代码示例>>C#>>正文


C# IEdge.GetType方法代码示例

本文整理汇总了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);
		}
开发者ID:timonela,项目名称:mb-unit,代码行数:25,代码来源:AdjacencyGraph.cs

示例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 );
        }
开发者ID:haisreekanth,项目名称:NetMap,代码行数:62,代码来源:Edge.cs

示例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);
 }
开发者ID:NigelThorne,项目名称:ndependencyinjection,代码行数:25,代码来源:AdjacencyGraph.cs


注:本文中的IEdge.GetType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。