Package org.apache.commons.math3.exception

Examples of org.apache.commons.math3.exception.MathIllegalArgumentException


    @Deprecated
    public void setExpansionMode(int expansionMode)
        throws MathIllegalArgumentException {
        if (expansionMode != MULTIPLICATIVE_MODE &&
            expansionMode != ADDITIVE_MODE) {
            throw new MathIllegalArgumentException(LocalizedFormats.UNSUPPORTED_EXPANSION_MODE, expansionMode,
                                                   MULTIPLICATIVE_MODE, "MULTIPLICATIVE_MODE",
                                                   ADDITIVE_MODE, "ADDITIVE_MODE");
        }
        synchronized(this) {
            if (expansionMode == MULTIPLICATIVE_MODE) {
View Full Code Here


     */
    public synchronized void setNumElements(int i)
        throws MathIllegalArgumentException {
        // If index is negative thrown an error.
        if (i < 0) {
            throw new MathIllegalArgumentException(
                    LocalizedFormats.INDEX_NOT_POSITIVE,
                    i);
        }

        // Test the new num elements, check to see if the array needs to be
View Full Code Here

     * @throws MathIllegalArgumentException if the tournament arity is bigger than the
     * population size
     */
    private Chromosome tournament(final ListPopulation population) {
        if (population.getPopulationSize() < this.arity) {
            throw new MathIllegalArgumentException(LocalizedFormats.TOO_LARGE_TOURNAMENT_ARITY,
                                                   arity, population.getPopulationSize());
        }
        // auxiliary population
        ListPopulation tournamentPopulation = new ListPopulation(this.arity) {
            public Population nextGeneration() {
View Full Code Here

     * @throws MathIllegalArgumentException if <code>original</code> is not an instance
     *         of {@link BinaryChromosome}.
     */
    public Chromosome mutate(Chromosome original) {
        if (!(original instanceof BinaryChromosome)) {
            throw new MathIllegalArgumentException(LocalizedFormats.INVALID_BINARY_CHROMOSOME);
        }

        BinaryChromosome origChrom = (BinaryChromosome) original;
        List<Integer> newRepr = new ArrayList<Integer>(origChrom.getRepresentation());

View Full Code Here

        // safety checks
        final FirstOrderDifferentialEquations ode = (jode instanceof MainStateJacobianWrapper) ?
                                                    ((MainStateJacobianWrapper) jode).ode :
                                                    jode;
        if (expandable.getPrimary() != ode) {
            throw new MathIllegalArgumentException(LocalizedFormats.UNMATCHED_ODE_IN_EXPANDED_SET);
        }

        efode = expandable;
        index = efode.addSecondaryEquations(new JacobiansSecondaryEquations());
        efode.setSecondaryState(index, matricesData);
View Full Code Here

                dirtyParameter = true;
                return;
            }
        }

        throw new MathIllegalArgumentException(LocalizedFormats.UNKNOWN_PARAMETER, parameter);

    }
View Full Code Here

                return;
            }
            i += stateDim;
        }

        throw new MathIllegalArgumentException(LocalizedFormats.UNKNOWN_PARAMETER, pName);

    }
View Full Code Here

     *         the expansionCriteria.
     */
    protected void checkContractExpand(float contraction, float expansion) {

        if (contraction < expansion) {
            throw new MathIllegalArgumentException(
                    LocalizedFormats.CONTRACTION_CRITERIA_SMALLER_THAN_EXPANSION_FACTOR,
                    contraction, expansion);
        }

        if (contraction <= 1.0) {
            throw new MathIllegalArgumentException(
                    LocalizedFormats.CONTRACTION_CRITERIA_SMALLER_THAN_ONE,
                    contraction);
        }

        if (expansion <= 1.0) {
            throw new MathIllegalArgumentException(
                    LocalizedFormats.EXPANSION_FACTOR_SMALLER_THAN_ONE,
                    expansion);
        }
    }
View Full Code Here

                            } catch (IllegalArgumentException iae) {
                            }
                        }
                    }
                    if (! found) {
                        throw new MathIllegalArgumentException(LocalizedFormats.UNKNOWN_PARAMETER,
                                                               param);
                    }
                }
            }
View Full Code Here

     * @throws IllegalArgumentException if i is greater than numElements.
     * @since 2.0
     */
    private synchronized void discardExtremeElements(int i,boolean front) {
        if (i > numElements) {
            throw new MathIllegalArgumentException(
                    LocalizedFormats.TOO_MANY_ELEMENTS_TO_DISCARD_FROM_ARRAY,
                    i, numElements);
       } else if (i < 0) {
           throw new MathIllegalArgumentException(
                   LocalizedFormats.CANNOT_DISCARD_NEGATIVE_NUMBER_OF_ELEMENTS,
                   i);
        } else {
            // "Subtract" this number of discarded from numElements
            numElements -= i;
View Full Code Here

TOP

Related Classes of org.apache.commons.math3.exception.MathIllegalArgumentException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.