Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- https://localhost:8000/abc/solr?sort=div(popularity,price),bf="recip(rord(price),1,1000,1000)^0.3"
- import java.util.function.Function;
- import javax.script.*;
- public class TestFunction {
- public static void main(String[] args) throws Exception {
- ScriptEngine engine = new ScriptEngineManager().getEngineByName("nashorn");
- @SuppressWarnings("unchecked")
- Function<Object,Object> f = (Function<Object,Object>)engine.eval(
- String.format("new java.util.function.Function(%s)", args[0]));
- for (int i = 1; i < args.length; i++) {
- System.out.println(f.apply(args[i]));
- }
- }
- }
- java TestFunction 'function(x) 3 * x + 1' 17 23 47
- 52.0
- 70.0
- 142.0
Add Comment
Please, Sign In to add comment