summaryrefslogtreecommitdiff
path: root/src/main/TweetCounter.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/TweetCounter.java')
-rw-r--r--src/main/TweetCounter.java28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/main/TweetCounter.java b/src/main/TweetCounter.java
new file mode 100644
index 0000000..19838e7
--- /dev/null
+++ b/src/main/TweetCounter.java
@@ -0,0 +1,28 @@
+package main;
+
+import org.json.JSONObject;
+import provider.ResultListener;
+
+/**
+ * Calculates statistic about the received tweets.
+ *
+ * @author Peter Wu
+ */
+public class TweetCounter implements ResultListener {
+
+ private int tweetCount = 0;
+
+ @Override
+ public void tweetGenerated(JSONObject obj) {
+ tweetCount++;
+ }
+
+ @Override
+ public void profileGenerated(JSONObject obj) {
+ // ignored
+ }
+
+ public int getTweetCount() {
+ return tweetCount;
+ }
+}