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


C# IVertex.ToString方法代码示例

本文整理汇总了C#中IVertex.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# IVertex.ToString方法的具体用法?C# IVertex.ToString怎么用?C# IVertex.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IVertex的用法示例。


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

示例1: BuildEstablishment

        public IEstablishment BuildEstablishment(IVertex vertex, IPlayer owner)
        {
            if (vertex == null)
                throw new ArgumentNullException(nameof(vertex));
            if (owner == null)
                throw new ArgumentNullException(nameof(owner));
            if (!Vertices.Contains(vertex))
                throw new ArgumentException("Did not find the passed vertex on the board");
            if (establishments.Any(e => e.Vertex == vertex))
                throw new ArgumentException("Invalid vertex, already an establishment here");

            var vertices = Vertices.Where(v => v.IsAdjacentTo(vertex));
            var tiles = Tiles.Where(t => t.IsAdjacentTo(vertex));
            if (establishments.Any(e => vertices.Contains(e.Vertex)))
                throw new ArgumentException("Invalid vertex, establishment can't be placed next to another establishment");
            if (tiles.All(t => t.Rawmaterial == MaterialType.Sea))
                throw new ArgumentException("Can't place an establishment on sea!");

            if (establishments.Count(e => e.Owner == owner) >= 2 &&
                roads.Where(r => r.Owner == owner).All(r => !r.Edge.IsAdjacentTo(vertex)))
                throw new InvalidOperationException("Each player can only build 2 houses without adjacent roads!");

            var establishment = new Establishment(owner, vertex);
            establishments.Add(establishment);


            logger.Info($"Establisment Build; Player {owner.Name}, {vertex.ToString()}");

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

示例2: OutEdges

		/// <summary>
		/// Returns an iterable collection over the edge connected to v
		/// </summary>
		/// <param name="v"></param>
		/// <returns></returns>
		public EdgeCollection OutEdges(IVertex v)
		{
			if (v == null)
				throw new ArgumentNullException("v");

			EdgeCollection ec=VertexOutEdges[v];
			if (ec==null)
				throw new VertexNotFoundException(v.ToString());
			return ec;
		}
开发者ID:timonela,项目名称:mb-unit,代码行数:15,代码来源:AdjacencyGraph.cs

示例3: OutEdges

 public EdgeCollection OutEdges(IVertex v)
 {
     if (v == null)
     {
         throw new ArgumentNullException("v");
     }
     EdgeCollection edges = this.VertexOutEdges.get_Item(v);
     if (edges == null)
     {
         throw new VertexNotFoundException(v.ToString());
     }
     return edges;
 }
开发者ID:NigelThorne,项目名称:ndependencyinjection,代码行数:13,代码来源:AdjacencyGraph.cs


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