diff options
Diffstat (limited to 'main/src/cgeo/geocaching/SearchResult.java')
| -rw-r--r-- | main/src/cgeo/geocaching/SearchResult.java | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/main/src/cgeo/geocaching/SearchResult.java b/main/src/cgeo/geocaching/SearchResult.java index 94ce28d..5053a85 100644 --- a/main/src/cgeo/geocaching/SearchResult.java +++ b/main/src/cgeo/geocaching/SearchResult.java @@ -24,6 +24,7 @@ import java.util.Set; public class SearchResult implements Parcelable { final private Set<String> geocodes; + final private Set<String> filteredGeocodes; private StatusCode error = null; private String url = ""; public String[] viewstates = null; @@ -55,6 +56,7 @@ public class SearchResult implements Parcelable { */ public SearchResult(final SearchResult searchResult) { geocodes = new HashSet<String>(searchResult.geocodes); + filteredGeocodes = new HashSet<String>(searchResult.filteredGeocodes); error = searchResult.error; url = searchResult.url; viewstates = searchResult.viewstates; @@ -70,6 +72,7 @@ public class SearchResult implements Parcelable { public SearchResult(final Collection<String> geocodes, final int total) { this.geocodes = new HashSet<String>(geocodes.size()); this.geocodes.addAll(geocodes); + this.filteredGeocodes = new HashSet<String>(); this.setTotal(total); } @@ -86,6 +89,9 @@ public class SearchResult implements Parcelable { final ArrayList<String> list = new ArrayList<String>(); in.readStringList(list); geocodes = new HashSet<String>(list); + final ArrayList<String> filteredList = new ArrayList<String>(); + in.readStringList(filteredList); + filteredGeocodes = new HashSet<String>(filteredList); error = (StatusCode) in.readSerializable(); url = in.readString(); final int length = in.readInt(); @@ -121,6 +127,7 @@ public class SearchResult implements Parcelable { @Override public void writeToParcel(final Parcel out, final int flags) { out.writeStringArray(geocodes.toArray(new String[geocodes.size()])); + out.writeStringArray(filteredGeocodes.toArray(new String[filteredGeocodes.size()])); out.writeSerializable(error); out.writeString(url); if (viewstates == null) { @@ -252,4 +259,19 @@ public class SearchResult implements Parcelable { return false; } + public void addFilteredGeocodes(Set<String> cachedMissingFromSearch) { + filteredGeocodes.addAll(cachedMissingFromSearch); + } + + public Set<String> getFilteredGeocodes() { + return Collections.unmodifiableSet(filteredGeocodes); + } + + public void addSearchResult(SearchResult other) { + if (other != null) { + addGeocodes(other.geocodes); + addFilteredGeocodes(other.filteredGeocodes); + } + } + } |
