com.eg.agent.android.harvest.Tracer Maven / Gradle / Ivy
The newest version!
package com.eg.agent.android.harvest;
import com.eg.agent.android.harvest.type.ArrayTransformer;
import com.eg.agent.android.trace.ActivityTracer;
import com.eg.google.gson.JsonArray;
import java.util.ArrayList;
import java.util.Collection;
public class Tracer extends ArrayTransformer {
private final Collection activityTraces = new ArrayList();
public JsonArray asJsonArray() {
JsonArray array = new JsonArray();
for (ActivityTracer activityTrace : this.activityTraces) {
array.add(activityTrace.asJson());
}
return array;
}
public synchronized void add(ActivityTracer activityTrace) {
this.activityTraces.add(activityTrace);
}
public synchronized void remove(ActivityTracer activityTrace) {
this.activityTraces.remove(activityTrace);
}
public void clear() {
this.activityTraces.clear();
}
public int count() {
return this.activityTraces.size();
}
public Collection getActivityTraces() {
return this.activityTraces;
}
}