All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.usf.java.jinterval.partition.multiple.MultiModelPart Maven / Gradle / Ivy

package org.usf.java.jinterval.partition.multiple;

import static lombok.AccessLevel.PACKAGE;

import java.util.List;
import java.util.Optional;
import java.util.function.BiFunction;
import java.util.function.BinaryOperator;
import java.util.function.Consumer;
import java.util.function.Function;

import org.usf.java.jinterval.core.IntervalUtils;
import org.usf.java.jinterval.partition.Part;

import lombok.Getter;
import lombok.RequiredArgsConstructor;

@Getter
@RequiredArgsConstructor(access = PACKAGE)
public final class MultiModelPart implements Part> {

	private final List model;
	private final int startIndex;
	private final int endExclusiveIndex;
	private final Object start;
	private final Object exclusifEnd;

	public Optional reduce(BinaryOperator op) {
		
		return model.stream().reduce(op);
	}

	public  R reduce(R identity, BiFunction op) {

		R acc = identity;
		for(var col=0; col void deepReduce(Function> fn, BinaryOperator op, Consumer consumer) {
		if(!model.isEmpty()) {
			for(int row=startIndex; row void deepReduce(Function> fn, R identity, BiFunction op, Consumer consumer) {
		if(model.isEmpty()) {
			for(int row=startIndex; row index  : " + IntervalUtils.toString(startIndex, endExclusiveIndex)
				+ " => models : " + model;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy