1
2
3
4
5
6
7
8
9
10
11 package psiprobe.beans.stats.providers;
12
13 import java.util.List;
14
15 import org.jfree.data.xy.XYDataItem;
16 import org.jfree.data.xy.XYSeries;
17 import org.slf4j.Logger;
18 import org.slf4j.LoggerFactory;
19
20
21
22
23 public abstract class AbstractSeriesProvider implements SeriesProvider {
24
25
26 protected final Logger logger = LoggerFactory.getLogger(getClass());
27
28
29 private final Object lockObj = new Object();
30
31
32
33
34
35
36
37
38
39 protected XYSeries toSeries(String legend, List<XYDataItem> stats) {
40 XYSeries xySeries = new XYSeries(legend, true, false);
41 synchronized (lockObj) {
42 for (XYDataItem item : stats) {
43 xySeries.addOrUpdate(item.getX(), item.getY());
44 }
45 }
46 return xySeries;
47 }
48
49 }