20 import ca.uqac.lif.cep.functions.StreamVariable;
21 import ca.uqac.lif.cep.functions.Constant;
22 import ca.uqac.lif.cep.functions.Function;
23 import ca.uqac.lif.cep.functions.FunctionException;
24 import ca.uqac.lif.cep.functions.FunctionTree;
25 import ca.uqac.lif.cep.functions.PassthroughFunction;
26 import ca.uqac.lif.cep.util.Numbers;
42 public Function getFunction()
47 return new FunctionTree(Numbers.addition,
50 new FunctionTree(Numbers.power,
62 public static void main(String[] args)
throws FunctionException
65 Object[] value =
new Object[1];
66 poly.evaluate(
new Integer[]{3}, value);
67 System.out.printf(
"Return value of the function: %f\n", value[0]);
68 poly.evaluate(
new Integer[]{8}, value);
69 System.out.printf(
"Return value of the function: %f\n", value[0]);
Use an StreamVariable and a FunctionTree to create the polynomial function x2+3.