List of usage examples for org.apache.commons.math.analysis PolynomialFunction degree
public int degree()
From source file:com.golemgame.properties.fengGUI.FunctionTab.java
public static PropertyStore invertView(PropertyStore store, UnivariateRealFunction function) { if (function instanceof PolynomialFunction) { PolynomialFunction f = (PolynomialFunction) function; PolynomialFunctionInterpreter interp = new PolynomialFunctionInterpreter(store); for (int i = 0; i <= f.degree(); i++) { interp.setCoefficient(i, new DoubleType(f.getCoefficients()[i])); }// www .j ava 2 s. c o m } else if (function instanceof SinFunction) { SinFunction f = (SinFunction) function; SineFunctionInterpreter interp = new SineFunctionInterpreter(store); interp.setAmplitude(f.getAmplitude()); interp.setLambda(f.getLambda()); interp.setPhase(f.getPhase()); } else if (function instanceof SqrtFunction) { SqrtFunction f = (SqrtFunction) function; SqrtFunctionInterpreter interp = new SqrtFunctionInterpreter(store); } else if (function instanceof CombinedTransformationFunction) { //finally, the combined knotted function will be recursively defined. CombinedTransformationFunction f = (CombinedTransformationFunction) function; CombinedFunctionInterpreter interp = new CombinedFunctionInterpreter(store); interp.setBottom(f.getBottom()); interp.setTop(f.getTop()); interp.setLeft(f.getLeft()); interp.setRight(f.getRight()); interp.setLocalScaleX(f.getScaleX()); interp.setLocalScaleY(f.getScaleY()); interp.setTranslateX(f.getTranslateX()); interp.setTranslateY(f.getTranslateY()); invertView(interp.getFunction1(), f.getBaseFunction()); invertView(interp.getFunction2(), f.getKnottedFunction()); } else if (function instanceof KnottedFunction) { KnottedFunction f = (KnottedFunction) function; KnottedFunctionInterpreter interp = new KnottedFunctionInterpreter(store); for (int i = 0; i < f.count(); i++) { interp.setKnot(i, f.getXKnots()[i], f.getYKnots()[i]); } } else { StateManager.getLogger().warning("Unrecognized Function"); } return store; }