
nl.tno.bim.nmd.scaling.NmdScalerFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bimnmdservice Show documentation
Show all versions of bimnmdservice Show documentation
provides a REST api for retrieving nmd data from various data sources
The newest version!
package nl.tno.bim.nmd.scaling;
import java.util.InputMismatchException;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.function.Function;
import java.util.stream.Collectors;
import nl.tno.bim.nmd.domain.NmdProductCard;
public final class NmdScalerFactory {
public NmdScaler create(String type, String description, String scaleUnit, Double[] coefficients, Double[] bounds, Double[] currentValues) throws InputMismatchException {
String lcType = type.toLowerCase();
NmdScaler scaler;
if (lcType.contains("lineair")) {
scaler = createLinScaler(scaleUnit, coefficients, bounds, currentValues);
} else if (lcType.contains("macht")) {
scaler = createPowScaler(scaleUnit, coefficients, bounds, currentValues);
} else if (lcType.contains("logaritmisch")) {
scaler = createLogScaler(scaleUnit, coefficients, bounds, currentValues);
} else if (lcType.contains("exponentieel")) {
scaler = createExpScaler(scaleUnit, coefficients, bounds, currentValues);
} else {
return null;
}
((NmdBaseScaler)scaler).setDescription(description);
return scaler;
}
public NmdTableScaler createTableScaler(String scaleUnit,
Map refDims, Double[] currentValues) {
return NmdTableScaler.getInstance(scaleUnit, refDims, currentValues);
}
public NmdExponentialScaler createExpScaler(String scaleUnit,
Double[] coefficients,
Double[] bounds,
Double[] currentValues) {
return new NmdExponentialScaler(scaleUnit, coefficients, bounds, currentValues);
}
public NmdLogarithmicScaler createLogScaler(String scaleUnit,
Double[] coefficients,
Double[] bounds,
Double[] currentValues) throws InputMismatchException {
return new NmdLogarithmicScaler(scaleUnit, coefficients, bounds, currentValues);
}
public NmdPowerScaler createPowScaler(String scaleUnit,
Double[] coefficients,
Double[] bounds,
Double[] currentValues) {
return new NmdPowerScaler(scaleUnit, coefficients, bounds, currentValues);
}
public NmdLinearScaler createLinScaler(String scaleUnit,
Double[] coefficients,
Double[] bounds,
Double[] currentValues) {
return new NmdLinearScaler(scaleUnit, coefficients, bounds, currentValues);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy