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


C# IEdge类代码示例

本文整理汇总了C#中IEdge的典型用法代码示例。如果您正苦于以下问题:C# IEdge类的具体用法?C# IEdge怎么用?C# IEdge使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IEdge类属于命名空间,在下文中一共展示了IEdge类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ChangeEventsEnabled_When_False_Prevents_NetworkChanged_Fired_When_RemoveEdge_Is_Called

        public void ChangeEventsEnabled_When_False_Prevents_NetworkChanged_Fired_When_RemoveEdge_Is_Called(int nodeCount, int edgeCount, int edgesToRemove)
        {
            //Arrange
            var net = new BasicAdjList(Guid.NewGuid());
            Random rand = new Random();
            for (int i = 0; i < nodeCount; i++)
                net.CreateNode();

            INode nodeA = null;
            INode nodeB = null;

            IEdge[] edges = new IEdge[edgeCount];
            for (int i = 0; i < edgeCount; i++)
            {
                nodeA = net.Nodes[rand.Next(nodeCount)];
                nodeB = net.Nodes[rand.Next(nodeCount)];
                edges[i] = net.CreateEdge(nodeA, nodeB);
            }
            //---------------------

            var helper = new NetworkChangedEventsTestHelper();
            net.NetworkChanged += new NetworkChangedEventHandler<INetwork, NetworkChangedEventArgs>(helper.NetworkChanged_DummyHandler);

            net.ChangeEventsEnabled = false;
            for (int i = 0; i < edges.Length; i++)
            {
                net.RemoveEdge(edges[i]);
            }

            Assert.Equal(0, helper.NetworkChanged_TimesCalled);
        }
开发者ID:BgRva,项目名称:Blob1,代码行数:31,代码来源:BasicAdjList_As_INetworkChangeEventsFixture.cs

示例2: AddEdge

 /// <summary>
 /// Inserts the Edge object to the Graph.
 /// <para>Connecting IVertex objects should already be present in the graph before attempting to add a connection.</para>
 /// </summary>
 /// <param name="edge">IEdge object to add.</param>
 public void AddEdge(IEdge edge)
 {
     if (_vertices.ContainsKey(edge.ParentId) && _vertices.ContainsKey(edge.ChildId))
         _edges.AddOrUpdate(edge.ParentId, edge.ChildId, edge);
     else
         throw new InvalidOperationException("Invalid vertex index specified in edge");
 }
开发者ID:sethjuarez,项目名称:numl,代码行数:12,代码来源:Graph.cs

示例3: AGSEdges

		public AGSEdges(IEdge left, IEdge right, IEdge top, IEdge bottom)
		{
			Left = left;
			Right = right;
			Top = top;
			Bottom = bottom;
		}
开发者ID:tzachshabtay,项目名称:MonoAGS,代码行数:7,代码来源:AGSEdges.cs

示例4: ReversedEdge

        public ReversedEdge(IEdge e)
        {
            if (e==null)
                throw new ArgumentNullException("e");

            this.wrapped = e;
        }
开发者ID:BackupTheBerlios,项目名称:mbunit-svn,代码行数:7,代码来源:ReversedEdge.cs

示例5: addEdge

        public void addEdge(IEdge e)
        {
            if (e == null) {return; }

            //neplatný graf
            if (!innerGraph.Vertices.Contains(e.Vertex_1) || !innerGraph.Vertices.Contains(e.Vertex_2)) { return; }

            //multihrana

            /*
            foreach(Edge ed in innerGraph.Edges)
            {
                if ((ed.vertex_1 == e.vertex_1 && ed.vertex_2 == e.vertex_2) || (ed.vertex_1 == e.vertex_2 && ed.vertex_2 == e.vertex_1))
                {
                    return;
                }
            }
             */

            if (GraphForEdit.Edges.Contains(e, GraphForEdit.getEdgeComparer())) { return; }

            innerGraph.Edges.Add(e);

            if (eHandler != null) eHandler(this, new EdgeChangeArgs(e, ChangeType.Add));
        }
开发者ID:bidacek,项目名称:GraphTheoryEditor,代码行数:25,代码来源:NonOriented.cs

示例6: Test

		/// <summary>
		/// Test if edge e has a positive residual capacity
		/// </summary>
		/// <param name="e">edge to test</param>
		/// <returns>0 &lt; ResidualCapacities[e]</returns>
		/// <exception cref="ArgumentNullException">e is null</exception>
		public bool Test(IEdge e)
		{
			if (e == null)
				throw new ArgumentNullException("e");

			return 0 < (double)this.residualCapacities[e];
		}
开发者ID:timonela,项目名称:mb-unit,代码行数:13,代码来源:ResidualEdgePredicate.cs

示例7: FormatEdgeEventArgs

		/// <summary>
		/// Graphviz format edge parameter object
		/// </summary>
		/// <param name="edgeFormatter">edge formatter</param>
		/// <param name="e">edge</param>
		public FormatEdgeEventArgs(GraphvizEdge edgeFormatter, IEdge e)
			: base(e)
		{
			if (edgeFormatter==null)
				throw new ArgumentNullException("edgeFormatter");
			m_EdgeFormatter = edgeFormatter;
		}
开发者ID:timonela,项目名称:mb-unit,代码行数:12,代码来源:FormatEdgeEventArgs.cs

示例8: AddEdge

 public IEdge AddEdge(IEdge e)
 {
     if (e != null && Graph.Equals(e.Graph)) return e;
     if(Graph.AddEdge(e))
         return e;
     return null;
 }
开发者ID:kinghand,项目名称:KHGraphDB,代码行数:7,代码来源:GraphHelper.cs

示例9: GetEdgeScore

 private double GetEdgeScore(IEdge edge, HashSet<IEdge> checkedEdges,
                             Dictionary<IVertex, double> vertexScores, int level)
 {
     if (checkedEdges.Contains(edge))
     {
         return 0.0;
     }
     checkedEdges.Add(edge);
     double score = 0.0;
     // get adjacent vertex scores
     foreach (IVertex vertex in edge.Adjacent.Vertices)
     {
         if (vertexScores.ContainsKey(vertex))
         {
             score += vertexScores[vertex];
             vertexScores.Remove(vertex);
         }
     }
     score /= level;
     // other edge scores
     foreach (IEdge nextEdge in edge.Adjacent.Edges)
     {
         if (nextEdge.Color == null)
         {
             score += GetEdgeScore(nextEdge, checkedEdges, vertexScores, level + 1);
         }
     }
     return score;
 }
开发者ID:MingStar,项目名称:SimUniversity,代码行数:29,代码来源:SetupPlayer.cs

示例10: BuildRoad

        public IRoad BuildRoad(IEdge edge, IPlayer owner)
        {
            if (edge == null)
                throw new ArgumentNullException(nameof(edge));
            if (owner == null)
                throw new ArgumentNullException(nameof(owner));

            if (!Edges.Contains(edge))
                throw new ArgumentException("Edge does not exist on the board");
            if (roads.Any(r => r.Edge == edge))
                throw new ArgumentException("There already is a road build on the given edge");
            if (Tiles.Where(t => t.IsAdjacentTo(edge)).All(t => t.Rawmaterial == MaterialType.Sea))
                throw new ArgumentException("Can't build roads on sea!");

            var adjacentVertices = Vertices.Where(v => v.IsAdjacentTo(edge));
            var adjacentEdges = Edges.Where(e => e.IsAdjacentTo(edge));
            //CvB Todo: fix readability
            if (establishments.All(e => !adjacentVertices.Contains(e.Vertex) || e.Owner != owner) &&
                roads.All(r => !adjacentEdges.Contains(r.Edge) || r.Owner != owner))
                throw new ArgumentException("Road should have an adjacent establisment or road of the player");

            var road = new Road(edge, owner);
            roads.Add(road);

            logger.Info($"Road build; Player {owner.Name}, {edge.ToString()}");

            return road;
        }
开发者ID:Corne,项目名称:VOC,代码行数:28,代码来源:Board.cs

示例11: UpdateRegister

 internal void UpdateRegister(VertexRegister milestoneRegister, IEdge edge)
 {
     TotalWeight = milestoneRegister.TotalWeight + edge.Weight;
     EdgeTracks.Clear();
     EdgeTracks = milestoneRegister.EdgeTracks.Select(et => et).ToList();
     EdgeTracks.Add(edge);
 }
开发者ID:lurongkai,项目名称:SuperNet,代码行数:7,代码来源:VertexRegister.cs

示例12: Test

 public bool Test(IEdge e)
 {
     NamedEdge ne = e as NamedEdge;
     if (ne==null)
         return false;
     return ne.Name == name;
 }
开发者ID:BackupTheBerlios,项目名称:mbunit-svn,代码行数:7,代码来源:NameEqualPredicate.cs

示例13: checkEdgeCross

		private bool checkEdgeCross(IEdge edge, float previous, float current, Func<IEdge,float,float,bool> check)
		{
            if (!edge.Enabled) return false;
			if (!check(edge,previous,current)) return false;
			edge.OnEdgeCrossed.Invoke(edge, new AGSEventArgs());
			return true;
		}
开发者ID:tzachshabtay,项目名称:MonoAGS,代码行数:7,代码来源:AGSEdges.cs

示例14: PrintEdgeTrack

 private static void PrintEdgeTrack(IEdge[] edge)
 {
     Console.WriteLine("Edge tracks:");
     for (int i = 0; i < edge.Count(); i++) {
         Console.WriteLine("{0}: {1}", i + 1, edge[i]);
     }
 }
开发者ID:lurongkai,项目名称:SuperNet,代码行数:7,代码来源:Program.cs

示例15: FromEdges

		public void FromEdges(IEdges edges)
		{
			Left = edges.Left;
			Right = edges.Right;
			Top = edges.Top;
			Bottom = edges.Bottom;
		}
开发者ID:tzachshabtay,项目名称:MonoAGS,代码行数:7,代码来源:AGSEdges.cs


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