本文整理汇总了C#中Process.CalculateNumberActivities方法的典型用法代码示例。如果您正苦于以下问题:C# Process.CalculateNumberActivities方法的具体用法?C# Process.CalculateNumberActivities怎么用?C# Process.CalculateNumberActivities使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Process
的用法示例。
在下文中一共展示了Process.CalculateNumberActivities方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CalculateProcessAuthorshipScore
private void CalculateProcessAuthorshipScore(Process process, Player author)
{
if (process.Author.Equals(author.Username))
{
#region Expected number of activities (Poisson Distribution)
float poissonFactor = (float)(process.score *
CalculateModPoissonValue(process.CalculateNumberActivities(),
int.Parse(PaintServerPanels.ExpectedNumActivities)));
author.bonusMalus[0] += poissonFactor;
process.bonusMalus[0] = poissonFactor;
#endregion
#region Quality voting
float votingFactor = 0;
if (process.QualityVotes.Count == 0) votingFactor = 0;
else if (process.posVotes > process.negVotes)
votingFactor = process.score*(((float)process.posVotes/process.QualityVotes.Count)/4);
else
votingFactor = -process.score*(((float)process.negVotes/process.QualityVotes.Count)/4);
author.bonusMalus[0] += votingFactor;
process.bonusMalus[1] = votingFactor;
#endregion
#region Process marked as a duplicate
float duplicationFactor = 0;
if (process.markedDuplication && (process.posDuplicationVotes > process.negDuplicationVotes))
duplicationFactor = - process.score*0.25f;
else if (process.markedDuplication && (process.posDuplicationVotes < process.negDuplicationVotes))
duplicationFactor = process.score*0.1f;
author.bonusMalus[0] += duplicationFactor;
process.bonusMalus[2] = duplicationFactor;
#endregion
#region Best Percentage of Positive Votes (PPV) in process tree
int PVID = 0;
float bestPPV = 0f;
float bestVoteRateFactor = 0;
foreach (ProcessVersion version in process.Versions)
if (version.QualityVotes.Count != 0 &&
(version.posVotes/version.QualityVotes.Count) > bestPPV)
{
bestPPV = version.posVotes/version.QualityVotes.Count;
PVID = version.PVID;
}
if (PVID == 0) bestVoteRateFactor = process.score*0.1f;
else bestVoteRateFactor = - process.score*0.05f;
author.bonusMalus[0] += bestVoteRateFactor;
process.bonusMalus[3] = bestVoteRateFactor;
#endregion
}
}