/// <summary> /// Checks if a player object comes before, after or at the same position as the other object /// when sorting /// </summary> /// <param name="other">other player to compare to</param> /// <returns>negative number if this player's sorting order if before another object, /// 0 if this player's sorting order is the same as the other player's, /// positive number if this player's sorting order is after the other player's</returns> public int CompareTo(Player other) { if (PointsScored == other.PointsScored) { if (MinutesPlayed == other.MinutesPlayed) { if (FoulsMade == other.FoulsMade) { return(0); } else { return(FoulsMade.CompareTo(other.FoulsMade)); } } else { return(MinutesPlayed.CompareTo(other.MinutesPlayed)); } } else { return(PointsScored.CompareTo(other.PointsScored) * -1); } }
public Match(Match match) { WeightClass = match.WeightClass; HomeWrestler = new Wrestler(match.HomeWrestler); AwayWrestler = new Wrestler(match.AwayWrestler); MatchName = match.MatchName; foreach (var point in match.PointsScored) { Point newPoint = new Point(point); { PointsScored.Add(newPoint); } } }
/// <summary> /// Returns the hash code of a PlayerStatistics object /// </summary> /// <returns>hash code of the a object</returns> public override int GetHashCode() { return(Team.GetHashCode() | Name.GetHashCode() | Surname.GetHashCode() | MinutesPlayed.GetHashCode() | PointsScored.GetHashCode() | FoulsMade.GetHashCode()); }