### Question:
PreferenceDomainQuantizer extends ValueArrayQuantizer { static RealVector makeValues(PreferenceDomain domain) { if (!domain.hasPrecision()) { throw new IllegalArgumentException("domain is not discrete"); } final double min = domain.getMinimum(); final double max = domain.getMaximum(); final double prec = domain.getPrecision(); final double nv = (max - min) / prec; int n = (int) nv; if (Math.abs(nv - n) > 1.0e-6) { n += 1; } if (n == 0) { throw new IllegalArgumentException("range has no elements"); } double[] values = new double[n + 1]; for (int i = 0; i <= n; i++) { values[i] = min + (prec * i); } return new ArrayRealVector(values); } @Inject  PreferenceDomainQuantizer(PreferenceDomain dom); @SuppressWarnings("unused")  PreferenceDomainQuantizer(double min, double max, double prec); @SuppressWarnings("unused") PreferenceDomain getPreferenceDomain();  }### Answer:
@Test public void testMakeValues() { RealVector vals = PreferenceDomainQuantizer.makeValues(domain); RealVector evals = new ArrayRealVector(new double[]{0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0}); assertThat(vals.getDimension(), equalTo(evals.getDimension())); for (int i = 0; i < vals.getDimension(); i++) { assertThat("element " + i, vals.getEntry(i), closeTo(evals.getEntry(i), 1.0e-6)); } }