@Override public void execute(Tuple tuple, Object state, TimeWindow window) { Map<String, Integer> counts = (Map<String, Integer>) state; String word = tuple.getString(0); Integer count = counts.get(word); if (count == null) count = 0; counts.put(word, ++count); }
@Override public void execute(Tuple tuple, Object state, TimeWindow window) { HashMap<String, Integer> counts = (HashMap<String, Integer>) state; String word = tuple.getString(0); Integer count = counts.get(word); if (count == null) count = 0; counts.put(word, ++count); }
@Override public void execute(Tuple tuple) { String key = tuple.getString(1); Integer curr = _counts.get(key); if (curr == null) curr = 0; _counts.put(key, curr + 1); }
@Override public void execute(Tuple tuple, Object state, TimeWindow window) { Map<String, Integer> counts = (Map<String, Integer>) state; String word = tuple.getString(0); Integer count = counts.get(word); if (count == null) count = 0; counts.put(word, ++count); }
@Override public void execute(Tuple tuple, Object state, TimeWindow window) { Map<String, Integer> counts = (Map<String, Integer>) state; String word = tuple.getString(0); Integer count = counts.get(word); if (count == null) count = 0; counts.put(word, ++count); }
@Override public void execute(Tuple tuple) { String word = tuple.getString(0); Integer count = counts.get(word); if (count == null) count = 0; counts.put(word, ++count); }
@Override public void execute(Tuple tuple, Object state, TimeWindow window) { Map<String, Integer> counts = (Map<String, Integer>) state; String word = tuple.getString(0); Integer count = counts.get(word); if (count == null) count = 0; counts.put(word, ++count); }
@Override public void execute(Tuple tuple, Object state, TimeWindow window) { Map<String, Integer> counts = (Map<String, Integer>) state; String word = tuple.getString(0); Integer count = counts.get(word); if (count == null) count = 0; counts.put(word, ++count); }
@Override public void execute(Tuple tuple, Object state, TimeWindow window) { Map<String, Integer> counts = (Map<String, Integer>) state; String word = tuple.getString(0); Integer count = counts.get(word); if (count == null) count = 0; counts.put(word, ++count); }
@Override public void execute(Tuple tuple) { String word = tuple.getString(0); Integer count = counts.get(word); if (count == null) count = 0; counts.put(word, ++count); if (isSlowdown == true) { JStormUtils.sleepMs(100); } }
@Override public void execute(Tuple tuple) { if (tuple.getSourceComponent().equals(_wordComponent)) { this.word = tuple.getString(1); } else { intSet.add(tuple.getInteger(1)); } }
@Override public void execute(Tuple tuple, BasicOutputCollector collector) { String word = tuple.getString(0); Integer count = counts.get(word); if (count == null) count = 0; count++; counts.put(word, count); collector.emit(new Values(word, count)); }
@Override public void execute(Tuple tuple) { String sentence = tuple.getString(0); for (String word : sentence.split("\\s+")) { collector.emit(new Values(word)); } }
@Override public void execute(Tuple tuple) { String sentence = tuple.getString(0); for (String word : sentence.split("\\s+")) { collector.emit(new Values(word)); } }
@Override public void execute(Tuple tuple) { String sentence = tuple.getString(0); for (String word : sentence.split("\\s+")) { collector.emit(new Values(word)); } }
@Override public void execute(Tuple input, BasicOutputCollector collector) { String name = input.getString(0); collector.emit(new Values(name, _conf.get(name))); }
@Override public void execute(Tuple tuple, BasicOutputCollector collector) { Object id = tuple.getValue(0); String url = tuple.getString(1); List<String> tweeters = TWEETERS_DB.get(url); if (tweeters != null) { for (String tweeter : tweeters) { collector.emit(new Values(id, tweeter)); } } }
@Override public void execute(Tuple tuple, BasicOutputCollector collector) { Object id = tuple.getValue(0); String tweeter = tuple.getString(1); List<String> followers = FOLLOWERS_DB.get(tweeter); if (followers != null) { for (String follower : followers) { collector.emit(new Values(id, follower)); } } }
@Override public void execute(Tuple tuple, BasicOutputCollector collector) { String args = tuple.getString(0); String returnInfo = tuple.getString(1); long requestId = rand.nextLong(); collector.emit(ARGS_STREAM, new Values(requestId, args)); collector.emit(RETURN_STREAM, new Values(requestId, returnInfo)); collector.emit(ID_STREAM, new Values(requestId)); }
@Override public void execute(Tuple input, BasicOutputCollector collector) { Object id = input.getValue(0); String word = input.getString(1); for (int i = 0; i < word.length(); i++) { if (word.charAt(i) == 'a') { collector.emit("multi", new Values(id, word.substring(0, i))); } } collector.emit("single", new Values(id, word)); }