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


C# Team.AddMember方法代码示例

本文整理汇总了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());
 }
开发者ID:markhalonen,项目名称:SortingHat,代码行数:13,代码来源:TeamMemberTests.cs

示例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));
         }
     }
 }
开发者ID:markhalonen,项目名称:SortingHat,代码行数:17,代码来源:League.cs

示例3: setTeam

    public void setTeam(Team team) {
		this.team = team;
		team.AddMember(username);
	}
开发者ID:vvega,项目名称:PewPewWars,代码行数:4,代码来源:Player.cs

示例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;
        }
开发者ID:codesharp,项目名称:cooper,代码行数:22,代码来源:TeamService.cs

示例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
                }
            }
        }
开发者ID:vivekelavarasan,项目名称:FantasyIT,代码行数:34,代码来源:TeamDataParser.cs

示例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
        }
开发者ID:markhalonen,项目名称:SortingHat,代码行数:48,代码来源:League.cs


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