private void grabTrending() { try { if (VERBOSE) { DAO.log("Kaizen is going to get trending topics ..."); } for (Location location : twitter.trends().getAvailableTrends()) { for (Trend trend : twitter.trends().getPlaceTrends(location.getWoeid()).getTrends()) { this.queries.addQuery(trend.getQuery()); } } } catch (TwitterException e) { if (e.getErrorCode() != 88) { DAO.severe(e); } } }
@Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof Trend)) return false; Trend trend = (Trend) o; if (!name.equals(trend.getName())) return false; if (query != null ? !query.equals(trend.getQuery()) : trend.getQuery() != null) return false; if (url != null ? !url.equals(trend.getURL()) : trend.getURL() != null) return false; if (tweetVolume != trend.getTweetVolume()) return false; return true; }
@Converter public static String toString(Trend trend) throws ParseException { return trend.getName(); }
private static Trend[] jsonArrayToTrendArray(JSONArray array) throws JSONException { Trend[] trends = new Trend[array.length()]; for (int i = 0; i < array.length(); i++) { JSONObject trend = array.getJSONObject(i); trends[i] = new Trend(trend); } return trends; }