Exemplo n.º 1
0
    @Override
    public boolean hasNext() {
      if (next != null) return true;
      next = new ArrayList<Partition>();

      while (it.hasNext()) {
        Entry<Long, Interval> entry = it.next();
        Interval intv = entry.getValue();
        if (jumpToStart && (intv.getEnd() <= start)) {
          continue;
        } else {
          jumpToStart = false;
        }
        if (partitioningSpec.type == _type.TIME) {
          next.add(intv.partitions.values().iterator().next());
        } else {
          for (Partition p : intv.partitions.values()) {
            if ((partitionValueFilter == null) || (partitionValueFilter.contains(p.getValue()))) {
              next.add(p);
            }
          }
        }
        if (!next.isEmpty()) {
          break;
        }
      }
      if (next.isEmpty()) {
        next = null;
        return false;
      } else {
        return true;
      }
    }