/** * Throws IllegalStateException if n > 0. * @throws MathIllegalStateException if data has been added */ private void checkEmpty() throws MathIllegalStateException { if (n > 0) { throw new MathIllegalStateException( LocalizedFormats.VALUES_ADDED_BEFORE_CONFIGURING_STATISTIC, n); } }
/** {@inheritDoc} */ public BSPTree<S> fixNode(BSPTree<S> node) { // the cut should not be null throw new MathIllegalStateException(LocalizedFormats.NULL_NOT_ALLOWED); } });
/** * Throws MathIllegalStateException if the statistic is not empty. * @throws MathIllegalStateException if n > 0. */ private void checkEmpty() throws MathIllegalStateException { if (n > 0) { throw new MathIllegalStateException( LocalizedFormats.VALUES_ADDED_BEFORE_CONFIGURING_STATISTIC, n); } }
/** * Returns {@code true} if {@link #computeRoots(int)} was called with a * positive value of its argument {@code n}. If {@code true}, then * counter-clockwise ordering of the roots of unity should be used. * * @return {@code true} if the roots of unity are stored in * counter-clockwise order * @throws MathIllegalStateException if no roots of unity have been computed * yet */ public synchronized boolean isCounterClockWise() throws MathIllegalStateException { if (omegaCount == 0) { throw new MathIllegalStateException( LocalizedFormats.ROOTS_OF_UNITY_NOT_COMPUTED_YET); } return isCounterClockWise; }
/** * Substitutes <code>value</code> for the most recently added value. * Returns the value that has been replaced. If the array is empty (i.e. * if {@link #numElements} is zero), an IllegalStateException is thrown. * * @param value New value to substitute for the most recently added value * @return the value that has been replaced in the array. * @throws MathIllegalStateException if the array is empty * @since 2.0 */ public synchronized double substituteMostRecentElement(double value) throws MathIllegalStateException { if (numElements < 1) { throw new MathIllegalStateException( LocalizedFormats.CANNOT_SUBSTITUTE_ELEMENT_FROM_EMPTY_ARRAY); } final int substIndex = startIndex + (numElements - 1); final double discarded = internalArray[substIndex]; internalArray[substIndex] = value; return discarded; }
/** * Removes the most recent value from the dataset. * * @throws MathIllegalStateException if there are no elements stored */ public void removeMostRecentValue() throws MathIllegalStateException { try { eDA.discardMostRecentElements(1); } catch (MathIllegalArgumentException ex) { throw new MathIllegalStateException(LocalizedFormats.NO_DATA); } }
/** * Generates a random value from this distribution. * <strong>Preconditions:</strong><ul> * <li>the distribution must be loaded before invoking this method</li></ul> * @return the random value. * @throws MathIllegalStateException if the distribution has not been loaded */ public double getNextValue() throws MathIllegalStateException { if (!loaded) { throw new MathIllegalStateException(LocalizedFormats.DISTRIBUTION_NOT_LOADED); } return sample(); }
/** * Returns the {@code nxk} membership matrix, where {@code n} is the number * of data points and {@code k} the number of clusters. * <p> * The element U<sub>i,j</sub> represents the membership value for data point {@code i} * to cluster {@code j}. * * @return the membership matrix * @throws MathIllegalStateException if {@link #cluster(Collection)} has not been called before */ public RealMatrix getMembershipMatrix() { if (membershipMatrix == null) { throw new MathIllegalStateException(); } return MatrixUtils.createRealMatrix(membershipMatrix); }
throw new MathIllegalStateException(LocalizedFormats.INVALID_IMPLEMENTATION, model.getClass().getName());
/** * Get the real part of the {@code k}-th {@code n}-th root of unity. * * @param k index of the {@code n}-th root of unity * @return real part of the {@code k}-th {@code n}-th root of unity * @throws MathIllegalStateException if no roots of unity have been * computed yet * @throws MathIllegalArgumentException if {@code k} is out of range */ public synchronized double getReal(int k) throws MathIllegalStateException, MathIllegalArgumentException { if (omegaCount == 0) { throw new MathIllegalStateException( LocalizedFormats.ROOTS_OF_UNITY_NOT_COMPUTED_YET); } if ((k < 0) || (k >= omegaCount)) { throw new OutOfRangeException( LocalizedFormats.OUT_OF_RANGE_ROOT_OF_UNITY_INDEX, Integer.valueOf(k), Integer.valueOf(0), Integer.valueOf(omegaCount - 1)); } return omegaReal[k]; }
/** * Get the imaginary part of the {@code k}-th {@code n}-th root of unity. * * @param k index of the {@code n}-th root of unity * @return imaginary part of the {@code k}-th {@code n}-th root of unity * @throws MathIllegalStateException if no roots of unity have been * computed yet * @throws OutOfRangeException if {@code k} is out of range */ public synchronized double getImaginary(int k) throws MathIllegalStateException, OutOfRangeException { if (omegaCount == 0) { throw new MathIllegalStateException( LocalizedFormats.ROOTS_OF_UNITY_NOT_COMPUTED_YET); } if ((k < 0) || (k >= omegaCount)) { throw new OutOfRangeException( LocalizedFormats.OUT_OF_RANGE_ROOT_OF_UNITY_INDEX, Integer.valueOf(k), Integer.valueOf(0), Integer.valueOf(omegaCount - 1)); } return isCounterClockWise ? omegaImaginaryCounterClockwise[k] : omegaImaginaryClockwise[k]; }
/** * Gets all the optima found during the last call to {@code optimize}. * The optimizer stores all the optima found during a set of * restarts. The {@code optimize} method returns the best point only. * This method returns all the points found at the end of each starts, * including the best one already returned by the {@code optimize} method. * <br/> * The returned array as one element for each start as specified * in the constructor. It is ordered with the results from the * runs that did converge first, sorted from best to worst * objective value (i.e in ascending order if minimizing and in * descending order if maximizing), followed by {@code null} elements * corresponding to the runs that did not converge. This means all * elements will be {@code null} if the {@code optimize} method did throw * an exception. * This also means that if the first element is not {@code null}, it is * the best point found across all starts. * * @return an array containing the optima. * @throws MathIllegalStateException if {@link #optimize(OptimizationData[]) * optimize} has not been called. */ public UnivariatePointValuePair[] getOptima() { if (optima == null) { throw new MathIllegalStateException(LocalizedFormats.NO_OPTIMUM_COMPUTED_YET); } return optima.clone(); }
throw new MathIllegalStateException(LocalizedFormats.NO_OPTIMUM_COMPUTED_YET);
throw new MathIllegalStateException(LocalizedFormats.NO_OPTIMUM_COMPUTED_YET);
/** * Throws MathIllegalStateException if n > 0. * @throws MathIllegalStateException if data has been added to this statistic */ private void checkEmpty() throws MathIllegalStateException { if (getN() > 0) { throw new MathIllegalStateException( LocalizedFormats.VALUES_ADDED_BEFORE_CONFIGURING_STATISTIC, getN()); } }
throw new MathIllegalStateException(LocalizedFormats.NO_OPTIMUM_COMPUTED_YET);
final int numNeurons = neuronList.length; if (numNeurons != neighbourIdList.length) { throw new MathIllegalStateException(); final long id = n.getIdentifier(); if (id >= nextId) { throw new MathIllegalStateException(); for (Long bId : neighbourIdList[i]) { if (neuronMap.get(bId) == null) { throw new MathIllegalStateException();
new Object[] {Double.valueOf(p)}); } catch (NoSuchMethodException e1) { // Setter guard should prevent throw new MathIllegalStateException( LocalizedFormats.PERCENTILE_IMPLEMENTATION_UNSUPPORTED_METHOD, percentileImpl.getClass().getName(), SET_QUANTILE_METHOD_NAME); } catch (IllegalAccessException e2) { throw new MathIllegalStateException( LocalizedFormats.PERCENTILE_IMPLEMENTATION_CANNOT_ACCESS_METHOD, SET_QUANTILE_METHOD_NAME, percentileImpl.getClass().getName());
/** * Gets a random value in DIGEST_MODE. * <p> * <strong>Preconditions</strong>: <ul> * <li>Before this method is called, <code>computeDistribution()</code> * must have completed successfully; otherwise an * <code>IllegalStateException</code> will be thrown</li></ul></p> * * @return next random value from the empirical distribution digest * @throws MathIllegalStateException if digest has not been initialized */ private double getNextDigest() throws MathIllegalStateException { if ((empiricalDistribution == null) || (empiricalDistribution.getBinStats().size() == 0)) { throw new MathIllegalStateException(LocalizedFormats.DIGEST_NOT_INITIALIZED); } return empiricalDistribution.getNextValue(); }