public static void assignValuesToOrderedRegions(List regions, Contour contour, String feature_name) {
    if (regions.size() == 0)
      return;
    int i = 0;
    Region current = (Region) regions.get(i);
    Contour attr = new Contour(current.getStart(), contour.getStep(),
        contour.indexFromTime(current.getDuration()) + 1);
    current.setAttribute(feature_name, attr);

    for (Pair<Double, Double> tvp : contour) {
      while (tvp.first > current.getEnd()) {
        i++;
        if (i >= regions.size()) break;
        current = (Region) regions.get(i);
        attr = new Contour(current.getStart(), contour.getStep(),
            contour.indexFromTime(current.getDuration()) + 1);

        current.setAttribute(feature_name, attr);
      }
      if ((tvp.first > current.getStart()) && (tvp.first <= current.getEnd())) {
        attr.set(tvp.first, tvp.second);
      }
    }
    while (i < regions.size()) {
      current = (Region) regions.get(i);
      current.setAttribute(feature_name, new Contour(current.getStart(), contour.getStep(), 0));
      ++i;
    }
  }