netflix.ocelli.functions.Weightings Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ocelli-core Show documentation
Show all versions of ocelli-core Show documentation
ocelli-core developed by Netflix
package netflix.ocelli.functions;
import rx.functions.Func1;
import netflix.ocelli.WeightingStrategy;
import netflix.ocelli.algorithm.EqualWeightStrategy;
import netflix.ocelli.algorithm.InverseMaxWeightingStrategy;
import netflix.ocelli.algorithm.LinearWeightingStrategy;
public class Weightings {
/**
* @return Strategy that provides a uniform weight to each client
*/
public WeightingStrategy uniform() {
return new EqualWeightStrategy();
}
/**
* @param func
* @return Strategy that uses the output of the function as the weight
*/
public WeightingStrategy identity(Func1 func) {
return new LinearWeightingStrategy(func);
}
/**
* @param func
* @return Strategy that sets the weight to the difference between the max
* value of all clients and the client value.
*/
public WeightingStrategy inverseMax(Func1 func) {
return new InverseMaxWeightingStrategy(func);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy