public class

BinaryOperation

extends Object
implements BinaryFunction<T>
java.lang.Object
   ↳ es.usc.citius.hipster.model.function.impl.BinaryOperation<E extends java.lang.Comparable<E>>

Class Overview

A implementation of BinaryFunction used to define a custom cost algebra that also has the following definitions:

  • identity element (A*I = A)
  • maximum element (A*M = M)

Summary

Public Constructors
BinaryOperation(BinaryFunction<E> operation, E identityElem, E maxElem)
Public Methods
E apply(E a, E b)
static BinaryOperation<Double> doubleAdditionOp()
static BinaryOperation<Double> doubleMultiplicationOp()
E getIdentityElem()
E getMaxElem()
[Expand]
Inherited Methods
From class java.lang.Object
From interface es.usc.citius.hipster.model.function.BinaryFunction

Public Constructors

public BinaryOperation (BinaryFunction<E> operation, E identityElem, E maxElem)

Public Methods

public E apply (E a, E b)

public static BinaryOperation<Double> doubleAdditionOp ()

Returns
  • a default addition implementation which works with doubles. For example, BinaryOperation.doubleAdditionOp().apply(2.5d, 1.0d) returns 3.5d.

public static BinaryOperation<Double> doubleMultiplicationOp ()

Returns
  • a multiplication implementation which works with doubles. For example, BinaryOperation.doubleMultiplicationOp.apply(2.5d, 2.0d) returns 5.0d.

public E getIdentityElem ()

Returns
  • minimum (identity) cost

public E getMaxElem ()

Returns
  • maximum cost