BasisFunctionKnots { public static BasisFunctionKnots fromKnots(double[] knots, int degree) { ArgumentChecker.notEmpty(knots, "knots"); ArgumentChecker.notNegative(degree, "degree"); int nKnots = knots.length; ArgumentChecker.isTrue(nKnots - 3 * degree > 0, "Require at least {} knots for degree {}, only given {}", 3 * degree + 1, degree, nKnots); for (int i = 1; i < nKnots; i++) { ArgumentChecker.isTrue(knots[i] - knots[i - 1] > 0, "knots are not ascending"); } int nSplines = nKnots - degree - 1; return new BasisFunctionKnots(knots, degree, nSplines); } private  BasisFunctionKnots(double[] knots, int degree, int nSplines); static BasisFunctionKnots fromUniform(double xa, double xb, int nKnots, int degree); static BasisFunctionKnots fromInternalKnots(double[] internalKnots, int degree); static BasisFunctionKnots fromKnots(double[] knots, int degree); double[] getKnots(); int getNumKnots(); int getDegree(); int getNumSplines();  }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullKnots() { BasisFunctionKnots.fromKnots(null, 2); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNegDegree() { BasisFunctionKnots.fromKnots(KNOTS, -1); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testWrongOrderKnots() { BasisFunctionKnots.fromKnots(WRONG_ORDER_KNOTS, 3); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testDegreeToHigh3() { BasisFunctionKnots.fromKnots(KNOTS, 11); }