Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
yusuke committed Mar 23, 2015
2 parents c809b53 + f817b56 commit 10ee3b6
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions twitter4j-stream/src/main/java/twitter4j/FilterQuery.java
Expand Up @@ -30,6 +30,7 @@ public final class FilterQuery implements java.io.Serializable {
private String[] track;
private double[][] locations;
private String[] language;
private String filterLevel;

/**
* Creates a new FilterQuery
Expand All @@ -40,6 +41,7 @@ public FilterQuery() {
this.track = null;
this.locations = null;
this.language = null;
this.filterLevel = null;
}

/**
Expand Down Expand Up @@ -166,6 +168,17 @@ public FilterQuery language(String[] language) {
return this;
}

/**
* The filter level limits what tweets appear in the stream to those with
* a minimum filter_level attribute value.
*
* @param filterLevel one of either none, low, or medium.
*/
public FilterQuery filterLevel(String filterLevel) {
this.filterLevel = filterLevel;
return this;
}


/*package*/ HttpParameter[] asHttpParameterArray(HttpParameter stallWarningsParam) {
ArrayList<HttpParameter> params = new ArrayList<HttpParameter>();
Expand All @@ -187,6 +200,9 @@ public FilterQuery language(String[] language) {
params.add(new HttpParameter("language"
, StringUtil.join(language)));
}
if (filterLevel != null && language.length > 0) {
params.add(new HttpParameter("filter_level", filterLevel));
}
params.add(stallWarningsParam);
HttpParameter[] paramArray = new HttpParameter[params.size()];
return params.toArray(paramArray);
Expand Down Expand Up @@ -216,6 +232,8 @@ public boolean equals(Object o) {
if (!Arrays.equals(follow, that.follow)) return false;
if (!Arrays.equals(track, that.track)) return false;
if (!Arrays.equals(language, that.language)) return false;
if (!(filterLevel == null ? that.filterLevel == null :
filterLevel.equals(that.filterLevel))) return false;

return true;
}
Expand All @@ -226,6 +244,7 @@ public int hashCode() {
result = 31 * result + (follow != null ? Arrays.hashCode(follow) : 0);
result = 31 * result + (track != null ? Arrays.hashCode(track) : 0);
result = 31 * result + (language != null ? Arrays.hashCode(language) : 0);
result = 31 * result + (filterLevel != null ? filterLevel.hashCode() : 0);
return result;
}

Expand All @@ -237,6 +256,7 @@ public String toString() {
", track=" + (track == null ? null : Arrays.asList(track)) +
", locations=" + (locations == null ? null : Arrays.asList(locations)) +
", language=" + (language == null ? null : Arrays.asList(language)) +
", filter_level=" + filterLevel +
'}';
}
}

0 comments on commit 10ee3b6

Please sign in to comment.