本文整理汇总了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";
}
}
示例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;
}