com.eg.agent.android.harvest.ActivityHistory Maven / Gradle / Ivy
package com.eg.agent.android.harvest;
import com.eg.agent.android.harvest.type.HarvestableArray;
import com.eg.google.gson.JsonArray;
import com.eg.google.gson.JsonElement;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public class ActivityHistory extends HarvestableArray {
private final List activityHistory;
public ActivityHistory(List activityHistory) {
this.activityHistory = activityHistory;
}
public int size() {
return this.activityHistory.size();
}
public JsonArray asJsonArray() {
JsonArray data = new JsonArray();
for (ActivitySighting sighting : this.activityHistory) {
data.add(sighting.asJsonArray());
}
return data;
}
public JsonArray asJsonArrayWithoutDuration() {
JsonArray data = new JsonArray();
for (ActivitySighting sighting : this.activityHistory) {
data.add(sighting.asJsonArrayWithoutDuration());
}
return data;
}
public static ActivityHistory newFromJson(JsonArray jsonArray) {
List sightings = new ArrayList();
Iterator i$ = jsonArray.iterator();
while (i$.hasNext()) {
sightings.add(ActivitySighting.newFromJson(((JsonElement) i$.next()).getAsJsonArray()));
}
return new ActivityHistory(sightings);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy