/** * Verifies that {@code array} has length at least 2. * * @param array array to test * @throws NullArgumentException if array is null * @throws InsufficientDataException if array is too short */ private void checkArray(double[] array) { if (array == null) { throw new NullArgumentException(LocalizedFormats.NULL_NOT_ALLOWED); } if (array.length < 2) { throw new InsufficientDataException(LocalizedFormats.INSUFFICIENT_OBSERVED_POINTS_IN_SAMPLE, array.length, 2); } }
/** * Creates a marker array using initial five elements and a quantile * * @param initialFive list of initial five elements * @param p the pth quantile * @return Marker array */ private static Marker[] createMarkerArray( final List<Double> initialFive, final double p) { final int countObserved = initialFive == null ? -1 : initialFive.size(); if (countObserved < PSQUARE_CONSTANT) { throw new InsufficientDataException( LocalizedFormats.INSUFFICIENT_OBSERVED_POINTS_IN_SAMPLE, countObserved, PSQUARE_CONSTANT); } Collections.sort(initialFive); return new Marker[] { new Marker(),// Null Marker new Marker(initialFive.get(0), 1, 0, 1), new Marker(initialFive.get(1), 1 + 2 * p, p / 2, 2), new Marker(initialFive.get(2), 1 + 4 * p, p, 3), new Marker(initialFive.get(3), 3 + 2 * p, (1 + p) / 2, 4), new Marker(initialFive.get(4), 5, 1, 5) }; }
/** {@inheritDoc} */ public Region<Euclidean2D> createRegion() throws InsufficientDataException { if (vertices.length < 3) { throw new InsufficientDataException(); } final RegionFactory<Euclidean2D> factory = new RegionFactory<Euclidean2D>(); final Segment[] segments = retrieveLineSegments(); final Line[] lineArray = new Line[segments.length]; for (int i = 0; i < segments.length; i++) { lineArray[i] = segments[i].getLine(); } return factory.buildConvex(lineArray); } }
throw new InsufficientDataException(LocalizedFormats.INSUFFICIENT_OBSERVED_POINTS_IN_SAMPLE, nobs, nvars + 1);
f.length < MIN_NUM_POINTS || f[0].length < MIN_NUM_POINTS) { throw new InsufficientDataException();
/** * Verifies that {@code array} has length at least 2. * * @param array array to test * @throws NullArgumentException if array is null * @throws InsufficientDataException if array is too short */ private void checkArray(double[] array) { if (array == null) { throw new NullArgumentException(LocalizedFormats.NULL_NOT_ALLOWED); } if (array.length < 2) { throw new InsufficientDataException(LocalizedFormats.INSUFFICIENT_OBSERVED_POINTS_IN_SAMPLE, array.length, 2); } }
/** * Creates a marker array using initial five elements and a quantile * * @param initialFive list of initial five elements * @param p the pth quantile * @return Marker array */ private static Marker[] createMarkerArray( final List<Double> initialFive, final double p) { final int countObserved = initialFive == null ? -1 : initialFive.size(); if (countObserved < PSQUARE_CONSTANT) { throw new InsufficientDataException( LocalizedFormats.INSUFFICIENT_OBSERVED_POINTS_IN_SAMPLE, countObserved, PSQUARE_CONSTANT); } Collections.sort(initialFive); return new Marker[] { new Marker(),// Null Marker new Marker(initialFive.get(0), 1, 0, 1), new Marker(initialFive.get(1), 1 + 2 * p, p / 2, 2), new Marker(initialFive.get(2), 1 + 4 * p, p, 3), new Marker(initialFive.get(3), 3 + 2 * p, (1 + p) / 2, 4), new Marker(initialFive.get(4), 5, 1, 5) }; }
/** {@inheritDoc} */ public Region<Euclidean2D> createRegion() throws InsufficientDataException { if (vertices.length < 3) { throw new InsufficientDataException(); } final RegionFactory<Euclidean2D> factory = new RegionFactory<Euclidean2D>(); final Segment[] segments = retrieveLineSegments(); final Line[] lineArray = new Line[segments.length]; for (int i = 0; i < segments.length; i++) { lineArray[i] = segments[i].getLine(); } return factory.buildConvex(lineArray); } }
throw new InsufficientDataException(LocalizedFormats.INSUFFICIENT_OBSERVED_POINTS_IN_SAMPLE, nobs, nvars + 1);
throw new InsufficientDataException(LocalizedFormats.INSUFFICIENT_OBSERVED_POINTS_IN_SAMPLE, nobs, nvars + 1);
f.length < MIN_NUM_POINTS || f[0].length < MIN_NUM_POINTS) { throw new InsufficientDataException();
f.length < MIN_NUM_POINTS || f[0].length < MIN_NUM_POINTS) { throw new InsufficientDataException();