public void getValues(MeasurementReport report, Set<MeasurementScheduleRequest> metrics) throws Exception {
for (MeasurementScheduleRequest req : metrics) {
if (req.getName().equals("tweetCount")) {
Twitter twitter = tFactory.getInstance();
Paging paging = new Paging();
MeasurementDataNumeric res;
if (isSearch) {
Query q = new Query(keyword);
q.setSinceId(lastId);
if (lastId == NOT_YET_SET)
q.setRpp(1);
else
q.setRpp(20);
QueryResult qr = twitter.search(q);
List<Tweet> tweets = qr.getTweets();
res = new MeasurementDataNumeric(req, (double) tweets.size());
eventPoller.addTweets(tweets);
if (tweets.size()>0)
lastId = tweets.get(0).getId();
}
else {
List<Status> statuses;
if (lastId == NOT_YET_SET) {
paging.setCount(1);
}
else {
paging.setCount(100);
}
paging.setSinceId(lastId);
statuses = twitter.getUserTimeline(keyword,paging);
res = new MeasurementDataNumeric(req, (double) statuses.size());
eventPoller.addStatuses(statuses);
if (statuses.size()>0)