Package tweetoscope.tweetsFilter
Class TweetFilter
java.lang.Object
tweetoscope.tweetsFilter.TweetFilter
- All Implemented Interfaces:
Flow.Publisher<com.twitter.clientlib.model.Tweet>
,Flow.Subscriber<com.twitter.clientlib.model.Tweet>
- Direct Known Subclasses:
EmptyTweetFilter
,LangTweetFilter
,LastNTweetFilter
,OnlineTweetFilter
public abstract class TweetFilter
extends Object
implements Flow.Subscriber<com.twitter.clientlib.model.Tweet>, Flow.Publisher<com.twitter.clientlib.model.Tweet>
Reacts to the reception of a new Tweet, if the Tweet matches the filter
condition, downstream subscribers are notified, otherwise the process is
silent. Tweets are received from
via Java Flow.
Filtered Tweets are passes down to the
via Java Flow.
invalid reference
distributed_tweetoscope.tweetsProducer.TweetsProducer
invalid reference
distributed_tweetoscope.HashtagCounter
- Author:
- Virginie Galtier
-
Field Summary
Modifier and TypeFieldDescriptionprotected List
<Flow.Subscriber<? super com.twitter.clientlib.model.Tweet>> List of objects to notify when a new Tweet passes the filter (downstream component = HashtagExtractor) -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected abstract boolean
match
(com.twitter.clientlib.model.Tweet tweet) Tests the filter conditionsvoid
void
void
onNext
(com.twitter.clientlib.model.Tweet tweet) void
onSubscribe
(Flow.Subscription subscription) void
subscribe
(Flow.Subscriber<? super com.twitter.clientlib.model.Tweet> subscriber)
-
Field Details
-
subscribers
List of objects to notify when a new Tweet passes the filter (downstream component = HashtagExtractor)
-
-
Constructor Details
-
TweetFilter
public TweetFilter()Creates a new Tweet filter
-
-
Method Details
-
match
protected abstract boolean match(com.twitter.clientlib.model.Tweet tweet) Tests the filter conditions- Parameters:
tweet
- Tweet to examine- Returns:
- true if the Tweet complies with the filter, false if it doesn't match the filter conditions
-
subscribe
- Specified by:
subscribe
in interfaceFlow.Publisher<com.twitter.clientlib.model.Tweet>
-
onNext
public void onNext(com.twitter.clientlib.model.Tweet tweet) - Specified by:
onNext
in interfaceFlow.Subscriber<com.twitter.clientlib.model.Tweet>
-
onSubscribe
- Specified by:
onSubscribe
in interfaceFlow.Subscriber<com.twitter.clientlib.model.Tweet>
-
onError
- Specified by:
onError
in interfaceFlow.Subscriber<com.twitter.clientlib.model.Tweet>
-
onComplete
public void onComplete()- Specified by:
onComplete
in interfaceFlow.Subscriber<com.twitter.clientlib.model.Tweet>
-