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


C# EntityType.Equals方法代码示例

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


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

示例1: makeName

	//Randomly chooses a name from a set of names
	private string makeName(EntityType unitType)
	{
		if (unitType.Equals (EntityType.SM))
		{
			switch (Random.Range(0, 6))
			{
				case 0:
					return "Derpy";
				case 1:
					return "Nrick";
				case 2:
					return "Block Head";
				case 3:
					return "Brainiac";
				case 4:
					return "Omnio";
				case 5:
					return "Phteven";
				default:
					return "Ian";
			}
		}
		else if (unitType.Equals (EntityType.GS))
		{
			switch (Random.Range (0, 7))
			{
				case 0:
					return "Biter";
				case 1:
					return "Ankle-Biter";
				case 2:
					return "Claw";
				case 3:
					return "Jaws";
				case 4:
					return "Hungry";
				case 5:
					return "Fluffy";
				case 6:
					return "Mangler";
				default:
					return "Cute";
			}
		}
		else if (unitType.Equals (EntityType.Blip))
		{
			return "Blip";
		}
		else
		{
			return "Name";
		}
	}
开发者ID:UnofficialSpaceHulkTeam,项目名称:UnofficialSpaceHulk,代码行数:54,代码来源:Game.cs

示例2: Create

        /// <summary>Create a AdjustedCosine matrix from given data</summary>
        /// <param name="ratings">the ratings data</param>
        /// <param name="entity_type">the entity type, either USER or ITEM</param>
        /// <param name="shrinkage">a shrinkage parameter</param>
        /// <returns>the complete AdjustedCosine matrix</returns>
        public static CorrelationMatrix Create(IRatings ratings, EntityType entity_type, float shrinkage)
        {
            AdjustedCosine cm;
            int num_entities = 0;
            if (entity_type.Equals(EntityType.USER))
                num_entities = ratings.MaxUserID + 1;
            else if (entity_type.Equals(EntityType.ITEM))
                num_entities = ratings.MaxItemID + 1;
            else
                throw new ArgumentException("Unknown entity type: " + entity_type);

            try
            {
                cm = new AdjustedCosine(num_entities);
            }
            catch (OverflowException)
            {
                Console.Error.WriteLine("Too many entities: " + num_entities);
                throw;
            }
            cm.shrinkage = shrinkage;
            cm.ComputeCorrelations(ratings, entity_type);
            return cm;
        }
开发者ID:zenogantner,项目名称:MML-KDD,代码行数:29,代码来源:AdjustedCosine.cs


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