Ejemplo n.º 1
0
        public override int GetHashCode()
        {
            int hashCode = (int)(
                Math.Pow((double)MyPlayers.Count(), 2) + Math.Pow((double)TheirPlayers.Count(), 2) +
                Math.Pow((double)MyDifferential, 2) + Math.Pow((double)TheirDifferential, 2) +
                Math.Pow((double)CompositeDifferential, 2) + Math.Pow((double)Fairness, 2) +
                Math.Pow((double)MyPlayers.Sum(p => p.FantasyPoints), 2) + Math.Pow((double)TheirPlayers.Sum(p => p.FantasyPoints), 2)
                );

            return(hashCode);
        }
Ejemplo n.º 2
0
        public bool Equals(Trade other)
        {
            if (MyPlayers.Count() != other.MyPlayers.Count())
            {
                return(false);
            }
            if (TheirPlayers.Count() != other.TheirPlayers.Count())
            {
                return(false);
            }

            List <int> myPlayerIds      = new List <int>();
            List <int> myOtherPlayerIds = new List <int>();

            foreach (Player player in MyPlayers)
            {
                myPlayerIds.Add(player.Id);
            }
            foreach (Player player in other.MyPlayers)
            {
                myOtherPlayerIds.Add(player.Id);
            }

            for (int i = 0; i < myPlayerIds.Count(); i++)
            {
                if (myPlayerIds[i] != myOtherPlayerIds[i])
                {
                    return(false);
                }
            }

            List <int> theirPlayerIds      = new List <int>();
            List <int> theirOtherPlayerIds = new List <int>();

            foreach (Player player in TheirPlayers)
            {
                theirPlayerIds.Add(player.Id);
            }
            foreach (Player player in other.TheirPlayers)
            {
                theirOtherPlayerIds.Add(player.Id);
            }

            for (int i = 0; i < theirPlayerIds.Count(); i++)
            {
                if (theirPlayerIds[i] != theirOtherPlayerIds[i])
                {
                    return(false);
                }
            }

            return(true);
        }