Example #1
0
 private IEnumerable <Element> GetElementEvent(TweetMatcher matcher)
 {
     foreach (var matchEvent in Game.Events)
     {
         yield return(new Element(matchEvent, FindMatchingTweet(matcher, matchEvent)));
     }
 }
Example #2
0
        private Tweet FindMatchingTweet(TweetMatcher matcher, MatchEvent matchEvent)
        {
            var tweets        = matcher.Find(matchEvent);
            var selectedTweet = tweets
                                .Except(_elements.Select(e => e.Tweet))
                                .OrderByDescending(t => t.Popularity)
                                .LastOrDefault();

            return(selectedTweet ?? Tweet.Null);
        }
Example #3
0
        public IEnumerable <Element> GetElements()
        {
            var matcher = new TweetMatcher(_tweets, Game);

            _elements.AddRange(GetElementEvent(matcher));
            _elements.AddRange(GetTweets(t => t.Date < Game.MatchStart, 2));
            _elements.AddRange(GetTweets(t => t.Date > Game.MatchStart && t.Date < Game.MatchStop, 4));
            _elements.AddRange(GetTweets(t => t.Date > Game.MatchStop, 2));
            return(_elements.OrderBy(x => x.Elapsed));
        }