package net.sf.jranges.range;

import net.sf.jranges.range.doublerange.DoubleRange;
import net.sf.jranges.range.integer.IntegerRange;
import net.sf.kerner.utils.math.MathUtils;

public class RangeUtils {
	
	public interface IntegerRangeCallback {
		void call(int i);
	}
	
	public interface DoubleRangeTask {
		void call(double d);
	}
	
	private RangeUtils(){}
	
	public static void doForAllInRange(IntegerRange range, IntegerRangeCallback task){
		for(int i = range.getStart(); i <= range.getStop(); i+= range.getInterval()){
			task.call(i);
		}
	}
	
	public static void doForAllInRange(DoubleRange range, DoubleRangeTask task){
		for(double i = range.getStart(); MathUtils.round(i, 6) <= range.getStop(); i+= range.getInterval()){
			task.call(i);
		}
	}

}

@@ -24,16 +24,46 @@
 range;%0A%0A
+import java.util.Collection;%0A%0A
 import n
@@ -381,24 +381,242 @@
 Utils()%7B%7D%0A%09%0A
+%09public static boolean includesAll(IntegerRange range, Collection%3C? extends Integer%3E positions)%7B%0A%09%09for(int i : positions)%7B%0A%09%09%09if(range.includes(i))%7B%0A%09%09%09%09// ok%0A%09%09%09%7D else %7B%0A%09%09%09%09return false;%0A%09%09%09%7D%0A%09%09%7D%0A%09%09return true;%0A%09%7D%0A%09%0A
 %09public stat

Introduce RangeUtils#includesAll().