Пример #1
0
        private bool DoestTheTweetMatchAllConditions(ITweet tweet, IEnumerable <string> matchingTracks, IEnumerable <ILocation> matchingLocations)
        {
            if (tweet.CreatedBy.Id == TweetinviSettings.DEFAULT_ID)
            {
                return(false);
            }

            bool followMatches   = FollowingUserIds.IsEmpty() || ContainsFollow(tweet.CreatedBy.Id);
            bool tracksMatches   = Tracks.IsEmpty() || matchingTracks.Any();
            bool locationMatches = Locations.IsEmpty() || matchingLocations.Any();

            if (FollowingUserIds.Any())
            {
                return(followMatches && tracksMatches && locationMatches);
            }

            if (Tracks.Any())
            {
                return(tracksMatches && locationMatches);
            }

            if (Locations.Any())
            {
                return(locationMatches);
            }

            return(true);
        }
Пример #2
0
        private bool DoestTheTweetMatchAllConditions(ITweet tweet, string[] matchingTracks, ILocation[] matchingLocations, long[] matchingFollowers)
        {
            if (tweet == null || tweet.CreatedBy.Id == TweetinviSettings.DEFAULT_ID)
            {
                return(false);
            }

            bool followMatches   = FollowingUserIds.IsEmpty() || matchingFollowers.Any();
            bool tracksMatches   = Tracks.IsEmpty() || matchingTracks.Any();
            bool locationMatches = Locations.IsEmpty() || matchingLocations.Any();

            if (FollowingUserIds.Any())
            {
                return(followMatches && tracksMatches && locationMatches);
            }

            if (Tracks.Any())
            {
                return(tracksMatches && locationMatches);
            }

            if (Locations.Any())
            {
                return(locationMatches);
            }

            return(true);
        }