Meta merger update using hidden values

This commit is contained in:
Alexander Nozik 2017-05-20 19:46:44 +03:00
parent 0f5b223e8b
commit 677f4de91f
3 changed files with 19 additions and 19 deletions

View File

@ -52,7 +52,6 @@ public class ReadLegacyDataAction extends OneToOneAction<Binary, NMFile> {
if (meta.hasMeta("debunch")) {
DebunchAction debunch = new DebunchAction();
Laminate laminate = new Laminate(meta.getMeta("debunch"))
.setValueContext(context)
.setDescriptor(debunch.getDescriptor());
raw = debunch.execute(context, name, raw, laminate);
}

View File

@ -34,24 +34,25 @@ public class NumassResolution extends AbstractParametricBiFunction {
super(list);
this.resA = meta.getDouble("A", 8.3e-5);
this.resB = meta.getDouble("B", 0);
if (meta.hasValue("tailAlpha")) {
//add polinomial function here
if (meta.hasValue("tail")) {
String tailFunctionStr = meta.getString("tail");
if (tailFunctionStr.startsWith("function::")) {
tailFunction = MathPlugin.buildFrom(context).buildBivariateFunction(tailFunctionStr.substring(10));
} else {
tailFunction = (E, U) -> {
Map<String, Object> binding = new HashMap<>();
binding.put("E", E);
binding.put("U", U);
binding.put("D", U - E);
return ExpressionUtils.function(tailFunctionStr, binding);
};
}
} else if (meta.hasValue("tailAlpha")) {
//add polynomial function here
double alpha = meta.getDouble("tailAlpha");
double beta = meta.getDouble("tailBeta", 0);
tailFunction = (double E, double U) -> 1 - (E - U) * (alpha + E / 1000d * beta) / 1000d;
} else if (meta.hasValue("tail")) {
String tailFunctionStr = meta.getString("tail");
if (tailFunctionStr.startsWith("function::")) {
tailFunction = MathPlugin.buildFrom(context).buildBivariateFunction(tailFunctionStr.substring(10));
} else {
tailFunction = (E, U) -> {
Map<String, Object> binding = new HashMap<>();
binding.put("E", E);
binding.put("U", U);
binding.put("D", U - E);
return ExpressionUtils.function(tailFunctionStr, binding);
};
}
} else {
tailFunction = ResolutionFunction.getConstantTail();
}

View File

@ -34,11 +34,11 @@ public class ExpressionUtils {
}
private static Script getScript(String expression) {
return cache.computeIfAbsent(expression, expr -> shell.parse(expr));
return cache.computeIfAbsent(expression, shell::parse);
}
public static double function(String expression, Map<String, ? extends Object> binding) {
public static double function(String expression, Map<String, ?> binding) {
synchronized (cache) {
Binding b = new Binding(binding);
Script script = getScript(expression);
@ -47,7 +47,7 @@ public class ExpressionUtils {
}
}
public static boolean condition(String expression, Map<String, ? extends Object> binding){
public static boolean condition(String expression, Map<String, ?> binding){
synchronized (cache) {
Binding b = new Binding(binding);
Script script = getScript(expression);