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

org.kernelab.basis.IndexedReducer Maven / Gradle / Ivy

There is a newer version: 0.0.19-RELEASE
Show newest version
package org.kernelab.basis;

import java.io.Serializable;

/**
 * The Reducer interface is applied to the operation of reducing an Iterable
 * object.
 * 
 * @author Dilly King
 * 
 * @param 
 *            The generic type of the elements to be reduced in the Iterable
 *            object.
 * @param 
 *            The generic type of the reduce result.
 */
public interface IndexedReducer extends Serializable
{
	/**
	 * To reduce the element in a certain Iterable object into the reduction
	 * result.
	 * 
	 * @param result
	 *            A former result of reduction. Attention that the result might
	 *            be null sometime in the reduce operation.
	 * @param element
	 *            An element in a certain Iterable object.
	 * @param index
	 *            The index (ZERO based) of the element in the Iterable object.
	 * @return The result of is reduce operation.
	 * @throws Terminator
	 *             to terminate the reduction procedure.
	 *             {@link Terminator#SIGNAL} is recommended.
	 * @see Tools#reduce(Iterable, IndexedReducer)
	 */
	public R reduce(R result, E element, int index);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy