Java Code Examples for java.util.PrimitiveIterator.OfDouble#nextDouble()

The following examples show how to use java.util.PrimitiveIterator.OfDouble#nextDouble() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Dimensions.java    From metanome-algorithms with Apache License 2.0 5 votes vote down vote up
private static Dimension toDimension(DoubleSortedSet thresholds) {
	int size = thresholds.size();
	Double2IntMap map = new Double2IntOpenHashMap(size);
	int i = 1;
	OfDouble it = thresholds.iterator();
	while (it.hasNext()) {
		double threshold = it.nextDouble();
		map.put(threshold, i++);
	}
	return new Dimension(map);
}
 
Example 2
Source File: IteratorUtils.java    From metanome-algorithms with Apache License 2.0 5 votes vote down vote up
public static OptionalDouble next(OfDouble it) {
	if (it.hasNext()) {
		double higher = it.nextDouble();
		return OptionalDouble.of(higher);
	}
	return OptionalDouble.empty();
}
 
Example 3
Source File: UniformTrimmer.java    From metanome-algorithms with Apache License 2.0 5 votes vote down vote up
private void trim(OfDouble iterator) {
	while (iterator.hasNext()) {
		double current = iterator.nextDouble();
		if (current <= first - count * intervalSize) {
			double diff = first - current;
			count = Math.max(count, (int) (diff / intervalSize)) + 1;
		} else {
			iterator.remove();
		}
	}
}