Exemple #1
0
        /// <summary>Creates a new instance of Leaders </summary>
        public Leaders()
        {
            //Loads teams from a league table (uses default table.xml).
            League L = new League();

            competitionName = L.CompetitionName;
            System.String[] names   = L.RosterNames;
            Roster[]        Rosters = new Roster[names.Length];
            System.Collections.ArrayList totPlayers = System.Collections.ArrayList.Synchronized(new System.Collections.ArrayList(10));
            int total = 0;

            for (int i = 0; i < names.Length; i++)
            {
                Rosters[i] = new Roster(names[i]);

                Player[] pList = Rosters[i].getPlayers().toArray(new Player[0]);

                for (int j = 0; j < pList.Length; j++)
                {
                    //Convert player into LeadersPlayer
                    pList[j] = new LeadersPlayer(pList[j], Rosters[i].Abbreviation);
                }
                //UPGRADE_TODO: Method 'java.util.Arrays.asList' was converted to 'System.Collections.ArrayList' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilArraysasList_javalangObject[]'"
                totPlayers.AddRange(new System.Collections.ArrayList(pList));
            }
            /* Now teams are loaded */
            /* Loads all players in a single array */
            this.totPlayers = (LeadersPlayer[])SupportClass.ICollectionSupport.ToArray(totPlayers, new LeadersPlayer[0]);
        }
Exemple #2
0
        public virtual int Compare(System.Object player1, System.Object player2)
        {
            LeadersPlayer p1 = (LeadersPlayer)player1;
            LeadersPlayer p2 = (LeadersPlayer)player2;

            switch (type)
            {
            case GOALS:
            {
                if (p1.getGoals() != p2.getGoals())
                {
                    return(-(p1.getGoals() - p2.getGoals()));
                }
                else
                {
                    return(p1.Games - p2.Games);
                }
            }
                goto case DPS;

            case DPS:
            {
                if (p1.Dps != p2.Dps)
                {
                    return(-(p1.Dps - p2.Dps));
                }
                else
                {
                    return(p1.Games - p2.Games);
                }
            }
                goto case ASSISTS;

            case ASSISTS:
            {
                if (p1.getAssists() != p2.getAssists())
                {
                    return(-(p1.getAssists() - p2.getAssists()));
                }
                else
                {
                    return(p1.Games - p2.Games);
                }
            }
                goto case PERFORMANCE;

            case PERFORMANCE:
            {
                if (p1.Performance != p2.Performance)
                {
                    return(-(p1.Performance - p2.Performance));
                }
                else
                {
                    return(p1.Games - p2.Games);
                }
            }
                goto default;

            default:
            {
                if (p1.getGoals() != p2.getGoals())
                {
                    return(-(p1.getGoals() - p2.getGoals()));
                }
                else
                {
                    return(p1.Games - p2.Games);
                }
            }
            break;
            }
        }