es.usc.citius.hipster.model.function.ScalarFunction<T> |
![]()
Product,
ScalarOperation<E extends Comparable<E>>
|
A scalar function takes an object and modifies its magnitude by a numeric factor without changing its type.
This interface can be used to do abstract definitions of the scaling operation for algorithms that need it without explicitly defining them inside the algorithms, making them easily replaceable when the cost definition changes. The definition of scalar functions requires the implementation of thescale(Object, double)
.
Here is an example for the Double scaling operation:
new ScalarFunction<Double>(){
Double scale(Double a, double b){
return a*b;
}
}
To create a default scalar function to operate with doubles,
simple use Product
.
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
abstract T |
scale(T a, double b)
Scale operation.
|
Scale operation.
a | value to be scaled |
---|---|
b | scale factor |