UniformMeshing extends MeshingFunction { @Override public Double evaluate(Integer x) { if (x < 0 || x >= getNumberOfPoints()) { throw new IllegalArgumentException("index out of range"); } if (x == 0) { return 0.0; } if (x == getNumberOfPoints() - 1) { return 1.0; } if (_db == null) { return ((double) x) / (getNumberOfPoints() - 1); } final int index = getFixedPointIndex(x); if (index >= 0) { return _fpValues[index]; } return INTERPOLATOR.interpolate(_db, (double) x); } UniformMeshing(int nPoints);  UniformMeshing(int nPoints, final double[] fixedPoints); @Override Double evaluate(Integer x);  }
@Test public void noFixedPointsTest() { int n = 7; MeshingFunction mesh = new UniformMeshing(n); for (int ii = 0; ii < n; ii++) { assertEquals(((double) ii) / (n - 1), mesh.evaluate(ii), 1e-15); } }