public StatConnecter(IConnectableStat <TIn, TOut> connection, IStat <TOut, TStat> stat) { this.connection = connection; this.stat = stat; connection.Added += (_, item) => stat.Add(item); connection.Deleted += (_, item) => stat.Delete(item); }
private void AddInGroup(IStat <TIn, TOut> groupStat, TIn item) { if (!groupStat.IsEmpty) { OnDeleted(groupStat.Value); } groupStat.Add(item); OnAdded(groupStat.Value); }
protected void HandleEvents <TTarget, TResult>(IStat <TTarget, TResult> stat, params Event <TTarget>[] events) { foreach (var e in events) { if (e.IsAddEvent) { stat.Add(e.Value); } else { stat.Delete(e.Value); } } }
public void Add(TIn item) { stat.Add(item); }
public void Update(MatchInfo matchInfo) { logger.ConditionalTrace("Update reports with match: {0}", matchInfo); recentMatches.Add(matchInfo); }
public void Update(PlayerInfo playerInfo) { logger.ConditionalTrace("Update reports with player: {0}", playerInfo); bestPlayers.Add(playerInfo); }
public void Update(ServerInfo serverInfo) { logger.ConditionalTrace("Update reports with server: {0}", serverInfo); allServers.Add(serverInfo); popularServers.Add(serverInfo); }