public interface

BinaryFunction

es.usc.citius.hipster.model.function.BinaryFunction<T>
Known Indirect Subclasses

Class Overview

A binary operation takes two elements of the same type and combines them returning an element of the same type.

This interface is useful to define abstract arithmetic functions used by the search algorithms (i. e. cost addition) and avoid the explicit definition of the operations in the algorithm. When the cost definition changes, the binary function can be changed without modifying the implementation of the algorithms.

The abstract definition of binary operations requires to complete the method apply(Object, Object), which returns an object of the same type. Here is an example for the Double addition operation:
 new BinaryFunction(){
          Double apply(Double a, Double b){
              return a + b;
          }
     }
 

Summary

Public Methods
abstract T apply(T a, T b)
Combination of two elements of the same type, returning an element of the same type.

Public Methods

public abstract T apply (T a, T b)

Combination of two elements of the same type, returning an element of the same type.

Parameters
a first element
b second element
Returns
  • result of the combination