예제 #1
0
  public static void test2() {
    MathFunc x = FX.x;
    MathFunc y = FX.y;
    MathFunc xy = x.M(y);
    System.out.println(xy);
    HashMap<String, MathFunc> map = new HashMap<String, MathFunc>();
    map.put(x.getVarNames().get(0), FX.r.A(FX.s));
    map.put(y.getVarNames().get(0), FX.r.S(FX.s));
    MathFunc xy2 = xy.compose(map);
    System.out.println(xy2);

    System.out.println(FX.r.A(FX.s).M(FX.r.S(FX.s)));

    FuncClassLoader<CompiledFunc> fcl = new FuncClassLoader<CompiledFunc>();
    ClassGen genClass = BytecodeUtils.genClass(xy2, null, "add2", true, false);
    CompiledFunc fxy2 = fcl.newInstance(genClass);
    System.out.println(fxy2.apply(4.0, 2.0));
  }