Example usage for org.jfree.data.function PolynomialFunction2D getCoefficients

List of usage examples for org.jfree.data.function PolynomialFunction2D getCoefficients

Introduction

In this page you can find the example usage for org.jfree.data.function PolynomialFunction2D getCoefficients.

Prototype

public double[] getCoefficients() 

Source Link

Document

Returns a copy of the coefficients array that was specified in the constructor.

Usage

From source file:org.jfree.data.function.PolynomialFunction2DTest.java

/**
 * Some checks for the getCoefficients() method.
 *//*from   www  .j  ava  2 s .c  o  m*/
@Test
public void testGetCoefficients() {
    PolynomialFunction2D f = new PolynomialFunction2D(new double[] { 1.0, 2.0 });
    double[] c = f.getCoefficients();
    assertTrue(Arrays.equals(new double[] { 1.0, 2.0 }, c));

    // make sure that modifying the returned array doesn't change the
    // function
    c[0] = 99.9;
    assertTrue(Arrays.equals(new double[] { 1.0, 2.0 }, f.getCoefficients()));
}

From source file:org.jfree.data.function.PolynomialFunction2DTest.java

/**
 * Some tests for the constructor.//from w ww . ja v a 2  s .co  m
 */
@Test
public void testConstructor() {
    PolynomialFunction2D f = new PolynomialFunction2D(new double[] { 1.0, 2.0 });
    assertTrue(Arrays.equals(new double[] { 1.0, 2.0 }, f.getCoefficients()));

    boolean pass = false;
    try {
        f = new PolynomialFunction2D(null);
    } catch (IllegalArgumentException e) {
        pass = true;
    }
    assertTrue(pass);
}