List of usage examples for org.apache.commons.math3.exception OutOfRangeException OutOfRangeException
public OutOfRangeException(Number wrong, Number lo, Number hi)
From source file:de.terministic.serein.core.genome.recombination.UniformCrossover.java
public UniformCrossover(double dominance) { if (dominance < 0.0 || dominance > 1.0) throw new OutOfRangeException(dominance, 0.0, 1.0); this.dominance = dominance; }
From source file:de.terministic.serein.core.genome.recombination.SingleArithmeticRecombination.java
public SingleArithmeticRecombination(double dominance) { if (dominance < 0.0 || dominance > 1.0) throw new OutOfRangeException(dominance, 0.0, 1.0); this.dominance = dominance; }
From source file:de.terministic.serein.core.genome.recombination.SimpleArithmeticRecombination.java
public SimpleArithmeticRecombination(double dominance) { if (dominance < 0.0 || dominance > 1.0) throw new OutOfRangeException(dominance, 0.0, 1.0); this.dominance = dominance; }
From source file:de.terministic.serein.core.genome.recombination.WholeArithmeticRecombination.java
public WholeArithmeticRecombination(double dominance) { if (dominance < 0.0 || dominance > 1.0) { throw new OutOfRangeException(dominance, 0.0, 1.0); }/*from ww w . j ava 2 s .c o m*/ this.dominance = dominance; }
From source file:de.terministic.serein.core.genome.recombination.AbstractRecombination.java
/** * Sets a dominance factor used for recombination. 0.0 is used for equally * distributed dominance./*from w ww .j ava2 s .c o m*/ * * * @param dominance */ public void setDominance(double dominance) { if (dominance > 1.0 || dominance < 0.0) throw new OutOfRangeException(dominance, 0.0, 1.0); this.dominance = dominance; }
From source file:jasima.core.random.discrete.IntBernoulli.java
/** * Sets the probability of success./*ww w. j a v a2 s . c om*/ * * @param probOfSuccess * The success probability. * @throws OutOfRangeException * If the supplied probability is not in the interval * {@code [0,1]}. */ public void setProbabilityOfSuccess(double probOfSuccess) throws OutOfRangeException { if (probOfSuccess < 0 || probOfSuccess > 1) { throw new OutOfRangeException(probOfSuccess, 0, 1); } probabilityOfSuccess = probOfSuccess; }
From source file:es.uvigo.ei.sing.laimages.core.operations.BilinearInterpolatingFunction.java
private static int previous(double value, double[] values) { if (value < values[0] || value > values[values.length - 1]) throw new OutOfRangeException(value, values[0], values[values.length - 1]); for (int i = values.length - 1; i >= 0; i--) { if (!Double.isNaN(values[i]) && values[i] < value) { return i; }/*from w w w . j a v a 2 s. co m*/ } return 0; }
From source file:es.uvigo.ei.sing.laimages.core.operations.BilinearInterpolatingFunction.java
private static int next(double value, double[] values) { if (value < values[0] || value > values[values.length - 1]) throw new OutOfRangeException(value, values[0], values[values.length - 1]); for (int i = 0; i < values.length; i++) { if (!Double.isNaN(values[i]) && values[i] > value) { return i; }//from ww w .j av a 2s .c om } return values.length - 1; }
From source file:experiment.PascalDistribution_bug.java
/** * Create a Pascal distribution with the given number of successes and * probability of success.//from ww w .j a v a2 s. c om * * @param rng Random number generator. * @param r Number of successes. * @param p Probability of success. * @throws NotStrictlyPositiveException if the number of successes is not positive * @throws OutOfRangeException if the probability of success is not in the * range {@code [0, 1]}. * @since 3.1 */ public PascalDistribution_bug(RandomGenerator rng, int r, double p, int id) throws NotStrictlyPositiveException, OutOfRangeException { super(rng); if (r <= 0) { throw new NotStrictlyPositiveException(LocalizedFormats.NUMBER_OF_SUCCESSES, r); } if (p < 0 || p > 1) { throw new OutOfRangeException(p, 0, 1); } numberOfSuccesses = r; probabilityOfSuccess = p; }
From source file:ISA681.CardDeck.Card.java
public Card(int cardNum) { // this.cardNum = cardNum; switch (cardNum) { case 1:/*from ww w . j a va 2 s . c om*/ Suit = "S"; Rank = "2"; break; case 2: Suit = "S"; Rank = "3"; break; case 3: Suit = "S"; Rank = "4"; break; case 4: Suit = "S"; Rank = "5"; break; case 5: Suit = "S"; Rank = "6"; break; case 6: Suit = "S"; Rank = "7"; break; case 7: Suit = "S"; Rank = "8"; break; case 8: Suit = "S"; Rank = "9"; break; case 9: Suit = "S"; Rank = "10"; break; case 10: Suit = "S"; Rank = "J"; break; case 11: Suit = "S"; Rank = "Q"; break; case 12: Suit = "S"; Rank = "K"; break; case 13: Suit = "S"; Rank = "A"; break; case 14: Suit = "D"; Rank = "2"; break; case 15: Suit = "D"; Rank = "3"; break; case 16: Suit = "D"; Rank = "4"; break; case 17: Suit = "D"; Rank = "5"; break; case 18: Suit = "D"; Rank = "6"; break; case 19: Suit = "D"; Rank = "7"; break; case 20: Suit = "D"; Rank = "8"; break; case 21: Suit = "D"; Rank = "9"; break; case 22: Suit = "D"; Rank = "10"; break; case 23: Suit = "D"; Rank = "J"; break; case 24: Suit = "D"; Rank = "Q"; break; case 25: Suit = "D"; Rank = "K"; break; case 26: Suit = "D"; Rank = "A"; break; case 27: Suit = "C"; Rank = "2"; break; case 28: Suit = "C"; Rank = "3"; break; case 29: Suit = "C"; Rank = "4"; break; case 30: Suit = "C"; Rank = "5"; break; case 31: Suit = "C"; Rank = "6"; break; case 32: Suit = "C"; Rank = "7"; break; case 33: Suit = "C"; Rank = "8"; break; case 34: Suit = "C"; Rank = "9"; break; case 35: Suit = "C"; Rank = "10"; break; case 36: Suit = "C"; Rank = "J"; break; case 37: Suit = "C"; Rank = "Q"; break; case 38: Suit = "C"; Rank = "K"; break; case 39: Suit = "C"; Rank = "A"; break; case 40: Suit = "H"; Rank = "2"; break; case 41: Suit = "H"; Rank = "3"; break; case 42: Suit = "H"; Rank = "4"; break; case 43: Suit = "H"; Rank = "5"; break; case 44: Suit = "H"; Rank = "6"; break; case 45: Suit = "H"; Rank = "7"; break; case 46: Suit = "H"; Rank = "8"; break; case 47: Suit = "H"; Rank = "9"; break; case 48: Suit = "H"; Rank = "10"; break; case 49: Suit = "H"; Rank = "J"; break; case 50: Suit = "H"; Rank = "Q"; break; case 51: Suit = "H"; Rank = "K"; break; case 52: Suit = "H"; Rank = "A"; break; default: throw new OutOfRangeException(cardNum, 1, 52); } }