本文整理汇总了C#中Team.AddMember方法的典型用法代码示例。如果您正苦于以下问题:C# Team.AddMember方法的具体用法?C# Team.AddMember怎么用?C# Team.AddMember使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Team
的用法示例。
在下文中一共展示了Team.AddMember方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: getFitnessTest
public void getFitnessTest()
{
//make a test
TeamMember mem1 = new TeamMember("Mem1");
TeamMember mem2 = new TeamMember("Mem2");
mem1.preferredTeammates.Add(mem2);
mem2.unprefferedTeammates.Add(mem1);
Team t1 = new Team();
t1.AddMember(mem1);
t1.AddMember(mem2);
Assert.AreEqual(Settings.PreferredTeammateWeight, mem1.getFitness());
Assert.AreEqual(Settings.UnpreferredTeammateWeight, mem2.getFitness());
}
示例2: League
public League(List<TeamMember> pop, int numTeams)
{
this.numTeams = numTeams;
for(int i = 0; i < pop.Count; i++)
{
if(teams.Count < numTeams)
{
Team t1 = new Team();
t1.AddMember(pop.ElementAt(i));
teams.Add(t1);
}
else
{
teams.ElementAt(i % numTeams).AddMember(pop.ElementAt(i));
}
}
}
示例3: setTeam
public void setTeam(Team team) {
this.team = team;
team.AddMember(username);
}
示例4: AddMemberToTeam
protected virtual Member AddMemberToTeam(Member member, Team team, Account associatedAccount)
{
Assert.IsNotNull(member);
Assert.IsValidKey(member.Email);
Assert.IsValidKey(member.Name);
Assert.IsValid(team);
Assert.AreEqual(team.ID, member.TeamId);
//HACK:为了确保新增成员时,团队内成员的Email以及成员关联的账号都唯一,所以这里通过锁来进行同步控制
this._locker.Require<Member>();
Assert.IsNull(_teamRepository.FindMemberBy(team, member.Email));
if (associatedAccount != null)
{
Assert.IsNull(_teamRepository.FindMemberBy(team, associatedAccount));
member.Associate(associatedAccount);
}
team.AddMember(member);
_teamRepository.Update(team);
return member;
}
示例5: AssignTeams
public static void AssignTeams(List<Employee> emps, List<Team> teams) // Sorts employees into their proper teams.
{
Team tempTeam = new Team();
Team targetTeam = null;
string tempName;
foreach (Employee e in emps)
{
tempName = e.GetTeam();
tempTeam.AddMember(e);
tempTeam.TeamName = tempName;
targetTeam = teams.Find(t => t.TeamName.Equals(tempName));
if (targetTeam == null)
{
teams.Add(tempTeam);
tempTeam = new Team();
}
else
{
targetTeam.AddMember(e);
tempTeam = new Team();
}
}
foreach (Team t in teams) // Assign free agents reference
{
if(t.TeamName != "Free Agents")
{
t.FreeAgents = teams[teams.Count-1]; // Free agents is always the last team
}
}
}
示例6: Crossover
public void Crossover(IChromosome pair)
{
//strategy:
//1. A new league is to be formed.
//2. Team 1 is added from this league to the new league
//3. From the input league, if a team is mutually exclusive to all team members in the new team.
//4. From this league, do the same thing.
//5. Continue until teams run out.
//6. Fill in the remaining teams randomly.
League L2 = (League)pair;
League hybrid = new League(getPopulationClone(), numTeams);
hybrid.teams = new List<Team>();
//hybrid.teams.Add(teams.ElementAt(0));
for(int i = 0; i < teams.Count; i++)
{
Team L1Team = teams.ElementAt(i);
Team L2Team = L2.teams.ElementAt(i); //they should have the same number of teams.
if (!hybrid.teamsHaveCommonMemberWith(L1Team))
hybrid.teams.Add(L1Team);
if (!hybrid.teamsHaveCommonMemberWith(L2Team))
hybrid.teams.Add(L2Team);
}
//fill existing teams into hybrid.
List<TeamMember> remainingMembers = hybrid.membersNotOnATeam();
int previousTeams = hybrid.teams.Count;
int idx = 0;
while (remainingMembers.Count > 0)
{
TeamMember remove = remainingMembers.ElementAt(0);
remainingMembers.RemoveAt(0);
if (numTeams > hybrid.teams.Count)
{
Team addTeam = new Team();
addTeam.AddMember(remove);
hybrid.teams.Add(addTeam);
}
else
{
hybrid.teams.ElementAt(previousTeams - 1 + idx % (numTeams - previousTeams)).AddMember(remove);
}
idx++;
}
this.teams = hybrid.teams;
//L.teams
//crossover does nothing right now
}