//private static bool ValidateMatch(this Match match, TeamFilters team1, TeamFilters team2) //{ // if (team1.Side == Side.Neutral) // { // return (team1.ValidateTeam(match, Side.Home) && team2.ValidateTeam(match, Side.Away)) || (team1.ValidateTeam(match, Side.Away) && team2.ValidateTeam(match, Side.Home)); // } // else if (team1.Side == Side.Home) // { // return team1.ValidateTeam(match, Side.Home) && team2.ValidateTeam(match, Side.Away); // } // else // { // return team1.ValidateTeam(match, Side.Away) && team2.ValidateTeam(match, Side.Home); // } //} private static bool ValidateTeam(this TeamFilters teamFilter, Match match, Side side) { foreach (var filter in teamFilter.GetFilters()) { if (filter != null && !filter.Valid(match, side)) { return false; } } return true; }
protected TableRow GetTableRow(Match match, Side side) { if (side == Side.Neutral) { throw new ArgumentException("Side cannot be neutral when filtering", "side"); } switch (this.Table) { case Side.Home: return side == Side.Home ? match.HomeTeamHomeTable : match.AwayTeamHomeTable; case Side.Away: return side == Side.Home ? match.HomeTeamAwayTable : match.AwayTeamAwayTable; default: return side == Side.Home ? match.HomeTeamTable : match.AwayTeamTable; } }
public override bool Valid(Match match, Side side) { return this.Valid(this.GetTableRow(match, side).Position); }
public override bool Valid(Match match, Side side) { return this.Valid(this.GetTableRow(match, side).GoalsFor); }
public override bool Valid(Match match, Side side) { return side == Side.Home ? match.HomeTeamId == this.TeamId : match.AwayTeamId == this.TeamId; }
public override bool Valid(Match match, Side side) { return this.Valid(this.GetTableRow(match, side).Round + 1); }
public abstract override bool Valid(Match match, Side side);
public abstract bool Valid(Match match, Side side);