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

com.meliorbis.numerics.convergence.MaxCriterion Maven / Gradle / Ivy

Go to download

A library for working with large multi-dimensional arrays and the functions they represent

There is a newer version: 1.2
Show newest version
package com.meliorbis.numerics.convergence;

import java.util.Arrays;
import org.apache.commons.lang.StringUtils;

/**
 * Combines multiple criteria by returning their maximum value
 * 
 * @author Tobias Grasl
 */
public class MaxCriterion implements Criterion
{
	final private Criterion[] _criteria;

	public MaxCriterion(Criterion... criteria_)
	{
		_criteria = criteria_;
	}

	@Override
	public double getValue()
	{
		return Arrays.stream(_criteria).reduce(Double.NEGATIVE_INFINITY,(running,crit) -> Double.max(running,crit.getValue()), Double::max);
	}
	
	@Override
	public String toString()
	{
		return StringUtils.join(_criteria,", ");
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy