@SuppressWarnings("unchecked")
 protected void fillMissingValues(
     Map<String, SeriesData<X, Y>> ret, List<Long> retTimes, int stepLen) {
   for (SeriesData<X, Y> nextValues : ret.values()) {
     Map<X, Y> valueMap = nextValues.pointsAsMap();
     List<Long> addX = new ArrayList<>();
     for (Long nextStep : retTimes) {
       if (!valueMap.containsKey(nextStep)) {
         addX.add(nextStep);
       }
     }
     Object zero = 0;
     for (Long nextAdd : addX) {
       for (int i = 0; i < nextValues.values.size(); i++) {
         if (nextValues.values.get(i).x.compareTo((X) nextAdd) > 0) {
           Point<X, Y> toAdd = new Point<>();
           toAdd.x = (X) nextAdd;
           toAdd.y = (Y) zero;
           nextValues.values.add(i, toAdd);
           break;
         }
       }
     }
   }
 }
Exemplo n.º 2
0
 private double getWindowMaxX() {
   double x = selection[1];
   SeriesData data = overviewHandler.getData();
   int size = data.length();
   if (size > 0 && x == data.getX(size - 1)) {
     return lastDataPoint.getX();
   }
   return x;
 }
Exemplo n.º 3
0
 @Override
 public SeriesData getData(double x1, double x2) {
   if (x2 < data.getX(0) || x1 > data.getX(data.length() - 1)) {
     return SeriesData.create();
   }
   int start = Algorithm.xBinarySearch(data, x1);
   if (start == -1) {
     start = 0;
   }
   int end = Algorithm.xBinarySearch(data, x2);
   if (end == -1) {
     return data.slice(start);
   }
   return data.slice(start, end);
 }