public AlignedAllocation next() {
        // if duration is over, get next start stop
        if ((alignment != null && duration <= maxDuration && alignment.startPoint + duration <= intervalsUpperBound) == false) {
            this.nextStop();
        }
        
        AlignedAllocation ret = new AlignedAllocation();
        ret.startPoint = alignment.startPoint;
        ret.intervalIndexOfStartPoint = alignment.startValuesIndex;
        ret.endPoint = alignment.startPoint + duration;
        
        if (duration == maxDuration || alignment.startPoint + duration == intervalsUpperBound) {
            this.nextStop();
            nextIsSkipped = true;
            return ret;
        }
        
        //set next duration to min of duration to upper bound, max duration and next stop end 
        duration = Math.min(maxDuration, elementaryIntervals.get(currentIntervalOfEnd).getEnd() - alignment.startPoint);
        currentIntervalOfEnd++;
           
        return ret;
    }