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")) { if (meta.hasMeta("debunch")) {
DebunchAction debunch = new DebunchAction(); DebunchAction debunch = new DebunchAction();
Laminate laminate = new Laminate(meta.getMeta("debunch")) Laminate laminate = new Laminate(meta.getMeta("debunch"))
.setValueContext(context)
.setDescriptor(debunch.getDescriptor()); .setDescriptor(debunch.getDescriptor());
raw = debunch.execute(context, name, raw, laminate); raw = debunch.execute(context, name, raw, laminate);
} }

View File

@ -34,12 +34,7 @@ public class NumassResolution extends AbstractParametricBiFunction {
super(list); super(list);
this.resA = meta.getDouble("A", 8.3e-5); this.resA = meta.getDouble("A", 8.3e-5);
this.resB = meta.getDouble("B", 0); this.resB = meta.getDouble("B", 0);
if (meta.hasValue("tailAlpha")) { if (meta.hasValue("tail")) {
//add polinomial 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"); String tailFunctionStr = meta.getString("tail");
if (tailFunctionStr.startsWith("function::")) { if (tailFunctionStr.startsWith("function::")) {
tailFunction = MathPlugin.buildFrom(context).buildBivariateFunction(tailFunctionStr.substring(10)); tailFunction = MathPlugin.buildFrom(context).buildBivariateFunction(tailFunctionStr.substring(10));
@ -52,6 +47,12 @@ public class NumassResolution extends AbstractParametricBiFunction {
return ExpressionUtils.function(tailFunctionStr, binding); 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 { } else {
tailFunction = ResolutionFunction.getConstantTail(); tailFunction = ResolutionFunction.getConstantTail();
} }

View File

@ -34,11 +34,11 @@ public class ExpressionUtils {
} }
private static Script getScript(String expression) { 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) { synchronized (cache) {
Binding b = new Binding(binding); Binding b = new Binding(binding);
Script script = getScript(expression); 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) { synchronized (cache) {
Binding b = new Binding(binding); Binding b = new Binding(binding);
Script script = getScript(expression); Script script = getScript(expression);